date-website

Operations & Maintenance Notes

Purpose

This guide collects the repo’s maintenance scripts and the situations where they should be used. Use it together with the main README for day-to-day operational work.

Environment Assumptions

Most scripts assume:

Unless a script says otherwise, prefer running it from a Bash-compatible shell.

Admin Theme

Set USE_UNFOLD=True in .env to run Django admin with the Unfold theme. Leave it unset or set it to False to use the classic Django admin.

Changing this value requires restarting or recreating the Django containers, because admin apps, widgets, templates, and static assets are selected when Django starts.

Fixture Reset and Local Seed Data

date-cleaninit / scripts/clean_init.sh

Use this when you want to reset local development data to a known starting point.

What it does:

Use this for:

Do not use this on environments that contain real data.

scripts/load_all_fixtures.sh

This is the fixture loader used by clean_init.sh.

It loads:

Treat the generated fixture output as disposable development data.

Multi-Association Dev Stack

docker-compose.dev-all.yml / date-all-* aliases

Use this when you need to run all associations simultaneously for style comparison or cross-association testing.

Each association gets its own web container on a dedicated port, sharing one PostgreSQL database and one Redis instance:

Association URL
biocum http://localhost:8001
date http://localhost:8002
kk http://localhost:8003
pulterit http://localhost:8004

The database is exposed on host port 5433 to avoid conflicting with the regular dev stack on 5432.

Helpers (after source env.sh or adding them to your shell config)

The helpers use the nearest date-website checkout from your current directory, falling back to DATE_WEBSITE_DIR when you are outside a checkout.

date-all-start       # build and start all containers
date-all-stop        # tear everything down
date-all-cleaninit   # reset to fixture data against the dev-all stack

How it works

An init container runs once on startup — it waits for PostgreSQL, then runs migrate, collectstatic, and compilemessages using PROJECT_NAME=date. All web containers wait for init to complete before accepting requests.

The web service (port 8002) is named web specifically so clean_init.sh can target it when running date-all-cleaninit.

Notes

Backups and Database Upgrades

scripts/backup_postgres.sh

Use this for routine PostgreSQL backups.

Typical usage:

./scripts/backup_postgres.sh [dev|prod|path/to/env] [output_dir]

Behavior:

Use this before risky schema or infrastructure work, and especially before any major PostgreSQL version upgrade.

For Kubernetes deployments, the Helm chart provides a PostgreSQL backup CronJob that can upload compressed dumps to Backblaze B2. See Kubernetes and k3s Deployment Notes for the k3s backup workflow.

update-postgres.sh

Use this only for major PostgreSQL version upgrades.

It:

The Compose db service also wraps the upstream Postgres entrypoint so existing volumes that were initialized with the legacy /var/lib/postgresql/data layout are moved into the configured PGDATA subdirectory on first boot.

This script is destructive if used incorrectly. Read the warnings in the README before running it.

Translation Maintenance

scripts/validate_translations.py

Use this to validate locale completeness before merging translation-heavy work.

python scripts/validate_translations.py

It checks each required locale catalog for:

This is useful after makemessages, after large translation edits, and before release branches.

Data Import / Export Helpers

These scripts are more task-specific and should usually be run only by someone familiar with the target app and data shape:

Before using one of these on shared or production-like data:

Before destructive operations

  1. Confirm which env file you are targeting.
  2. Make a backup.
  3. Verify whether the script mutates local-only data, shared data, or production data.
  4. Make sure containers are using the expected compose file.

After maintenance work

  1. Restart the relevant services.
  2. Run a minimal smoke test on the public site and admin.
  3. If translations were touched, run the translation validator and preview one translated locale.
  4. Update the docs if the workflow changed.