Skip to content

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:

  1. 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 the webwork database and the same value needs to also be set for WEBWORK_DB_PASSWORD: in the environment: section further down in the file.
  2. 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 your docker-compose.yml per VM in a special per-VM directory, and have each one point to the central location of webwork2 using the settings in the build: section of the file. Sample lines are included.
  3. It is possible to mount webwork2/ and/or pg/ 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.
  4. 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 a ww-docker-data directory will be in parallel to the webwork2 directory.
    • For production servers, a more appropriate location should be used.
  5. 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
  6. Local Apache configuration / default files should be created and mounted from appropriate locations:
  7. Set the hostname:
  8. Adjust the ports: for production vs. personal PC use
  9. Set/adjust the environment variables section environment:
    • SSL: 1 to turn on SSL
    • PAPERSIZE: size to change the default system paper-size (defaults to letter and a4 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 (ex vim) 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 is UTC.)
    • 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.