From 5ff625feaaccca16c27f21f450a8cee7f2617add Mon Sep 17 00:00:00 2001 From: Sergei Poljanski Date: Tue, 17 Nov 2026 13:12:54 +0400 Subject: [PATCH] Drop the container pipeline: the servers serve the flake asxpio-services serves the site from this flake (services.blog), and Traefik no longer routes to the container. The Dockerfile, nginx.conf, docker-compose.yml and the Kaniko and deploy jobs go; CI builds the package on every push, main included. Assisted-by: Claude:opus-5-5 --- .forgejo/workflows/{test.yaml => ci.yaml} | 8 +- .forgejo/workflows/deploy.yaml | 111 ---------------------- CLAUDE.md | 2 - Dockerfile | 16 ---- docker-compose.yml | 29 ------ nginx.conf | 15 --- 6 files changed, 5 insertions(+), 176 deletions(-) rename .forgejo/workflows/{test.yaml => ci.yaml} (75%) delete mode 100644 .forgejo/workflows/deploy.yaml delete mode 100644 Dockerfile delete mode 100644 docker-compose.yml delete mode 100644 nginx.conf diff --git a/.forgejo/workflows/test.yaml b/.forgejo/workflows/ci.yaml similarity index 75% rename from .forgejo/workflows/test.yaml rename to .forgejo/workflows/ci.yaml index ad158e3..4d7c61a 100644 --- a/.forgejo/workflows/test.yaml +++ b/.forgejo/workflows/ci.yaml @@ -1,9 +1,11 @@ -name: Test +name: CI + +# Every push builds the site as the servers will (the flake's package). +# Deploying is not this repository's job: Renovate in asxpi/iac picks up +# each push to main and the servers pull it (comin). on: push: - branches-ignore: - - main jobs: check: diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml deleted file mode 100644 index d037dbd..0000000 --- a/.forgejo/workflows/deploy.yaml +++ /dev/null @@ -1,111 +0,0 @@ -name: Build and Deploy to Production - -on: - push: - branches: - - main - -jobs: - # Same job as in test.yaml (non-main branches); duplicated so a broken - # build blocks deploy — Forgejo has no cross-workflow needs. - check: - runs-on: nix-latest - # Settings via env, not /etc/nix/nix.conf: in the image that is a - # symlink into /nix/store, which the runner's nix-store volume - # shadows, so it dangles once the image moves on. - env: - NIX_CONFIG: | - experimental-features = nix-command flakes - build-users-group = - sandbox = false - steps: - - name: Prepare container for actions - run: | - nix-env -iA nixpkgs.nodejs_22 - - - name: Checkout - uses: actions/checkout@v7.0.1 - - - name: Build site (the package nginx serves) - run: nix build .#default - - build: - runs-on: arch-latest - needs: check - container: - image: gcr.io/kaniko-project/executor:v1.24.0-debug - outputs: - image_tag: ${{ steps.build_image.outputs.image_tag }} - steps: - - name: Build and push Docker Image using Kaniko - id: build_image - run: | - # Tags - SHORT_SHA=${GITHUB_SHA::8} - IMAGE_BASE=git.czsk.it/asxpi/blog - IMAGE_TAG=${IMAGE_BASE}:${SHORT_SHA} - IMAGE_LATEST=${IMAGE_BASE}:latest - - # Auth Conf - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"git.czsk.it\":{\"auth\":\"$(echo -n asxpi:${{ secrets.FJ_TOKEN }} | base64)\"}}}" > /kaniko/.docker/config.json - - # Build & push - /kaniko/executor \ - --context=git://git.czsk.it/${{ github.repository }}.git \ - --git=branch=${{ github.ref_name }} \ - --destination=$IMAGE_TAG \ - --destination=$IMAGE_LATEST - - # Output the specific tag for deployment - echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT - - deploy: - runs-on: arch-latest - needs: build - steps: - - name: Install dependencies - run: | - pacman -Syu --noconfirm nodejs openssh rsync - - - name: Checkout code - uses: actions/checkout@v7.0.1 - - - name: Deploy docker-compose.yml - uses: easingthemes/ssh-deploy@v6.0.3 - with: - SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_KEY }} - REMOTE_HOST: ${{ secrets.DEPLOY_IP }} - REMOTE_USER: ${{ secrets.DEPLOY_USER }} - SOURCE: "docker-compose.yml" - TARGET: "/opt/blog/" - - - name: Deploy and update container - uses: appleboy/ssh-action@v1.2.5 - env: - NEW_IMAGE: ${{ needs.build.outputs.image_tag }} - with: - host: ${{ secrets.DEPLOY_IP }} - username: ${{ secrets.DEPLOY_USER }} - key: ${{ secrets.DEPLOY_SSH_KEY }} - envs: NEW_IMAGE - script: | - cd /opt/blog - - sed -i "s|image:.*|image: $NEW_IMAGE|" docker-compose.yml - - docker pull $NEW_IMAGE - docker compose up -d - - # Wait for the image HEALTHCHECK to report healthy. - for i in $(seq 1 18); do - status=$(docker inspect --format '{{.State.Health.Status}}' blog 2>/dev/null || echo missing) - if [ "$status" = "healthy" ]; then - echo "Deployment successful!" - exit 0 - fi - sleep 5 - done - echo "blog never became healthy (last status: $status)" >&2 - docker logs --tail 50 blog - exit 1 diff --git a/CLAUDE.md b/CLAUDE.md index ffb3062..f26f1d3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,8 +7,6 @@ servers take the site from this flake: a push to `main` is picked up by Renovate in asxpi/iac (flake input `blog`) within about 15 minutes and deployed by comin, no deploy job here. -The old container pipeline (Kaniko image, compose deploy to `/opt/blog`) -still runs until it is removed; nothing serves from it. ## Writing a post diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ced7fee..0000000 --- a/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# Keep in step with the zola in flake.nix (tests, local serve): bump this -# pin together with nixpkgs in flake.lock. -FROM ghcr.io/getzola/zola:v0.23.6 AS build - -COPY . /project -WORKDIR /project -# zola is /zola in the image since 0.23, not on PATH -RUN ["/zola", "build"] - -FROM nginx:1.31.8-alpine - -COPY nginx.conf /etc/nginx/conf.d/default.conf -COPY --from=build /project/public /usr/share/nginx/html - -HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ - CMD wget -qO /dev/null http://127.0.0.1/ || exit 1 diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 1aadec5..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,29 +0,0 @@ -services: - blog: - # Image will be dynamically updated during deployment - # Format: registry.example.com/user/blog:sha_tag - build: . - image: blog:latest - container_name: blog - # Same as the image HEALTHCHECK. Podman ignores HEALTHCHECK in OCI-format - # images (what kaniko pushes), and the deploy waits for "healthy". - healthcheck: - test: ["CMD-SHELL","wget -qO /dev/null http://127.0.0.1/ || exit 1"] - interval: 30s - timeout: 5s - start_period: 5s - retries: 3 - restart: unless-stopped - networks: - - traefik - labels: - - "traefik.enable=true" - - "traefik.http.routers.blog.rule=Host(`blog.asxp.io`)" - - "traefik.http.routers.blog.entrypoints=websecure" - - "traefik.http.routers.blog.tls=true" - - "traefik.http.routers.blog.tls.certresolver=letsencrypt" - - "traefik.http.services.blog.loadbalancer.server.port=80" - -networks: - traefik: - external: true diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index 30fd3c2..0000000 --- a/nginx.conf +++ /dev/null @@ -1,15 +0,0 @@ -server { - listen 80; - server_name _; - root /usr/share/nginx/html; - - error_page 404 /404.html; - - location / { - try_files $uri $uri/ =404; - } - - location ~* \.(css|png|svg|xml|ico)$ { - expires 1h; - } -}