-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
226 lines (218 loc) · 7.54 KB
/
docker-compose.yaml
File metadata and controls
226 lines (218 loc) · 7.54 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
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
216
217
218
219
220
221
222
223
224
225
226
services:
wallet-backend:
image: wallet-backend:latest
build:
context: ./
dockerfile: Dockerfile
db:
container_name: db
image: timescale/timescaledb:2.25.0-pg17
command: ["postgres", "-c", "timescaledb.enable_chunk_skipping=on", "-c", "timescaledb.enable_sparse_index_bloom=on"]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d wallet-backend"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
environment:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: wallet-backend
PGDATA: /data/postgres
POSTGRES_INITDB_ARGS: "--auth-host=trust"
volumes:
- postgres-db:/data/postgres
ports:
- 5432:5432
configs:
- source: postgres_init
target: /docker-entrypoint-initdb.d/init-schemas.sql
stellar-rpc-mainnet:
container_name: stellar-rpc-mainnet
image: stellar/stellar-rpc:stable
healthcheck:
test: "curl --location 'http://localhost:8000/' -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":8675309,\"method\":\"getHealth\"}' | grep -q '\"status\":\"healthy\"'"
interval: 10s
timeout: 10s
retries: 40
start_period: 10s
ports:
- 8000:8000
volumes:
- ./config:/config
environment:
NETWORK: pubnet
entrypoint: ["/bin/bash", "/config/stellar_rpc_startup.sh"]
stellar-rpc-testnet:
container_name: stellar-rpc-testnet
image: stellar/stellar-rpc:stable
healthcheck:
test: "curl --location 'http://localhost:8000/' -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":8675309,\"method\":\"getHealth\"}' | grep -q '\"status\":\"healthy\"'"
interval: 10s
timeout: 10s
retries: 40
start_period: 10s
ports:
- 8001:8000
volumes:
- ./config:/config
environment:
NETWORK: testnet
entrypoint: ["/bin/bash", "/config/stellar_rpc_startup.sh"]
api-testnet:
container_name: api-testnet
image: wallet-backend:latest
healthcheck:
test: "curl --fail --silent --show-error --location 'http://localhost:8002/health' | grep -q '\"status\": \"ok\"'"
interval: 10s
timeout: 10s
retries: 3
depends_on:
wallet-backend:
condition: service_completed_successfully
db:
condition: service_healthy
ingest-testnet:
condition: service_healthy
ports:
- 8002:8002
entrypoint: ""
command:
- sh
- -c
- |
./wallet-backend serve
environment:
RPC_URL: ${RPC_URL:-http://stellar-rpc-testnet:8000}
DATABASE_URL: postgres://postgres@db:5432/wallet-backend?sslmode=disable&search_path=wallet_backend_testnet
PORT: 8002
SERVER_BASE_URL: ${SERVER_BASE_URL:-http://api-testnet:8002}
LOG_LEVEL: TRACE
NETWORK: testnet
NETWORK_PASSPHRASE: "Test SDF Network ; September 2015"
CLIENT_AUTH_PUBLIC_KEYS: ${CLIENT_AUTH_PUBLIC_KEYS}
TRACKER_DSN: ${TRACKER_DSN}
STELLAR_ENVIRONMENT: ${STELLAR_ENVIRONMENT:-development}
api-mainnet:
container_name: api-mainnet
image: wallet-backend:latest
healthcheck:
test: "curl --fail --silent --show-error --location 'http://localhost:8003/health' | grep -q '\"status\": \"ok\"'"
interval: 10s
timeout: 10s
retries: 3
depends_on:
wallet-backend:
condition: service_completed_successfully
db:
condition: service_healthy
ingest-mainnet:
condition: service_healthy
ports:
- 8003:8003
entrypoint: ""
command:
- sh
- -c
- |
./wallet-backend serve
environment:
RPC_URL: ${RPC_URL:-http://stellar-rpc-mainnet:8000}
DATABASE_URL: postgres://postgres@db:5432/wallet-backend?sslmode=disable&search_path=wallet_backend_mainnet
PORT: 8003
SERVER_BASE_URL: ${SERVER_BASE_URL:-http://api-mainnet:8003}
LOG_LEVEL: TRACE
NETWORK: mainnet
NETWORK_PASSPHRASE: "Public Global Stellar Network ; September 2015"
CLIENT_AUTH_PUBLIC_KEYS: ${CLIENT_AUTH_PUBLIC_KEYS}
TRACKER_DSN: ${TRACKER_DSN}
STELLAR_ENVIRONMENT: ${STELLAR_ENVIRONMENT:-development}
ingest-testnet:
container_name: ingest-testnet
image: wallet-backend:latest
healthcheck:
test: "curl --fail --silent --show-error --location 'http://localhost:8004/health' | grep -q '\"status\": \"ok\"'"
interval: 10s
timeout: 10s
retries: 3
depends_on:
wallet-backend:
condition: service_completed_successfully
db:
condition: service_healthy
entrypoint: ""
command:
- sh
- -c
- |
sleep 5
./wallet-backend migrate up
if [ "$STELLAR_ENVIRONMENT" = "GITHUB_WORKFLOW" ]; then
HEALTH_RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"getHealth"}' "${RPC_URL}")
LATEST_LEDGER=$(echo "$$HEALTH_RESPONSE" | grep -oE '"latestLedger":[0-9]+' | grep -oE '[0-9]+' || true)
if [ -z "$$LATEST_LEDGER" ] || [ "$$LATEST_LEDGER" = "" ]; then
./wallet-backend ingest
else
./wallet-backend ingest --start-ledger "$$LATEST_LEDGER"
fi
else
./wallet-backend ingest
fi
environment:
RPC_URL: ${RPC_URL:-http://stellar-rpc-testnet:8000}
DATABASE_URL: postgres://postgres@db:5432/wallet-backend?sslmode=disable&search_path=wallet_backend_testnet
INGEST_SERVER_PORT: 8004
NETWORK: testnet
NETWORK_PASSPHRASE: "Test SDF Network ; September 2015"
LOG_LEVEL: TRACE
GET_LEDGERS_LIMIT: 150
TRACKER_DSN: ${TRACKER_DSN}
STELLAR_ENVIRONMENT: ${STELLAR_ENVIRONMENT:-development}
# ADMIN_PORT: 9094 # Optional: Port for pprof endpoints at /debug/pprof. WARNING: Do NOT expose publicly!
ingest-mainnet:
container_name: ingest-mainnet
image: wallet-backend:latest
healthcheck:
test: "curl --fail --silent --show-error --location 'http://localhost:8005/health' | grep -q '\"status\": \"ok\"'"
interval: 10s
timeout: 10s
retries: 3
depends_on:
wallet-backend:
condition: service_completed_successfully
db:
condition: service_healthy
entrypoint: ""
command:
- sh
- -c
- |
./wallet-backend migrate up
if [ "$STELLAR_ENVIRONMENT" = "GITHUB_WORKFLOW" ]; then
HEALTH_RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"getHealth"}' "$$RPC_URL")
LATEST_LEDGER=$(echo "$$HEALTH_RESPONSE" | grep -oE '"latestLedger":[0-9]+' | grep -oE '[0-9]+' || true)
if [ -z "$$LATEST_LEDGER" ] || [ "$$LATEST_LEDGER" = "" ]; then
./wallet-backend ingest
else
./wallet-backend ingest --start-ledger "$$LATEST_LEDGER"
fi
else
./wallet-backend ingest
fi
environment:
RPC_URL: ${RPC_URL:-http://stellar-rpc-mainnet:8000}
DATABASE_URL: postgres://postgres@db:5432/wallet-backend?sslmode=disable&search_path=wallet_backend_mainnet
INGEST_SERVER_PORT: 8005
NETWORK: mainnet
NETWORK_PASSPHRASE: "Public Global Stellar Network ; September 2015"
LOG_LEVEL: TRACE
GET_LEDGERS_LIMIT: 20
TRACKER_DSN: ${TRACKER_DSN}
STELLAR_ENVIRONMENT: ${STELLAR_ENVIRONMENT:-development}
# ADMIN_PORT: 9095 # Optional: Port for pprof endpoints at /debug/pprof. WARNING: Do NOT expose publicly!
volumes:
postgres-db:
driver: local
configs:
postgres_init:
content: |
CREATE EXTENSION IF NOT EXISTS timescaledb;