From 59f9272446d6740a9d2e7a9ab63666e21ae58f81 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Sat, 4 Jul 2026 13:05:19 +0900 Subject: [PATCH 1/2] Add nginx config validation workflow --- .github/nginx-check/Dockerfile.docker | 16 ++++++++++++ .github/nginx-check/Dockerfile.production | 13 +++++++++ .github/workflows/server-config.yml | 32 +++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 .github/nginx-check/Dockerfile.docker create mode 100644 .github/nginx-check/Dockerfile.production create mode 100644 .github/workflows/server-config.yml diff --git a/.github/nginx-check/Dockerfile.docker b/.github/nginx-check/Dockerfile.docker new file mode 100644 index 000000000..7dc6d2a5b --- /dev/null +++ b/.github/nginx-check/Dockerfile.docker @@ -0,0 +1,16 @@ +FROM nginx:1.30.1-alpine + +# Validate the config set loaded by the mempool/frontend docker image. +# Build context: repo root +COPY nginx.conf http-basic.conf /etc/nginx/ +COPY nginx-mempool.conf /etc/nginx/conf.d/ + +# Replay the transforms applied by docker/init.sh (with the default values +# docker/frontend/entrypoint.sh substitutes at container start) +RUN sed -i \ + -e "s!127.0.0.1:80!0.0.0.0:8080!g" \ + -e "s!user nobody;!!g" \ + -e "s!/etc/nginx/nginx-mempool.conf!/etc/nginx/conf.d/nginx-mempool.conf!g" \ + /etc/nginx/nginx.conf + +CMD ["nginx", "-t"] diff --git a/.github/nginx-check/Dockerfile.production b/.github/nginx-check/Dockerfile.production new file mode 100644 index 000000000..cb91c2fc6 --- /dev/null +++ b/.github/nginx-check/Dockerfile.production @@ -0,0 +1,13 @@ +FROM nginx:1.30.1-alpine + +# Stage the config the way production/install does: the repo is available at +# ${NGINX_ETC_FOLDER}/mempool and production/nginx/nginx.conf becomes the main +# config, with __NGINX_USER__ and __NGINX_ETC_FOLDER__ substituted. +# Build context: production/ +COPY nginx /etc/nginx/mempool/production/nginx + +RUN cp /etc/nginx/mempool/production/nginx/nginx.conf /etc/nginx/nginx.conf && \ + sed -i "s!__NGINX_USER__!nginx!" /etc/nginx/nginx.conf && \ + sed -i "s!__NGINX_ETC_FOLDER__!/etc/nginx!" /etc/nginx/nginx.conf + +CMD ["nginx", "-t"] diff --git a/.github/workflows/server-config.yml b/.github/workflows/server-config.yml new file mode 100644 index 000000000..d1a89173c --- /dev/null +++ b/.github/workflows/server-config.yml @@ -0,0 +1,32 @@ +name: Validate server config + +on: + pull_request: + types: [opened, synchronize] + paths: + - "nginx.conf" + - "http-basic.conf" + - "nginx-mempool.conf" + - "production/nginx/**" + - ".github/nginx-check/**" + - ".github/workflows/server-config.yml" + +permissions: + contents: read + +jobs: + check_config: + runs-on: "ubuntu-latest" + + name: Validate nginx config + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + + - name: Validate the production nginx config + run: | + docker run --rm $(docker build -q -f .github/nginx-check/Dockerfile.production production) + + - name: Validate the docker frontend nginx config + run: | + docker run --rm $(docker build -q -f .github/nginx-check/Dockerfile.docker .) From 2fa37ff787853d20c43ae1506a90ad4e90572501 Mon Sep 17 00:00:00 2001 From: wiz Date: Sat, 4 Jul 2026 14:17:52 +0900 Subject: [PATCH 2/2] Add suggested fix from copilot review for nginx CI Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/nginx-check/Dockerfile.docker | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/nginx-check/Dockerfile.docker b/.github/nginx-check/Dockerfile.docker index 7dc6d2a5b..68776f088 100644 --- a/.github/nginx-check/Dockerfile.docker +++ b/.github/nginx-check/Dockerfile.docker @@ -9,6 +9,7 @@ COPY nginx-mempool.conf /etc/nginx/conf.d/ # docker/frontend/entrypoint.sh substitutes at container start) RUN sed -i \ -e "s!127.0.0.1:80!0.0.0.0:8080!g" \ + -e "s!127.0.0.1!0.0.0.0!g" \ -e "s!user nobody;!!g" \ -e "s!/etc/nginx/nginx-mempool.conf!/etc/nginx/conf.d/nginx-mempool.conf!g" \ /etc/nginx/nginx.conf