77 lines
2.2 KiB
Markdown
77 lines
2.2 KiB
Markdown
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:
|
|
|
|
```bash
|
|
cd ~/tmp/progcode/web
|
|
npm install
|
|
node scripts/buildDatabase.mjs
|
|
npm run dev -- --port 3000
|
|
npm run build
|
|
```
|
|
|
|
Docker static deploy:
|
|
|
|
```bash
|
|
docker build -t progcode:static .
|
|
docker run --rm -p 8080:8080 progcode:static
|
|
```
|
|
|
|
Swarm example:
|
|
|
|
```bash
|
|
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 example `registry.example.com/progcode:latest`.
|
|
- `IMAGE_REPO` — optional alternative to `IMAGE`; the workflow will tag images as `${IMAGE_REPO}:${short_sha}`.
|
|
- `REGISTRY` — registry host for `docker login`.
|
|
- `STACK_NAME` — optional, defaults to `progcode`.
|
|
- `TRAEFIK_NETWORK` — optional, defaults to `traefik-public`.
|
|
- `TRAEFIK_ENTRYPOINT` — optional, defaults to `websecure`.
|
|
- The workflow also pushes `${IMAGE_REPO}:latest` automatically.
|
|
|
|
Gitea Actions secrets:
|
|
|
|
- `REGISTRY_USERNAME`
|
|
- `REGISTRY_PASSWORD`
|
|
- `SWARM_MANAGER_HOST`
|
|
- `SWARM_SSH_USER`
|
|
- `SWARM_SSH_PORT` — optional, defaults to `22`.
|
|
|
|
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:
|
|
|
|
```text
|
|
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
|
|
```
|
|
|
|
Example account or organization secrets:
|
|
|
|
```text
|
|
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
|
|
```
|