-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
131 lines (121 loc) · 4.01 KB
/
Copy pathdocker-compose.yml
File metadata and controls
131 lines (121 loc) · 4.01 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
# BloomFL — docker-compose deployment
#
# Scalable decentralised edge-intelligence nodes.
# Each replica runs on the host network (required for mDNS multicast).
#
# Quick start (single node):
# docker-compose up --build
#
# Scale to 10 nodes (each gets a unique port via entrypoint.sh):
# docker-compose up --build --scale node=10
#
# Override transport or gossip interval per deployment:
# BLOOMFL_TRANSPORT=grpc docker-compose up --scale node=5
services:
node:
build:
context: .
dockerfile: Dockerfile
image: bloomfl:latest
# host networking is required on Linux so mDNS multicast (224.0.0.251)
# works across all replicas on the same machine.
network_mode: host
restart: unless-stopped
environment:
# Core node settings — override as needed
BLOOMFL_TRANSPORT: ${BLOOMFL_TRANSPORT:-tcp}
BLOOMFL_GOSSIP_INTERVAL_SECONDS: ${BLOOMFL_GOSSIP_INTERVAL_SECONDS:-15}
BLOOMFL_TRAIN_EPOCHS_PER_ROUND: ${BLOOMFL_TRAIN_EPOCHS_PER_ROUND:-1}
BLOOMFL_ADAPTATION_ENABLED: ${BLOOMFL_ADAPTATION_ENABLED:-true}
BLOOMFL_AGGREGATION_STRATEGY: ${BLOOMFL_AGGREGATION_STRATEGY:-weighted_avg}
# Data / storage inside container home
BLOOMFL_KEY_STORAGE_DIR: /home/bloomfl/.bloomfl/keys
BLOOMFL_METRICS_DIR: /home/bloomfl/.bloomfl/metrics
BLOOMFL_DATA_DIR: /home/bloomfl/.bloomfl/data
# Optional: static peer list (comma-separated host:port) if mDNS unavailable
BLOOMFL_PEER_ADDRS: ${BLOOMFL_PEER_ADDRS:-}
volumes:
# Mount local results directory for metric persistence
- ./results/metrics:/home/bloomfl/.bloomfl/metrics
- ./results/keys:/home/bloomfl/.bloomfl/keys
# Resource limits — reasonable defaults for edge devices
deploy:
replicas: 1 # override with --scale node=N
resources:
limits:
cpus: "1.0"
memory: 1G
reservations:
cpus: "0.25"
memory: 256M
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "${BLOOMFL_LISTEN_PORT:-50051}"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
# ── Dashboard API (FastAPI) ────────────────────────────────────────────────
api:
build:
context: .
dockerfile: Dockerfile
image: bloomfl:latest
command: >
sh -c "/home/bloomfl/.bloomfl/venv/bin/uvicorn api.main:app
--host 0.0.0.0 --port 8000 --log-level info"
ports:
- "8000:8000"
environment:
BLOOMFL_METRICS_DIR: /home/bloomfl/.bloomfl/metrics
BLOOMFL_KEY_STORAGE_DIR: /home/bloomfl/.bloomfl/keys
BLOOMFL_DATA_DIR: /home/bloomfl/.bloomfl/data
volumes:
- ./results/metrics:/home/bloomfl/.bloomfl/metrics
- ./results/keys:/home/bloomfl/.bloomfl/keys
- .:/app
working_dir: /app
depends_on:
- node
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
logging:
driver: "json-file"
options:
max-size: "20m"
max-file: "2"
# ── Dashboard Frontend (Next.js) ───────────────────────────────────────────
frontend:
image: node:20-alpine
working_dir: /app
command: sh -c "npm run build && npm start"
ports:
- "3000:3000"
environment:
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://api:8000}
NODE_ENV: production
PORT: 3000
volumes:
- ./frontend:/app
- /app/node_modules
depends_on:
- api
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000"]
interval: 30s
timeout: 5s
retries: 3
start_period: 60s
logging:
driver: "json-file"
options:
max-size: "20m"
max-file: "2"