Operations manual

Reference · 05

Troubleshooting playbook

Start with the narrowest signal: a health probe, a service status, one journal excerpt, one browser network response. Change one variable at a time and record what moved.

ReferenceTroubleshootingOperationsReviewed November 2026

First five checks

curl -fsS https://perfumz.com/health/live/
curl -fsS https://perfumz.com/health/ready/
sudo systemctl status perfumz perfumz-jobs.timer --no-pager
sudo journalctl -u perfumz -n 100 --no-pager
sudo tail -n 80 /var/log/nginx/error.log

If readiness is 503, read the JSON checks object. If the service is inactive, read the last 100 journal lines before restarting.

Startup failures

SymptomLikely causeFix
Service exits immediatelySettings import error, missing secret or database credentials.Run manage.py check --settings config.settings_production as the service user.
DisallowedHostHost missing from DJANGO_ALLOWED_HOSTS.Add the host and restart.
CSRF verification failedOrigin missing from DJANGO_CSRF_TRUSTED_ORIGINS.Add the full https:// origin and restart.
Port 8007 in useAnother process is bound.Find it with ss -ltnp or lsof -i :8007.

502 / 504 from Nginx

502 usually means Gunicorn is down, the upstream port is wrong or the service failed to start. 504 means Nginx timed out; check a slow query, a provider call inside a request path, or a worker timeout. Read the Gunicorn journal before changing Nginx.

sudo systemctl status perfumz --no-pager
curl -v http://127.0.0.1:8007/health/live/
sudo journalctl -u perfumz -n 150 --no-pager
sudo nginx -t
sudo tail -n 100 /var/log/nginx/error.log

Static files and media

SymptomCauseFix
CSS 404collectstatic not run or the Nginx alias is wrong.Run it, check staticfiles/ permissions, then nginx -t.
Uploaded image 404Media alias, permissions or file missing.Check media/<path>, the Nginx alias and the web service UMask.
413 on uploadNginx or Django body limit.Raise both limits; do not raise only one.
Documentation 404Docs alias missing or wrong path.Check the /documentations/ alias and index.html.

Database and readiness

sudo systemctl status postgresql --no-pager
pg_isready -h 127.0.0.1 -p 5432
psql -h 127.0.0.1 -U perfumz -d perfumz -c 'select 1;'
curl -fsS http://127.0.0.1:8007/health/ready/

A readiness 503 with database=error points to connectivity or credentials, not to the web worker. Check the database service, role password, host/port and connection limits. A cache error is unusual with LocMem; investigate the worker if it appears.

Email, payments and auth

  • Email: check the resolved backend, SMTP host, TLS mode, credentials and sender. The delivery log records the provider error. A console backend is not a real send.
  • Payments: check the provider environment, keys, webhook URL and signature secret. Replay a provider event after changing a handler. Never mark an order paid from a redirect alone.
  • Auth: check the callback URL registered with Google/Apple, the client secret and the site origin. A social identity cannot be unlinked if it is the last usable sign-in method.

Jobs, locale and performance

systemctl list-timers 'perfumz*'
sudo systemctl start perfumz-jobs.service
sudo journalctl -u perfumz-jobs -n 120 --no-pager

.venv/bin/python scripts/audit_ui_translations.py
sudo journalctl -u perfumz --since '1 hour ago' | grep -i 'slow\|error'

If a job fails, run its command directly with the production settings to see the full error. For locale issues, confirm the cookie and the generated catalog, then re-run the audit. For performance, check PostgreSQL slow queries, the number of Gunicorn workers and the Nginx upstream timing before adding hardware.

Evidence to capture

  • The exact URL, time and user role that triggered the issue.
  • The health response and the service status.
  • The relevant journal lines, with secrets redacted.
  • The browser network response for a frontend failure.
  • The provider event ID for a payment or webhook issue.
  • The last release commit and whether a migration ran.
Perfumz Operations Manual · English reference · Reviewed November 2026