Skip to main content

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​

ServicePortDescription
nginx80, 443Reverse proxy
frontend3000Next.js app
backend8000FastAPI API
postgres5432Database
redis6379Cache

4. SSL Setup​

Place SSL certificates in nginx/ssl/:

  • cert.pem — Certificate
  • key.pem — Private key

Or use Let's Encrypt with certbot.

GitHub Actions CD​

The CD pipeline deploys via SSH to your server:

  1. Push to main branch
  2. GitHub Actions builds Docker images
  3. Pushes to GitHub Container Registry
  4. SSHs to your server
  5. Pulls images and restarts services

Required Secrets​

SecretDescription
SERVER_HOSTYour server IP/hostname
SERVER_USERSSH username
SERVER_SSH_KEYSSH private key

Health Check​

curl http://localhost:8000/health
# {"status": "healthy", "app": "BalanceSheet Pro"}