This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
compose.yaml
167 lines (152 loc) · 5.45 KB
/
compose.yaml
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
version: '3.8'
services:
init:
image: ghcr.io/arch-network/validator:latest
command:
- /bin/bash
- -c
- |
set -e
echo "Generating validator PeerIds..."
rm -f /bootnode_data/validator_whitelist /bootnode_data/leader_peer_id
echo "> Replicas: ${REPLICA_COUNT}"
LEADER_PEER_ID=$$(/validator -d /leader_data --generate-peer-id | tee -a /bootnode_data/validator_whitelist)
echo "> Leader PeerID: $$LEADER_PEER_ID"
echo "$$LEADER_PEER_ID" > /bootnode_data/leader_peer_id
echo "> Add Leader Peer ID to whitelist"
echo "$$LEADER_PEER_ID" >> /bootnode_data/validator_whitelist
for i in $(seq 1 $${REPLICA_COUNT}); do
echo ">> Making directory for replica $$i"
mkdir -p /validators_data/$$i
/validator -d /validators_data/$$i --generate-peer-id | tee -a /bootnode_data/validator_whitelist;
done
sort -u -o /bootnode_data/validator_whitelist /bootnode_data/validator_whitelist
volumes:
- ./.arch-data/validator_arch_data:/validators_data
- ./.arch-data/leader_arch_data:/leader_data
- ./.arch-data/bootnode_arch_data:/bootnode_data
environment:
- REPLICA_COUNT=${REPLICA_COUNT:-2}
bootnode:
image: ghcr.io/arch-network/bootnode:latest
command:
- /bin/bash
- -c
- |
set -e
while [ ! -f /arch_data/leader_peer_id ]; do
echo "Waiting for leader_peer_id file..."
sleep 1
done
WHITELIST=$(sort -u /arch_data/validator_whitelist | paste -sd "," -)
LEADER_PEER_ID=$(cat /arch_data/leader_peer_id)
echo "Validator Whitelist: $$WHITELIST"
echo "Leader Peer ID: $$LEADER_PEER_ID"
/bootnode -d /arch_data -n ${NETWORK_MODE:-localnet} --leader-peer-id "$$LEADER_PEER_ID" --validator-whitelist "$$WHITELIST"
depends_on:
init:
condition: service_completed_successfully
volumes:
- ./.arch-data/bootnode_arch_data:/arch_data
networks:
arch:
ipv4_address: 172.19.0.250
environment:
- NETWORK_MODE=${NETWORK_MODE:-localnet}
leader:
image: ghcr.io/arch-network/validator:latest
depends_on:
- bootnode
command:
- /bin/bash
- -c
- |
set -ex
while [ ! -f /bootnode_data/leader_peer_id ]; do
echo "Waiting for leader_peer_id file..."
sleep 1
done
LEADER_PEER_ID=$(cat /bootnode_data/leader_peer_id)
echo "Leader Peer ID: $$LEADER_PEER_ID"
# Get bootnode peer ID
BOOTNODE_PEER_ID=$(cat /bootnode_data/peer_id)
/validator -d /arch_data -n ${NETWORK_MODE:-localnet} -b "/ip4/172.19.0.250/tcp/19001/p2p/$$BOOTNODE_PEER_ID"
volumes:
- ./.arch-data/leader_arch_data:/arch_data
- ./.arch-data/bootnode_arch_data:/bootnode_data:ro
environment:
- RUST_LOG=${RUST_LOG:-info,validator=debug}
- RUSTC_LOG_COLOR=never
- RPC_BIND_IP=0.0.0.0
- RPC_BIND_PORT=9002
- NETWORK_MODE=${NETWORK_MODE:-localnet}
- RPC_BIND_IP=0.0.0.0 # bind to all IPs
- RPC_BIND_PORT=9002 # TCP 9002
- P2P_BIND_PORT=19002
- BITCOIN_RPC_ENDPOINT=bitcoin-node.dev.aws.archnetwork.xyz
- BITCOIN_RPC_PORT=18443
- BITCOIN_RPC_USERNAME=bitcoin
- BITCOIN_RPC_PASSWORD=428bae8f3c94f8c39c50757fc89c39bc7e6ebc70ebf8f618
- BITCOIN_RPC_WALLET=devwallet
ports:
- 19002:19002
- 9002:9002
networks:
- arch
validator-1:
image: ghcr.io/arch-network/validator:latest
command: /usr/local/bin/validator.sh
environment:
- RUST_LOG=${RUST_LOG:-info,validator=debug}
- RUSTC_LOG_COLOR=never
- NETWORK_MODE=${NETWORK_MODE:-localnet}
- REPLICA_ID=1
- PRIVATE_KEY_PASSWORD="" # Provide a password if you'd like to encrypt the local node keys.
- RPC_BIND_IP=0.0.0.0 # bind to all IPs
- RPC_BIND_PORT=9003
- P2P_BIND_PORT=19003
- BITCOIN_RPC_ENDPOINT=bitcoin-node.dev.aws.archnetwork.xyz
- BITCOIN_RPC_PORT=18443
- BITCOIN_RPC_USERNAME=bitcoin
- BITCOIN_RPC_PASSWORD=428bae8f3c94f8c39c50757fc89c39bc7e6ebc70ebf8f618
- BITCOIN_RPC_WALLET=devwallet
volumes:
- ./.arch-data/validator_arch_data:/arch_data
- ./.arch-data/bootnode_arch_data:/bootnode_data:ro
- ./validator.sh:/usr/local/bin/validator.sh
depends_on:
- bootnode
networks:
- arch
validator-2:
image: ghcr.io/arch-network/validator:latest
command: /usr/local/bin/validator.sh
environment:
- RUST_LOG=${RUST_LOG:-info,validator=debug}
- RUSTC_LOG_COLOR=never
- NETWORK_MODE=${NETWORK_MODE:-localnet}
- REPLICA_ID=2
- PRIVATE_KEY_PASSWORD="" # Provide a password if you'd like to encrypt the local node keys.
- RPC_BIND_IP=0.0.0.0 # bind to all IPs
- RPC_BIND_PORT=9004 # TCP 9004
- P2P_BIND_PORT=19004
- BITCOIN_RPC_ENDPOINT=bitcoin-node.dev.aws.archnetwork.xyz
- BITCOIN_RPC_PORT=18443
- BITCOIN_RPC_USERNAME=bitcoin
- BITCOIN_RPC_PASSWORD=428bae8f3c94f8c39c50757fc89c39bc7e6ebc70ebf8f618
- BITCOIN_RPC_WALLET=devwallet
volumes:
- ./.arch-data/validator_arch_data:/arch_data
- ./.arch-data/bootnode_arch_data:/bootnode_data:ro
- ./validator.sh:/usr/local/bin/validator.sh
depends_on:
- bootnode
networks:
- arch
networks:
arch:
ipam:
driver: default
config:
- subnet: 172.19.0.0/24
gateway: 172.19.0.1