mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
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.
69 lines
2.4 KiB
Nginx Configuration File
69 lines
2.4 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# React/Vue/Vite SPA routing
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Do not aggressively cache index.html.
|
|
# It references the latest hashed JS/CSS files.
|
|
location = /index.html {
|
|
try_files $uri =404;
|
|
|
|
add_header Cache-Control "no-cache, must-revalidate";
|
|
}
|
|
|
|
# Vite-generated assets normally contain content hashes.
|
|
# They can safely be cached for a long time.
|
|
location ~* \.(?:css|js|mjs|map|png|jpg|jpeg|gif|svg|ico|webp|avif|woff|woff2|ttf|otf)$ {
|
|
try_files $uri =404;
|
|
|
|
expires 30d;
|
|
add_header Cache-Control "public, max-age=2592000, immutable";
|
|
}
|
|
|
|
location = /favicon.ico {
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
location = /robots.txt {
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
# Content write path (spec-v4 §6.2, spec-v4-deploy-infra D11/D13, spec-v6 D4):
|
|
# Basic-auth at the proxy; ${CONTENT_API_TOKEN} and ${CONTENT_API_BASE} are
|
|
# substituted by the image's envsubst template step from the container
|
|
# environment (sourced from the stack's secrets/site_config) BEFORE nginx parses
|
|
# this file — so proxy_pass below is a literal upstream once rendered, exactly as
|
|
# it was when the URL was written here. The SPA bundle and the repository never
|
|
# carry the token or the git host.
|
|
location /api/content/ {
|
|
auth_basic "Editor";
|
|
auth_basic_user_file /etc/nginx/htpasswd;
|
|
|
|
# HTTP/2 to the upstream (nginx >= 1.29.4; the stack runs 1.31.x; the API host
|
|
# answers an h2 ALPN handshake — verified against api.github.com 2026-10-26). The
|
|
# edit-mode client issues its 12 document reads + 2 label reads as one concurrent
|
|
# wave, so those requests multiplex over a single upstream connection instead of
|
|
# one HTTP/1.1 connection each. Upstream keepalive caching is already the default
|
|
# since 1.29.7; the docs still require the Connection header to be cleared for a
|
|
# reused upstream connection.
|
|
proxy_http_version 2;
|
|
proxy_set_header Connection "";
|
|
|
|
proxy_pass ${CONTENT_API_BASE};
|
|
proxy_ssl_server_name on;
|
|
# Bearer is the form the GitHub Contents API documents; the legacy "token"
|
|
# prefix was Gitea's.
|
|
proxy_set_header Authorization "Bearer ${CONTENT_API_TOKEN}";
|
|
}
|
|
} |