mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Update traefik-setup.ts
This commit is contained in:
@@ -86,17 +86,18 @@ export const initializeTraefik = async () => {
|
|||||||
|
|
||||||
export const createDefaultServerTraefikConfig = () => {
|
export const createDefaultServerTraefikConfig = () => {
|
||||||
const configFilePath = path.join(DYNAMIC_TRAEFIK_PATH, "dokploy.yml");
|
const configFilePath = path.join(DYNAMIC_TRAEFIK_PATH, "dokploy.yml");
|
||||||
if (existsSync(configFilePath)) {
|
const acmeJsonPath = path.join(DYNAMIC_TRAEFIK_PATH, "acme.json");
|
||||||
console.log("Default traefik config already exists");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const acmeJsonPath = "/etc/dokploy/traefik/dynamic/acme.json";
|
|
||||||
if (existsSync(acmeJsonPath)) {
|
if (existsSync(acmeJsonPath)) {
|
||||||
chmodSync(acmeJsonPath, '600');
|
chmodSync(acmeJsonPath, '600');
|
||||||
} else {
|
} else {
|
||||||
console.error(`File not found: ${acmeJsonPath}`);
|
console.error(`File not found: ${acmeJsonPath}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (existsSync(configFilePath)) {
|
||||||
|
console.log("Default traefik config already exists");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const appName = "dokploy";
|
const appName = "dokploy";
|
||||||
const serviceURLDefault = `http://${appName}:${process.env.PORT || 3000}`;
|
const serviceURLDefault = `http://${appName}:${process.env.PORT || 3000}`;
|
||||||
@@ -191,6 +192,12 @@ export const createDefaultTraefikConfig = () => {
|
|||||||
const yamlStr = dump(configObject);
|
const yamlStr = dump(configObject);
|
||||||
mkdirSync(MAIN_TRAEFIK_PATH, { recursive: true });
|
mkdirSync(MAIN_TRAEFIK_PATH, { recursive: true });
|
||||||
writeFileSync(mainConfig, yamlStr, "utf8");
|
writeFileSync(mainConfig, yamlStr, "utf8");
|
||||||
|
const acmeJsonPath = "/etc/dokploy/traefik/dynamic/acme.json";
|
||||||
|
if (existsSync(acmeJsonPath)) {
|
||||||
|
chmodSync(acmeJsonPath, '600');
|
||||||
|
} else {
|
||||||
|
console.error(`File not found: ${acmeJsonPath}, func createDefaultTraefikConfig`);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createDefaultMiddlewares = () => {
|
export const createDefaultMiddlewares = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user