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 :doc:`/architecture/caching`. Flush the entire Redis cache: .. code-block:: bash $ docker exec -it richy-redis redis-cli flushall Recompute caches selectively for a single item: .. code-block:: python Item.objects.get(symbol="FB").update_cache() Celery ------ Restart all Celery instances (sends ``SIGHUP`` so workers reload code without losing in-flight tasks): .. code-block:: bash $ 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): .. code-block:: bash $ 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: .. code-block:: bash $ 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: .. code-block:: bash $ docker exec -it richy ./manage.py loaddata celery_beat Re-export the current beat schedule back into the fixture (developer machines only): .. code-block:: bash $ ./app/_scripts/fixtures.sh User management --------------- Create a new superuser: .. code-block:: bash $ docker exec -it richy ./manage.py createsuperuser Reset a user's password: .. code-block:: bash $ docker exec -it richy ./manage.py changepassword Static files ------------ Recollect static files (run inside the running container): .. code-block:: bash $ docker exec -it richy ./manage.py collectstatic -i node_modules --no-input Recompile the frontend bundle (webpack): .. code-block:: bash $ docker exec richy ./_scripts/webpack.sh Database -------- Connect to the database for ad-hoc queries: .. code-block:: bash $ docker exec -it richy-db psql -U postgres richy For dumps, restores and full deploys, see :doc:`deployment`. TLS certificates ---------------- Issuance and renewal procedures live in :doc:`certificates`.