Merge pull request #1325 from Dokploy/1257-main-server-error-error-http-code-409-unexpected---rpc-error

fix: handle race condition to catch recreation base containers
This commit is contained in:
Mauricio Siu
2025-02-15 14:26:52 -06:00
committed by GitHub
3 changed files with 24 additions and 4 deletions

View File

@@ -54,10 +54,16 @@ export const initializePostgres = async () => {
version: Number.parseInt(inspect.Version.Index),
...settings,
});
console.log("Postgres Started ✅");
} catch (error) {
await docker.createService(settings);
try {
await docker.createService(settings);
} catch (error: any) {
if (error?.statusCode !== 409) {
throw error;
}
console.log("Postgres service already exists, continuing...");
}
console.log("Postgres Not Found: Starting ✅");
}
};

View File

@@ -53,7 +53,14 @@ export const initializeRedis = async () => {
});
console.log("Redis Started ✅");
} catch (error) {
await docker.createService(settings);
try {
await docker.createService(settings);
} catch (error: any) {
if (error?.statusCode !== 409) {
throw error;
}
console.log("Redis service already exists, continuing...");
}
console.log("Redis Not Found: Starting ✅");
}
};

View File

@@ -128,7 +128,14 @@ export const initializeTraefik = async ({
console.log("Traefik Started ✅");
} catch (error) {
await docker.createService(settings);
try {
await docker.createService(settings);
} catch (error: any) {
if (error?.statusCode !== 409) {
throw error;
}
console.log("Traefik service already exists, continuing...");
}
console.log("Traefik Not Found: Starting ✅");
}
};