Runbook#

A collection of common operational tasks. Commands assume a Docker Compose deployment matching compose.yaml.skel (so containers named richy, richy-db, richy-redis and worker containers richy-beat, richy-worker, richy-worker-slow, richy-worker-fast).

Cache management#

Cached values and their invalidation rules are documented in Cache.

Flush the entire Redis cache:

$ docker exec -it richy-redis redis-cli flushall

Recompute caches selectively for a single item:

Item.objects.get(symbol="FB").update_cache()

Celery#

Restart all Celery instances (sends SIGHUP so workers reload code without losing in-flight tasks):

$ for i in richy beat worker worker_slow worker_fast; do \
      docker compose kill -s HUP ${i}; \
  done

Force-reinstall packages in all running containers (useful after a requirements_dev change without rebuilding the image):

$ for i in richy beat worker worker_slow worker_fast; do \
      docker compose exec ${i} pip install -UI -r requirements_dev; \
  done

Tail Celery worker logs:

$ docker logs -f richy-worker
$ docker logs -f richy-worker-slow
$ docker logs -f richy-worker-fast

The Celery beat schedule lives in django_celery_beat and is loaded from the celery_beat fixture on startup unless NO_CELERY_FIXTURES=true is set. To re-seed it manually:

$ docker exec -it richy ./manage.py loaddata celery_beat

Re-export the current beat schedule back into the fixture (developer machines only):

$ ./app/_scripts/fixtures.sh

User management#

Create a new superuser:

$ docker exec -it richy ./manage.py createsuperuser

Reset a user’s password:

$ docker exec -it richy ./manage.py changepassword <email>

Static files#

Recollect static files (run inside the running container):

$ docker exec -it richy ./manage.py collectstatic -i node_modules --no-input

Recompile the frontend bundle (webpack):

$ docker exec richy ./_scripts/webpack.sh

Database#

Connect to the database for ad-hoc queries:

$ docker exec -it richy-db psql -U postgres richy

For dumps, restores and full deploys, see Deployment.

TLS certificates#

Issuance and renewal procedures live in Server.