- JavaScript 94.8%
- Shell 2.3%
- HTML 1.3%
- Dockerfile 0.9%
- Makefile 0.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| .husky | ||
| docs | ||
| editor | ||
| scripts | ||
| .env.example | ||
| .gitignore | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| commitlint.config.mjs | ||
| docker-compose.dev.yml | ||
| Dockerfile | ||
| FACTS.md | ||
| index.html | ||
| Makefile | ||
| nginx.conf | ||
| openAPI.yaml | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
Docs service
The REST contract of «Дубль» (an app for audio-ad agency staff) and the static Swagger UI that
publishes it at https://docs.dubl.lightnode.ru.
openAPI.yaml(OpenAPI 3.2.0) is the single source of truth:dubl-apigenerates its zod schemas from it (npm run gen:schemas),dubl-mobileits client (yarn api:generate). 47 operations in 8 sections; everything except login, refresh and health needs a JWT.FACTS.md— verified facts and numbers about the source and the final version, for the thesis.- Thesis materials (screenshots, listings, demo video, reconciliation) live outside the repo in
the local Nextcloud folder:
Nextcloud/Studding/10 семестр/ВКР/thesis/(/home/egoreast/Nextcloud/Studding/10 семестр/ВКР/thesis/);thesis/is gitignored.
The service is a fully static nginx container: it serves Swagger UI and openAPI.yaml and needs
no database, MinIO or API to run.
Makefile shortcuts
Команды из этого README обёрнуты в Makefile — см. make help для полного списка
целей (dev-редактор, прод-сборка, запуск, остановка).
What it serves
| Endpoint | Description |
|---|---|
/ |
Swagger UI (interactive API documentation) |
/openAPI.yaml |
The OpenAPI 3.2.0 specification (raw YAML) |
Build the Docker image
docker build -t dubl-docs .
The build downloads swagger-ui-dist (default 5.34.1, overridable via the
SWAGGER_UI_VERSION build arg) and bundles it with the custom index.html, openAPI.yaml,
and nginx.conf into a minimal nginx:alpine image. There is no Node.js runtime in the final image.
The backend API hostname is REQUIRED (no default): it is substituted into the
__BACKEND_API_HOSTNAME__ placeholders in the nginx CSP and the openAPI.yaml
servers URL, via the BACKEND_API_HOSTNAME build arg — the build fails
without it.
# With a specific Swagger UI version and/or backend hostname
docker build --build-arg SWAGGER_UI_VERSION=5.34.1 --build-arg BACKEND_API_HOSTNAME=api.example.com \
-t dubl-docs .
# Or via the Makefile shortcut:
make prod-build SWAGGER_UI_VERSION=5.34.1 BACKEND_API_HOSTNAME=api.example.com
Run it locally
docker run --rm -p 8080:8080 dubl-docs
Then open http://localhost:8080/ to browse the API documentation.
Quick sanity check:
curl -s http://localhost:8080/openAPI.yaml | head
How to update the spec
-
Edit
openAPI.yaml(servers:https://__BACKEND_API_HOSTNAME__, filled at build time, andhttp://localhost:3000), then regenerate the schemas indubl-apiand the client indubl-mobile. -
Rebuild the image:
docker build -t dubl-docs . -
Restart the container with the new image.
Локальный редактор OpenAPI (только для разработки)
Для удобного редактирования openAPI.yaml (вместо правки файла вручную) есть отдельный
dev-контейнер: официальный Swagger Editor v5 + кнопки Load from disk и Save to disk.
Он не входит в прод-образ (см. Dockerfile) и существует только локально.
Самый простой способ запустить редактор — make:
make dev-up
Команда собирает и запускает dev-контейнер, ждёт, пока редактор станет готовым, и
автоматически открывает его в браузере по адресу http://localhost:8081/ (в
headless-окружениях без браузера она просто печатает сообщение о готовности).
Редактор автоматически загрузит текущий openAPI.yaml.
Кнопка Save to disk записывает содержимое редактора обратно в openAPI.yaml на диске
(файл примонтирован как том). После сохранения проверьте diff и закоммитьте:
git diff openAPI.yaml
git add openAPI.yaml && git commit
Если браузер не открылся сам (или вы его закрыли) — откройте вручную:
make dev-open
Остановить dev-редактор:
make dev-down
Если предпочитаете сырые команды: под капотом make dev-up — это просто
docker compose -f docker-compose.dev.yml up --build.
Продакшен-контейнер (Swagger UI на :8080) этим не затрагивается.
Изменения openAPI.yaml вне редактора (git pull, переключение веток и т.п.) идут через атомарную
замену файла: работающий контейнер держит старый inode и отдаёт старую версию до перезапуска.
Перезапустите dev-контейнер: make dev-restart (или make dev-down && make dev-up).
Кнопка Save to disk не затронута — она пишет в тот же примонтированный файл.
Deployment
Production deployment is fully automated via Forgejo Actions.
How it works
- Push a commit to
main→ CI workflow validatesopenAPI.yaml. - Tag a release (
v*) and push → the Release workflow:- Waits for CI to pass on the tagged commit.
- SSHes into the VPS, uploads
scripts/vps-deploy.sh, and runs it. - The workflow transfers the source code to the VPS via
tar+ssh, then runsscripts/vps-deploy.shwhich builds the Docker image on the VPS viadocker buildx, writes the Traefik labels + systemd unit, and restartsdubl-docs.service.
npm run bump-version patch # updates package.json, openAPI.yaml, CHANGELOG and tags v<version>
git push --follow-tags origin main
Boundary.
vps-deploy.showns only thedubl-docscontainer and its owndubl-docsDocker network. Shared infrastructure — Docker, thedubluser/group, thedubl-constrainedbuildx builder, Traefik (dubl-traefik.service) and thetraefiknetwork — is owned by the externaldubl-infraand must be provisioned first (just setup-all). The script only verifies it and fails fast if anything is missing.
Required Forgejo secrets
Settings → Actions → Secrets.
| Secret | Description |
|---|---|
VPS_SSH_PRIVATE_KEY |
SSH private key (ed25519) for root access to the VPS |
VPS_SSH_KNOWN_HOSTS |
Pinned VPS host key: ssh-keyscan <VPS_HOST> output, verified against the server's fingerprints (see docs/ci-cd.md) |
VPS_HOST |
VPS hostname or IP |
VPS_SSH_USER |
SSH user on the VPS (root) |
Required Forgejo variables
Settings → Actions → Variables.
| Variable | Description |
|---|---|
DOCS_HOSTNAME |
Public hostname of the docs site (docs.dubl.lightnode.ru) |
BACKEND_API_HOSTNAME |
API hostname baked into the spec servers and the CSP (api.dubl.lightnode.ru) |
TRAEFIK_NETWORK, TRAEFIK_SERVICE, BUILDX_BUILDER |
Names provisioned by dubl-infra (traefik, dubl-traefik.service, dubl-constrained) |
The full list for all repositories is in dubl-infra/docs/deploying-apps.md.
VPS prerequisites
The VPS must already be provisioned by the external dubl-infra (just setup-all)
before the first deploy. The script verifies these and errors out if any is missing:
- Docker is installed and running
dublsystem user/group exists- Docker buildx builder
dubl-constrainedexists - Traefik reverse proxy is running (
dubl-traefik.service) - the
traefikDocker network exists
Repository layout
Dockerfile # Multi-stage build: swagger-ui-dist + nginx
index.html # Custom Swagger UI entry page
nginx.conf # Server config: port 8080, YAML content type, CORS, security headers
openAPI.yaml # The OpenAPI specification