the CI stack mounts its nginx config through a volume, because the daemon cannot see the job's workspace
ci / lint the workflow and the shell (push) Successful in 9s
ci / the operator page in a real browser (push) Failing after 53s
ci / build, test, smoke (push) Successful in 1m33s
ci / build the image and smoke it (push) Failing after 13m18s

Run 2346 named the cause, and it was not Docker and not the stack:

  error mounting "/workspace/para/openwaf/deploy/upstream.conf" to rootfs at
  "/etc/nginx/conf.d/default.conf": not a directory: Are you trying to mount a
  directory onto a file (or vice-versa)?

The job's workspace lives inside the runner's job container; the docker daemon is
the host's, reached through /var/run/docker.sock. A relative bind mount written in
docker-compose.yml is resolved by the daemon on the host, where that path does not
exist, so Docker turns it into a directory and the mount dies. deploy/upstream.conf
is tracked (b6126c2) — this was never a checkout problem.

docker-compose.ci.yml is the overlay: the upstream service gets its config from a
named volume at /etc/nginx/conf.d, filled by a step that pipes the tracked file
into the volume. `!override` replaces the base volumes list, otherwise the broken
mount would still sit next to the working one. Compose reads the overlay through
COMPOSE_FILE, which only the workflow sets — a laptop and the README demo keep the
plain file mount, and the gate scripts stay the scripts an operator runs.

Verified before pushing, on this tree: `docker compose config` shows the upstream
volumes as the named volume at /etc/nginx/conf.d with the bind mount gone; the
fill step writes 1209 bytes, exactly deploy/upstream.conf; scripts/compose-smoke.sh
under COMPOSE_FILE=docker-compose.yml:docker-compose.ci.yml reports 348 passed /
0 failed, including the 502-upstream scenes that need that config to be read.
This commit is contained in:
Pavlo Ratushnyi
2026-10-05 21:11:33 +02:00
parent 1ada35486f
commit b402ec4cc9
2 changed files with 60 additions and 0 deletions
+33
View File
@@ -210,10 +210,28 @@ jobs:
- name: docker build and image size - name: docker build and image size
run: ./scripts/ci-gates.sh image run: ./scripts/ci-gates.sh image
# The nginx config reaches the upstream container through a named volume
# here, not through a workspace path — docker-compose.ci.yml explains why
# (the host daemon cannot see the job container's workspace). Compose names
# the volume after the project, so the name is built, not guessed.
- name: Put the upstream config where the host daemon can see it
env:
COMPOSE_PROJECT_NAME: openwafci-image
run:
set -eu
VOL="${COMPOSE_PROJECT_NAME}_openwaf-upstream-conf"
docker volume create "$VOL" >/dev/null
docker run --rm -i -v "$VOL:/conf" busybox:1.37 sh -c 'cat > /conf/default.conf' < deploy/upstream.conf
docker run --rm -v "$VOL:/conf" busybox:1.37 sh -c 'wc -c /conf/default.conf'
# Brings up edge + nginx, waits for the image's own HEALTHCHECK, asserts # Brings up edge + nginx, waits for the image's own HEALTHCHECK, asserts
# over a socket, and tears the stack down on exit. # over a socket, and tears the stack down on exit.
- name: Compose smoke — the deployed image - name: Compose smoke — the deployed image
env: env:
# The CI overlay: the upstream config comes from the volume the step
# above filled. Compose reads COMPOSE_FILE itself, so the gate script
# stays the one an operator runs.
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
# Its own compose project and its own host port. The console job below # Its own compose project and its own host port. The console job below
# brings up the same file, and on any machine where two jobs share one # brings up the same file, and on any machine where two jobs share one
# docker daemon (a self-hosted runner, a local act run) the default # docker daemon (a self-hosted runner, a local act run) the default
@@ -304,6 +322,20 @@ jobs:
npx playwright install --with-deps chromium npx playwright install --with-deps chromium
echo "PLAYWRIGHT_CORE=$(node -e 'console.log(require.resolve("playwright-core"))')" >> "$GITHUB_ENV" echo "PLAYWRIGHT_CORE=$(node -e 'console.log(require.resolve("playwright-core"))')" >> "$GITHUB_ENV"
# The nginx config reaches the upstream container through a named volume
# here, not through a workspace path — docker-compose.ci.yml explains why
# (the host daemon cannot see the job container's workspace). Compose names
# the volume after the project, so the name is built, not guessed.
- name: Put the upstream config where the host daemon can see it
env:
COMPOSE_PROJECT_NAME: openwafci-console
run:
set -eu
VOL="${COMPOSE_PROJECT_NAME}_openwaf-upstream-conf"
docker volume create "$VOL" >/dev/null
docker run --rm -i -v "$VOL:/conf" busybox:1.37 sh -c 'cat > /conf/default.conf' < deploy/upstream.conf
docker run --rm -v "$VOL:/conf" busybox:1.37 sh -c 'wc -c /conf/default.conf'
- name: Console smoke — the page, not only its endpoints - name: Console smoke — the page, not only its endpoints
env: env:
# Written into the job's workspace so the next step can publish it. # Written into the job's workspace so the next step can publish it.
@@ -314,6 +346,7 @@ jobs:
# See the compose-smoke step: a separate project and port, so the two # See the compose-smoke step: a separate project and port, so the two
# jobs cannot tear down each other's stack. # jobs cannot tear down each other's stack.
COMPOSE_PROJECT_NAME: openwafci-console COMPOSE_PROJECT_NAME: openwafci-console
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
EDGE_PORT: "8090" EDGE_PORT: "8090"
EDGE: http://127.0.0.1:8090 EDGE: http://127.0.0.1:8090
run: ./scripts/ci-gates.sh console run: ./scripts/ci-gates.sh console
+27
View File
@@ -0,0 +1,27 @@
# The CI overlay. It changes nothing about what the stack is — only about how
# nginx's config gets into the upstream container.
#
# Why it exists, measured on Gitea Actions run 2346 (head 1ada354): the job's
# workspace is a path inside the runner's job container, while the docker daemon
# is the host's, reached through a mounted /var/run/docker.sock. A relative bind
# mount written in docker-compose.yml is resolved by the daemon on the host,
# where /workspace/para/openwaf/deploy/upstream.conf does not exist, so Docker
# makes a directory out of it and the mount dies:
# not a directory: Are you trying to mount a directory onto a file (or
# vice-versa)?
# A named volume carries the same bytes on a path the daemon owns. The CI step
# that fills it is in .github/workflows/ci.yml; compose names the volume
# "<COMPOSE_PROJECT_NAME>_openwaf-upstream-conf", which is what that step creates.
#
# `!override` replaces the base volumes list instead of appending to it — without
# it the broken file mount would still be there next to this one.
#
# Local runs and the README demo do not use this file: compose only reads it when
# COMPOSE_FILE names it, which only the workflow does.
services:
upstream:
volumes: !override
- openwaf-upstream-conf:/etc/nginx/conf.d:ro
volumes:
openwaf-upstream-conf: