If the site goes down
Stay calm, and follow the steps in order. The goal is first to get the site back online, then to understand.
1. Observe
sh
curl -i https://api.trinity.jostud.com/health
curl -i https://trinity.jostud.com/api/health| Result | Lead |
|---|---|
Both answer 200 | the infrastructure is fine: look at the application logs |
404 page not found (plain text) | Traefik answers but cannot find the service: it is stopped or not on the trinity network |
502 Bad Gateway | Traefik finds the service but it does not answer: it is restarting or crashing |
| Certificate error | see Troubleshooting |
| Timeout, connection refused | machine stopped, firewall, or Traefik stopped |
2. Look at the latest pipeline
In GitLab, Build → Pipelines. Did a deployment just go through? Did it fail? The deploy-prod log often tells everything.
3. Look at the services
On trinity-prod:
sh
docker service ls # REPLICAS: 2/2 for api and web, 1/1 for db and docs
docker service ps trinity_api --no-trunc # latest tasks and their errors
docker service logs --tail 100 trinity_api
docker ps --filter name=trinity-traefikGo back to the previous version
If the problem came with a deployment:
- GitLab → Operate → Environments → prod, pick the previous deployment, Re-deploy. The job re-runs
docker stack deploywith the old SHA. - In an emergency, on the server:
docker service rollback trinity_web(ortrinity_api) returns to the service's previous configuration.
Then fix it with a git revert in a merge request, so that main does not redeploy the broken version on the next push.
Restart what is stopped
sh
# Traefik
cd /opt/trinity/traefik && docker compose up -d
# a Swarm service
docker service update --force trinity_webIf the machine itself rebooted, Traefik (restart: unless-stopped) and the Swarm services come back on their own.
After the incident
Write a few lines in a GitLab issue:
- what happened and for how long;
- how it was fixed;
- what will prevent it from happening again (a test, an alert, a line in these docs).
Outages already met and their fix are in Troubleshooting.