Docker Deployment
Docker Compose is the recommended way to deploy Bizon Platform.
Quick Start
Section titled “Quick Start”-
Clone the Repository
Terminal window git clone https://github.com/bizon-data/bizon-platform.gitcd bizon-platform -
Configure Environment
Terminal window cp .env.example .env# Edit .env with your configuration -
Start Services
Terminal window docker compose up -d -
Access the Platform
Services
Section titled “Services”The default docker-compose.yml includes:
| Service | Port | Description |
|---|---|---|
ui | 5173 | React frontend (nginx) |
api | 8000 | FastAPI backend |
worker | - | Job executor |
db | 5432 | PostgreSQL |
Production Configuration
Section titled “Production Configuration”Environment Variables
Section titled “Environment Variables”# RequiredDATABASE_URL=postgresql+asyncpg://bizon:secure-password@db:5432/bizonJWT_SECRET_KEY=your-256-bit-secretENCRYPTION_KEY=your-fernet-key
# RecommendedCORS_ALLOWED_ORIGINS=["https://your-domain.com"]FRONTEND_URL=https://your-domain.comScaling Workers
Section titled “Scaling Workers”# Scale to 4 workersdocker compose up -d --scale worker=4Resource Limits
Section titled “Resource Limits”services: api: deploy: resources: limits: cpus: '2' memory: 2G reservations: cpus: '0.5' memory: 512M
worker: deploy: resources: limits: cpus: '1' memory: 1GDocker Compose Files
Section titled “Docker Compose Files”Production (docker-compose.yml)
Section titled “Production (docker-compose.yml)”version: '3.8'
services: db: image: postgres:14 environment: POSTGRES_USER: bizon POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_DB: bizon volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U bizon"] interval: 5s timeout: 5s retries: 5
api: build: . depends_on: db: condition: service_healthy environment: DATABASE_URL: postgresql+asyncpg://bizon:${DB_PASSWORD}@db:5432/bizon JWT_SECRET_KEY: ${JWT_SECRET_KEY} ENCRYPTION_KEY: ${ENCRYPTION_KEY} ports: - "8000:8000"
worker: build: . command: python -m bizon_platform.worker depends_on: db: condition: service_healthy environment: DATABASE_URL: postgresql+asyncpg://bizon:${DB_PASSWORD}@db:5432/bizon ENCRYPTION_KEY: ${ENCRYPTION_KEY}
ui: build: ./ui ports: - "5173:80" depends_on: - api
volumes: postgres_data:Development Override (docker-compose.dev.yml)
Section titled “Development Override (docker-compose.dev.yml)”version: '3.8'
services: api: volumes: - ./bizon_platform:/app/bizon_platform - ${BIZON_CORE_PATH}:/app/bizon-core environment: DEBUG: "true"
ui: build: context: ./ui dockerfile: Dockerfile.dev volumes: - ./ui/src:/app/src ports: - "5173:5173"Use with:
docker compose -f docker-compose.yml -f docker-compose.dev.yml upHealth Checks
Section titled “Health Checks”API Health
Section titled “API Health”curl http://localhost:8000/api/health# {"status": "healthy"}Database Connection
Section titled “Database Connection”docker compose exec api python -c "from bizon_platform.db.session import test_connection; test_connection()"All Services
Section titled “All Services”docker compose logs -fSpecific Service
Section titled “Specific Service”docker compose logs -f apidocker compose logs -f workerMaintenance
Section titled “Maintenance”Database Backup
Section titled “Database Backup”docker compose exec db pg_dump -U bizon bizon > backup.sqlDatabase Restore
Section titled “Database Restore”cat backup.sql | docker compose exec -T db psql -U bizon bizonMigrations
Section titled “Migrations”docker compose exec api alembic upgrade headRestart Services
Section titled “Restart Services”docker compose restart api workerTroubleshooting
Section titled “Troubleshooting”Container Won’t Start
Section titled “Container Won’t Start”# Check logsdocker compose logs api
# Verify database is readydocker compose ps dbDatabase Connection Failed
Section titled “Database Connection Failed”- Check DB container is running
- Verify DATABASE_URL format
- Check network connectivity
Workers Not Processing
Section titled “Workers Not Processing”- Verify worker containers are running
- Check worker logs for errors
- Verify database connectivity
Production Checklist
Section titled “Production Checklist”- Set strong
JWT_SECRET_KEY(256-bit) - Set strong
ENCRYPTION_KEY - Set strong database password
- Configure CORS origins
- Set up reverse proxy (nginx/Traefik)
- Enable TLS/HTTPS
- Configure log aggregation
- Set up monitoring
- Configure database backups
- Scale workers appropriately