-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
215 lines (201 loc) · 6.42 KB
/
docker-compose.yml
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
208
209
210
211
212
213
214
215
version: "3.9"
services:
postgres:
image: postgres:11.18-alpine
environment:
- POSTGRES_LOGGING=true
- POSTGRES_DB_FILE=/run/secrets/postgres_db
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
- POSTGRES_USER_FILE=/run/secrets/postgres_user
secrets:
- postgres_password
- postgres_user
- postgres_db
ports:
- ${POSTGRES_PORT:-5432}:5432
volumes:
- postgres:/var/lib/postgresql/data
restart: on-failure
healthcheck:
# Use pg_isready to check postgres is running. Substitute different
# user `postgres` if you've setup differently to config/pgpass-mainnet
test: ["CMD-SHELL", "pg_isready -U cardano-db-sync -d cardano-db-sync"]
interval: 10s
timeout: 5s
retries: 5
command: ${POSTGRES_ARGS:--c maintenance_work_mem=1GB -c max_parallel_maintenance_workers=4}
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
cardano-node:
image: inputoutput/cardano-node:${CARDANO_NODE_VERSION:-8.0.0}
environment:
- NETWORK=${NETWORK:-mainnet}
volumes:
- node-db:/data/db
- node-ipc:/ipc
restart: on-failure
healthcheck:
# Ping the EKG port to see if it responds.
# Assuming if EKG isn't up then the rest of cardano-node isn't either.
test: ["CMD-SHELL", "curl -f 127.0.0.1:12788 || exit 1"]
interval: 60s
timeout: 10s
retries: 5
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
ogmios:
image: cardanosolutions/ogmios:${OGMIOS_VERSION:-latest}
restart: on-failure
command: [
"--host", "0.0.0.0",
"--node-socket", "/ipc/node.socket",
"--node-config", "/config/cardano-node/config.json"
]
volumes:
- ./config/network/${NETWORK:-mainnet}:/config
- node-ipc:/ipc
ports:
- ${OGMIOS_PORT:-1337}:1337
depends_on:
cardano-node:
condition: service_healthy
cardano-db-sync:
image: inputoutput/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.1.1.3}
environment:
- NETWORK=${NETWORK:-mainnet}
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- RESTORE_SNAPSHOT=${RESTORE_SNAPSHOT:-}
- RESTORE_RECREATE_DB=N
- EXTRA_DB_SYNC_ARGS=${EXTRA_DB_SYNC_ARGS:-}
depends_on:
# Depend on both services to be healthy before starting.
cardano-node:
condition: service_healthy
postgres:
condition: service_healthy
secrets:
- postgres_password
- postgres_user
- postgres_db
volumes:
- db-sync-data:/var/lib/cexplorer
- node-ipc:/node-ipc
restart: on-failure
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
# snapshots provided by RESTORE_SNAPSHOT env var will be downloaded to the working dir
working_dir: /var/lib/cexplorer
postgrest:
image: postgrest/postgrest
ports:
- "3000:3000"
links:
- postgres:db_host
environment:
PGRST_DB_URI: postgres://${POSTGREST_USER}:${POSTGREST_PASSWORD}@db_host/${POSTGREST_DB}
PGRST_DB_SCHEMA: public
#IMPORTANT: In production this role should not be the same as the one used for the connection:
PGRST_DB_ANON_ROLE: ${POSTGREST_USER}
PGRST_SERVER_PROXY_URI: "http://127.0.0.1:3000"
depends_on:
postgres:
condition: service_healthy
swagger:
image: swaggerapi/swagger-ui
ports:
- "8080:8080"
expose:
- "8080"
environment:
API_URL: http://external_postgrest_ip:3000/
depends_on:
postgres:
condition: service_healthy
pgadmin:
container_name: pgadmin4
image: dpage/pgadmin4
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: 12345678
PGADMIN_LISTEN_PORT: 80
ports:
- "5050:80"
links:
- "postgres:pgsql-server"
volumes:
- pgadmin-data:/var/lib/pgadmin
depends_on:
postgres:
condition: service_healthy
token-registry:
image: gimbalabs/dbless-cardano-token-registry:latest
restart: always
environment:
- TOKEN_REGISTRY_MAPPINGS_DIR:${TOKEN_REGISTRY_MAPPINGS_DIR:-/app/cardano-token-registry/mappings}
ports:
- "3042:3042"
volumes:
- token-registry-data:/app/cardano-token-registry
depends_on:
token-registry-updater:
condition: service_healthy
token-registry-updater:
image: alpine/git
entrypoint: sh
restart: always
# due to weird entrypoint issues, below env vars are not reaching command line, so pass them on docker-compose call
environment:
TOKEN_REGISTRY_GIT_REPO: ${TOKEN_REGISTRY_GIT_REPO:-https://github.com/cardano-foundation/cardano-token-registry}
TOKEN_REGISTRY_GIT_BRANCH: ${TOKEN_REGISTRY_GIT_BRANCH:-master}
TOKEN_REGISTRY_DEST: ${TOKEN_REGISTRY_DEST:-/app/cardano-token-registry}
TOKEN_REGISTRY_SYNC_INTERVAL: ${TOKEN_REGISTRY_SYNC_INTERVAL:-3600}
volumes:
- token-registry-data:/app/cardano-token-registry
command: [
"-c",
"echo 'Token Registry will be updated from ${TOKEN_REGISTRY_GIT_REPO}:${TOKEN_REGISTRY_GIT_BRANCH} into ${TOKEN_REGISTRY_DEST} each ${TOKEN_REGISTRY_SYNC_INTERVAL} seconds...' && while true; do if [ ! -e ${TOKEN_REGISTRY_DEST}/.git ]; then git clone ${TOKEN_REGISTRY_GIT_REPO} ${TOKEN_REGISTRY_DEST}; fi; cd ${TOKEN_REGISTRY_DEST} && git reset && git checkout ${TOKEN_REGISTRY_GIT_BRANCH} && git pull; sleep ${TOKEN_REGISTRY_SYNC_INTERVAL}; done"
]
healthcheck:
test: ["CMD-SHELL","-c", "[ -d $TOKEN_REGISTRY_DEST ] && exit 0"]
interval: 30s
timeout: 10s
retries: 1000
unimatrix-peer:
image: unimatrix-peer:latest
build:
context: ./src/unimatrix
restart: always
environment:
- UNIMATRIX_PORT:${UNIMATRIX_PORT:-8765}
# static http server can be exposed as well
ports:
- ${UNIMATRIX_PORT:-8765}:8765
# TODO: fix env vars passing and link to persistent volume
volumes:
- unimatrix-data:/work/data
secrets:
postgres_db:
file: ./config/secrets/cardano-db-sync/postgres_db
postgres_password:
file: ./config/secrets/cardano-db-sync/postgres_password
postgres_user:
file: ./config/secrets/cardano-db-sync/postgres_user
volumes:
db-sync-data:
postgres:
node-db:
node-ipc:
pgadmin-data:
token-registry-data:
unimatrix-data: