-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
152 lines (144 loc) · 4.73 KB
/
Copy pathdocker-compose.yml
File metadata and controls
152 lines (144 loc) · 4.73 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
# Local Stellar Network for ILN Smart Contract Development
# Usage: docker compose up -d stellar
# Check health: docker compose logs -f stellar | grep "ready"
# Stop: docker compose down
#
# Insurance pool testing (opt-in "insurance" profile — builds and deploys
# the insurance_pool contract against the local Stellar node):
# docker compose --profile insurance up insurance-pool-deploy
version: '3.8'
services:
stellar:
image: stellar/stellar-quickstart:latest
container_name: iln-stellar-local
ports:
- "8000:8000" # HTTP RPC port
- "11626:11626" # Peer port
environment:
# Standalone mode for local development
- NETWORK_MODE=standalone
- STELLAR_NETWORK_ID=local
- FAST_START=true
volumes:
# Persist Stellar data across container restarts
- stellar-data:/opt/stellar
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/ledger"]
interval: 5s
timeout: 10s
retries: 10
start_period: 30s
restart: unless-stopped
notifications-db:
image: postgres:16-alpine
container_name: iln-notifications-db
environment:
- POSTGRES_USER=notifications
- POSTGRES_PASSWORD=notifications
- POSTGRES_DB=notifications
ports:
- "5433:5432"
volumes:
- notifications-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U notifications"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
indexer:
build:
context: ./indexer
dockerfile: Dockerfile
image: iln/indexer:latest
container_name: iln-indexer
depends_on:
stellar:
condition: service_healthy
environment:
- PORT=3000
- HORIZON_URL=http://stellar:8000
- DB_PATH=/app/data/indexer.db
# Contract ID from `insurance-pool-deploy` (see the "insurance" profile
# below) or scripts/deploy-insurance-pool.sh. Empty until deployed.
- INSURANCE_POOL_CONTRACT_ID=${INSURANCE_POOL_CONTRACT_ID:-}
ports:
- "3000:3000"
volumes:
- indexer-data:/app/data
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:3000/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
restart: unless-stopped
notifications:
build:
context: ./notifications
dockerfile: Dockerfile
image: iln/notifications:latest
container_name: iln-notifications
depends_on:
notifications-db:
condition: service_healthy
environment:
- PORT=3001
- DATABASE_URL=postgres://notifications:notifications@notifications-db:5432/notifications
# Contract ID from `insurance-pool-deploy` (see the "insurance" profile
# below) or scripts/deploy-insurance-pool.sh. Empty until deployed.
- INSURANCE_POOL_CONTRACT_ID=${INSURANCE_POOL_CONTRACT_ID:-}
ports:
- "3001:3001"
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:3001/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
restart: unless-stopped
# Builds and deploys the insurance_pool contract to the local Stellar node,
# then calls initialize(). Opt-in only — it is not part of the default
# `docker compose up` since it installs the Stellar CLI via `cargo install`
# on first run, which can take several minutes.
#
# Usage: docker compose --profile insurance up insurance-pool-deploy
insurance-pool-deploy:
image: rust:1-slim
container_name: iln-insurance-pool-deploy
profiles: ["insurance"]
depends_on:
stellar:
condition: service_healthy
working_dir: /workspace
volumes:
- .:/workspace
- insurance-pool-cargo-cache:/usr/local/cargo/registry
environment:
# Passed through to insurance_pool's initialize(admin, coverage).
# See scripts/deploy-insurance-pool.sh for defaults.
- INSURANCE_POOL_ADMIN=${INSURANCE_POOL_ADMIN:-}
- INSURANCE_POOL_COVERAGE=${INSURANCE_POOL_COVERAGE:-1000000000}
command: >
bash -c "
set -e &&
rustup target add wasm32v1-none &&
command -v stellar >/dev/null 2>&1 || cargo install --locked stellar-cli &&
stellar network add --global local --rpc-url http://stellar:8000 --network-passphrase 'Standalone Network ; February 2021' --override || true &&
stellar keys generate --global alice || true &&
stellar account fund alice --network local || true &&
bash scripts/deploy-insurance-pool.sh local alice
"
restart: "no"
volumes:
stellar-data:
driver: local
indexer-data:
driver: local
notifications-db-data:
driver: local
insurance-pool-cargo-cache:
driver: local
networks:
default:
name: iln-local-network