116 lines
2.9 KiB
YAML
116 lines
2.9 KiB
YAML
# MCP Database Server - Docker Compose Example
|
|
# Copy this file to docker-compose.yml and customize for your environment
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
mcp-database-server:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: mcp-database-server
|
|
restart: unless-stopped
|
|
ports:
|
|
- "7700:7700"
|
|
environment:
|
|
# Server configuration
|
|
MCP_LOG_LEVEL: info
|
|
MCP_LISTEN: "0.0.0.0:7700"
|
|
|
|
# Authentication token (REQUIRED - generate with: node scripts/generate-token.js)
|
|
MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN}
|
|
|
|
# Database passwords (one per environment)
|
|
MCP_DRWORKS_PASSWORD: ${MCP_DRWORKS_PASSWORD}
|
|
MCP_IPWORKSTATION_PASSWORD: ${MCP_IPWORKSTATION_PASSWORD}
|
|
|
|
# Optional: SSL certificates (if using SSL connections)
|
|
# MCP_DRWORKS_SSL__CA: /certs/drworks-ca.pem
|
|
|
|
volumes:
|
|
# Configuration file
|
|
- ./config/database.json:/app/config/database.json:ro
|
|
|
|
# Optional: SSL certificates
|
|
# - ./certs:/certs:ro
|
|
|
|
# Optional: Audit logs (if writing to file)
|
|
# - ./logs:/app/data/logs
|
|
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:7700/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
networks:
|
|
- mcp-network
|
|
|
|
# Resource limits
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1.0'
|
|
memory: 512M
|
|
reservations:
|
|
cpus: '0.25'
|
|
memory: 128M
|
|
|
|
# Example PostgreSQL for local development/testing
|
|
postgres-dev:
|
|
image: postgres:16-alpine
|
|
container_name: postgres-dev
|
|
restart: unless-stopped
|
|
ports:
|
|
- "5432:5432"
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: ${POSTGRES_DEV_PASSWORD:-devpassword}
|
|
POSTGRES_DB: testdb
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
# Optional: Init scripts
|
|
# - ./init-scripts:/docker-entrypoint-initdb.d:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- mcp-network
|
|
profiles:
|
|
- dev # Only starts with: docker compose --profile dev up
|
|
|
|
networks:
|
|
mcp-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
postgres-data:
|
|
|
|
# Usage:
|
|
#
|
|
# 1. Copy this file:
|
|
# cp docker-compose.example.yml docker-compose.yml
|
|
#
|
|
# 2. Create your configuration:
|
|
# cp config/database.example.json config/database.json
|
|
# # Edit config/database.json with your database connections
|
|
#
|
|
# 3. Generate an auth token:
|
|
# node scripts/generate-token.js
|
|
#
|
|
# 4. Create .env file with secrets:
|
|
# echo "MCP_AUTH_TOKEN=your-generated-token" >> .env
|
|
# echo "MCP_DRWORKS_PASSWORD=your-db-password" >> .env
|
|
#
|
|
# 5. Start the server:
|
|
# docker compose up -d
|
|
#
|
|
# 6. Check health:
|
|
# curl http://localhost:7700/health
|
|
#
|
|
# 7. For local development with PostgreSQL:
|
|
# docker compose --profile dev up -d
|