From b24acbc27d2937a66807ad385f262285dc49ddbb Mon Sep 17 00:00:00 2001 From: Nxssie Date: Sat, 20 Jun 2026 19:51:57 +0100 Subject: [PATCH] fix(deploy): make docker-compose deploy correctly on Coolify - web healthcheck: use 127.0.0.1 instead of localhost so busybox wget doesn't hit IPv6 ::1 (nginx listens IPv4-only); container now reaches healthy and Traefik keeps it in the load balancer instead of returning 503 - drop custom networks: Coolify auto-creates the per-stack network and attaches its proxy; declaring our own multi-homes the container and causes 504s - remove hardcoded Traefik labels: let Coolify generate routers/TLS from the UI domain (the entrypoint name "websecure" does not exist in Coolify's Traefik) - switch SQLite persistence from a relative bind mount to a named volume --- docker-compose.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0a9c690..ca9fe6c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,10 @@ services: expose: - "3001" volumes: - - ./data:/app/data + # Named volume (not a relative bind mount): Coolify resolves it under the + # resource's managed storage and it survives redeploys without the + # convert-to-directory bind-mount pitfalls. + - b2b_data:/app/data environment: - NODE_ENV=production # SQLite file inside the mounted volume so data survives redeploys. @@ -51,28 +54,25 @@ services: mem_limit: 128m cpus: "0.5" healthcheck: - # nginx:alpine has busybox wget. - test: ["CMD", "wget", "--spider", "-q", "http://localhost:80/"] + # nginx:alpine has busybox wget. Use 127.0.0.1 (not localhost): localhost + # resolves to ::1 first and nginx listens IPv4-only, so wget would fail + # forever, the container would never go healthy, and Traefik would drop it + # from the load balancer (503 "no available server"). + test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:80/"] interval: 30s timeout: 5s retries: 3 start_period: 10s - networks: - - default - - coolify - labels: - - traefik.enable=true - - "traefik.http.routers.b2b-web.rule=Host(`b2b.nxssie.dev`)" - - traefik.http.routers.b2b-web.entrypoints=websecure - - traefik.http.routers.b2b-web.tls=true - - traefik.http.routers.b2b-web.tls.certresolver=letsencrypt - - traefik.http.services.b2b-web.loadbalancer.server.port=80 + # No custom networks and no hardcoded Traefik labels: Coolify auto-creates + # the per-stack network, attaches its proxy, and generates the correct + # routers/TLS when you set this service's domain (https://b2b.nxssie.dev) in + # the Coolify UI. Declaring our own network or labels here would multi-home + # the container (intermittent 504s) and collide with Coolify's generated set. logging: driver: json-file options: max-size: "10m" max-file: "3" -networks: - coolify: - external: true +volumes: + b2b_data: