Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
126 lines (120 loc) · 4.13 KB
/
Copy pathdocker-compose.yml
File metadata and controls
126 lines (120 loc) · 4.13 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
services:
# ── Interactive development shell ──────────────────────────────────────────
# Default service; started by plain `docker compose up -d`.
# Run cluster scripts (run_live_cluster.sh) or individual cargo commands here.
vertex-dev:
build:
context: .
dockerfile: Dockerfile
container_name: vertex_swarm_demo_dev
stdin_open: true
tty: true
working_dir: /workspace
entrypoint: ["/usr/local/bin/dev-entrypoint.sh"]
command: ["bash"]
volumes:
- .:/workspace
- cargo_registry:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
- target:/workspace/target
# No ports: dev access is via `docker compose exec vertex-dev bash`.
# Exposing ports here would conflict with `network_mode: host` cluster
# services if both are started at the same time.
environment:
- CARGO_HOME=/usr/local/cargo
- RUST_BACKTRACE=1
# ── Multi-node cluster (profile: cluster) ──────────────────────────────────
# Start with: docker compose --profile cluster up
# Do NOT run vertex-dev at the same time if it has cluster scripts running
# (both would compete for the same ports on the host network).
#
# Why network_mode: host?
# All node configs bind to 127.0.0.1:800X. Containers in their own
# network namespace cannot reach each other via loopback addresses, so
# all cluster services share the host network stack instead.
#
# Why node-build?
# Three containers starting simultaneously would each invoke the Rust
# compiler against the shared `target` volume, corrupting the build.
# node-build compiles the binary once; the node services run it directly.
node-build:
build:
context: .
dockerfile: Dockerfile
container_name: vertex_swarm_node_build
working_dir: /workspace
entrypoint: ["/usr/local/bin/dev-entrypoint.sh"]
command: ["cargo", "build", "--bin", "vertex_live_node"]
volumes:
- .:/workspace
- cargo_registry:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
- target:/workspace/target
environment:
- CARGO_HOME=/usr/local/cargo
- RUST_BACKTRACE=1
profiles: ["cluster"]
node1:
build:
context: .
dockerfile: Dockerfile
network_mode: host
working_dir: /workspace
entrypoint: ["/usr/local/bin/node-entrypoint.sh"]
command: ["/workspace/target/debug/vertex_live_node", "--config", "config/node1.toml"]
volumes:
- .:/workspace
- cargo_registry:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
- target:/workspace/target
environment:
- CARGO_HOME=/usr/local/cargo
- RUST_BACKTRACE=1
depends_on:
node-build:
condition: service_completed_successfully
profiles: ["cluster"]
node2:
build:
context: .
dockerfile: Dockerfile
network_mode: host
working_dir: /workspace
entrypoint: ["/usr/local/bin/node-entrypoint.sh"]
command: ["/workspace/target/debug/vertex_live_node", "--config", "config/node2.toml"]
volumes:
- .:/workspace
- cargo_registry:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
- target:/workspace/target
environment:
- CARGO_HOME=/usr/local/cargo
- RUST_BACKTRACE=1
depends_on:
node-build:
condition: service_completed_successfully
profiles: ["cluster"]
node3:
build:
context: .
dockerfile: Dockerfile
network_mode: host
working_dir: /workspace
entrypoint: ["/usr/local/bin/node-entrypoint.sh"]
command: ["/workspace/target/debug/vertex_live_node", "--config", "config/node3.toml"]
volumes:
- .:/workspace
- cargo_registry:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
- target:/workspace/target
environment:
- CARGO_HOME=/usr/local/cargo
- RUST_BACKTRACE=1
depends_on:
node-build:
condition: service_completed_successfully
profiles: ["cluster"]
volumes:
cargo_registry:
cargo_git:
target: