-
-
Notifications
You must be signed in to change notification settings - Fork 167
Running a production WeBWorK server using Docker
Nathan Wallach edited this page Aug 19, 2019
·
12 revisions
INITIAL DRAFT
It is possible to run a reasonable production WeBWorK server using Docker. It was already possible to do this using WeBWorK 2.14, but the 2.15 release will include a docker-compose.yml
file and several sample configuration files to make setting up a production system much easier.
At present, this includes an R server, a MariaDB server (MariaDB 10.4 for WW 2.15), and a WeBWorK server running Apache. (In principle, it would also be possible to run a Docker system connecting to an external mysql
-derived database server.)
In the future, the Docker system may be extended to also allow using lighthttpd to reduce the workload on Apache.
Configuration in the docker-compose.yml
file and files it may mount to a running container:
-
Before first starting your Docker based system you should change the default sample SQL passwords. Once the Maria DB data volume is created, you would need to modify those values by hand via direct mysql commands.
-
MYSQL_ROOT_PASSWORD
is the root password for mysql, and appears only once in the file. -
MYSQL_PASSWORD
is the password used by the WeBWorK server to access thewebwork
database and the same value needs to also be set forWEBWORK_DB_PASSWORD:
in theenvironment:
section further down in the file.
-
- If you are using a shared
webwork2
directory on shared storage to operate several VMs each running WeBWorK via Docker, you will want to store yourdocker-compose.yml
per VM in a special per-VM directory, and have each one point to the central location ofwebwork2
using the settings in thebuild:
section of the file. Sample lines are included. - It is possible to mount
webwork2/
and/orpg/
from outside the standard image.- Those options are intended for people doing development work, but is also useful is you need a customized version of the code.
- Small customizations could be better made by mounting just specific modified files from outside the image.
- The location from which the
courses
directory is mounted should be set.- The default is to store it in
../ww-docker-data/courses
namely, that aww-docker-data
directory will be in parallel to thewebwork2
directory. - For production servers, a more appropriate location should be used.
- The default is to store it in
- Several other directories and files should be mounted from a persistent location outside of the docker container.:
- the WeBWorK log file directory
webwork2/logs/
, - the Apache logs directory
/var/log/apache2
(possibly relocated by Apache config) - the WeBWorK
webwork2/htdocs/tmp
directory, htdocs/my_site_info.txt
- (optional) the OPL
- local WeBWorK configuration files:
conf/localOverrides.conf
conf/site.conf
conf/authen_LTI.conf
- the WeBWorK log file directory
- Local Apache configuration / default files should be created and mounted from appropriate locations:
-
var/www/html/index.html
- Set your server URL for the
Refresh
line and the<a href=...">
setting.
- Set your server URL for the
-
/var/www/html/.htaccess
- To be used if you are running with SSL and want to redirect all non-SSL traffic to SSL.
- Set your server URL for the
Redirect
to https line.
-
/etc/apache2/sites-available/000-default.conf
- Set
ServerName
,ServerAdmin
, andServerAlias
in the lastVirtualHost
block. - Set the
Redirect permanent
if redirecting all traffic to SSL.
- Set
-
/etc/apache2/apache2.conf
- Set
ServerName
,ServerAdmin
- Set
-
/etc/apache2/mods-enabled/mpm_prefork.conf
- Set suitable values for the amount of RAM available. See:
- http://webwork.maa.org/wiki/Installation_Manual_for_2.12_on_Ubuntu_16.04#Configuring_Apache%EF%BB%BF
- http://webwork.maa.org/moodle/mod/forum/discuss.php?d=3904
- http://webwork.maa.org/moodle/mod/forum/discuss.php?d=3827
- http://webwork.maa.org/moodle/mod/forum/discuss.php?d=3928
- http://webwork.maa.org/moodle/mod/forum/discuss.php?d=4331
- http://hirebenjam.in/tag/webwork/
- Set suitable values for the amount of RAM available. See:
- for SSL:
- You need to provide your own SSL key, CA-signed SSL certificate, and probably a CA "chain file" and mount them or a directory containing all 3 files to the location you set in the configuration files.
- The sample files assume it/thet will be mounted to
/etc/ssl/local
/etc/apache2/mods-available/ssl.conf
-
/etc/apache2/sites-available/default-ssl.conf
- Adjust the in container location of the SSLCertificateFile/KeyFile/ChainFail files in both
VirtualHost
blocks. - Set
ServerName
,ServerAdmin
, andServerAlias
in the secondVirtualHost
block.
- Adjust the in container location of the SSLCertificateFile/KeyFile/ChainFail files in both
-
- Set the
hostname:
- Adjust the
ports:
for production vs. personal PC use - Set/adjust the environment variables section
environment:
-
SSL: 1
to turn on SSL -
PAPERSIZE: size
to change the default system paper-size (defaults toletter
anda4
or something else may be desired) -
ADD_LOCALES:
can be used to set which locales which will be generated and available in the running container. -
ADD_PACKAGES:
can be used to have additional Ubuntu packages (exvim
) installed in the running container. (Such packages additions are not persistent and will be reinstalled each container start-up.) -
SYSTEM_TIMEZONE:
can set the server timezone of the running container. (The default isUTC
.) -
WEBWORK_ROOT_URL:
can set the URL, and should be used in particular if you are using SSL. -
WEBWORK_SMTP_SERVER:
,WEBWORK_SMTP_SENDER:
sets these environment variables used by the running container. -
WEBWORK_TIMEZONE:
sets the timezone WeBWorK uses by default.
-