-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
174 lines (155 loc) · 4.9 KB
/
Copy pathdocker-compose.yml
File metadata and controls
174 lines (155 loc) · 4.9 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
# Environment variables:
# - MIDEN_REMOTE_PROVER_URL: remote transaction prover URL. Defaults to the
# bundled miden-remote-prover service at http://tx-prover:50051.
# - MIDEN_GENESIS_CONFIG_FILE: path to the genesis configuration file.
# By default, the local network bootstraps from the validator's built-in
# genesis configuration. Use this environment variable to override the
# built-in configuration.
services:
bootstrap-validator:
image: miden-validator
pull_policy: if_not_present
volumes:
- node-data:/data
- type: bind
source: ${MIDEN_GENESIS_CONFIG_FILE:-./compose/genesis/dummy.toml}
target: /genesis.toml
read_only: true
environment:
MIDEN_NODE_VALIDATOR_USE_GENESIS_CONFIG: ${MIDEN_GENESIS_CONFIG_FILE:-}
entrypoint: ["/bin/sh", "-c"]
command:
- |
set -e
if [ -f /data/validator/.bootstrapped ]; then
echo "Validator already bootstrapped."
exit 0
fi
echo "Cleaning incomplete validator bootstrap state..."
rm -rf /data/genesis /data/validator /data/accounts
mkdir -p /data/genesis /data/validator /data/accounts
GENESIS_CONFIG_ARGS=""
if [ -n "$${MIDEN_NODE_VALIDATOR_USE_GENESIS_CONFIG:-}" ]; then
if [ ! -f /genesis.toml ]; then
echo "Genesis config requested but /genesis.toml is not mounted."
exit 1
fi
GENESIS_CONFIG_ARGS="--genesis-config-file /genesis.toml"
fi
echo "Bootstrapping validator..."
miden-validator bootstrap \
--data-directory /data/validator \
--genesis-block-directory /data/genesis \
--accounts-directory /data/accounts \
$$GENESIS_CONFIG_ARGS
touch /data/validator/.bootstrapped
bootstrap-node:
image: miden-node
pull_policy: if_not_present
volumes:
- node-data:/data
entrypoint: ["/bin/sh", "-c"]
depends_on:
bootstrap-validator:
condition: service_completed_successfully
command:
- |
set -e
if [ -f /data/node/.bootstrapped ]; then
echo "Node already bootstrapped."
exit 0
fi
echo "Cleaning incomplete node bootstrap state..."
rm -rf /data/node
mkdir -p /data/node
echo "Bootstrapping node..."
miden-node bootstrap \
--data-directory /data/node \
--file /data/genesis/genesis.dat
touch /data/node/.bootstrapped
bootstrap-ntx-builder:
image: miden-ntx-builder
pull_policy: if_not_present
volumes:
- node-data:/data
entrypoint: ["/bin/sh", "-c"]
depends_on:
bootstrap-node:
condition: service_completed_successfully
command:
- |
set -e
if [ -f /data/ntx-builder/.bootstrapped ]; then
echo "Network transaction builder already bootstrapped."
exit 0
fi
echo "Cleaning incomplete network transaction builder bootstrap state..."
rm -rf /data/ntx-builder
mkdir -p /data/ntx-builder
echo "Bootstrapping network transaction builder..."
miden-ntx-builder bootstrap \
--data-directory /data/ntx-builder \
--file /data/genesis/genesis.dat
touch /data/ntx-builder/.bootstrapped
sequencer:
image: miden-node
pull_policy: if_not_present
volumes:
- node-data:/data
depends_on:
bootstrap-node:
condition: service_completed_successfully
validator:
condition: service_started
command:
- miden-node
- sequencer
- --rpc.listen=0.0.0.0:57291
- --data-directory=/data/node
- --validator.url=http://validator:50101
- --ntx-builder.url=http://ntx-builder:50301
- --rpc.network-tx-auth-header-value=secret_value
ports:
- "127.0.0.1:57291:57291"
validator:
image: miden-validator
pull_policy: if_not_present
volumes:
- node-data:/data
depends_on:
bootstrap-validator:
condition: service_completed_successfully
command:
- miden-validator
- start
- --listen=0.0.0.0:50101
- --data-directory=/data/validator
tx-prover:
image: miden-remote-prover
pull_policy: if_not_present
command:
- miden-remote-prover
- --kind=transaction
- --port=50051
ntx-builder:
image: miden-ntx-builder
pull_policy: if_not_present
volumes:
- node-data:/data
depends_on:
bootstrap-ntx-builder:
condition: service_completed_successfully
sequencer:
condition: service_started
tx-prover:
condition: service_started
command:
- miden-ntx-builder
- start
- --listen=0.0.0.0:50301
- --rpc.url=http://sequencer:57291
- --rpc.auth-header-value=secret_value
- --tx-prover.url=${MIDEN_REMOTE_PROVER_URL:-http://tx-prover:50051}
- --data-directory=/data/ntx-builder
volumes:
node-data: