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: Remove proxy container in case of dependent container is down

Andras Bacsai25ff63770338
diff --git a/src/lib/haproxy/index.ts b/src/lib/haproxy/index.ts
index 9aa3797b4a..6770d5c931 100644
--- a/src/lib/haproxy/index.ts
+++ b/src/lib/haproxy/index.ts
@@ -141,6 +141,11 @@ export async function startTcpProxy(
} -d coollabsio/${defaultProxyImageTcp}`
);
}
+ if (!foundDependentContainer && found) {
+ return await asyncExecShell(
+ `DOCKER_HOST=${host} docker stop -t 0 ${containerName} && docker rm ${containerName}`
+ );
+ }
} catch (error) {
return error;
}
@@ -169,6 +174,11 @@ export async function startHttpProxy(
`DOCKER_HOST=${host} docker run --restart always -e PORT=${publicPort} -e APP=${id} -e PRIVATE_PORT=${privatePort} --add-host 'host.docker.internal:host-gateway' --add-host 'host.docker.internal:${ip}' --network ${network} -p ${publicPort}:${publicPort} --name ${containerName} -d coollabsio/${defaultProxyImageHttp}`
);
}
+ if (!foundDependentContainer && found) {
+ return await asyncExecShell(
+ `DOCKER_HOST=${host} docker stop -t 0 ${containerName} && docker rm ${containerName}`
+ );
+ }
} catch (error) {
return error;
}