From 4957cd331c3ab42acd594fd9229626be036f679b Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Tue, 18 Aug 2026 19:48:24 +0100 Subject: [PATCH 1/2] feat: adds Docker health check Signed-off-by: Pedro Lamas --- .github/workflows/build.yml | 5 +---- Dockerfile | 6 ++++++ docs/docs/getting-started.md | 22 ++++++++++++++++++++++ server/nginx/default.conf.template | 6 ++++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22e0eae736..037332376e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,10 +97,6 @@ jobs: name: fluidd-${{ github.sha }}.zip path: ./dist - - name: Update nginx configuration - run: | - sed -i "s/\${PORT} default_server;/${{ matrix.port }} default_server;/g" ./server/nginx/default.conf.template - - name: Prepare Docker image metadata id: docker_meta uses: docker/metadata-action@v6 @@ -136,6 +132,7 @@ jobs: platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 build-args: | BASE_IMAGE=${{ matrix.base-image }} + PORT=${{ matrix.port }} push: true sbom: true provenance: true diff --git a/Dockerfile b/Dockerfile index 680bb0f44c..219b362fec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,5 +2,11 @@ ARG BASE_IMAGE=nginx:alpine-slim FROM $BASE_IMAGE +ARG PORT=80 +ENV PORT=${PORT} + COPY /dist /usr/share/nginx/html COPY /server/nginx /etc/nginx/templates + +HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --start-interval=2s --retries=3 \ + CMD wget -q -O /dev/null -T 2 "http://127.0.0.1:${PORT}/healthz" || exit 1 diff --git a/docs/docs/getting-started.md b/docs/docs/getting-started.md index fd04dbba6b..6aa61c8a29 100644 --- a/docs/docs/getting-started.md +++ b/docs/docs/getting-started.md @@ -46,6 +46,28 @@ Both are updated on each release and each commit. Available tags: [View on GitHub Container registry](https://github.com/fluidd-core/fluidd/pkgs/container/fluidd){.md-button} +### Health Check + +Both images ship a Docker `HEALTHCHECK` that polls `/healthz` on the image's own +port, so `docker ps` reports the container as `healthy` once NGINX is serving: + +```bash +docker inspect --format '{{.State.Health.Status}}' fluidd +``` + +With Docker Compose, other services can wait for it: + +```yaml +depends_on: + fluidd: + condition: service_healthy +``` + +The endpoint is a plain `200 ok` response and is excluded from the access log. +The check runs every 2 seconds while the container starts — so it reports +`healthy` within a few seconds — then every 30 seconds. It can be overridden +per-deployment with the `healthcheck` key in Compose. + ## Manual Installation Every Fluidd release includes a pre-built `fluidd.zip` on the diff --git a/server/nginx/default.conf.template b/server/nginx/default.conf.template index fa4d3ef960..9a2d62669f 100644 --- a/server/nginx/default.conf.template +++ b/server/nginx/default.conf.template @@ -30,4 +30,10 @@ server { location = /index.html { add_header Cache-Control "no-store, no-cache, must-revalidate"; } + + location = /healthz { + access_log off; + default_type text/plain; + return 200 "ok\n"; + } } From 5d142cfdf1687f7a3d97cb800c7e6b432aff08eb Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Tue, 18 Aug 2026 20:59:24 +0100 Subject: [PATCH 2/2] chore: drop HEALTHCHECK start-interval flag Signed-off-by: Pedro Lamas --- Dockerfile | 2 +- docs/docs/getting-started.md | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 219b362fec..6cf5b5b03f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,5 +8,5 @@ ENV PORT=${PORT} COPY /dist /usr/share/nginx/html COPY /server/nginx /etc/nginx/templates -HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --start-interval=2s --retries=3 \ +HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 \ CMD wget -q -O /dev/null -T 2 "http://127.0.0.1:${PORT}/healthz" || exit 1 diff --git a/docs/docs/getting-started.md b/docs/docs/getting-started.md index 6aa61c8a29..3dbd919084 100644 --- a/docs/docs/getting-started.md +++ b/docs/docs/getting-started.md @@ -64,9 +64,8 @@ depends_on: ``` The endpoint is a plain `200 ok` response and is excluded from the access log. -The check runs every 2 seconds while the container starts — so it reports -`healthy` within a few seconds — then every 30 seconds. It can be overridden -per-deployment with the `healthcheck` key in Compose. +The check runs every 10 seconds and can be overridden per-deployment with the +`healthcheck` key in Compose. ## Manual Installation