2.7 KiB
2.7 KiB
ProgCode.Ru
Structure:
web/— Next.js application.web/data/articles.json— article data used by the site.web/public/assets/illustrations/— SVG illustrations and article covers.web/public/assets/media/— raster images used by the site.web/scripts/buildDatabase.mjs— refreshes article data and generated assets from local source files.
Useful commands:
cd ~/tmp/progcode/web
npm install
ADMIN_PORT=3333 npm run admin:posts
node scripts/buildDatabase.mjs
npm run dev -- --port 3000
npm run build
Local posts admin:
- run from
web/withnpm run admin:posts; - open
http://127.0.0.1:3333; - it edits posts as Markdown and saves generated
contentHtmltoweb/data/articles.json; - uploaded files are stored in
web/public/assets/uploads/; - it lives in
local-admin/, outside the Next.js app, and.dockerignoreexcludes it from Docker builds.
Docker static deploy:
docker build -t progcode:static .
docker run --rm -p 8080:8080 progcode:static
Swarm example:
DOMAIN=progcode.example.com IMAGE=registry.example.com/progcode:static \
docker stack deploy -c deploy/stack.example.yml progcode
Gitea Actions variables:
DOMAIN— public host routed by Traefik.IMAGE— full image tag to build and deploy, for exampleregistry.example.com/progcode:latest.IMAGE_REPO— optional alternative toIMAGE; the workflow will tag images as${IMAGE_REPO}:${short_sha}.REGISTRY— registry host fordocker login.STACK_NAME— optional, defaults toprogcode.TRAEFIK_NETWORK— optional, defaults totraefik-public.TRAEFIK_ENTRYPOINT— optional, defaults towebsecure.TRAEFIK_CERTRESOLVER— optional, defaults tole.- The workflow also pushes
${IMAGE_REPO}:latestautomatically.
Gitea Actions secrets:
REGISTRY_USERNAMEREGISTRY_PASSWORDSWARM_MANAGER_HOSTSWARM_SSH_USERSWARM_SSH_PORT— optional, defaults to22.
The workflow follows the same SSH model as ohuello: the deploy SSH private key is not stored in Gitea secrets. It must be created on the Gitea runner host and mounted into job containers as /root/.ssh:ro, including known_hosts.
Example account or organization variables:
REGISTRY=git.example.com
IMAGE_REPO=git.example.com/huncode/progcode
DOMAIN=progcode.example.com
STACK_NAME=progcode
TRAEFIK_NETWORK=traefik-public
TRAEFIK_ENTRYPOINT=websecure
TRAEFIK_CERTRESOLVER=le
Example account or organization secrets:
REGISTRY_USERNAME=<gitea-user-or-token-user>
REGISTRY_PASSWORD=<gitea-token>
SWARM_MANAGER_HOST=<swarm-manager-origin-ip-or-ssh-host>
SWARM_SSH_USER=deploy
SWARM_SSH_PORT=22