-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.redis.yml
More file actions
163 lines (155 loc) · 4.57 KB
/
docker-compose.redis.yml
File metadata and controls
163 lines (155 loc) · 4.57 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
162
163
services:
redis:
image: redis:7-alpine
container_name: horde-model-reference-redis
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis-data:/data
ports:
- "6379:6379"
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
networks:
- horde-network
labels:
- "org.haidra.service=redis"
- "org.haidra.role=cache"
horde-model-reference:
build:
context: .
dockerfile: Dockerfile
container_name: horde-model-reference-primary
depends_on:
redis:
condition: service_healthy
ports:
- "19800:19800"
volumes:
# Persist model reference data (shared across workers)
- model-data:/data
environment:
# PRIMARY mode configuration
- HORDE_MODEL_REFERENCE_REPLICATE_MODE=PRIMARY
- HORDE_MODEL_REFERENCE_MAKE_FOLDERS=true
- HORDE_MODEL_REFERENCE_CACHE_TTL_SECONDS=60
- HORDE_MODEL_REFERENCE_CANONICAL_FORMAT=${HORDE_MODEL_REFERENCE_CANONICAL_FORMAT:-LEGACY}
- HORDE_MODEL_REFERENCE_GITHUB_SEED_ENABLED=true
# Redis configuration (REQUIRED for multi-worker)
- HORDE_MODEL_REFERENCE_REDIS__USE_REDIS=true
- HORDE_MODEL_REFERENCE_REDIS__URL=redis://redis:6379/0
- HORDE_MODEL_REFERENCE_REDIS__POOL_SIZE=10
- HORDE_MODEL_REFERENCE_REDIS__TTL_SECONDS=60
- HORDE_MODEL_REFERENCE_REDIS__USE_PUBSUB=true
# Data directory
- AIWORKER_CACHE_HOME=/data
env_file:
# Load additional configuration from .env file (optional)
- path: .env.primary
required: false
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:19800/api/heartbeat"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- horde-network
labels:
- "org.haidra.service=horde-model-reference"
- "org.haidra.mode=primary"
- "org.haidra.deployment=multi-worker"
# Run with multiple workers (requires Redis)
command:
[
"/app/.venv/bin/python",
"-m",
"uvicorn",
"horde_model_reference.service.app:app",
"--host",
"0.0.0.0",
"--port",
"19800",
"--workers",
"4",
]
# Optional: Add more worker instances for horizontal scaling
# Uncomment to enable
# horde-model-reference-worker-2:
# extends: horde-model-reference
# container_name: horde-model-reference-worker-2
# ports:
# - "8001:19800"
# labels:
# - "org.haidra.worker=2"
# horde-model-reference-worker-3:
# extends: horde-model-reference
# container_name: horde-model-reference-worker-3
# ports:
# - "8002:19800"
# labels:
# - "org.haidra.worker=3"
# GitHub Sync Service (optional, enable with --profile sync)
# Syncs model references from PRIMARY to GitHub legacy repositories
#
# IMPORTANT: Configure authentication before enabling
# See SYNC_README.md for detailed setup instructions
#
# Quick setup:
# 1. Copy .env.sync.example to .env.sync
# 2. Configure GitHub authentication (token or App)
# 3. For GitHub App: place private key as ./github-app-key.pem
# 4. For GitHub App: uncomment the volume mount below
# 5. Start: docker-compose -f docker-compose.redis.yml --env-file .env.sync --profile sync up -d
github-sync:
build:
context: .
dockerfile: Dockerfile
args:
EXTRA_DEPS: sync
container_name: horde-github-sync
profiles:
- sync
depends_on:
horde-model-reference:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- github-sync-data:/data
# Mount GitHub App private key if using GitHub App auth
# Uncomment and ensure file exists before starting:
# - ./github-app-key.pem:/app/github-app-key.pem:ro
env_file:
# Load all configuration from .env.sync file
# Create this file from .env.sync.example
- path: .env.sync
required: false
restart: unless-stopped
networks:
- horde-network
labels:
- "org.haidra.service=github-sync"
- "org.haidra.mode=sync"
# Use native watch mode instead of shell loop
command:
[
"/app/.venv/bin/python",
"scripts/sync/sync_github_references.py",
"--watch",
"--watch-startup-sync",
]
volumes:
model-data:
driver: local
redis-data:
driver: local
github-sync-data:
driver: local
networks:
horde-network:
driver: bridge