Docker Deployment
Development
# Start all services
make dev
# Stop all services
make dev-down
# View logs
docker compose -f docker/docker-compose.dev.yml logs -f
Production
1. Configure Environment
Create .env.production:
DB_PASSWORD=your-secure-password
SECRET_KEY=your-secret-key-min-32-chars
DOMAIN=balancesheetpro.yourdomain.com
2. Build and Deploy
# Build images
make build
# Start services
make up
# Run migrations
docker compose -f docker/docker-compose.prod.yml exec backend alembic upgrade head
# Seed database (first time only)
docker compose -f docker/docker-compose.prod.yml exec backend python -m scripts.seed_runner
3. Services
| Service | Port | Description |
|---|---|---|
| nginx | 80, 443 | Reverse proxy |
| frontend | 3000 | Next.js app |
| backend | 8000 | FastAPI API |
| postgres | 5432 | Database |
| redis | 6379 | Cache |
4. SSL Setup
Place SSL certificates in nginx/ssl/:
cert.pem— Certificatekey.pem— Private key
Or use Let's Encrypt with certbot.
GitHub Actions CD
The CD pipeline deploys via SSH to your server:
- Push to
mainbranch - GitHub Actions builds Docker images
- Pushes to GitHub Container Registry
- SSHs to your server
- Pulls images and restarts services
Required Secrets
| Secret | Description |
|---|---|
SERVER_HOST | Your server IP/hostname |
SERVER_USER | SSH username |
SERVER_SSH_KEY | SSH private key |
Health Check
curl http://localhost:8000/health
# {"status": "healthy", "app": "BalanceSheet Pro"}