mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge branch 'canary' into feat/multi-node-support
This commit is contained in:
@@ -52,7 +52,7 @@ export const domainRouter = createTRPCRouter({
|
||||
.mutation(async ({ input }) => {
|
||||
const domain = await findDomainById(input.domainId);
|
||||
const result = await removeDomainById(input.domainId);
|
||||
removeDomain(domain.application.appName, domain.uniqueConfigKey);
|
||||
await removeDomain(domain.application.appName, domain.uniqueConfigKey);
|
||||
|
||||
return result;
|
||||
}),
|
||||
|
||||
@@ -36,9 +36,8 @@ export const createApplication = async (
|
||||
});
|
||||
}
|
||||
|
||||
createTraefikConfig(newApplication.appName);
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
createTraefikConfig(newApplication.appName);
|
||||
await tx.insert(domains).values({
|
||||
applicationId: newApplication.applicationId,
|
||||
host: `${newApplication.appName}.docker.localhost`,
|
||||
|
||||
@@ -48,9 +48,9 @@ void app.prepare().then(async () => {
|
||||
await initializeNetwork();
|
||||
createDefaultTraefikConfig();
|
||||
createDefaultServerTraefikConfig();
|
||||
await initializePostgres();
|
||||
await initializeTraefik();
|
||||
await initializeRedis();
|
||||
await initializePostgres();
|
||||
initCronJobs();
|
||||
welcomeServer();
|
||||
|
||||
@@ -74,7 +74,7 @@ async function welcomeServer() {
|
||||
"",
|
||||
"Dokploy server is up and running!",
|
||||
"Please wait for 15 seconds before opening the browser.",
|
||||
` http://${ip}:3000`,
|
||||
` http://${ip}:${PORT}`,
|
||||
"",
|
||||
"",
|
||||
].join("\n"),
|
||||
|
||||
@@ -5,6 +5,7 @@ import { APPLICATIONS_PATH, docker } from "@/server/constants";
|
||||
import type { ContainerInfo, ResourceRequirements } from "dockerode";
|
||||
import type { ApplicationNested } from "../builders";
|
||||
import { execAsync } from "../process/execAsync";
|
||||
import { parse } from "dotenv";
|
||||
|
||||
interface RegistryAuth {
|
||||
username: string;
|
||||
@@ -154,15 +155,7 @@ export const removeService = async (appName: string) => {
|
||||
};
|
||||
|
||||
export const prepareEnvironmentVariables = (env: string | null) =>
|
||||
env
|
||||
?.split("\n")
|
||||
.map((line) => line.trim()) // Trim whitespace
|
||||
.filter((line) => line && !line.startsWith("#")) // Exclude empty lines and comments
|
||||
.map((envVar) => {
|
||||
let [key, value] = envVar.split("=", 2);
|
||||
value = value?.replace(/^"(.*)"$/, "$1"); // Remove surrounding double quotes
|
||||
return `${key}=${value}`;
|
||||
}) || [];
|
||||
Object.entries(parse(env ?? "")).map(([key, value]) => `${key}=${value}`);
|
||||
|
||||
export const generateVolumeMounts = (mounts: ApplicationNested["mounts"]) => {
|
||||
if (!mounts || mounts.length === 0) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
createServiceConfig,
|
||||
loadOrCreateConfig,
|
||||
removeTraefikConfig,
|
||||
writeTraefikConfig,
|
||||
} from "./application";
|
||||
import type { ApplicationNested } from "../builders";
|
||||
@@ -23,7 +24,7 @@ export const manageDomain = async (app: ApplicationNested, domain: Domain) => {
|
||||
writeTraefikConfig(config, appName);
|
||||
};
|
||||
|
||||
export const removeDomain = (appName: string, uniqueKey: number) => {
|
||||
export const removeDomain = async (appName: string, uniqueKey: number) => {
|
||||
const config: FileConfig = loadOrCreateConfig(appName);
|
||||
|
||||
const routerKey = `${appName}-router-${uniqueKey}`;
|
||||
@@ -35,7 +36,15 @@ export const removeDomain = (appName: string, uniqueKey: number) => {
|
||||
delete config.http.services[serviceKey];
|
||||
}
|
||||
|
||||
writeTraefikConfig(config, appName);
|
||||
// verify if is the last router if so we delete the router
|
||||
if (
|
||||
config?.http?.routers &&
|
||||
Object.keys(config?.http?.routers).length === 0
|
||||
) {
|
||||
await removeTraefikConfig(appName);
|
||||
} else {
|
||||
writeTraefikConfig(config, appName);
|
||||
}
|
||||
};
|
||||
|
||||
export const createRouterConfig = async (
|
||||
|
||||
Reference in New Issue
Block a user