-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
272 lines (260 loc) · 10 KB
/
docker-compose.yaml
File metadata and controls
272 lines (260 loc) · 10 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
services:
wallet-backend:
image: wallet-backend:latest
build:
context: ./
dockerfile: Dockerfile
db:
container_name: db
image: postgres:14-alpine
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 channel-account ensure ${NUMBER_CHANNEL_ACCOUNTS}
./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}
DISTRIBUTION_ACCOUNT_PUBLIC_KEY: ${DISTRIBUTION_ACCOUNT_PUBLIC_KEY}
DISTRIBUTION_ACCOUNT_PRIVATE_KEY: ${DISTRIBUTION_ACCOUNT_PRIVATE_KEY}
DISTRIBUTION_ACCOUNT_SIGNATURE_PROVIDER: ENV
NUMBER_CHANNEL_ACCOUNTS: ${NUMBER_CHANNEL_ACCOUNTS:-2}
CHANNEL_ACCOUNT_ENCRYPTION_PASSPHRASE: ${CHANNEL_ACCOUNT_ENCRYPTION_PASSPHRASE}
TRACKER_DSN: ${TRACKER_DSN}
STELLAR_ENVIRONMENT: ${STELLAR_ENVIRONMENT:-development}
WALLET_SIGNING_KEY: ${WALLET_SIGNING_KEY}
# Integration Tests & Wallet Source Accounts
CLIENT_AUTH_PRIVATE_KEY: ${CLIENT_AUTH_PRIVATE_KEY}
PRIMARY_SOURCE_ACCOUNT_PRIVATE_KEY: ${PRIMARY_SOURCE_ACCOUNT_PRIVATE_KEY}
PRIMARY_SOURCE_ACCOUNT_PUBLIC_KEY: ${PRIMARY_SOURCE_ACCOUNT_PUBLIC_KEY}
SECONDARY_SOURCE_ACCOUNT_PRIVATE_KEY: ${SECONDARY_SOURCE_ACCOUNT_PRIVATE_KEY}
SECONDARY_SOURCE_ACCOUNT_PUBLIC_KEY: ${SECONDARY_SOURCE_ACCOUNT_PUBLIC_KEY}
WALLET_SOURCE_ACCOUNT_PRIVATE_KEY: ${WALLET_SOURCE_ACCOUNT_PRIVATE_KEY}
WALLET_SOURCE_ACCOUNT_PUBLIC_KEY: ${WALLET_SOURCE_ACCOUNT_PUBLIC_KEY}
# (optional) KMS Signature Client
KMS_KEY_ARN: ${KMS_KEY_ARN}
AWS_REGIONG: ${AWS_REGION}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
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 channel-account ensure ${NUMBER_CHANNEL_ACCOUNTS}
./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}
DISTRIBUTION_ACCOUNT_PUBLIC_KEY: ${DISTRIBUTION_ACCOUNT_PUBLIC_KEY}
DISTRIBUTION_ACCOUNT_PRIVATE_KEY: ${DISTRIBUTION_ACCOUNT_PRIVATE_KEY}
DISTRIBUTION_ACCOUNT_SIGNATURE_PROVIDER: ENV
NUMBER_CHANNEL_ACCOUNTS: ${NUMBER_CHANNEL_ACCOUNTS:-2}
CHANNEL_ACCOUNT_ENCRYPTION_PASSPHRASE: ${CHANNEL_ACCOUNT_ENCRYPTION_PASSPHRASE}
TRACKER_DSN: ${TRACKER_DSN}
STELLAR_ENVIRONMENT: ${STELLAR_ENVIRONMENT:-development}
WALLET_SIGNING_KEY: ${WALLET_SIGNING_KEY}
# Integration Tests & Wallet Source Accounts
CLIENT_AUTH_PRIVATE_KEY: ${CLIENT_AUTH_PRIVATE_KEY}
PRIMARY_SOURCE_ACCOUNT_PRIVATE_KEY: ${PRIMARY_SOURCE_ACCOUNT_PRIVATE_KEY}
PRIMARY_SOURCE_ACCOUNT_PUBLIC_KEY: ${PRIMARY_SOURCE_ACCOUNT_PUBLIC_KEY}
SECONDARY_SOURCE_ACCOUNT_PRIVATE_KEY: ${SECONDARY_SOURCE_ACCOUNT_PRIVATE_KEY}
SECONDARY_SOURCE_ACCOUNT_PUBLIC_KEY: ${SECONDARY_SOURCE_ACCOUNT_PUBLIC_KEY}
WALLET_SOURCE_ACCOUNT_PRIVATE_KEY: ${WALLET_SOURCE_ACCOUNT_PRIVATE_KEY}
WALLET_SOURCE_ACCOUNT_PUBLIC_KEY: ${WALLET_SOURCE_ACCOUNT_PUBLIC_KEY}
# (optional) KMS Signature Client
KMS_KEY_ARN: ${KMS_KEY_ARN}
AWS_REGIONG: ${AWS_REGION}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
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 SCHEMA IF NOT EXISTS wallet_backend_mainnet;
CREATE SCHEMA IF NOT EXISTS wallet_backend_testnet;