-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdocker-compose.hack-a-chain.yaml
207 lines (193 loc) · 5.5 KB
/
docker-compose.hack-a-chain.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# Containers
# Chainweb Node
# + a miner
# Hack-a-chain indexer service
# Postgres
# Local Stack
configs:
chainweb-node.common:
file: ${PWD}/config/chainweb-node.common.yaml
chainweb-node.logging:
file: ./config/chainweb-node.logging.yaml
services:
# ########################################################################## #
# Bootstrap Node
# For a minimal config, this is the only node we need
#
chainweb-node:
extends:
file: node.yaml
service: node
platform: linux/amd64
hostname: bootstrap-node
# user: ${UID:-1000}:${GID:-1000}
labels:
com.chainweb.devnet.description: "Devnet Bootstrap Node"
com.chainweb.devnet.bootstrap-node: ""
volumes:
- ${PWD}/devnet-bootstrap-node.cert.pem:/chainweb/devnet-bootstrap-node.cert.pem:ro
- ${PWD}/devnet-bootstrap-node.key.pem:/chainweb/devnet-bootstrap-node.key.pem:ro
- ${PWD}/db:/chainweb/db
command:
- --p2p-certificate-chain-file=/chainweb/devnet-bootstrap-node.cert.pem
- --p2p-certificate-key-file=/chainweb/devnet-bootstrap-node.key.pem
- --p2p-hostname=bootstrap-node
- --bootstrap-reachability=1
- --cluster-id=devnet-indexer
- --p2p-max-session-count=2
- --mempool-p2p-max-session-count=2
- --known-peer-info=YNo7pXthYQ9RQKv1bbpQf2R5LcLYA3ppx2BL2Hf8fIM@bootstrap-node:1789
- --log-level=info
- --enable-mining-coordination
- --mining-public-key=${MINER_PUBLIC_KEY}
- --header-stream
- --rosetta
- --allowReadsInLocal
- --database-directory=/chainweb/db
- --disable-pow
expose:
- "1848"
- "1789"
environment:
- DISABLE_POW_VALIDATION
simulation-miner:
# user: ${UID:-1000}:${GID:-1000}
image: "${MINING_CLIENT_IMAGE}"
platform: linux/amd64
restart: unless-stopped
depends_on:
chainweb-node:
condition: service_healthy
entrypoint: "/chainweb-mining-client/chainweb-mining-client"
command:
- --public-key=${MINER_PUBLIC_KEY}
- --node=bootstrap-node:1848
- --worker=constant-delay
- --thread-count=1
- --log-level=info
- --no-tls
- --constant-delay-block-time=10
ports:
- target: 1917
published: 1917
protocol: tcp
# ########################################################################## #
# Nginx API Proxy
# api-proxy:
# labels:
# com.chainweb.devnet.description: "Devnet API Proxy"
# com.chainweb.devnet.api-proxy: ""
# depends_on:
# bootstrap-node:
# condition: service_healthy
# image: amd64/nginx:latest
# platform: linux/amd64
# volumes:
# - ${PWD}/config/nginx.api.minimal.conf:/etc/nginx/conf.d/default.conf
# ports:
# - target: 80
# published: ${HOST_SERVICE_PORT}
# protocol: tcp
# ########################################################################## #
#
# hackachain indexer components
#
# ########################################################################## #
certs:
image: alpine
volumes:
- ./indexer/certs:/certs
entrypoint: |
/bin/sh -c '
apk add --no-cache openssl &&
mkdir -p /certs &&
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
-keyout /certs/server.key \
-out /certs/server.crt \
-subj "/C=US/ST=Blockchain/L=Kadena/O=Hackachain/OU=Indexer/CN=localhost" &&
chown -R 999:999 /certs &&
chmod 600 /certs/server.key
'
postgres:
hostname: indexer-postgres
image: postgres:latest
environment:
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
command: [
"postgres",
"-c", "ssl=on",
"-c", "ssl_cert_file=/var/lib/postgresql/certs/server.crt",
"-c", "ssl_key_file=/var/lib/postgresql/certs/server.key"
]
ports:
- "5432:5432"
volumes:
- ${PWD}/indexer/postgres:/var/lib/postgresql/data
- ./indexer/certs:/var/lib/postgresql/certs:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME} -d ${DB_NAME}"]
interval: 1s
timeout: 5s
retries: 10
depends_on:
certs:
condition: service_completed_successfully
## Indexer Startup
# Run migrations when databases are up
indexer-migrations:
# user: ${UID:-1000}:${GID:-1000}
build:
context: ${INDEXER_REPO}
dockerfile: Dockerfile.development
command: ["yarn", "create:database"]
env_file:
- .env
- .env.indexer
depends_on:
postgres:
condition: service_healthy
chainweb-node:
condition: service_healthy
# GraphQL API
indexer-kadenagraphql:
hostname: indexer-kadenagraphql
user: ${UID:-1000}:${GID:-1000}
build:
context: ${INDEXER_REPO}
dockerfile: Dockerfile.development
command: ["yarn", "dev:graphql"]
env_file:
- .env
- .env.indexer
ports:
- "3000:3000"
depends_on:
postgres:
condition: service_healthy
chainweb-node:
condition: service_healthy
indexer-migrations:
condition: service_completed_successfully
# Main indexer service
indexer:
build:
context: ${INDEXER_REPO}
dockerfile: Dockerfile.development
command: ["yarn", "dev:streaming"]
env_file:
- .env
- .env.indexer
ports:
- "3001:3001"
depends_on:
postgres:
condition: service_healthy
chainweb-node:
condition: service_healthy
indexer-kadenagraphql:
condition: service_started
networks:
default:
name: chainweb-devnet-indexer