docker-compose.dev.yml•10.2 kB
# ==============================================================================
# CodeGraph Development Docker Compose
# Optimized for: Development Experience, Hot Reloading, Debugging
# ==============================================================================
version: '3.8'
services:
# ==============================================================================
# CodeGraph API Service - Development with debugging
# ==============================================================================
codegraph-api:
build:
context: .
dockerfile: Dockerfile.optimized
target: development
args:
RUST_VERSION: 1.75
image: codegraph/api:dev
container_name: codegraph-api-dev
hostname: codegraph-api-dev
# Resource constraints (more generous for development)
deploy:
resources:
limits:
cpus: '4.0'
memory: 4G
reservations:
cpus: '2.0'
memory: 2G
# Development environment
environment:
RUST_LOG: debug
RUST_BACKTRACE: full
TOKIO_WORKER_THREADS: 8
ROCKSDB_PATH: /app/data/rocksdb
FAISS_INDEX_PATH: /app/data/faiss
SERVER_HOST: 0.0.0.0
SERVER_PORT: 3000
METRICS_PORT: 9090
# Development-specific settings
HOT_RELOAD: "true"
DEBUG_MODE: "true"
PROFILING_ENABLED: "true"
# Port mapping (expose more ports for debugging)
ports:
- "3000:3000" # API port
- "9090:9090" # Metrics port
- "7878:7878" # Debug port
- "8080:8080" # Hot reload port
# Volume mounts (bind mounts for live editing)
volumes:
- .:/app:cached # Source code
- ./target:/app/target:cached # Build cache
- /usr/local/cargo/registry:/usr/local/cargo/registry:cached # Cargo cache
- codegraph_data_dev:/app/data:rw # Data persistence
- codegraph_logs_dev:/app/logs:rw # Logs
# Working directory
working_dir: /app
# Override command for development (with cargo watch)
command: >
sh -c "
cargo install cargo-watch --force &&
cargo watch -x 'run --bin codegraph-api'
"
# Health check (more lenient for development)
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000/health || exit 1"]
interval: 60s
timeout: 30s
retries: 5
start_period: 60s
# Dependencies
depends_on:
redis-dev:
condition: service_healthy
# Network configuration
networks:
- codegraph_dev_network
# Development privileges (for debugging)
cap_add:
- SYS_PTRACE # For debugging with gdb/lldb
security_opt:
- seccomp:unconfined # Disable seccomp for debugging
# ==============================================================================
# Redis Cache Service - Development
# ==============================================================================
redis-dev:
image: redis:7-alpine
container_name: codegraph-redis-dev
hostname: codegraph-redis-dev
# Less restrictive for development
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 256M
# Redis configuration for development
command: >
redis-server
--maxmemory 512mb
--maxmemory-policy allkeys-lru
--save ""
--loglevel debug
--tcp-keepalive 60
# Port mapping (expose for external tools)
ports:
- "6379:6379"
# Volume mounts
volumes:
- redis_data_dev:/data:rw
# Health check
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
# Network configuration
networks:
- codegraph_dev_network
# ==============================================================================
# PostgreSQL Database - Development
# ==============================================================================
postgres-dev:
image: postgres:15-alpine
container_name: codegraph-postgres-dev
hostname: codegraph-postgres-dev
# Resource constraints
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
# Environment configuration
environment:
POSTGRES_DB: codegraph_dev
POSTGRES_USER: codegraph
POSTGRES_PASSWORD: dev_password_123
POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256"
# Port mapping
ports:
- "5432:5432"
# Volume mounts
volumes:
- postgres_data_dev:/var/lib/postgresql/data:rw
- ./sql/init:/docker-entrypoint-initdb.d:ro
# Health check
healthcheck:
test: ["CMD-SHELL", "pg_isready -U codegraph -d codegraph_dev"]
interval: 10s
timeout: 5s
retries: 3
# Network configuration
networks:
- codegraph_dev_network
# ==============================================================================
# Jupyter Notebook for Data Science
# ==============================================================================
jupyter:
image: jupyter/datascience-notebook:latest
container_name: codegraph-jupyter
hostname: codegraph-jupyter
# Resource constraints
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
reservations:
cpus: '1.0'
memory: 1G
# Environment configuration
environment:
JUPYTER_ENABLE_LAB: "yes"
JUPYTER_TOKEN: "codegraph_dev_token"
# Port mapping
ports:
- "8888:8888"
# Volume mounts
volumes:
- ./notebooks:/home/jovyan/work:rw
- jupyter_data_dev:/home/jovyan:rw
# Network configuration
networks:
- codegraph_dev_network
# ==============================================================================
# Adminer Database Administration
# ==============================================================================
adminer:
image: adminer:latest
container_name: codegraph-adminer
hostname: codegraph-adminer
# Port mapping
ports:
- "8081:8080"
# Dependencies
depends_on:
postgres-dev:
condition: service_healthy
# Network configuration
networks:
- codegraph_dev_network
# ==============================================================================
# Redis Commander
# ==============================================================================
redis-commander:
image: rediscommander/redis-commander:latest
container_name: codegraph-redis-commander
hostname: codegraph-redis-commander
# Environment configuration
environment:
REDIS_HOSTS: local:redis-dev:6379
# Port mapping
ports:
- "8082:8081"
# Dependencies
depends_on:
redis-dev:
condition: service_healthy
# Network configuration
networks:
- codegraph_dev_network
# ==============================================================================
# Prometheus (simplified for development)
# ==============================================================================
prometheus-dev:
image: prom/prometheus:latest
container_name: codegraph-prometheus-dev
hostname: codegraph-prometheus-dev
# Configuration
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=1d'
- '--web.enable-lifecycle'
- '--log.level=debug'
# Port mapping
ports:
- "9091:9090"
# Volume mounts
volumes:
- ./monitoring/prometheus-dev.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data_dev:/prometheus:rw
# Network configuration
networks:
- codegraph_dev_network
# ==============================================================================
# Grafana (development configuration)
# ==============================================================================
grafana-dev:
image: grafana/grafana:latest
container_name: codegraph-grafana-dev
hostname: codegraph-grafana-dev
# Environment configuration
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_INSTALL_PLUGINS: grafana-clock-panel,grafana-simple-json-datasource
GF_LOG_LEVEL: debug
# Port mapping
ports:
- "3001:3000"
# Volume mounts
volumes:
- grafana_data_dev:/var/lib/grafana:rw
- ./monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards:ro
- ./monitoring/grafana/datasources-dev:/etc/grafana/provisioning/datasources:ro
# Dependencies
depends_on:
prometheus-dev:
condition: service_started
# Network configuration
networks:
- codegraph_dev_network
# ==============================================================================
# Network Configuration
# ==============================================================================
networks:
codegraph_dev_network:
driver: bridge
driver_opts:
com.docker.network.bridge.name: codegraph-dev0
ipam:
driver: default
config:
- subnet: 172.21.0.0/16
gateway: 172.21.0.1
# ==============================================================================
# Volume Configuration
# ==============================================================================
volumes:
# Development data volumes
codegraph_data_dev:
driver: local
codegraph_logs_dev:
driver: local
# Database volumes
redis_data_dev:
driver: local
postgres_data_dev:
driver: local
# Development tools volumes
jupyter_data_dev:
driver: local
# Monitoring volumes
prometheus_data_dev:
driver: local
grafana_data_dev:
driver: local