Deployment¶
The server runs the images published by CI; nothing is built on the server.
flowchart LR
PR[Pull request] -->|lint, types, tests| Main[merge to main]
Main -->|CI| Images[ghcr.io/rewake-fr/api<br/>ghcr.io/rewake-fr/api-ocr<br/>ghcr.io/rewake-fr/api-docs<br/>tags latest and sha-…]
Images -->|scripts/deploy/deploy.sh| Server[Server: docker compose]
Every push to main builds the images (api, api-ocr, api-docs), tagged latest and
sha-<commit>, and publishes a GitHub release with its notes. Merging does not deploy.
Deploy¶
On the server, in the API directory:
scripts/deploy/deploy.sh # the latest image
scripts/deploy/deploy.sh sha-abc1234 # a precise build: to pin a version or roll back
The script pulls the images, restarts the services and waits for /health/ to answer.
Once per server, log in to the registry (the images are private): docker login ghcr.io with a
GitHub token that has read:packages.
Before deploying¶
New settings: add them to the server’s
.env(see the release notes and Configuration).A change in the job names or the schedule: jobs already queued under an old name fail once; deploy when nothing important is running.
Documentation site¶
The docs service serves this documentation (nginx, image api-docs) on
172.17.0.1:${DOCS_PORT} (3003 by default); Traefik publishes it on
https://docs.api.rewake.fr. scripts/deploy/deploy.sh deploys it with the API; to deploy only
the documentation:
scripts/deploy/docs.sh # or: make docs-deploy
scripts/deploy/docs.sh sha-abc1234
Set up once:
DNS: an
Arecorddocs.api.rewake.frpointing to the server.Traefik: a router to the service. With Traefik’s file provider (dynamic configuration):
http: routers: api-docs: rule: Host(`docs.api.rewake.fr`) entryPoints: [websecure] service: api-docs tls: certResolver: mytlschallenge services: api-docs: loadBalancer: servers: - url: http://172.17.0.1:3003
If Traefik reads Docker labels instead, declare the same router as
traefik.http.routers.*labels on thedocsservice and attach it to Traefik’s network. Use the entry point and certificate resolver names of the existing routers.
While writing documentation, make docs builds it and opens it, and make docs-live rebuilds
it on every change.