Files
metabuilder/deployment/docker-compose.development.yml
copilot-swe-agent[bot] 5c0fc0b794 Add fire-and-forget Docker deployment for entire project
Created comprehensive production and development deployment configurations in `/deployment` folder:

**Production Stack (docker-compose.production.yml):**
- PostgreSQL 16 with persistent storage
- C++ DBAL Daemon (optimized, daemon mode)
- MetaBuilder App (production build)
- Nginx reverse proxy with SSL/TLS
- Redis cache layer
- Health checks and auto-restart
- Resource limits configured
- Isolated network (172.20.0.0/16)

**Development Stack (docker-compose.development.yml):**
- PostgreSQL 16 (port 5433)
- C++ DBAL Daemon (debug mode, interactive)
- MetaBuilder App (hot-reload with Vite)
- Redis cache (port 6380)
- Mailhog (email testing, port 8025)
- Adminer (DB UI, port 8082)
- Redis Commander (Redis UI, port 8083)
- Full source mounting for live changes
- Isolated network (172.21.0.0/16)

**Supporting Files:**
- Dockerfile.app - Production app build (multi-stage)
- Dockerfile.app.dev - Development with hot-reload
- init-db.sh - PostgreSQL initialization script
- production.conf - Nginx config with SSL
- config.yaml - DBAL daemon configuration
- .env.production.example - Production environment template
- .env.development.example - Development environment template
- README.md - Complete deployment guide
- start.sh - Quick start interactive script
- .gitignore - Protect secrets and generated files

**Fire-and-Forget Features:**
- Single command startup: `./deployment/start.sh`
- Auto environment detection
- SSL certificate generation
- Health checks for all services
- Automatic retries and restarts
- Volume persistence
- Complete documentation

**Usage:**
```bash
# Quick start (interactive)
cd deployment && ./start.sh

# Or directly
docker-compose -f deployment/docker-compose.production.yml up -d
docker-compose -f deployment/docker-compose.development.yml up
```

**Services Access:**
Production:
- App: https://localhost
- API: https://localhost/api/dbal/

Development:
- App: http://localhost:5173
- API: http://localhost:8081
- DB UI: http://localhost:8082
- Redis UI: http://localhost:8083
- Email: http://localhost:8025

Complete, tested, and production-ready deployment.

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2025-12-25 00:59:16 +00:00

165 lines
4.3 KiB
YAML

# MetaBuilder Development Deployment
# Fire-and-forget development stack with hot-reload and debugging tools
# Usage: docker-compose -f deployment/docker-compose.development.yml up
version: '3.8'
services:
# PostgreSQL Database (Development)
postgres:
image: postgres:16-alpine
container_name: metabuilder-postgres-dev
environment:
POSTGRES_DB: metabuilder_dev
POSTGRES_USER: metabuilder
POSTGRES_PASSWORD: dev_password
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
volumes:
- postgres_data_dev:/var/lib/postgresql/data
- ./init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro
ports:
- "5433:5432" # Different port to avoid conflicts with local PostgreSQL
networks:
- metabuilder-dev-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U metabuilder"]
interval: 10s
timeout: 5s
retries: 5
# C++ DBAL Daemon (Development with interactive mode)
dbal-daemon:
build:
context: ../dbal/cpp
dockerfile: Dockerfile
args:
BUILD_TYPE: Debug
container_name: metabuilder-dbal-dev
environment:
DBAL_BIND_ADDRESS: 0.0.0.0
DBAL_PORT: 8080
DBAL_LOG_LEVEL: debug
DBAL_MODE: development
DBAL_DAEMON: "false" # Interactive mode for development
DBAL_CONFIG: /app/config/config.yaml
volumes:
- ../dbal/cpp:/app/source:ro # Mount source for live changes
- ./config/dbal:/app/config:ro
- dbal_data_dev:/app/data
ports:
- "8081:8080" # Different port to avoid conflicts
stdin_open: true # Enable interactive mode
tty: true
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
depends_on:
postgres:
condition: service_healthy
networks:
- metabuilder-dev-network
# MetaBuilder Frontend & API (Development with hot-reload)
metabuilder-app:
build:
context: ..
dockerfile: deployment/Dockerfile.app.dev
args:
NODE_ENV: development
container_name: metabuilder-app-dev
environment:
NODE_ENV: development
DATABASE_URL: postgresql://metabuilder:dev_password@postgres:5432/metabuilder_dev
PORT: 3000
DBAL_API_URL: http://dbal-daemon:8080
VITE_HMR_HOST: localhost # For Vite hot module replacement
volumes:
- ..:/app # Mount entire project for hot-reload
- /app/node_modules # Prevent overwriting node_modules
- app_cache_dev:/app/.cache
ports:
- "5173:3000" # Vite dev server
command: npm run dev
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
dbal-daemon:
condition: service_healthy
networks:
- metabuilder-dev-network
# Redis Cache (Development)
redis:
image: redis:7-alpine
container_name: metabuilder-redis-dev
command: redis-server --appendonly yes
volumes:
- redis_data_dev:/data
ports:
- "6380:6379" # Different port to avoid conflicts
networks:
- metabuilder-dev-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
# Mailhog (Email testing in development)
mailhog:
image: mailhog/mailhog:latest
container_name: metabuilder-mailhog
ports:
- "1025:1025" # SMTP
- "8025:8025" # Web UI
networks:
- metabuilder-dev-network
# Adminer (Database management UI)
adminer:
image: adminer:latest
container_name: metabuilder-adminer
environment:
ADMINER_DEFAULT_SERVER: postgres
ports:
- "8082:8080"
depends_on:
- postgres
networks:
- metabuilder-dev-network
# Redis Commander (Redis management UI)
redis-commander:
image: rediscommander/redis-commander:latest
container_name: metabuilder-redis-commander
environment:
REDIS_HOSTS: local:redis:6379
ports:
- "8083:8081"
depends_on:
- redis
networks:
- metabuilder-dev-network
volumes:
postgres_data_dev:
driver: local
dbal_data_dev:
driver: local
app_cache_dev:
driver: local
redis_data_dev:
driver: local
networks:
metabuilder-dev-network:
driver: bridge
ipam:
config:
- subnet: 172.21.0.0/16