-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
120 lines (115 loc) · 3.69 KB
/
Copy pathdocker-compose.yml
File metadata and controls
120 lines (115 loc) · 3.69 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
services:
# ---------------------------------------------------------------------------
# Default: the GFS Playground — one container that supervises a full cluster
# (1 master + 3 chunk servers) and serves an interactive web UI at :8080
# where you can create/read/write files, kill servers, wipe disks, and watch
# the system heal itself. `docker compose up --build` and open
# http://localhost:8080 (the .env file selects this profile by default)
# ---------------------------------------------------------------------------
playground:
profiles: [playground]
container_name: gfs_playground
build:
context: .
dockerfile: Dockerfile
image: gfs-image
command: python3 webapp/server.py
working_dir: /app
environment:
GFS_PLAYGROUND_CONFIG: webapp/config.yml
ports:
- 8080:8080 # web UI
- 50051:50051 # master (also reachable by host-side gfs_client_main)
- 50052:50052 # chunk servers
- 50053:50053
- 50054:50054
volumes:
# Persist only the databases; config stays baked into the image so
# rebuilding after a config edit actually takes effect
- gfs_data:/app/data/dbs
healthcheck:
test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/localhost/8080"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
# ---------------------------------------------------------------------------
# Classic topology: each server in its own container, no web UI.
# Start with: COMPOSE_PROFILES=cluster docker compose up --build
# (not simultaneously with the playground — they share ports)
# ---------------------------------------------------------------------------
master_server_01:
profiles: [cluster]
container_name: master_server_01
image: gfs-image
build:
context: .
dockerfile: Dockerfile
command: bazel-bin/src/server/master_server/run_master_server_main
--config_path=data/config.yml
--use_docker_dns_server
--master_name=master_server_01
working_dir: /app
ports:
- 50051:50051
volumes:
- gfs_data:/app/data/dbs
healthcheck:
test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/localhost/50051"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
chunk_server_01:
profiles: [cluster]
container_name: chunk_server_01
image: gfs-image
command: bazel-bin/src/server/chunk_server/run_chunk_server_main
--config_path=data/config.yml
--use_docker_dns_server
--chunk_server_name=chunk_server_01
ports:
- 50052:50052
depends_on:
master_server_01:
condition: service_healthy
working_dir: /app
volumes:
- gfs_data:/app/data/dbs
restart: unless-stopped
chunk_server_02:
profiles: [cluster]
container_name: chunk_server_02
image: gfs-image
command: bazel-bin/src/server/chunk_server/run_chunk_server_main
--config_path=data/config.yml
--use_docker_dns_server
--chunk_server_name=chunk_server_02
ports:
- 50053:50053
depends_on:
master_server_01:
condition: service_healthy
working_dir: /app
volumes:
- gfs_data:/app/data/dbs
restart: unless-stopped
chunk_server_03:
profiles: [cluster]
container_name: chunk_server_03
image: gfs-image
command: bazel-bin/src/server/chunk_server/run_chunk_server_main
--config_path=data/config.yml
--use_docker_dns_server
--chunk_server_name=chunk_server_03
ports:
- 50054:50054
depends_on:
master_server_01:
condition: service_healthy
working_dir: /app
volumes:
- gfs_data:/app/data/dbs
restart: unless-stopped
volumes:
gfs_data: