Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
161 lines (141 loc) · 3.8 KB
/
Copy pathdocker-compose.yml
File metadata and controls
161 lines (141 loc) · 3.8 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# HotPlex Worker Gateway - Docker Compose
#
# Usage:
# Development:
# docker-compose up -d
#
# Production:
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
#
version: '3.8'
services:
gateway:
build:
context: .
dockerfile: Dockerfile
args:
GIT_SHA: ${GIT_SHA:-unknown}
BUILD_TIME: ${BUILD_TIME:-unknown}
image: hotplex:latest
container_name: hotplex
restart: unless-stopped
# Use init to handle zombie processes (critical for spawning workers)
init: true
ports:
- "${HOTPLEX_PORT:-8888}:8888" # WebSocket gateway
- "${HOTPLEX_ADMIN_PORT:-9999}:9999" # Admin API
environment:
# Required secrets
- HOTPLEX_JWT_SECRET=${HOTPLEX_JWT_SECRET:?HOTPLEX_JWT_SECRET is required}
- HOTPLEX_ADMIN_TOKEN_1=${HOTPLEX_ADMIN_TOKEN:-admin-token-dev}
- HOTPLEX_ADMIN_TOKEN_2=${HOTPLEX_ADMIN_TOKEN_2:-}
# Optional configuration
- HOTPLEX_LOG_LEVEL=${HOTPLEX_LOG_LEVEL:-info}
- OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT:-}
- TZ=${TZ:-Asia/Shanghai}
- GOMEMLIMIT=6500MiB
# Claude Code environment
- CLAUDE_API_KEY=${CLAUDE_API_KEY:-}
volumes:
# Configuration
- ./configs:/etc/hotplex:ro
# Persistent data (SQLite database & sessions)
- hotplex-data:/var/lib/hotplex/data
- hotplex-worker-sessions:/home/hotplex/.claude
# Logs
- hotplex-logs:/var/log/hotplex
# TLS certificates (optional)
- ./tls:/etc/hotplex/tls:ro
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:9999/admin/health/ready"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
networks:
- hotplex-network
# Security options
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- NET_BIND_SERVICE
# Resource limits
deploy:
resources:
limits:
cpus: '4'
memory: 8G
reservations:
cpus: '1'
memory: 2G
# Database backup sidecar
backup:
image: alpine:3.21
container_name: hotplex-backup
restart: unless-stopped
depends_on:
- gateway
volumes:
- hotplex-data:/data:ro
- backup-storage:/backups
environment:
- BACKUP_INTERVAL=3600 # 1 hour
- RETENTION_DAYS=30
command: >
sh -c "
apk add --no-cache sqlite &&
mkdir -p /backups &&
while true; do
TIMESTAMP=$$(date +%Y%m%d-%H%M%S) &&
sqlite3 /data/hotplex.db \".backup '/backups/hotplex-$$TIMESTAMP.db'\" &&
find /backups -name '*.db' -mtime +$$RETENTION_DAYS -delete &&
echo \"Backup created: hotplex-$$TIMESTAMP.db at $$(date)\" &&
sleep $$BACKUP_INTERVAL
done
"
networks:
- hotplex-network
# Prometheus for metrics
prometheus:
image: prom/prometheus:latest
container_name: hotplex-prometheus
restart: unless-stopped
profiles:
- monitoring
ports:
- "9090:9090"
volumes:
- ./configs/monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
networks:
- hotplex-network
# Grafana for visualization
grafana:
image: grafana/grafana:latest
container_name: hotplex-grafana
restart: unless-stopped
profiles:
- monitoring
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}
volumes:
- grafana-data:/var/lib/grafana
depends_on:
- prometheus
networks:
- hotplex-network
volumes:
hotplex-data:
hotplex-worker-sessions:
hotplex-logs:
backup-storage:
prometheus-data:
grafana-data:
networks:
hotplex-network:
driver: bridge