forked from RunestoneInteractive/rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
210 lines (191 loc) · 6.43 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
version: '3.8'
services:
redis:
image: redis:6-alpine
# pgbouncer is for production only, when in a load balancer configuration.
# This will effectively limit the total number of connections to the database
# for the composed application to 30. If you need more than that you will need
# to set the PGBOUNCER_DEFAULT_POOL_SIZE environment variable to a larger number.
pgbouncer:
image: bitnami/pgbouncer:latest
restart: always
ports:
- 6432:6432
extra_hosts:
- host.docker.internal:host-gateway
environment:
- POSTGRESQL_HOST=${POSTGRESQL_HOST}
- POSTGRESQL_DATABASE=${POSTGRESQL_DATABASE}
- PGBOUNCER_DATABASE=${POSTGRESQL_DATABASE}
- POSTGRESQL_USERNAME=${POSTGRESQL_USERNAME}
- POSTGRESQL_PASSWORD=${POSTGRESQL_PASSWORD}
- PGBOUNCER_AUTH_TYPE=trust #md5 or scram-sha-256
- PGBOUNCER_DEFAULT_POOL_SIZE=25
- PGBOUNCER_POOL_MODE=transaction
- PGBOUNCER_MAX_PREPARED_STATEMENTS=100
- PGBOUNCER_MAX_CLIENT_CONN=250
- PGBOUNCER_STATS_USERS=runestone
jobe:
build:
context: ./projects/jobe
#image: registry.digitalocean.com/runestone-registry/rs-jobe
image: ghcr.io/runestoneinteractive/rs-jobe
restart: always
book:
build:
context: ./projects/book_server
#image: registry.digitalocean.com/runestone-registry/rs-book
image: ghcr.io/runestoneinteractive/rs-book
extra_hosts:
- host.docker.internal:host-gateway
ports:
- 8111:8111
command: uvicorn rsptx.book_server_api.main:app --host 0.0.0.0 --port 8111
#command: tail -f /var/log/lastlog
restart: always
volumes:
- ${BOOK_PATH}:/usr/books
environment:
- BOOK_PATH=/usr/books
- SERVER_CONFIG=${SERVER_CONFIG}
- RUNESTONE_HOST=${RUNESTONE_HOST}
- RUNESTONE_PATH=/usr/src/app
- REDIS_URI=redis://${REDIS_HOST}:6379/0
# Note: host.docker.internal refers back to the host so we can just use a local instance
# of postgresql
- DEV_DBURL=${DC_DEV_DBURL:-$DEV_DBURL}
- DBURL=${DC_DBURL:-$DBURL}
- DOCKER_COMPOSE=1
- JWT_SECRET=${JWT_SECRET}
- UVICORN_WORKERS=${UVICORN_WORKERS:-2}
- UVICORN_USER=www-data
- UVICORN_GROUP=www-data
- UVICORN_MAX_REQUESTS=5000
- UVICORN_MAX_REQUESTS_JITTER=30
- UVICORN_TIMEOUT=60
- LOGIN_URL="/runestone/default/user"
- WORKER_NAME=${HOSTNAME}
- LOAD_BALANCER_HOST=${LOAD_BALANCER_HOST}
- SPACES_KEY=${SPACES_KEY}
- SPACES_SECRET=${SPACES_SECRET}
links:
- redis
- jobe
- pgbouncer
runestone:
build:
context: ./projects/w2p_login_assign_grade
#image: registry.digitalocean.com/runestone-registry/rs-runestone
image: ghcr.io/runestoneinteractive/rs-runestone
extra_hosts:
- host.docker.internal:host-gateway
ports:
- 8112:8112
#command: gunicorn --bind 0.0.0.0:8112 rsptx.web2py_server.wsgihandler:application
# see projects/w2p_login_assign_grade/entrypoint.sh and the Dockerfile
restart: always
volumes:
- ${BOOK_PATH}:/usr/books
environment:
- BOOK_PATH=/usr/books
- SERVER_CONFIG=${SERVER_CONFIG}
- WEB2PY_CONFIG=${SERVER_CONFIG}
- RUNESTONE_HOST=${RUNESTONE_HOST}
- RUNESTONE_PATH=/usr/src/app
- REDIS_URI=redis://${REDIS_HOST}:6379/0
# Note: host.docker.internal refers back to the host so we can just use a local instance
# of postgresql
- DEV_DBURL=${DC_DEV_DBURL:-$DEV_DBURL}
- DBURL=${DC_DBURL:-$DBURL}
- LOAD_BALANCER_HOST=${LOAD_BALANCER_HOST}
- JWT_SECRET=${JWT_SECRET}
- WEB2PY_PRIVATE_KEY=${WEB2PY_PRIVATE_KEY}
- ACADEMY_MODE=True
- USE_MASTER_AUTHOR=${USE_MASTER_AUTHOR:-False}
- EMAIL_SENDER="smtp.gmail.com:587"
- EMAIL_SERVER=${EMAIL_SERVER}
- EMAIL_LOGIN=${EMAIL_LOGIN}
- SPACES_KEY=${SPACES_KEY}
- SPACES_SECRET=${SPACES_SECRET}
- GUNICORN_CMD_ARGS=${GUNICORN_CMD_ARGS}
links:
- redis
- jobe
- pgbouncer
assignment:
build:
context: ./projects/assignment_server
#image: registry.digitalocean.com/runestone-registry/rs-assignment
image: ghcr.io/runestoneinteractive/rs-assignment
extra_hosts:
- host.docker.internal:host-gateway
ports:
- 8113:8113
command: uvicorn rsptx.assignment_server_api.core:app --host 0.0.0.0 --port 8113
#command: tail -f /var/log/lastlog
restart: always
volumes:
- ${BOOK_PATH}:/usr/books
environment:
- BOOK_PATH=/usr/books
- SERVER_CONFIG=${SERVER_CONFIG}
- RUNESTONE_PATH=/usr/src/app
- REDIS_URI=redis://${REDIS_HOST}:6379/0
# Note: host.docker.internal refers back to the host so we can just use a local instance
# of postgresql
- DEV_DBURL=${DC_DEV_DBURL:-$DEV_DBURL}
- DBURL=${DC_DBURL:-$DBURL}
- DOCKER_COMPOSE=1
- JWT_SECRET=${JWT_SECRET}
- UVICORN_WORKERS=3
- UVICORN_USER=www-data
- UVICORN_GROUP=www-data
- UVICORN_MAX_REQUESTS=5000
- UVICORN_MAX_REQUESTS_JITTER=30
- UVICORN_TIMEOUT=60
links:
- redis
- jobe
- pgbouncer
nginx:
# Note we use context: ./ here so that the Dockerfile can copy from the components folder
build:
context: ./
dockerfile: projects/nginx/Dockerfile
#image: registry.digitalocean.com/runestone-registry/rs-nginx
image: ghcr.io/runestoneinteractive/rs-nginx
restart: always
ports:
# ports are specified host:container
- 80:80
#- 443:443
volumes:
- ${BOOK_PATH}:/usr/books
depends_on:
- runestone
- book
- assignment
links:
- runestone
- book
- assignment
# create an image/container to run rsmanage inside the composed services
# docker compose run rsmanage rsmanage --help
rsmanage:
build:
context: ./projects/rsmanage
#image: registry.digitalocean.com/runestone-registry/rs-rsmanage
image: ghcr.io/runestoneinteractive/rs-rsmanage
extra_hosts:
- host.docker.internal:host-gateway
volumes:
- ${BOOK_PATH}:/usr/books
environment:
- BOOK_PATH=/usr/books
- SERVER_CONFIG=${SERVER_CONFIG}
- RUNESTONE_HOST=${RUNESTONE_HOST}
- RUNESTONE_PATH=/usr/src/app
- REDIS_URI=redis://${REDIS_HOST}:6379/0
- DEV_DBURL=${DC_DEV_DBURL:-$DEV_DBURL}
- DBURL=${DC_DBURL:-$DBURL}
- DOCKER_COMPOSE=1