No description
  • JavaScript 94.8%
  • Shell 2.3%
  • HTML 1.3%
  • Dockerfile 0.9%
  • Makefile 0.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
egoreast 4416931253
All checks were successful
CI / validate (push) Successful in 10s
chore: move thesis materials to Nextcloud storage
2026-11-07 10:53:36 +03:00
.forgejo/workflows feat!: rename the contract to Dubl (clients, campaigns, spots) 2026-11-04 11:33:32 +03:00
.husky chore: drop DCO sign-off requirement 2026-11-04 10:37:18 +03:00
docs chore: remove remaining references to the original project 2026-11-07 10:20:41 +03:00
editor chore: import from slovo-propovedi-docs ccd1a7a (v0.23.3) 2026-11-04 10:24:22 +03:00
scripts feat!: rename the contract to Dubl (clients, campaigns, spots) 2026-11-04 11:33:32 +03:00
.env.example chore: import from slovo-propovedi-docs ccd1a7a (v0.23.3) 2026-11-04 10:24:22 +03:00
.gitignore chore: move thesis materials to Nextcloud storage 2026-11-07 10:53:36 +03:00
AGENTS.md docs: describe the contract, FACTS and thesis folders in README 2026-11-04 22:11:03 +03:00
CHANGELOG.md chore: bump version to 0.3.0 2026-11-05 23:39:56 +03:00
CLAUDE.md chore: import from slovo-propovedi-docs ccd1a7a (v0.23.3) 2026-11-04 10:24:22 +03:00
commitlint.config.mjs chore: drop DCO sign-off requirement 2026-11-04 10:37:18 +03:00
docker-compose.dev.yml chore: import from slovo-propovedi-docs ccd1a7a (v0.23.3) 2026-11-04 10:24:22 +03:00
Dockerfile chore: remove remaining references to the original project 2026-11-07 10:20:41 +03:00
FACTS.md feat!: allow txt and markdown scripts, drop fb2 2026-11-06 21:36:01 +03:00
index.html feat!: rename the contract to Dubl (clients, campaigns, spots) 2026-11-04 11:33:32 +03:00
Makefile feat!: rename the contract to Dubl (clients, campaigns, spots) 2026-11-04 11:33:32 +03:00
nginx.conf chore: import from slovo-propovedi-docs ccd1a7a (v0.23.3) 2026-11-04 10:24:22 +03:00
openAPI.yaml feat!: allow txt and markdown scripts, drop fb2 2026-11-06 21:36:01 +03:00
package-lock.json chore: remove remaining references to the original project 2026-11-07 10:20:41 +03:00
package.json chore: bump version to 0.3.0 2026-11-05 23:39:56 +03:00
README.md chore: move thesis materials to Nextcloud storage 2026-11-07 10:53:36 +03:00

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-api generates its zod schemas from it (npm run gen:schemas), dubl-mobile its 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

  1. Edit openAPI.yaml (servers: https://__BACKEND_API_HOSTNAME__, filled at build time, and http://localhost:3000), then regenerate the schemas in dubl-api and the client in dubl-mobile.

  2. Rebuild the image:

    docker build -t dubl-docs .
    
  3. 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

  1. Push a commit to main → CI workflow validates openAPI.yaml.
  2. 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 runs scripts/vps-deploy.sh which builds the Docker image on the VPS via docker buildx, writes the Traefik labels + systemd unit, and restarts dubl-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.sh owns only the dubl-docs container and its own dubl-docs Docker network. Shared infrastructure — Docker, the dubl user/group, the dubl-constrained buildx builder, Traefik (dubl-traefik.service) and the traefik network — is owned by the external dubl-infra and 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
  • dubl system user/group exists
  • Docker buildx builder dubl-constrained exists
  • Traefik reverse proxy is running (dubl-traefik.service)
  • the traefik Docker 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