VPS / Self-Hosted
Self-hosting gives you control of the stack and responsibility for patching, TLS, backups, monitoring, and recovery. Use Python 3.12, a supported Node.js runtime for the bundled Next.js version, PostgreSQL, and a reverse proxy such as Nginx. Use Redis only for the shared or queued features you configure. This guide assumes you already have a server and two DNS names, such as app.example.com and api.example.com.
1. Prepare the server
Create an unprivileged deployment user. Install the runtimes and PostgreSQL, restrict the database to local/private access, and create a database user dedicated to EstateHub. Configure a firewall for SSH, HTTP, and HTTPS; keep the Django, Next.js, PostgreSQL, and Redis ports private. Arrange encrypted off-server backups before importing real data.
2. Configure and build
Deploy the release under your chosen application directory. In backend/, install requirements.txt in a virtual environment and set production variables from backend/.env.example through protected service configuration. Set DJANGO_SETTINGS_MODULE=core.settings.prod for every Django process. In frontend/, install from the selected lockfile, set NEXT_PUBLIC_API_BASE_URL=https://api.example.com/api/v1 and NEXT_PUBLIC_SITE_URL=https://app.example.com, then run the existing build script. Build-time public values cannot be changed without rebuilding.
Run the Django deployment check and migrations once for the release. Run collectstatic into storage available to the backend process. Do not use development data in production. Follow the production checklist to verify HTTPS, proxy handling, cache, and realtime services.
3. Run supervised application processes
Start Daphne for the API and the Next.js production server as non-root services supervised by systemd or an equivalent process manager. Configure automatic restart, working directories, environment, and logs. For example, the backend service can execute:
daphne -b 127.0.0.1 -p 8000 core.asgi:applicationRun that command from backend/ with the production settings variable set. Run the frontend's start script from frontend/ on a private local port. Do not use Django runserver or a development Next.js server for public traffic. If you enable Celery tasks, supervise a separate worker and test its broker; it does not replace Daphne.
4. Add the reverse proxy and TLS
Route the frontend hostname to the Next.js port and the API hostname to Daphne. Forward the host and WebSocket upgrade headers, terminate TLS with valid certificates, and redirect HTTP to HTTPS. Configure Django to recognize the trusted proxy's HTTPS indication; the supplied production settings do not yet define SECURE_PROXY_SSL_HEADER. Test redirects and secure cookies before exposing the domain, especially because production settings already enable long-lived HSTS for subdomains and preload. Follow the Next.js self-hosting guide for reverse-proxy considerations.
5. Verify and operate
Test https://api.example.com/health/, an authenticated /api/v1 request, frontend navigation, email, protected uploads, and enabled WebSockets. Monitor both processes, PostgreSQL, certificates, disk space, and backup jobs. Restore a backup into an isolated environment on a schedule. Use Updating EstateHub for subsequent releases and Troubleshooting for failures.
Scheduled upload cleanup
Run cleanup_uploads hourly through 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 and is not required to schedule this management command.
First run the command manually from backend/ using the application's virtual environment and production configuration:
DJANGO_SETTINGS_MODULE=core.settings.prod /absolute/path/to/EstateHub/backend/venv/bin/python manage.py cleanup_uploadsFor a Linux host with cron and flock installed, add this entry to the deployment user's crontab:
0 * * * * cd /absolute/path/to/EstateHub/backend && DJANGO_SETTINGS_MODULE=core.settings.prod /usr/bin/flock -n /absolute/path/to/cleanup.lock /absolute/path/to/EstateHub/backend/venv/bin/python manage.py cleanup_uploads >> /absolute/path/to/cleanup.log 2>&1Replace the project, virtual environment, lock, and log paths with your deployment's absolute paths. Confirm the flock path using command -v flock. The scheduler user must have permission to run the backend, read its configuration, and create the lock and log files. Provide the same production database, storage, and secret values as the backend service; cron does not inherit systemd service environment settings. The backend loads backend/.env when present, or you can supply variables through a protected scheduler configuration.
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.