Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: Destinations to HAProxy

Andras Bacsai5bf79b75b0db
diff --git a/src/lib/haproxy/index.ts b/src/lib/haproxy/index.ts
index 473660fa13..618d410d5d 100644
--- a/src/lib/haproxy/index.ts
+++ b/src/lib/haproxy/index.ts
@@ -236,9 +236,15 @@ export async function stopCoolifyProxy(
export async function configureNetworkCoolifyProxy(engine: string): Promise<void> {
const host = getEngine(engine);
const destinations = await db.prisma.destinationDocker.findMany({ where: { engine } });
+ const { stdout: networks } = await asyncExecShell(
+ `DOCKER_HOST="${host}" docker ps -a --filter name=coolify-haproxy --format '{{json .Networks}}'`
+ );
+ const configuredNetworks = networks.replace(/"/g, '').replace('\n', '').split(',');
for (const destination of destinations) {
- await asyncExecShell(
- `DOCKER_HOST="${host}" docker network connect ${destination.network} coolify-haproxy`
- );
+ if (!configuredNetworks.includes(destination.network)) {
+ await asyncExecShell(
+ `DOCKER_HOST="${host}" docker network connect ${destination.network} coolify-haproxy`
+ );
+ }
}
}