forked from TheCryptoDonkey/DonkeyRide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
230 lines (215 loc) · 6.81 KB
/
Copy pathdocker-compose.yml
File metadata and controls
230 lines (215 loc) · 6.81 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# DonkeyRide Reference Infrastructure
# Complete Docker setup for development and production
services:
# =====================================================
# Nostr Relay (strfry - Fast, Simple, Production-Ready)
# =====================================================
nostr-relay:
image: ghcr.io/hoytech/strfry:latest
container_name: donkeyride-nostr-relay
restart: unless-stopped
ports:
- "7777:7777" # WebSocket port for Nostr events
volumes:
- ./docker/strfry/strfry.conf:/etc/strfry.conf:ro
- strfry-db:/app/strfry-db
networks:
- donkeyride-network
healthcheck:
test: ["CMD-SHELL", "pgrep -x strfry > /dev/null || exit 1"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
# =====================================================
# PostgreSQL - Operator State & Ride History
# =====================================================
postgres:
image: postgres:15-alpine
container_name: donkeyride-postgres
restart: unless-stopped
environment:
POSTGRES_DB: donkeyride
POSTGRES_USER: donkey
POSTGRES_PASSWORD: ${DB_PASSWORD:-devpassword123}
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=en_US.UTF-8"
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
- ./docker/postgres/init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
networks:
- donkeyride-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U donkey -d donkeyride"]
interval: 10s
timeout: 5s
retries: 5
# =====================================================
# Redis - Caching, Sessions, Real-Time State
# =====================================================
redis:
image: redis:7-alpine
container_name: donkeyride-redis
restart: unless-stopped
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- donkeyride-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# =====================================================
# DonkeyRide Operator Backend
# =====================================================
operator:
build:
context: .
dockerfile: Dockerfile
container_name: donkeyride-operator
restart: unless-stopped
ports:
- "3000:3000" # REST API
- "3001:3001" # WebSocket (real-time updates)
environment:
# Node
NODE_ENV: ${NODE_ENV:-production}
PORT: 3000
WS_PORT: 3001
# Operator Identity
OPERATOR_PUBKEY: ${OPERATOR_PUBKEY}
OPERATOR_NSEC: ${OPERATOR_NSEC}
OPERATOR_LIGHTNING: ${OPERATOR_LIGHTNING}
OPERATOR_FEE_PERCENT: ${OPERATOR_FEE_PERCENT:-0.005}
# Payment Provider
PAYMENT_PROVIDER: ${PAYMENT_PROVIDER:-cash}
STRIKE_API_KEY: ${STRIKE_API_KEY}
# Infrastructure (use Docker service names)
NOSTR_RELAY: ws://nostr-relay:7777
DATABASE_URL: postgresql://donkey:${DB_PASSWORD:-devpassword123}@postgres:5432/donkeyride
REDIS_URL: redis://redis:6379
OSRM_SERVER: http://osrm-backend:5000
# Security
ENABLE_NIP98_AUTH: ${ENABLE_NIP98_AUTH:-true}
ENABLE_RATE_LIMITING: ${ENABLE_RATE_LIMITING:-true}
# Bonds
BOND_AMOUNT: ${BOND_AMOUNT:-1000000}
BOND_ADDRESS: ${BOND_ADDRESS}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./data:/usr/src/app/data
- ./logs:/usr/src/app/logs
networks:
- donkeyride-network
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# =====================================================
# OSRM Backend - Navigation & Routing
# =====================================================
# Using local central London map data for GDPR compliance
osrm-backend:
image: ghcr.io/project-osrm/osrm-backend:latest
container_name: donkeyride-osrm
restart: unless-stopped
ports:
- "5001:5000" # Port 5001 externally to avoid conflicts
volumes:
- ./data:/data # Use local data directory with central-london.osrm files
command: osrm-routed --algorithm mld /data/central-london.osrm --max-table-size 10000
networks:
- donkeyride-network
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:5000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# Note: Map data already processed in ./data/central-london.osrm
# =====================================================
# Mock Lightning Node (Development Only)
# =====================================================
mock-lightning:
build:
context: ./docker/mock-lightning
dockerfile: Dockerfile
container_name: donkeyride-mock-lightning
restart: unless-stopped
ports:
- "9735:9735" # Lightning P2P
- "8080:8080" # REST API
environment:
NETWORK: regtest
INITIAL_BALANCE: 10000000 # 10M sats
networks:
- donkeyride-network
profiles:
- dev # Only start in development
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
# =====================================================
# Adminer - Database Management UI (Development)
# =====================================================
adminer:
image: adminer:latest
container_name: donkeyride-adminer
restart: unless-stopped
ports:
- "8081:8080"
environment:
ADMINER_DEFAULT_SERVER: postgres
networks:
- donkeyride-network
profiles:
- dev # Only start in development
# =====================================================
# Redis Commander - Redis Management UI (Development)
# =====================================================
redis-commander:
image: rediscommander/redis-commander:latest
container_name: donkeyride-redis-ui
restart: unless-stopped
ports:
- "8082:8081"
environment:
REDIS_HOSTS: local:redis:6379
networks:
- donkeyride-network
profiles:
- dev # Only start in development
# =====================================================
# Networks
# =====================================================
networks:
donkeyride-network:
driver: bridge
ipam:
config:
- subnet: 172.28.0.0/16
# =====================================================
# Volumes (Persistent Data)
# =====================================================
volumes:
postgres-data:
driver: local
redis-data:
driver: local
strfry-db:
driver: local
osrm-data:
driver: local