-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcompose.dev.yaml
209 lines (200 loc) · 7.86 KB
/
compose.dev.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
208
209
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Docker compose reference guide at
# https://docs.docker.com/compose/compose-file/
# Here the instructions define your application as a service called "server".
# This service is built from the Dockerfile in the current directory.
# You can add other services your application may depend on here, such as a
# database or a cache. For examples, see the Awesome Compose repository:
# https://github.com/docker/awesome-compose
services:
# server:
# environment:
# - PORT=3000
# - POSTGRES_DATABASE_URL=postgres://postgres:[email protected]:5432/project_f
# - HOST=0.0.0.0
# - RUST_LOG=info
# build:
# context: .
# target: final
# ports:
# - 3000:3000
# The commented out section below is an example of how to define a PostgreSQL
# database that your application can use. `depends_on` tells Docker Compose to
# start the database before your application. The `db-data` volume persists the
# database data between container restarts. The `db-password` secret is used
# to set the database password. You must create `db/password.txt` and add
# a password of your choosing to it before running `docker compose up`.
# depends_on:
# db:
# condition: service_healthy
# pragma-node:
# container_name: "pragma-node"
# environment:
# - DATABASE_MAX_CONN=25
# - TOPIC=pragma-data
# - KAFKA_BROKERS=pragma-kafka:9092
# - OFFCHAIN_DATABASE_URL=postgres://postgres:test-password@offchain-db:5432/pragma
# - ONCHAIN_DATABASE_URL=postgres://postgres:test-password@onchain-db:5433/pragma
# - METRICS_PORT=8080
# depends_on:
# pragma-kafka:
# condition: service_healthy
# offchain-db:
# condition: service_healthy
# onchain-db:
# condition: service_healthy
# networks:
# - pragma-kafka-network
# - pragma-db-network
# ports:
# - "3000:3000"
# - "8080:8080"
# build:
# dockerfile: infra/pragma-node/Dockerfile
onchain-db:
image: timescale/timescaledb-ha:pg14-latest
restart: always
user: postgres
secrets:
- db-password
networks:
- pragma-db-network
volumes:
- ./infra/pragma-node/postgres_migrations/01-init.sql:/docker-entrypoint-initdb.d/01-init.sql
- ./infra/pragma-node/postgres_migrations/02-add-publishers.sql:/docker-entrypoint-initdb.d/02-add-publishers.sql
- ./infra/pragma-node/postgres_migrations/03-create-publishers-index.sql:/docker-entrypoint-initdb.d/03-create-publishers-index.sql
- ./infra/pragma-node/postgres_migrations/04-create-timescale-hypertables.sql:/docker-entrypoint-initdb.d/04-create-timescale-hypertables.sql
- ./infra/pragma-node/postgres_migrations/05-create-timescale-median-aggregates-spot.sql:/docker-entrypoint-initdb.d/05-create-timescale-median-aggregates-spot.sql
- ./infra/pragma-node/postgres_migrations/06-create-timescale-median-aggregates-future.sql:/docker-entrypoint-initdb.d/06-create-timescale-median-aggregates-future.sql
- ./infra/pragma-node/postgres_migrations/07-create-timescale-median-aggregates-mainnet-spot.sql:/docker-entrypoint-initdb.d/07-create-timescale-median-aggregates-mainnet-spot.sql
- ./infra/pragma-node/postgres_migrations/08-create-timescale-median-aggregates-mainnet-future.sql:/docker-entrypoint-initdb.d/08-create-timescale-median-aggregates-mainnet-future.sql
- ./infra/pragma-node/postgres_migrations/09-create-timescale-ohlc-aggregates-spot.sql:/docker-entrypoint-initdb.d/09-create-timescale-ohlc-aggregates-spot.sql
- ./infra/pragma-node/postgres_migrations/10-create-timescale-ohlc-aggregates-future.sql:/docker-entrypoint-initdb.d/10-create-timescale-ohlc-aggregates-future.sql
- ./infra/pragma-node/postgres_migrations/11-create-timescale-ohlc-aggregates-mainnet-spot.sql:/docker-entrypoint-initdb.d/11-create-timescale-ohlc-aggregates-mainnet-spot.sql
- ./infra/pragma-node/postgres_migrations/12-create-timescale-ohlc-aggregates-mainnet-future.sql:/docker-entrypoint-initdb.d/12-create-timescale-ohlc-aggregates-mainnet-future.sql
- ./infra/pragma-node/postgres_migrations/13-add-weekly-and-daily-median-aggregates.sql:/docker-entrypoint-initdb.d/13-add-weekly-and-daily-median-aggregates.sql
- ./infra/pragma-node/postgres_migrations/14-add-weekly-and-daily-ohlc-aggregates.sql:/docker-entrypoint-initdb.d/14-add-weekly-and-daily-ohlc-aggregates.sql
- onchain-db-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=pragma
- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
- PGPORT=5433
ports:
- 5433:5433
expose:
- 5433
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
offchain-db:
image: timescale/timescaledb-ha:pg14-latest
restart: always
user: postgres
secrets:
- db-password
networks:
- pragma-db-network
volumes:
- offchain-db-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=pragma
- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
ports:
- 5432:5432
healthcheck:
test: ["CMD", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
pragma-zookeeper:
container_name: "pragma-zookeeper"
image: confluentinc/cp-zookeeper:latest
restart: "always"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
networks:
- pragma-zookeeper-network
volumes:
- pragma_zookeeper_data:/var/lib/zookeeper/data
- pragma_zookeeper_logs:/var/lib/zookeeper/log
ports:
- "22181:2181"
pragma-kafka:
container_name: "pragma-kafka"
image: confluentinc/cp-kafka:latest
depends_on:
pragma-zookeeper:
condition: service_started
networks:
- pragma-kafka-network
- pragma-zookeeper-network
ports:
- "29092:29092"
- "9092:9092"
expose:
- "29092"
healthcheck:
test:
[
"CMD",
"kafka-topics",
"--list",
"--bootstrap-server",
"pragma-kafka:9092",
]
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: pragma-zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://pragma-kafka:9092,PLAINTEXT_E://localhost:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,PLAINTEXT_E:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
#KAFKA_SOCKET_REQUEST_MAX_BYTES: "10000000"
#KAFKA_MESSAGE_MAX_BYTES: "10000000"
#KAFKA_TOPIC_MAX_MESSAGE_BYTES: "15728640"
#KAFKA_REPLICA_FETCH_MAX_BYTES: "15728640"
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
pragma-ingestor-1:
container_name: "pragma-ingestor-1"
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
- DATABASE_MAX_CONN=25
- BROKERS=pragma-kafka:9092
- TOPIC=pragma-data
- GROUP_ID=pragma-data
- OFFCHAIN_DATABASE_URL=postgres://postgres:test-password@offchain-db:5432/pragma
- ONCHAIN_DATABASE_URL=postgres://postgres:test-password@onchain-db:5433/pragma
depends_on:
pragma-kafka:
condition: service_healthy
offchain-db:
condition: service_healthy
networks:
- pragma-kafka-network
- pragma-db-network
build:
dockerfile: infra/pragma-ingestor/Dockerfile
networks:
pragma-db-network:
# production
#driver: bridge
#internal: true
pragma-kafka-network:
# production
#driver: bridge
#internal: true
pragma-zookeeper-network:
# production
#driver: bridge
#internal: true
volumes:
offchain-db-data:
onchain-db-data:
pragma_zookeeper_data:
pragma_zookeeper_logs:
secrets:
db-password:
file: infra/db/password.txt