Files
cv/compose.yaml
T
dong.nguyen cff981c5f3 ci: move both pipelines to GitHub Actions (spec-v6)
GitHub becomes the primary repository host; the site keeps its VPS + nginx + Dockge host, the three-job pipeline and the same concurrency, so what moves is the CI host and the write-path target. .github/workflows/{deploy,deploy-infra}.yml are ports of the Gitea files with permissions: contents: read on every job. .gitea/workflows/ stays until the first green GitHub run (D9); its infra test step carries the new template variable names because the template it validates is the one this repository now ships.

The write-path values are renamed GITEA_TOKEN / GITEA_CONTENTS_API -> CONTENT_API_TOKEN / CONTENT_API_BASE and the upstream header becomes Bearer — in nginx.conf, in the compose envsubst filter and in the dev proxy, so dev and production send the identical header (D4). draft.ts learns GitHub's answer to a stale blob sha (409) while keeping the 422 "does not match" and 412 legs; smoke-draft.ts check 14 drives a stubbed proxy that answers 409 with GitHub's body and asserts the conflict refreshes the base, keeps the draft and never stops the save sequence.

Both workflows read the stack directory and the compose service / container name from the STACK_DIR and CONTAINER_NAME repository variables instead of hard-coding them, and each job refuses a missing, relative, trailing-slash or compose-disagreeing value in its first step, before any artifact download or rsync reaches the VPS (D15).

Verified: tsc -b and oxlint pass with no new warnings; validate:content, smoke-draft (14 checks) and smoke-generated-ids (7 checks) pass; both workflows parse, every run/script block passes bash -n with the variables substituted, and the guard refuses every bad value against the real compose.yaml. Owner-side variables, secrets, the write token and the VPS config rewrite stay open in spec-v6 §6.
2026-10-26 20:49:34 +07:00

45 lines
2.0 KiB
YAML

# Repo-as-source-of-truth copy (spec-v4-deploy-infra D7/D9): rsynced to the
# stack directory and run there by the pipeline or Dockge. Runtime values live
# in secrets/site_config, which is NOT in the repository — the repo carries no
# site identity (D10-D13).
services:
dong-site:
image: nginx:alpine
container_name: dong-site
restart: unless-stopped
# Source the config file, then hand over to the image's official entrypoint.
# set -a is REQUIRED: a sourced assignment is a shell variable, not an env var —
# without export the entrypoint child (and its envsubst step) sees nothing and
# the template renders unsubstituted (reproduced locally 2026-10-23 as an
# "unknown variable" failure; the names are content_api_* since spec-v6). The
# nginx command is inline: a compose
# entrypoint override does NOT keep the image's CMD (CMD=[]) — an empty "$@"
# makes the exec a no-op, exit 0, restart loop.
entrypoint: ["sh", "-c", "set -a; . /run/secrets/site_config; exec /docker-entrypoint.sh nginx -g 'daemon off;'"]
environment:
# Names the variables the template renderer substitutes. The filter is a
# REGEX the official entrypoint matches against each variable name
# (`t ~ /^(filter)$/`) — alternatives MUST be separated with |, a comma
# matches nothing and leaves ${…} in the rendered config (nginx -t then
# fails with an unknown variable — reproduced 2026-10-23).
# $uri/$host stay nginx runtime variables. The filter is not sensitive.
NGINX_ENVSUBST_FILTER: CONTENT_API_TOKEN|CONTENT_API_BASE
volumes:
- ./dist:/usr/share/nginx/html:ro
# Mounted as a template: the image's envsubst step renders it to
# /etc/nginx/conf.d/default.conf with the variables sourced above.
- ./nginx.conf:/etc/nginx/templates/default.conf.template:ro
- ./deploy/htpasswd:/etc/nginx/htpasswd:ro
secrets:
- site_config
networks:
- docker-network
secrets:
site_config:
file: ./secrets/site_config
networks:
docker-network:
external: true