-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
134 lines (130 loc) · 4.88 KB
/
docker-compose.yml
File metadata and controls
134 lines (130 loc) · 4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
services:
# Open Hardware Manager API Server
ohm-api:
build:
context: .
dockerfile: Dockerfile
container_name: ohm-api
ports:
# Map host port 8001 to container port (defaults to 8001, but can be overridden via PORT/API_PORT)
# If you change PORT or API_PORT, update this mapping accordingly
- "8001:8001"
# Load environment variables from .env file (if it exists)
# Individual environment variables can override .env values
env_file:
- .env
environment:
# Core API settings
# Note: PORT is handled by docker-entrypoint.sh which prioritizes PORT over API_PORT
# Cloud Run sets PORT, so we support both PORT and API_PORT for compatibility
# If PORT is set in host environment, it will be passed through automatically
# If PORT is not set, docker-entrypoint.sh will use API_PORT (defaults to 8001)
- API_HOST=${API_HOST:-0.0.0.0}
- API_PORT=${API_PORT:-8001}
# PORT: Pass through if set (e.g., from Cloud Run or host environment)
# If PORT is not set, docker-entrypoint.sh will use API_PORT (defaults to 8001)
# Note: Using ${PORT:-} means if PORT is unset, it becomes empty string,
# but entrypoint script handles empty PORT correctly by falling back to API_PORT
- PORT=${PORT:-}
# DEBUG defaults to False in settings.py (case-insensitive)
- DEBUG=${DEBUG:-False}
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- ENVIRONMENT=${ENVIRONMENT:-development}
# CORS and security
# Note: CORS_ORIGINS defaults to "*" in development, empty in production (handled in settings.py)
- CORS_ORIGINS=${CORS_ORIGINS:-*}
# API_KEYS should come from .env file (sensitive value)
# Do not set default here - should be in .env file for security
- API_KEYS=${API_KEYS:-}
# Storage configuration
# Note: Storage config uses provider-specific env vars:
# - LOCAL_STORAGE_PATH for local provider (defaults to "storage" in code)
# - AWS_S3_BUCKET for AWS S3
# - AZURE_STORAGE_CONTAINER for Azure Blob
# - GCP_STORAGE_BUCKET for Google Cloud Storage
- STORAGE_PROVIDER=${STORAGE_PROVIDER:-local}
# For local storage, LOCAL_STORAGE_PATH defaults to "storage" in code
# Set it here only if you want a different path
- LOCAL_STORAGE_PATH=${LOCAL_STORAGE_PATH:-storage}
# LLM configuration
- LLM_ENABLED=${LLM_ENABLED:-false}
# Server configuration
- USE_GUNICORN=${USE_GUNICORN:-auto}
volumes:
- ohm-storage:/app/storage
- ohm-logs:/app/logs
# Optional: Mount local directories for development (may require Docker Desktop permissions)
# - ./storage:/app/storage
# - ./logs:/app/logs
- ./test-data:/app/test-data
networks:
- ohm-network
restart: unless-stopped
healthcheck:
# Note: Healthcheck uses hardcoded port 8001 (default)
# If PORT or API_PORT is changed, update this accordingly
# The Dockerfile healthcheck uses ${PORT:-8001} which is more flexible
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Prometheus for metrics collection
prometheus:
image: prom/prometheus:latest
container_name: ohm-prometheus
ports:
- "9090:9090"
volumes:
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
- '--web.enable-lifecycle'
networks:
- ohm-network
depends_on:
- ohm-api
restart: unless-stopped
profiles:
- monitoring
# Start with: docker-compose --profile monitoring up prometheus
# Open Hardware Manager CLI (for testing CLI commands)
ohm-cli:
build: .
container_name: ohm-cli
environment:
- SERVER_URL=http://ohm-api:8001
- LOG_LEVEL=INFO
- STORAGE_PROVIDER=local
# Note: For local storage, LOCAL_STORAGE_PATH defaults to "storage" in code
# Using shared volume, so bucket name doesn't matter for CLI service
- LLM_ENABLED=false
volumes:
- ohm-storage:/app/storage
- ohm-logs:/app/logs
# Optional: Mount local directories for development (may require Docker Desktop permissions)
# - ./storage:/app/storage
# - ./logs:/app/logs
# - ./test-data:/app/test-data
networks:
- ohm-network
depends_on:
- ohm-api
profiles:
- cli
# This service is only started when explicitly requested
# Use: docker-compose --profile cli up ohm-cli
networks:
ohm-network:
driver: bridge
volumes:
ohm-storage:
driver: local
ohm-logs:
driver: local
prometheus-data:
driver: local