-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
75 lines (71 loc) · 2.02 KB
/
docker-compose.yml
File metadata and controls
75 lines (71 loc) · 2.02 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
services:
# 1. Database
postgres:
image: postgres:14-alpine
container_name: cloudsync_db
environment:
POSTGRES_USER: cloudsync
POSTGRES_PASSWORD: password
POSTGRES_DB: cloudsync_db
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cloudsync -d cloudsync_db"]
interval: 5s
timeout: 5s
retries: 5
# 2. Master Node
master:
build:
context: .
dockerfile: Dockerfile
container_name: cloudsync_master
command: /app/master
ports:
- "8080:8080" # HTTP API
- "50051:50051" # gRPC
environment:
DATABASE_DSN: "host=postgres user=cloudsync password=password dbname=cloudsync_db port=5432 sslmode=disable"
REPLICATION_FACTOR: "3"
depends_on:
postgres:
condition: service_healthy
volumes:
- ./data_master:/data
# 3. Agent Nodes (Scalable)
agent:
build:
context: .
dockerfile: Dockerfile
command: /app/agent start --port=5000
environment:
AUTO_REGISTER: "true"
MASTER_ADDR: "master:50051"
# If running 1 agent, we can hardcode this to localhost:5001 (mapped below)
# If running multiple, this needs to be dynamic or use internal Docker IPs
# For now, let's assume 1 Agent for easy localhost testing:
ADVERTISED_URL: "http://localhost:5001"
volumes:
- /data/storage
depends_on:
- master
ports:
# Map Host Port 5001 -> Container Port 5000
# We use a range so if you scale up, it grabs 5002, 5003, etc.
- "5001-5005:5000"
# 4. Frontend (Next.js)
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
container_name: cloudsync_frontend
ports:
- "3000:3000"
environment:
# This variable is available at build time / server runtime
# Ideally, for browser access, your Master URL should be public.
NEXT_PUBLIC_MASTER_URL: "http://localhost:8080"
depends_on:
- master
volumes:
postgres_data: