forked from F1R3FLY-io/system-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
553 lines (524 loc) · 16.3 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
553 lines (524 loc) · 16.3 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# F1R3FLY Dev Stack - Single-Validator Setup
#
# Unified compose for local development. No PDS blockchain integration.
# Matches the working local stack architecture (services/embers/docker pattern).
#
# Usage:
# docker compose -f docker-compose.dev.yml up --build
#
# Prerequisites:
# - Run `poetry run shardctl clone` to set up service repositories
# - NPM_TOKEN env var with GitHub PAT (read:packages scope) for @f1r3fly-io packages:
# export NPM_TOKEN=ghp_YOUR_TOKEN
# - services/embers/docker/mainnet/genesis/ and testnet/genesis/ directories
# - services/embers/docker/certs/ directory with TLS certs
# - Embers is built from source (Rust toolchain NOT needed — Docker handles it)
#
# Startup order (managed by depends_on + healthchecks):
# Phase 1: postgres, redis, plc
# Phase 2: firefly, firefly-testnet (validators)
# Phase 3: firefly-read, firefly-read-testnet (read-only nodes)
# Phase 4: bsky-migrate, bsync-migrate (database migrations)
# Phase 5: dataplane (gRPC data layer)
# Phase 6: bsync (background sync)
# Phase 7: bsky (AppView)
# Phase 8: pds (Personal Data Server - no blockchain)
# Phase 9: ozone (moderation)
# Phase 10: embers (blockchain API bridge, built from source)
# Phase 11: f1r3sky (frontend - Expo dev server)
services:
# ============================================================
# Infrastructure
# ============================================================
postgres:
image: postgres:14.4-alpine
container_name: dev-postgres
environment:
POSTGRES_USER: pg
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
ports:
- "5433:5432"
networks:
- dev
healthcheck:
test: ["CMD-SHELL", "pg_isready -U pg -d postgres"]
interval: 5s
timeout: 5s
retries: 20
redis:
image: redis:7.0-alpine
container_name: dev-redis
ports:
- "6380:6379"
networks:
- dev
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 20
# ============================================================
# Blockchain Shard (Single-Validator, matching embers/docker)
# ============================================================
firefly:
image: f1r3flyindustries/f1r3fly-scala-node:latest
pull_policy: always
container_name: dev-firefly
user: root
ports:
- "14401:40401" # deploy service
- "14402:40402" # propose service
- "14403:40403" # rest api
volumes:
- ./services/embers/docker/mainnet/genesis:/var/lib/rnode/genesis
- ./services/embers/docker/certs/node.key.pem:/var/lib/rnode/node.key.pem:ro
- ./services/embers/docker/certs/node.certificate.pem:/var/lib/rnode/node.certificate.pem:ro
command:
- run
- -s
- --validator-private-key=6a786ec387aff99fcce1bd6faa35916bfad3686d5c98e90a89f77670f535607c
- --host=firefly
- --no-upnp
- --allow-private-addresses
- --synchrony-constraint-threshold=0.0
- --protocol-port=40400
- --discovery-port=40404
- --tls-key-path=/var/lib/rnode/node.key.pem
- --tls-certificate-path=/var/lib/rnode/node.certificate.pem
networks:
- dev
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:40403/status || exit 1"]
interval: 15s
timeout: 10s
retries: 20
start_period: 60s
firefly-read:
image: f1r3flyindustries/f1r3fly-scala-node:latest
pull_policy: always
container_name: dev-firefly-read
user: root
ports:
- "14413:40403" # rest api (read-only)
command:
- run
- --bootstrap=rnode://ebffd419dea60220734ccea8875e86d87bac10a7@firefly?protocol=40400&discovery=40404
- --host=firefly-read
- --no-upnp
- --allow-private-addresses
depends_on:
firefly:
condition: service_healthy
networks:
- dev
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:40403/status || exit 1"]
interval: 15s
timeout: 10s
retries: 20
start_period: 60s
firefly-testnet:
image: f1r3flyindustries/f1r3fly-scala-node:latest
pull_policy: always
container_name: dev-firefly-testnet
user: root
ports:
- "15401:40401" # deploy service
- "15402:40402" # propose service
- "15403:40403" # rest api
volumes:
- ./services/embers/docker/testnet/genesis:/var/lib/rnode/genesis
- ./services/embers/docker/certs/node.key.pem:/var/lib/rnode/node.key.pem:ro
- ./services/embers/docker/certs/node.certificate.pem:/var/lib/rnode/node.certificate.pem:ro
command:
- run
- -s
- --validator-private-key=6a786ec387aff99fcce1bd6faa35916bfad3686d5c98e90a89f77670f535607c
- --host=firefly-testnet
- --no-upnp
- --allow-private-addresses
- --synchrony-constraint-threshold=0.0
- --protocol-port=40400
- --discovery-port=40404
- --tls-key-path=/var/lib/rnode/node.key.pem
- --tls-certificate-path=/var/lib/rnode/node.certificate.pem
networks:
- dev
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:40403/status || exit 1"]
interval: 15s
timeout: 10s
retries: 20
start_period: 60s
firefly-read-testnet:
image: f1r3flyindustries/f1r3fly-scala-node:latest
pull_policy: always
container_name: dev-firefly-read-testnet
user: root
ports:
- "15413:40403" # rest api (read-only)
command:
- run
- --bootstrap=rnode://ebffd419dea60220734ccea8875e86d87bac10a7@firefly-testnet?protocol=40400&discovery=40404
- --host=firefly-read-testnet
- --no-upnp
- --allow-private-addresses
depends_on:
firefly-testnet:
condition: service_healthy
networks:
- dev
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:40403/status || exit 1"]
interval: 15s
timeout: 10s
retries: 20
start_period: 60s
# ============================================================
# AT Protocol - PLC (DID Registry)
# ============================================================
# PLC server provides did:plc: registration and resolution.
# Uses in-memory SQLite (ephemeral — DIDs lost on restart, matching local dev-env).
# Required for: user account creation in PDS, DID resolution in BSKY/Ozone.
plc:
build:
context: ./services/plc
image: f1r3flyindustries/plc:dev
container_name: dev-plc
ports:
- "2582:2582"
networks:
- dev
healthcheck:
test: ["CMD-SHELL", "node -e \"const s=require('net').connect(2582,'localhost',()=>{s.end();process.exit(0)});s.on('error',()=>process.exit(1))\""]
interval: 5s
timeout: 5s
retries: 20
start_period: 15s
restart: unless-stopped
# ============================================================
# AT Protocol - Database Migrations (run-once)
# ============================================================
bsky-migrate:
image: f1r3flyindustries/f1r3sky-bsky:latest
container_name: dev-bsky-migrate
env_file:
- .env.dev
depends_on:
postgres:
condition: service_healthy
networks:
- dev
command: >
node -e "
const { Database } = require('@atproto/bsky');
(async () => {
console.log('Running bsky database migrations...');
const db = new Database({
url: process.env.BSKY_DB_POSTGRES_URL,
schema: process.env.BSKY_DB_POSTGRES_SCHEMA
});
await db.migrateToLatestOrThrow();
await db.close();
console.log('Bsky migrations complete!');
})();
"
restart: "no"
bsync-migrate:
image: f1r3flyindustries/f1r3sky-bsync:latest
container_name: dev-bsync-migrate
env_file:
- .env.dev
depends_on:
postgres:
condition: service_healthy
networks:
- dev
command: >
node -e "
const { Database } = require('@atproto/bsync');
(async () => {
console.log('Running bsync database migrations...');
const db = new Database({
url: process.env.BSYNC_DB_POSTGRES_URL,
schema: process.env.BSYNC_DB_POSTGRES_SCHEMA
});
await db.migrateToLatestOrThrow();
await db.close();
console.log('Bsync migrations complete!');
})();
"
restart: "no"
ozone-migrate:
image: f1r3flyindustries/f1r3sky-ozone:latest
container_name: dev-ozone-migrate
env_file:
- .env.dev
depends_on:
postgres:
condition: service_healthy
networks:
- dev
command: >
node -e "
const { Database } = require('@atproto/ozone');
(async () => {
console.log('Running ozone database migrations...');
const db = new Database({
url: process.env.OZONE_DB_POSTGRES_URL,
schema: process.env.OZONE_DB_POSTGRES_SCHEMA || 'ozone_db'
});
await db.migrateToLatestOrThrow();
await db.close();
console.log('Ozone migrations complete!');
})();
"
restart: "no"
# ============================================================
# AT Protocol - Services
# ============================================================
dataplane:
image: f1r3flyindustries/f1r3sky-bsky:latest
container_name: dev-dataplane
ports:
- "2585:2585"
env_file:
- .env.dev
environment:
DATAPLANE_PORT: 2585
command: >
node -e "
const { Database, DataPlaneServer, RepoSubscription } = require('@atproto/bsky');
(async () => {
const port = parseInt(process.env.DATAPLANE_PORT || '2585', 10);
const plcUrl = process.env.BSKY_DID_PLC_URL || 'http://plc:2582';
const repoSubUrls = (process.env.DATAPLANE_REPOSUBSCRIPTION_URLS || '').split(',').map(s => s.trim()).filter(Boolean);
if (!repoSubUrls.length) {
throw new Error('Missing DATAPLANE_REPOSUBSCRIPTION_URLS');
}
const db = new Database({
url: process.env.BSKY_DB_POSTGRES_URL,
schema: process.env.BSKY_DB_POSTGRES_SCHEMA,
});
console.log('Starting dataplane server on port ' + port + '...');
const dp = await DataPlaneServer.create(db, port, plcUrl);
console.log('Starting repo subscription to ' + repoSubUrls[0] + '...');
const sub = new RepoSubscription({ service: repoSubUrls[0], db, idResolver: dp.idResolver });
sub.start();
const shutdown = async () => {
console.log('Shutting down dataplane...');
try { await sub.destroy(); } catch (err) { console.error(err); }
try { await dp.destroy(); } catch (err) { console.error(err); }
try { await db.close(); } catch (err) { console.error(err); }
process.exit(0);
};
process.on('SIGTERM', shutdown);
process.on('SIGINT', shutdown);
})();
"
depends_on:
postgres:
condition: service_healthy
plc:
condition: service_healthy
bsky-migrate:
condition: service_completed_successfully
networks:
- dev
restart: unless-stopped
bsync:
image: f1r3flyindustries/f1r3sky-bsync:latest
container_name: dev-bsync
ports:
- "3100:3000"
env_file:
- .env.dev
environment:
PORT: 3000
depends_on:
postgres:
condition: service_healthy
bsync-migrate:
condition: service_completed_successfully
networks:
- dev
restart: unless-stopped
bsky:
image: f1r3flyindustries/f1r3sky-bsky:latest
container_name: dev-bsky
ports:
- "2584:2584"
env_file:
- .env.dev
environment:
PORT: 2584
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
plc:
condition: service_healthy
bsky-migrate:
condition: service_completed_successfully
dataplane:
condition: service_started
bsync:
condition: service_started
networks:
- dev
restart: unless-stopped
pds:
image: f1r3flyindustries/f1r3sky-pds:latest
container_name: dev-pds
user: root
ports:
- "2583:2583"
env_file:
- .env.dev
volumes:
- pds_blocks:/pds/blocks
- pds_tmp:/pds/tmp
- pds_data:/pds
environment:
PORT: 2583
# No blockchain integration in dev mode
depends_on:
postgres:
condition: service_healthy
plc:
condition: service_healthy
bsky:
condition: service_started
networks:
- dev
restart: unless-stopped
ozone:
image: f1r3flyindustries/f1r3sky-ozone:latest
container_name: dev-ozone
ports:
- "2587:3001"
env_file:
- .env.dev
environment:
PORT: 3001
depends_on:
postgres:
condition: service_healthy
plc:
condition: service_healthy
bsky:
condition: service_started
pds:
condition: service_started
ozone-migrate:
condition: service_completed_successfully
networks:
- dev
restart: unless-stopped
# ============================================================
# Embers (Blockchain API Bridge)
# ============================================================
embers:
build:
context: ./services/embers
dockerfile: docker/embers.dev.dockerfile
image: f1r3flyindustries/embers:dev
container_name: dev-embers
# Shard needs ~30s after genesis before it can accept deploys
entrypoint: ["sh", "-c", "echo 'Waiting 30s for shard genesis...' && sleep 30 && /app/embers"]
ports:
- "8080:3000"
env_file:
- .env.dev
environment:
EMBERS__PORT: 3000
EMBERS__ADDRESS: "::"
EMBERS__LOG_LEVEL: debug
EMBERS__MAINNET__DEPLOY_SERVICE_URL: http://firefly:40401
EMBERS__MAINNET__PROPOSE_SERVICE_URL: http://firefly:40402
EMBERS__MAINNET__OBSERVER_URL: http://firefly-read:40403
EMBERS__MAINNET__OBSERVER_WS_API_URL: ws://firefly-read:40403
EMBERS__MAINNET__VALIDATOR_WS_API_URL: ws://firefly:40403
EMBERS__TESTNET__DEPLOY_SERVICE_URL: http://firefly-testnet:40401
EMBERS__TESTNET__PROPOSE_SERVICE_URL: http://firefly-testnet:40402
EMBERS__TESTNET__OBSERVER_URL: http://firefly-read-testnet:40403
EMBERS__TESTNET__OBSERVER_WS_API_URL: ws://firefly-read-testnet:40403
EMBERS__TESTNET__VALIDATOR_WS_API_URL: ws://firefly-testnet:40403
depends_on:
firefly:
condition: service_healthy
firefly-read:
condition: service_healthy
networks:
- dev
restart: on-failure:5
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:3000/api/service/ready"]
interval: 10s
timeout: 5s
retries: 10
start_period: 60s
# ============================================================
# Embers Frontend (React 19 Web UI)
# ============================================================
embers-frontend:
build:
context: ./services/embers-frontend
dockerfile: ../../backups/embers-frontend/Dockerfile.dev
secrets:
- npm_token
image: f1r3flyindustries/embers-frontend:dev
container_name: dev-embers-frontend
ports:
- "5173:80"
environment:
# Browser-side URL: must be accessible from the user's browser (host ports)
API_URL: "http://localhost:8080"
depends_on:
embers:
condition: service_healthy
networks:
- dev
restart: unless-stopped
# ============================================================
# F1R3Sky Frontend (Expo Dev Server)
# ============================================================
f1r3sky:
build:
context: ./services/f1r3sky
dockerfile: Dockerfile.dev
secrets:
- npm_token
container_name: dev-f1r3sky
ports:
- "8100:19006"
environment:
# These are read by webpack DefinePlugin at transpile time (Expo dev server)
EXPO_PUBLIC_ENV: development
EXPO_PUBLIC_EMBERS_API_URL: "http://localhost:8080"
EXPO_PUBLIC_EMBERS_URL: "http://localhost:5173"
# Tell webpack dev server client to use the host-mapped port for HMR WebSocket
WDS_SOCKET_PORT: 8100
depends_on:
bsky:
condition: service_started
pds:
condition: service_started
embers:
condition: service_healthy
networks:
- dev
restart: unless-stopped
secrets:
npm_token:
environment: NPM_TOKEN
networks:
dev:
name: dev
driver: bridge
volumes:
pds_blocks:
pds_tmp:
pds_data: