EstateHub

Docker

The root compose.yaml declares frontend and backend builds, PostgreSQL 17, Redis 7, and a Celery worker. Use the steps below to prepare production configuration, networking, static files, and release verification.

1. Prepare production configuration

Use backend/.env.example and frontend/.env.example as templates, but never commit or bake real .env files into images. Set DJANGO_SETTINGS_MODULE=core.settings.prod, strong persistent secrets, exact domains/origins, production database credentials, storage, and email values. Provide NEXT_PUBLIC_API_BASE_URL and NEXT_PUBLIC_SITE_URL to the frontend build, not only the running container. Review the frontend Dockerfile to ensure these build-time values are supplied.

The ${DB_NAME}, ${DB_USER}, and ${DB_PASSWORD} expressions in the Postgres service are Compose interpolation values. They must be supplied to Compose from its environment or root .env; backend/.env alone does not populate them. Inspect the resolved result before startup:

BASH
docker compose config

Protect this output because resolved configuration can contain secrets.

2. Create a production override

Keep the supplied Compose file as a base and add a reviewed production override for a TLS reverse proxy, internal-only backend/database/Redis networking, durable Postgres storage and backups, resource limits, and health checks. Ensure the proxy is trusted and Django recognizes HTTPS correctly before enabling the production settings' forced redirect and HSTS behavior. See Docker's production Compose guidance.

Move migrations to a deliberate one-time release step. Collect static files into the final backend image or a persistent filesystem before serving traffic. Do not assume a pre-start command that runs for every replica provides safe one-time migrations. Use the Compose backend's Daphne command as the production ASGI entry point.

3. Review process state

Review cache and channel-layer configuration and test realtime and account recovery flows before increasing backend replicas. Keep the Celery service only when your release has tasks to process, and define any schedules explicitly.

Scheduled upload cleanup

Schedule cleanup_uploads hourly through host cron or the hosting scheduler. It deletes expired pending uploads, unattached uploads older than UPLOAD_UNATTACHED_RETENTION_HOURS (default: 24 hours), and uploads awaiting deletion. Attached uploads are excluded. Celery Beat is optional; the supplied Compose stack does not automatically schedule cleanup.

First run the command manually from the project root against the configured production backend:

BASH
docker compose exec -T backend python manage.py cleanup_uploads

For a Linux host with cron and flock installed, add this entry to the deployment user's crontab:

CRON
0 * * * * cd /absolute/path/to/EstateHub && /usr/bin/flock -n /absolute/path/to/cleanup.lock /usr/bin/docker compose exec -T backend python manage.py cleanup_uploads >> /absolute/path/to/cleanup.log 2>&1

Replace the project, lock, and log paths with absolute paths for your deployment. Confirm the executable paths using command -v docker and command -v flock. The scheduler user must have Docker access and permission to create the lock and log files. The backend container must be running with DJANGO_SETTINGS_MODULE=core.settings.prod and the production database and storage configuration. Include the same Compose file and project options used to start the deployment if you use overrides or a custom project name.

Use one scheduler for the deployment. The lock prevents overlapping executions on this host; coordinate jobs across hosts if you run multiple replicas. Verify the first scheduled run, monitor failures, and rotate the log. Storage-provider deletion failures leave uploads in deletion-pending state for retry, so also monitor that backlog: a successful exit or deleted count does not confirm that every eligible upload was removed.

4. Launch and verify

After the production preflight, build the reviewed Compose configuration, apply migrations once, start the stack, and verify /health/, HTTPS frontend requests, sign-in, uploads, and backup restore. Do not expose development credentials, database ports, or Redis publicly. For Compose variable behavior, see Docker interpolation.