-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yaml
144 lines (136 loc) · 3.82 KB
/
docker-compose.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
version: "3.7"
services:
# --------------
# The database
# --------------
database:
image: mongo:5.0
restart: always
ports:
- 27017:27017
volumes:
- ./services/database/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro
- ./db:/data/db
environment:
# read from .env file
MONGO_INITDB_DATABASE: ${DB_DATABASE}
MONGO_INITDB_ROOT_USERNAME: ${DB_ROOT_USER}
MONGO_INITDB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
DB_DATABASE: ${DB_DATABASE}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
# ------------------
# Live Recording
# - stream service
# ------------------
live:
build:
context: ./services/recording
dockerfile: ./Dockerfile.live
restart: always
command: python entrypoint.py
volumes:
- ./configs/live/config.yaml:/usr/config.yaml
environment:
# hard-coded since it refers to the database service above
DB_HOST: database
DB_PORT: 27017
# read from .env file
DB_DATABASE: ${DB_DATABASE}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
NODE_PROVIDER_WSS_URI: ${NODE_PROVIDER_WSS_URI}
NODE_PROVIDER_RPC_URI: ${NODE_PROVIDER_RPC_URI}
depends_on:
- database
# --------------------------------
# Historical Recording & RPC API
# - redis as broker
# - rpc api service
# - celery workers
# --------------------------------
redis:
image: redis:alpine
restart: always
historical-rpc-api:
build:
context: ./services/recording
dockerfile: ./Dockerfile.historical
restart: always
command: uvicorn src.historical.app:app --host 0.0.0.0 --port 80
expose:
- 80
volumes:
- ./configs/historical/config.yaml:/usr/config.yaml
environment:
REDIS_URI: "redis://redis:6379"
# hard-coded since it refers to the database service above
DB_HOST: database
DB_PORT: 27017
# read from .env file
DB_DATABASE: ${DB_DATABASE}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
ETHERSCAN_API_KEY: ${ETHERSCAN_API_KEY}
NODE_PROVIDER_RPC_URI: ${NODE_PROVIDER_RPC_URI}
depends_on:
- redis
historical-workers:
build:
context: ./services/recording
dockerfile: Dockerfile.historical
restart: always
# Limit concurrency to prevent etherscan rate limits
command: celery -A src.historical worker -l INFO --concurrency=2 --uid nobody --gid nogroup
volumes:
- ./configs/historical/config.yaml:/usr/config.yaml
environment:
REDIS_URI: "redis://redis:6379"
# hard-coded since it refers to the database service above
DB_HOST: database
DB_PORT: 27017
# read from .env file
DB_DATABASE: ${DB_DATABASE}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
ETHERSCAN_API_KEY: ${ETHERSCAN_API_KEY}
NODE_PROVIDER_RPC_URI: ${NODE_PROVIDER_RPC_URI}
depends_on:
- database
- redis
# -------------------------
# Interface (RESTful API)
# -------------------------
interface:
build:
context: ./services/interface
dockerfile: Dockerfile
restart: always
command: uvicorn src.app:app --host 0.0.0.0 --port 80
expose:
- 80
environment:
# hard-coded since it refers to the database service above
DB_HOST: database
DB_PORT: 27017
# read from .env file
DB_DATABASE: ${DB_DATABASE}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
depends_on:
- database
# --------------------------------
# Proxy for RPC and RESTful APIs
# Use this for now just so we
# have both on the same host/port
# --------------------------------
proxy:
build:
context: ./services/nginx
dockerfile: Dockerfile
restart: always
ports:
- 80:80
depends_on:
- historical-rpc-api
- interface