2.4 KiB
2.4 KiB
IELTS Mock deployment runbook
Before the first deployment
- Create a private
.envfrom.env.example. - Generate a long random
DJANGO_SECRET_KEY. - Set
DJANGO_DEBUG=False. - Set the real domain in
DJANGO_ALLOWED_HOSTSand HTTPS origins inDJANGO_CSRF_TRUSTED_ORIGINS. - Set a strong PostgreSQL password and production
DATABASE_URL. - Configure all
DJANGO_EMAIL_*values and send a real password-reset test. - Keep
DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS=FalseandDJANGO_SECURE_HSTS_PRELOAD=Falseuntil every required subdomain is confirmed HTTPS-only. - Create the first administrator with
python manage.py createsuperuserinside the deployed web container.
Release procedure
- Run
powershell -ExecutionPolicy Bypass -File scripts/check_deployment.ps1locally. - Back up the current production database and media.
- Build and deploy the new image.
- The container entrypoint runs migrations and
collectstaticbefore Gunicorn starts. - Confirm
/health/returns HTTP 200. - Check
/,/accounts/login/,/faq/,/contact/, and/admin/. - Submit a contact message and password-reset request.
- Review application and proxy logs for errors.
The repository is deployment-ready, but the final upload requires the chosen host, public domain, PostgreSQL credentials, SMTP credentials, and DNS/HTTPS access. Never commit these values to the repository.
Backups
- Windows Docker host:
powershell -ExecutionPolicy Bypass -File scripts/backup_docker.ps1 - Linux/macOS Docker host:
sh scripts/backup_docker.sh - Local SQLite development copy:
powershell -ExecutionPolicy Bypass -File scripts/backup_local.ps1 - Store copies outside the server and test restoration regularly.
- Never consider a backup reliable until a restoration test succeeds.
Routine operations
- Monitor
/health/and HTTPS certificate expiration. - Review error logs and disk usage.
- Apply dependency/security updates through a tested deployment.
- Verify automated backups and keep more than one retention point.
- Do not edit production data directly unless a backup has been confirmed.
Rollback
- Stop routing new traffic to the failed release.
- Redeploy the previously working image.
- Restore the database only if the migration or release changed data incompatibly.
- Restore media independently if uploaded files were affected.
- Run
/health/and the release smoke checks before reopening traffic.