Upgrading
Upgrading TheTerms is straightforward. The container startup script automatically applies database migrations.
Upgrade Steps
Section titled “Upgrade Steps”-
Back up your database before upgrading (recommended)
Terminal window docker compose exec postgres pg_dump -U postgres theterms > backup-pre-upgrade.sql -
Pull the latest code
Terminal window git pull -
Rebuild and restart all services
Terminal window docker compose up -d --buildThe new container will:
- Build the updated Next.js application
- Apply any new database migrations via
prisma migrate deploy - Start serving traffic
Zero-Downtime Considerations
Section titled “Zero-Downtime Considerations”The current Docker Compose setup has a brief downtime window during rebuild. For zero-downtime deployments, consider:
- Using a load balancer with multiple app containers
- Blue-green deployment (run a second stack, shift traffic, stop the first)
Rollback
Section titled “Rollback”If something goes wrong after an upgrade:
# Check out a previous versiongit log --oneline -10 # find the previous commitgit checkout <previous-commit>
# Rebuild from that versiondocker compose up -d --buildFor database rollbacks, restore from your pre-upgrade backup:
docker compose stop appdocker compose exec -T postgres psql -U postgres theterms < backup-pre-upgrade.sqldocker compose up -d