-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose-dev.yml
More file actions
244 lines (232 loc) · 7.68 KB
/
Copy pathdocker-compose-dev.yml
File metadata and controls
244 lines (232 loc) · 7.68 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
services:
# Named volumes (fast, native filesystem) for the npm download
# caches below are created root-owned by Docker on first use, which the
# non-root *host-user containers can't write into - chown them once here
# before anything else starts.
zendro-cache-init:
container_name: zendro-cache-init
image: busybox
volumes:
- gql_npm_cache:/cache/gql-npm
- spa_npm_cache:/cache/spa-npm
- giql_npm_cache:/cache/giql-npm
command:
- sh
- -c
- |
chown -R "${UID_GID}" /cache/gql-npm /cache/spa-npm /cache/giql-npm
zendro-keycloak-postgres:
container_name: zendro-keycloak-postgres
image: postgres
volumes:
- keycloak_pg_data:/var/lib/postgresql
environment:
POSTGRES_DB: ${KEYCLOAK_DATABASE_NAME}
POSTGRES_USER: ${KEYCLOAK_DATABASE_USER}
POSTGRES_PASSWORD: ${KEYCLOAK_DATABASE_PASSWORD}
networks:
zendro:
zendro-keycloak:
container_name: zendro-keycloak
image: quay.io/keycloak/keycloak:26.2.0
entrypoint: ["/opt/keycloak/bin/kc.sh", "start-dev"]
ports:
- ${KEYCLOAK_HOSTNAME_PORT}:${KEYCLOAK_HOSTNAME_PORT}
environment:
KC_DB: ${KEYCLOAK_DATABASE_VENDOR}
KC_DB_URL_HOST: ${KEYCLOAK_DATABASE_HOST}
KC_DB_URL_DATABASE: ${KEYCLOAK_DATABASE_NAME}
KC_DB_USERNAME: ${KEYCLOAK_DATABASE_USER}
KC_DB_SCHEMA: ${KEYCLOAK_DATABASE_SCHEMA}
KC_DB_PASSWORD: ${KEYCLOAK_DATABASE_PASSWORD}
KC_BOOTSTRAP_ADMIN_USERNAME: ${KEYCLOAK_ADMIN_USER}
KC_BOOTSTRAP_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD}
KC_HTTP_RELATIVE_PATH: ${KEYCLOAK_HTTP_RELATIVE_PATH}
KC_HTTP_PORT: ${KEYCLOAK_HOSTNAME_PORT}
KC_HOSTNAME: http://${KEYCLOAK_HOSTNAME}:${KEYCLOAK_HOSTNAME_PORT}${KEYCLOAK_HTTP_RELATIVE_PATH}
KC_HOSTNAME_BACKCHANNEL_DYNAMIC: true
depends_on:
- zendro-keycloak-postgres
networks:
zendro:
zendro-graphql-server-migrations:
container_name: zendro-graphql-server-migrations
depends_on:
zendro-keycloak:
condition: service_started
zendro-cache-init:
condition: service_completed_successfully
build: &gql-server-build
context: ./contexts
dockerfile: Dockerfile.graphql_server
volumes: &gql-server-volumes
- ./graphql-server:/usr/graphql-server
# override default default config with Starterpack config
- ./config/data_models_storage_config.json:/usr/graphql-server/config/data_models_storage_config.json
- ./graphiql-auth/.env:/usr/graphiql-auth/.env
- ./single-page-app/.env.development:/usr/single-page-app/.env.development
- ./single-page-app/.env.production:/usr/single-page-app/.env.production
# npm's own download cache (package tarballs/metadata) - separate
# from node_modules above. A named volume, not a path inside the
# bind mount above: node_modules and this repo live on a Windows
# drive bind-mounted through WSL2 (9p/drvfs), which is slow for the
# high volume of small-file I/O a populated npm cache involves -
# confirmed this was causing real ESOCKETTIMEDOUT install failures
# under load. A named volume is native filesystem, no such penalty.
- gql_npm_cache:/usr/graphql-server/.npm-cache
# Run as the host user so files written to the bind-mounted volumes above
# (e.g. node_modules) are not owned by root on the host.
user: &host-user "${UID_GID}"
environment: &host-user-env
# With HOME unset, npm would default its cache to $HOME/.npm, which
# isn't guaranteed to be writable for an arbitrary host UID with no
# /etc/passwd entry - point it at the named volume mounted above
# instead.
HOME: /tmp
npm_config_cache: /usr/graphql-server/.npm-cache
# Await POSTGRES role and DB creation, migrate schema, then start web
# server:
networks: &gql-server-networks
zendro:
datastores:
command:
- /bin/sh
- -c
- |
set -e
npm install
# @vscode/sqlite3 (graphql-server's sqlite driver, replacing the
# now-archived sqlite3) has no working prebuilt-binary fetch path -
# it always compiles from source via node-gyp, and its own install
# script is blocked by graphql-server's allowScripts, so it has to
# be rebuilt explicitly here.
npm rebuild @vscode/sqlite3
npm run build:graphiql
node migrateDb.js up
zendro-graphql-server:
container_name: zendro-graphql-server
depends_on: &migrations
zendro-graphql-server-migrations:
condition: service_completed_successfully
restart: true
build: *gql-server-build
ports:
- 3000:3000
volumes: *gql-server-volumes
user: *host-user
environment: *host-user-env
# Await POSTGRES role and DB creation, migrate schema, then start web
# server:
networks: *gql-server-networks
command:
- /bin/sh
- -c
- |
node startServer.js dev
zendro-spa-install:
container_name: zendro-spa-install
# Workaround. See https://github.com/facebook/create-react-app/issues/8688
depends_on:
<<: *migrations
zendro-cache-init:
condition: service_completed_successfully
build: &spa-build
context: ./contexts
dockerfile: Dockerfile.spa
volumes: &spa-volumes
- ./single-page-app:/usr/single-page-app
- ./data_model_definitions:/usr/data_model_definitions
# See the npm_config_cache comment on zendro-graphql-server-migrations
# above.
- spa_npm_cache:/usr/single-page-app/.npm-cache
user: *host-user
environment: &spa-env
HOME: /tmp
npm_config_cache: /usr/single-page-app/.npm-cache
command:
- /bin/sh
- -c
- |
set -e
npm install
rm -rf .next
zendro-spa:
container_name: zendro-spa
# Workaround. See https://github.com/facebook/create-react-app/issues/8688
stdin_open: true
depends_on:
zendro-spa-install:
condition: service_completed_successfully
restart: true
build: *spa-build
ports:
- 8080:8080
volumes: *spa-volumes
user: *host-user
environment: *spa-env
networks:
zendro:
# Install dependencies and start single-page-app-server in development
# mode.
command:
- /bin/sh
- -c
- |
npm run dev
zendro-graphiql-install:
container_name: zendro-graphiql-install
depends_on:
<<: *migrations
zendro-cache-init:
condition: service_completed_successfully
build: &giql-build
context: ./contexts
dockerfile: Dockerfile.graphiql
volumes: &giql-volumes
- ./graphiql-auth:/usr/graphiql-auth
# See the npm_config_cache comment on zendro-graphql-server-migrations
# above.
- giql_npm_cache:/usr/graphiql-auth/.npm-cache
user: *host-user
environment: &giql-env
HOME: /tmp
npm_config_cache: /usr/graphiql-auth/.npm-cache
command:
- /bin/sh
- -c
- |
set -e
npm install
npm run build:graphiql
zendro-graphiql:
container_name: zendro-graphiql
# Workaround. See https://github.com/facebook/create-react-app/issues/8688
stdin_open: true
depends_on:
zendro-graphiql-install:
condition: service_completed_successfully
restart: true
build: *giql-build
ports:
- 7070:7070
volumes: *giql-volumes
user: *host-user
environment: *giql-env
# Install dependencies and start single-page-app-server in development
# mode.
networks:
zendro:
command:
- /bin/sh
- -c
- |
npm run dev
volumes:
zendro_db_data:
keycloak_pg_data:
gql_npm_cache:
spa_npm_cache:
giql_npm_cache:
networks:
zendro:
datastores: