-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdocker-compose.yml
225 lines (217 loc) · 5.69 KB
/
docker-compose.yml
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
services:
nginx:
profiles: ["studio"] # For hosted studio, turned off by default
build:
context: ./
dockerfile: ./docker/Dockerfile.nginx
cap_add:
- NET_BIND_SERVICE
ports:
- "80:80"
- "443:443" # For the frontend
- "8443:8443" # For the jsonrpc
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
- ./nginx/rpc-blocker.lua:/etc/nginx/rpc-blocker.lua:ro
depends_on:
- frontend
- jsonrpc
healthcheck:
test: ["CMD", "nginx", "-t"]
interval: 30s
timeout: 10s
retries: 3
restart: always
security_opt:
- "no-new-privileges=true"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
frontend:
build:
context: ./
dockerfile: ./docker/Dockerfile.frontend
target: ${FRONTEND_BUILD_TARGET:-final}
args:
- VITE_*
ports:
- "${FRONTEND_PORT}:8080"
volumes:
- ./examples:/app/src/assets/examples
- ./frontend/src:/app/src
depends_on:
jsonrpc:
condition: service_healthy
expose:
- "${FRONTEND_PORT}"
environment:
- VITE_*
restart: always
security_opt:
- "no-new-privileges=true"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
jsonrpc:
build:
context: ./
dockerfile: ./docker/Dockerfile.backend
target: ${BACKEND_BUILD_TARGET:-prod}
environment:
- FLASK_SERVER_PORT=${RPCPORT}
# TODO: remove this in production
- PYTHONUNBUFFERED=1
- RPCDEBUGPORT=${RPCDEBUGPORT}
- WEBREQUESTPORT=${WEBREQUESTPORT}
- WEBREQUESTHOST=${WEBREQUESTHOST}
- WEBREQUESTPROTOCOL=${WEBREQUESTPROTOCOL}
ports:
- "${RPCPORT}:${RPCPORT}"
- "${RPCDEBUGPORT}:${RPCDEBUGPORT}"
volumes:
- ./.env:/app/.env
- ./backend:/app/backend
- hardhat_artifacts:/app/hardhat/artifacts
- hardhat_deployments:/app/hardhat/deployments
depends_on:
hardhat:
condition: service_healthy
database-migration:
condition: service_completed_successfully
webrequest:
condition: service_healthy
expose:
- "${RPCPORT}"
healthcheck:
test: ["CMD", "python3", "backend/healthcheck.py", "--port", "${RPCPORT}"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: always
security_opt:
- "no-new-privileges=true"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
replicas: ${JSONRPC_REPLICAS:-1}
webrequest:
build:
context: ./
dockerfile: ./docker/Dockerfile.webrequest
shm_size: 2gb
volumes:
- ./.env:/app/webrequest/.env
- ./webrequest:/app/webrequest
environment:
- FLASK_SERVER_PORT=${WEBREQUESTPORT}
- WEBREQUESTSELENIUMPORT=${WEBREQUESTSELENIUMPORT}
# TODO: remove this in production
- PYTHONUNBUFFERED=1
depends_on:
ollama:
condition: service_started
expose:
- "${WEBREQUESTPORT}:${WEBREQUESTPORT}"
- "${WEBREQUESTSELENIUMPORT}:${WEBREQUESTSELENIUMPORT}"
restart: always
security_opt:
- "no-new-privileges=true"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
ollama:
image: ollama/ollama:0.4.1
ports:
- 11434:11434
volumes:
- ./.ollama:/root/.ollama
container_name: ollama
tty: true
restart: always
security_opt:
- "no-new-privileges=true"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
postgres:
image: postgres:16-alpine
ports:
- "${DBPORT}:5432"
environment:
- POSTGRES_USER=${DBUSER}
- POSTGRES_PASSWORD=${DBPASSWORD}
- POSTGRES_DB=${DBNAME}
healthcheck:
test: pg_isready -U ${DBUSER} -d ${DBNAME}
interval: 10s
timeout: 3s
retries: 3
restart: always
security_opt:
- "no-new-privileges=true"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# If you want your db to persist in dev
volumes:
- "./data/postgres:/var/lib/postgresql/data"
database-migration:
build:
context: .
dockerfile: docker/Dockerfile.database-migration
environment:
- DB_URL=postgresql://${DBUSER}:${DBUSER}@postgres/${DBNAME}
- WEBREQUESTPORT=${WEBREQUESTPORT}
- WEBREQUESTHOST=${WEBREQUESTHOST}
- WEBREQUESTPROTOCOL=${WEBREQUESTPROTOCOL}
depends_on:
postgres:
condition: service_healthy
webrequest:
condition: service_healthy
hardhat:
build:
context: .
dockerfile: docker/Dockerfile.hardhat
ports:
- "${HARDHAT_PORT:-8545}:8545"
volumes:
- ./hardhat/contracts:/app/contracts
- ./hardhat/scripts:/app/scripts
- ./hardhat/test:/app/test
- ./hardhat/hardhat.config.js:/app/hardhat.config.js
- ./hardhat/deploy:/app/deploy
- ./hardhat/scripts:/app/scripts
- hardhat_artifacts:/app/artifacts
- hardhat_cache:/app/cache
- hardhat_deployments:/app/deployments
- ignition_deployments:/app/ignition/deployments
environment:
- HARDHAT_NETWORK=hardhat
restart: always
healthcheck:
test: ["CMD", "curl", "-X", "POST", "-H", "Content-Type: application/json", "--fail", "http://localhost:8545", "-d", '{"jsonrpc":"2.0","method":"net_version","params":[],"id":1}']
interval: 60s
timeout: 30s
retries: 5
start_period: 60s
volumes:
hardhat_artifacts:
hardhat_cache:
hardhat_deployments:
ignition_deployments: