forked from openwebwork/webwork2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
267 lines (204 loc) · 10.4 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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
version: '3.5'
services:
db:
image: mariadb:10.4
# Set a fixed container name, so it does not depend on the directory name
container_name: webwork2_db_1
volumes:
- mysql:/var/lib/mysql
# Set up UTF8MB4 in config file for the container.
# Needs to be done BEFORE the database is created.
# *** Some other MariaDB settings were modified in the sample file:
# wait_timeout, interactive_timeout, max_connections, net_read_timeout
# + skip-name-resolve
# Note: It seems different versions of the MariaDB container need
# this file in different locations. Put in in both places.
- "./docker-config/db/mariadb.cnf:/etc/mysql/conf.d/mariadb.cnf"
- "./docker-config/db/mariadb.cnf:/etc/mysql/mariadb.cnf"
# Tuning MariaDB config - sample file
# The sample file modifies wait_timeout, and adds skip-name-resolve
#- "./docker-config/db/my.cnf:/etc/mysql/my.cnf"
# Adjust open file limits for MariaDB/mySQL - sample file
#- "./docker-config/db/limits.conf:/etc/security/limits.conf"
# Provides read only access to the host system's /etc/localtime - tested on Linux hosts
#- "/etc/localtime:/etc/localtime:ro"
# The ulimits lines were only tested on Linux hosts in conjuction woth the limits.conf file
# ulimits:
# nofile:
# soft: 4096
# hard: 4096
restart: always
environment:
# When the MariaDB container is first started it will set the
# the MYSQL_ROOT_PASSWORD if there is no mysql database in the
# data volume.
MYSQL_ROOT_PASSWORD: ${WEBWORK_MYSQL_ROOT_PASSWORD}
# When the MariaDB container is first started it will create
# the WW database and WW DB user based on:
MYSQL_DATABASE: webwork
MYSQL_USER: ${WEBWORK_DB_USER}
MYSQL_PASSWORD: ${WEBWORK_DB_PASSWORD}
# A timezone for the DB server can be set:
#TZ: zone/city
# where zone/city must be a valid setting.
# "/usr/bin/timedatectl list-timezones" on an Ubuntu system with
# that tool installed will find valid values.
# See: https://stackoverflow.com/questions/39172652/using-docker-compose-to-set-containers-timezones
app:
# Modifying the image name can be helpful to create a new image instead of
# overwriting the "standard" one during testing.
image: webwork
# Set a fixed container name, so it does not depend on the directory name
container_name: webwork2_app_1
# Set up the "build:" configuration:
build:
# For use/building when docker-compose.yml is in the webwork2 directory
context: .
# For use/building when docker-compose.yml is OUTSIDE the webwork2 directory.
# For example, if multiple hosts use a NFS shared webwork2/ directory, and
# each one needs customized values in docker-compose.yml.
# Under typical use, the Dockerfile should not need to be customized per host,
# but may contain some changes/additions relative to the standard webwork image.
#
# context: /Path_To/webwork2/
# dockerfile: /Path_To/Dockerfile
args:
# Build args to set the source Git repositories. Here we set the main repositories:
- WEBWORK2_GIT_URL=https://github.com/openwebwork/webwork2.git
- PG_GIT_URL=https://github.com/openwebwork/pg.git
# Build args specifying the branches of webwork2 and pg to install.
# Exactly one pair of settings should be left uncommented and all the others
# should be commented out.
# main branches:
- WEBWORK2_BRANCH=main
- PG_BRANCH=main
# WeBWorK/PG develop branches
# (other valid branches can also be used in a similar manner)
#- WEBWORK2_BRANCH=develop
#- PG_BRANCH=develop
# If you are using the 2 stage build process uncomment the next line
dockerfile: DockerfileStage2
# and first run
# docker build --tag webwork-base:forWW216 -f DockerfileStage1 .
# and then
# docker-compose build
depends_on:
- db
- r
volumes:
# ======================================================================
# If you are using locally modified webwork2 files, then
# either mount them from the webwork2 tree from which you start Docker:
#- ".:/opt/webwork/webwork2"
# OR mount it from a fixed external location
#- "/path_to/webwork2:/opt/webwork/webwork2"
# Shared main /pg repository - allows local PG development
#- "/path_to_shared/pg:/opt/webwork/pg"
# OR locally modified PG directory
#- "../pg:/opt/webwork/pg"
# ======================================================================
# Sometimes it is helpful to mount certain webwork2/conf files from elsewhere
# so the main contents of webwork2 can be shared by several hosts (ex. NFS)
#- "/per_host_conf_path/conf/authen_LTI.conf:/opt/webwork/webwork2/conf/authen_LTI.conf"
#- "/per_host_conf_path/conf/localOverrides.conf:/opt/webwork/webwork2/conf/localOverrides.conf"
#- "/per_host_conf_path/conf/site.conf:/opt/webwork/webwork2/conf/site.conf"
# webwork2 misc LOCAL files - mount live (per host) so NOT in the main webwork2 location
#- "/per_host_conf_path/htdocs/my_site_info.txt:/opt/webwork/webwork2/htdocs/my_site_info.txt"
# webwork2 LOCAL logs and htdocs/tmp directories (per host)
#- "/per_host_data_path/webwork2/logs:/opt/webwork/webwork2/logs"
#- "/per_host_data_path/webwork2/htdocs/tmp:/opt/webwork/webwork2/htdocs/tmp"
# By default the courses tree in a separate tree outside of webwork2/ as follows:
- "${COURSES_DIRECTORY_ON_HOST}:/opt/webwork/courses"
# OR mount like (here we are assuming that the hosts have different courses on them)
#- "/per_host_data_path/courses/:/opt/webwork/courses/"
# ======================================================================
# By default the OPL is stored in a named Docker storage volume:
- oplVolume:/opt/webwork/libraries/webwork-open-problem-library
#
# as an alternative, you can comment out the prior option and uncomment the line below to use a local directory containing the OPL
#- "/path_to/webwork-open-problem-library:/opt/webwork/libraries/webwork-open-problem-library"
# ======================================================================
# The mounts from ./docker-config/ below are local samples.
# In production, there may be per-host versions of most
# of these files stored in an appropriate place.
# If not - the samples should be edited as needed.
# Main index.html page with a redirect (you probably need to customize some of these files)
#- "./docker-config/apache/index.html:/var/www/html/index.html"
#- "./docker-config/apache/htaccess:/var/www/html/.htaccess"
# Apache config (you probably need to customize some of these files)
- "./docker-config/apache/000-default.conf:/etc/apache2/sites-available/000-default.conf"
- "./docker-config/apache/apache2.conf:/etc/apache2/apache2.conf"
- "./docker-config/apache/mpm_prefork.conf:/etc/apache2/mods-enabled/mpm_prefork.conf"
# Apache logs - to have them persistent (per host) mount directory from outside.
#- "/per_host_data_path/apache2_logs:/var/log/apache2"
# ======================================================================
# SSL certificates (subdirectory with certificate and key)
# (you MUST replace/customize these files, or change the location they are mounded from)
- "./docker-config/ssl/local/:/etc/ssl/local"
# Apache SSL config (you probably need to customize some of these files)
# (make sure default-ssl.conf points to the certificates where they will be in the container)
- "./docker-config/ssl/ssl.conf:/etc/apache2/mods-available/ssl.conf"
- "./docker-config/ssl/default-ssl.conf:/etc/apache2/sites-available/default-ssl.conf"
# ======================================================================
hostname: myhost.mydomain.edu
ports:
# For a personal machine
- "${WEBWORK2_HTTP_PORT_ON_HOST}:80"
# For a production machine
#- "80:80"
#- "443:443"
# For a production machine
#restart: always
stop_signal: SIGWINCH
stop_grace_period: 30s
environment:
DEV: 0
APACHE_RUN_GROUP: www-data
# Standard database environment variables needed by WeBWorK:
# Select which DBD driver to use
WEBWORK_DB_DRIVER: MariaDB
# WEBWORK_DB_DRIVER: mysql
WEBWORK_DB_HOST: db
WEBWORK_DB_PORT: 3306
WEBWORK_DB_NAME: webwork
# These are set in the .env file and import values from there
WEBWORK_DB_PASSWORD: ${WEBWORK_DB_PASSWORD}
WEBWORK_DB_USER: ${WEBWORK_DB_USER}
# =======================================================
# Local configuration variables:
# To turn on SSL in the running container
#SSL: 1
# Control settings for error message handling by webwork2/lib/WeBWorK.pm
# The standard behavior is with both of these set to 0
MIN_HTML_ERRORS: 0
JSON_ERROR_LOG: 0
# Change to A4 paper
#PAPERSIZE: a4
# Use to build additional locales in the running container at startup. Ex:
#ADD_LOCALES: "he_IL ISO-8859-8\nhe_IL.UTF-8 UTF-8\n"
# Extra Ubuntu packages to install during startup
# Commenting the following line out will speed up container startup time.
ADD_APT_PACKAGES: nano less
# The system timezone for the container can be set using
#SYSTEM_TIMEZONE: zone/city
# where zone/city must be a valid setting.
# "/usr/bin/timedatectl list-timezones" on an Ubuntu system with
# that tool installed will find valid values.
# =======================================================
# If you use https below, make sure to set up the certificate and SSL configuration
# WEBWORK_ROOT_URL: https://myhost.mydomain.edu
# WEBWORK_SMTP_SERVER: smtp.mydomain.edu
# WEBWORK_SMTP_SENDER: [email protected]
# WEBWORK_TIMEZONE: America/New_York
r:
image: ubcctlt/rserve
# # The R server need not be available from outside the local Docker network.
# ports:
# - "6311:6311"
volumes:
oplVolume:
driver: local
name: webwork2_oplVolume
mysql:
driver: local
name: webwork2_mysql