fix(deploy): ship curl so Coolify's health check can reach /health/ready

With health checks enabled Coolify swaps the Dockerfile HEALTHCHECK for its
own curl/wget probe; without either binary deploy 10856 reported unhealthy
on every attempt and rolled back.
This commit is contained in:
juancarlos.cavero 2026-08-25 12:51:21 +02:00
parent 2935aca896
commit 17b8ce476b
2 changed files with 10 additions and 4 deletions

View file

@ -264,8 +264,10 @@ container before stopping the old one (rolling update) and both share
answers. Only SIGTERM flips it, not the marker drain: at that point the new answers. Only SIGTERM flips it, not the marker drain: at that point the new
container is still booting and nobody else would be routable. The Coolify container is still booting and nobody else would be routable. The Coolify
app has its health check enabled on that path so it waits for the new app has its health check enabled on that path so it waits for the new
container to be `healthy` before stopping the old one. `/health` stays a container to be `healthy` before stopping the old one. With that option on,
plain liveness probe for the external watcher. Coolify replaces the Dockerfile HEALTHCHECK with its own curl/wget command,
so the image must ship `curl` or every deploy rolls back as unhealthy.
`/health` stays a plain liveness probe for the external watcher.
- `/api/status` answers from disk for a job this instance never held, so a - `/api/status` answers from disk for a job this instance never held, so a
poll landing on either container during the handover is fine. poll landing on either container during the handover is fine.
- `main.py` leaves `.transcript_checkpoint.json` in the job dir so a job that - `main.py` leaves `.transcript_checkpoint.json` in the job dir so a job that

View file

@ -40,6 +40,7 @@ WORKDIR /app
# fonts libass falls back to DejaVu for every UI option (issue #57). # fonts libass falls back to DejaVu for every UI option (issue #57).
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \ ffmpeg \
curl \
libgl1 \ libgl1 \
libglib2.0-0 \ libglib2.0-0 \
libsm6 \ libsm6 \
@ -122,8 +123,11 @@ EXPOSE 8000
# it answers and an instance that received SIGTERM (503 from /health/ready) # it answers and an instance that received SIGTERM (503 from /health/ready)
# is dropped within interval*retries, while its socket is still open. Coolify's # is dropped within interval*retries, while its socket is still open. Coolify's
# rolling update also waits on this before stopping the old container. The # rolling update also waits on this before stopping the old container. The
# app is up in ~3 s; start-period covers slow disks. No curl in the image. # app is up in ~3 s; start-period covers slow disks. curl is installed above
# for this: when the Coolify health check is enabled it replaces this
# HEALTHCHECK with its own curl/wget command, and an image without either
# reports unhealthy forever and every deploy rolls back (2026-08-25).
HEALTHCHECK --interval=5s --timeout=3s --start-period=30s --retries=2 \ HEALTHCHECK --interval=5s --timeout=3s --start-period=30s --retries=2 \
CMD ["python3", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/health/ready', timeout=2).status == 200 else 1)"] CMD curl -sf http://127.0.0.1:8000/health/ready > /dev/null || exit 1
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips", "*", "--timeout-graceful-shutdown", "15"] CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips", "*", "--timeout-graceful-shutdown", "15"]