mirror of
https://github.com/andwati/dokploy.git
synced 2026-10-18 11:12:56 +00:00
* feat: add builds concurrency management for servers - Introduced a new `BuildsConcurrency` component to manage the number of concurrent builds for both local and remote servers, gated by license validity. - Implemented backend logic to resolve effective builds concurrency based on server settings and organization licenses. - Added unit tests for concurrency resolution logic to ensure correct behavior under various licensing scenarios. - Updated database schema to include `buildsConcurrency` field for servers and web server settings. - Refactored deployment queue to support in-memory job processing with configurable concurrency limits. This feature enhances deployment flexibility and control for enterprise users. * refactor: enhance deployment cancellation logic and improve Railpack build isolation - Reintroduced the `initCancelDeployments` function in the server initialization sequence to ensure deployments can be canceled effectively. - Updated the Railpack build command to use a unique builder name for each build, preventing conflicts during concurrent deployments. - Enhanced the cancellation logic to reset application and compose statuses to "idle" after canceling running deployments, improving system reliability. * test: add buildsConcurrency setting to server configuration tests - Introduced a new `buildsConcurrency` property in the server configuration tests to ensure proper handling of concurrent builds in deployment scenarios. * feat: implement builds concurrency management and validation - Added `assertBuildsConcurrencyAllowed` function to validate concurrency settings based on license status. - Updated `resolveBuildsConcurrency` to reflect new concurrency limits for free and enterprise tiers. - Enhanced `BuildsConcurrency` component to manage concurrent builds for servers, with UI adjustments for better user experience. - Introduced a new settings page for managing concurrent builds across servers, ensuring proper handling of deployments. - Updated database schema to support increased maximum concurrency values for servers and web server settings.
81 lines
2.7 KiB
TypeScript
81 lines
2.7 KiB
TypeScript
import http from "node:http";
|
|
import {
|
|
createDefaultMiddlewares,
|
|
createDefaultServerTraefikConfig,
|
|
createDefaultTraefikConfig,
|
|
IS_CLOUD,
|
|
initCancelDeployments,
|
|
initCronJobs,
|
|
initEnterpriseBackupCronJobs,
|
|
initializeNetwork,
|
|
initSchedules,
|
|
initVolumeBackupsCronJobs,
|
|
sendDokployRestartNotifications,
|
|
setupDirectories,
|
|
} from "@dokploy/server";
|
|
import { config } from "dotenv";
|
|
import next from "next";
|
|
import packageInfo from "../package.json";
|
|
import { setupDockerContainerLogsWebSocketServer } from "./wss/docker-container-logs";
|
|
import { setupDockerContainerTerminalWebSocketServer } from "./wss/docker-container-terminal";
|
|
import { setupDockerStatsMonitoringSocketServer } from "./wss/docker-stats";
|
|
import { setupDrawerLogsWebSocketServer } from "./wss/drawer-logs";
|
|
import { setupDeploymentLogsWebSocketServer } from "./wss/listen-deployment";
|
|
import { setupTerminalWebSocketServer } from "./wss/terminal";
|
|
|
|
config({ path: ".env" });
|
|
const PORT = Number.parseInt(process.env.PORT || "3000", 10);
|
|
const HOST = process.env.HOST || "0.0.0.0";
|
|
const dev = process.env.NODE_ENV !== "production";
|
|
|
|
// Initialize critical directories and Traefik config BEFORE Next.js starts
|
|
// This prevents race conditions with the install script
|
|
if (process.env.NODE_ENV === "production" && !IS_CLOUD) {
|
|
setupDirectories();
|
|
createDefaultTraefikConfig();
|
|
createDefaultServerTraefikConfig();
|
|
console.log("✅ initialization complete");
|
|
}
|
|
|
|
const app = next({ dev, turbopack: process.env.TURBOPACK === "1" });
|
|
const handle = app.getRequestHandler();
|
|
void app.prepare().then(async () => {
|
|
try {
|
|
console.log("Running DokployVersion: ", packageInfo.version);
|
|
const server = http.createServer((req, res) => {
|
|
handle(req, res);
|
|
});
|
|
|
|
// WEBSOCKET
|
|
setupDrawerLogsWebSocketServer(server);
|
|
setupDeploymentLogsWebSocketServer(server);
|
|
setupDockerContainerLogsWebSocketServer(server);
|
|
setupDockerContainerTerminalWebSocketServer(server);
|
|
setupTerminalWebSocketServer(server);
|
|
if (!IS_CLOUD) {
|
|
setupDockerStatsMonitoringSocketServer(server);
|
|
}
|
|
|
|
server.listen(PORT, HOST);
|
|
console.log(`Server Started on: http://${HOST}:${PORT}`);
|
|
if (process.env.NODE_ENV === "production" && !IS_CLOUD) {
|
|
createDefaultMiddlewares();
|
|
await initializeNetwork();
|
|
await initCronJobs();
|
|
await initSchedules();
|
|
await initCancelDeployments();
|
|
await initVolumeBackupsCronJobs();
|
|
await sendDokployRestartNotifications();
|
|
}
|
|
await initEnterpriseBackupCronJobs();
|
|
|
|
if (!IS_CLOUD) {
|
|
console.log("Starting Deployment Worker");
|
|
const { startDeploymentWorker } = await import("./queues/queueSetup");
|
|
await startDeploymentWorker();
|
|
}
|
|
} catch (e) {
|
|
console.error("Main Server Error", e);
|
|
}
|
|
});
|