Troubleshooting
Problems already met, or likely, with their cause and fix.
The pipeline
| Symptom | Likely cause | Fix |
|---|---|---|
| A job stays pending | no online runner with the right tag | check the dots in Settings → CI/CD → Runners, then sudo gitlab-runner verify on the server |
deploy-prod pending | the trinity-prod-deploy runner is stopped, or lacks the prod tag | systemctl status gitlab-runner on trinity-prod |
api:lint runs on a deploy runner | a deploy runner accepts untagged jobs | uncheck "Run untagged jobs" on the deploy runners |
No *:lint / *:test job runs | no file in api/ or web/ changed | expected: see The pipeline |
*:build: Cannot connect to the Docker daemon | the CI runner is not privileged, or /certs/client is not shared | re-run the gitlab-runner role; check privileged = true in config.toml |
web:test green but nothing in the Tests tab | junit.xml not produced | run npm run test:ci (not npm test) |
Runners
| Symptom | Likely cause | Fix |
|---|---|---|
Every shell job fails with prepare environment: exit status 1 | Ubuntu's /home/gitlab-runner/.bash_logout | the Ansible role deletes it; re-run it |
Shell job: permission denied … docker.sock | gitlab-runner is not in the docker group | re-run the role, then sudo systemctl restart gitlab-runner |
| A runner appears twice in GitLab | registered by hand on top of Ansible | delete the duplicate in GitLab and in /etc/gitlab-runner/config.toml |
Deployment
| Symptom | Likely cause | Fix |
|---|---|---|
deploy-prod: manifest unknown or pull access denied | the …:<sha> image does not exist: a *:build job did not run or failed | look at the build stage of the same pipeline |
deploy-prod fails on the test … = 3 line | Swarm rolled back: the new image fails its health check | docker service ps trinity_api --no-trunc and docker service logs trinity_api |
deploy-dev fails on curl … /health after 20 attempts | the container crashes at startup | docker logs trinity_api on trinity-dev |
The prod API crashes with PermissionError: '/app/staticfiles' | /app does not belong to appuser | fixed in api/Dockerfile.prod: see Configuration and startup |
The API refuses to start: SECRET_KEY must be set | DJANGO_SECRET_KEY variable missing, or not available to this branch | check Settings → CI/CD → Variables |
password authentication failed for user "trinity" | POSTGRES_PASSWORD changed after the volume was created | see Secrets |
Traefik and HTTPS
| Symptom | Likely cause | Fix |
|---|---|---|
404 page not found | no route for this domain, or the service is not on the trinity network | check the file in /opt/trinity/traefik/dynamic/ and docker network inspect trinity |
502 Bad Gateway | the target container does not answer on its port | service logs; check the port (3000 or 8000) |
| Invalid "TRAEFIK DEFAULT CERT" certificate | Let's Encrypt could not issue the certificate | docker logs trinity-traefik; check the DNS points to the right IP and port 80 is open |
Traefik: permissions 644 for /acme.json are too open | wrong permissions on acme.json | chmod 600 /opt/trinity/traefik/acme.json, then restart Traefik |
| A changed route is not applied | the file was not copied to the server | re-run ansible-playbook … --tags traefik |
The application
| Symptom | Likely cause | Fix |
|---|---|---|
Every API request answers 400 Bad Request | the domain is not in ALLOWED_HOSTS | fix ALLOWED_HOSTS in the Compose file |
| The web shows "API indisponible : fetch failed" | wrong API_URL, or the API is stopped | check API_URL and the API's /health |
| The Django admin has no styling in prod | Gunicorn does not serve static files | known: see Limits |