Merge pull request #442 from coollabsio/next

fix: Only reconfigure coolify proxy if its missconfigured
This commit is contained in:
Andras Bacsai 2022-05-31 22:30:09 +02:00 committed by GitHub
commit eb5aebd58d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,17 +70,29 @@ async function main() {
} }
}); });
} }
const versions = ['2.9.2', '2.9.3']; if (settings.isTraefikUsed) {
if (versions.includes(version)) {
// Force stop Coolify Proxy, as it had a bug in < 2.9.2. TrustProxy + api.insecure // Force stop Coolify Proxy, as it had a bug in < 2.9.2. TrustProxy + api.insecure
try { try {
await asyncExecShell(`docker stop -t 0 coolify-proxy && docker rm coolify-proxy`); const { stdout } = await asyncExecShell(
const { stdout: Config } = await asyncExecShell( `docker inspect coolify-proxy --format '{{json .Config.Cmd}}'`
`docker network inspect bridge --format '{{json .IPAM.Config }}'`
); );
const ip = JSON.parse(Config)[0].Gateway; if (
await asyncExecShell( !stdout
`docker run --restart always \ .replaceAll('[', '')
.replaceAll(']', '')
.replaceAll('"', '')
.replace('\n', '')
.split(',')
.includes('--entrypoints.web.forwardedHeaders.insecure=true')
) {
console.log('Reconfiguring Coolify Proxy (Traefik)...');
await asyncExecShell(`docker stop -t 0 coolify-proxy && docker rm coolify-proxy`);
const { stdout: Config } = await asyncExecShell(
`docker network inspect bridge --format '{{json .IPAM.Config }}'`
);
const ip = JSON.parse(Config)[0].Gateway;
await asyncExecShell(
`docker run --restart always \
--add-host 'host.docker.internal:host-gateway' \ --add-host 'host.docker.internal:host-gateway' \
--add-host 'host.docker.internal:${ip}' \ --add-host 'host.docker.internal:${ip}' \
-v coolify-traefik-letsencrypt:/etc/traefik/acme \ -v coolify-traefik-letsencrypt:/etc/traefik/acme \
@ -102,7 +114,8 @@ async function main() {
--certificatesresolvers.letsencrypt.acme.storage=/etc/traefik/acme/acme.json \ --certificatesresolvers.letsencrypt.acme.storage=/etc/traefik/acme/acme.json \
--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web \ --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web \
--log.level=error` --log.level=error`
); );
}
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }