Do not directly modify any of the files in the initial git clone of webwork2. If a filename contains .dist
then the
file is intended to be copied to a file by the same name without .dist
and the copy modified as needed. Specific
instructions are given below. If a filename does contain .dist
then it should not be modified. If changes
are made to .dist
files, then the modifications will be lost or cause conflict when webwork2 is upgraded.
Basic webwork2 configuration files.
site.conf.dist
should be copied tosite.conf
, and contains global variables required for basic server configuration. This file is read first in the initialization sequence.defaults.config
contains initial settings for many customizable options in WeBWorK. This file is read second in the initialization sequence. This file should not be changedlocalOverrides.conf.dist
should be copied tolocalOverrides.conf
.localOverrides.conf
will be read after thedefaults.config
file is processed and will overwrite configurations indefaults.config
. Use this file to make changes to the settings indefaults.config
.
Configuration extension files.
authen_LTI.conf.dist
should be copied toauthen_LTI.conf
if you want to allow LTI authentication into webwork2 from an LMS.LTIConfigVariables.config
includes some additional variables used byauthen_LTI.conf
and is included by that file.authen_CAS.conf.dist
should be copied toauthen_CAS.conf
to configure CAS authentication.authen_ldap.conf.dist
should be copied toauthen_ldap.conf
to configure LDAP authentication.
Server configuration files.
webwork2.mojolicious.dist.yml
contains the webwork2 Mojolicious app configuration settings. Copy this file towebwork2.mojolicious.yml
if you need to change those settings. You usually will need to do this. This file contains server settings, database settings and paths to external programs.webwork2.dist.service
is a systemd configuration file for linux systems that serves the webwork2 app via the Mojolicious hypnotoad server. If you need to change it, then copy it towebwork2.service
.webwork2-job-queue.dist.service
is a systemd configuration file for linux systems that runs the webwork2 job queue via Minion. If you need to change it, then copy it towebwork2-job-queue.service
.webwork2.apache2.4.dist.conf
is only used if you proxy hypnotoad via apache2. Copy this towebwork2.apache2.4.conf
if any changes need to be made.webwork2.nginx.dist.conf
is only used if you proxy hypnotoad via nginx. Copy this towebwork2.nginx.conf
if any changes need to be made.
- Copy
site.conf.dist
tosite.conf
andlocalOverrides.conf.dist
tolocalOverrides.conf
, and adjust the variables insite.conf
as needed. In particular you will need to set$server_root_url
to the server name, and set$database_password
to the password for the database. - Adjust the variables in
localOverrides.conf
to customize your server for your needs. - Copy any of the other
.dist
files and adjust the variables in them as needed. Note that those files will need to be included by thelocalOverrides.conf
file.
Examine the differences between your copies of the .dist
files and the corresponding .dist
files, and adjust your
copies as needed for changes to the variables that have been made. It is helpful to view a side-by-side diff
of your
copy to the corresponding .dist
file for this.
There are two important settings that you may need to change in site.conf
- make sure that
$server_root_url
is set tohttp://localhost:3000
. - make sure that
$pg_dir
is set to the top of your pg directory.
After any other changes in the initial configuration of webwork2 you are ready to run webwork2 for development. To do so from the webwork2 directory execute the following
./bin/dev_scripts/webwork2-morbo
Note that if you have permissions set for standard production use, then you may need to run this script as the server user. You can do this on Ubuntu/Debian systems or MacOS with
sudo -u www-data ./bin/dev_scripts/webwork2-morbo
Use the server user on your system instead of "www-data" if it is different.
You can now open your browser to http://localhost:3000/webwork2
.
For development and testing of the webwork2 job queue additionally execute the following.
./bin/webwork2 minion worker
Note that this needs to be run by the same user as the webwork2 app. Both need to have read and write access to the SQLite database file that is used for the job queue.
Additionally note that the Minion worker does not hot reload. You must manually restart the worker to reload with changes to the task modules.
This is the simplest way to deploy webwork2 for production. Note that you should only use this if your server is dedicated to only serving webwork2. In addition this may not work in some other cases. For instance, it may not work with Shibboleth authentication.
First set up the webwork2 Mojolicious app:
- Copy
webwork2.mojolicious.dist.yml
towebwork2.mojolicious.yml
. - Change
server_user
andserver_group
to the appropriate values for your system. On Ubuntu appropriate values arewww-data
for both. - To run the server without SSL certificates change
listen
in thehypnotoad
section at the end of the file to- http://*:80
. This is not recommended for production use. - To use SSL certificates change
listen
in thehypnotoad
section to- https://*:443?cert=/path/to/fullchain.pem&key=/path/to/privkey.pem
. - Change
proxy: 1
toproxy: 0
or comment out that line. - You may also want to adjust the other settings in the file. The
server_root_url_redirect
setting may be useful. - Instead of using that setting, you can also copy
htdocs/index.dist.html
tohtdocs/index.html
and that will be the server front page. - Install the Perl module
Mojolicious::Plugin::SetUserGroup
.
The Mojolicious hypnotoad server will be started by the root user and the user and group will be switched to what is set
for server_user
and server_group
after the app starts. It is not advisable to run the Mojolicious hypnotoad server
as a user that can directly login to the server. On Ubuntu systems you can use the www-data
user that is already
available. If a user is needed you can create the user webwork
, for example, with sudo useradd -M webwork
. Make
sure that the user has read access to the SSL certificates given in the configuration above if using certificates.
Usually the user and group will be the same.
Then set up the systemd service:
- Copy
webwork2.dist.service
towebwork2.service
. - Comment out the
User
,Group
, andEnvironment
settings in the copy. - To enable and start the service, execute
sudo systemctl enable /opt/webwork/webwork2/conf/webwork2.service
sudo systemctl start webwork2
You should now be able to open your browser to http://yoursite.edu/webwork2
or https://yoursite.edu/webwork2
.
This is a more versatile deployment approach. It allows you to use urls not consumed by webwork2 for other purposes.
First install and configure apache2. This is not covered in this document.
Then set up the webwork2 Mojolicious app:
- Copy
webwork2.mojolicious.dist.yml
towebwork2.mojolicious.yml
if you want to modify settings in that file. - Copy
webwork2.apache2.4.dist.conf
towebwork2.apache2.4.conf
. - Change the
X-Forwarded-Proto
tohttp
if you do not have SSL certificates. - Execute the following from the
/opt/webwork/webwork
directory to enable the webwork2 apache configuration:
sudo ln -s $PWD/conf/webwork2.apache2.4.conf /etc/conf-enabled/webwork2.conf
sudo a2enmod proxy proxy_http
sudo systemctl restart apache2
Now set up the systemd service:
- Copy
webwork2.dist.service
towebwork2.service
. - Execute the following to enable and start the service:
sudo systemctl enable /opt/webwork/webwork2/conf/webwork2.service
sudo systemctl start webwork2
This is a more versatile deployment approach. It allows you to use urls not consumed by webwork2 for other purposes.
First install and configure nginx. This is not covered in this document.
Then set up the webwork2 Mojolicious app:
- Copy
webwork2.mojolicious.dist.yml
towebwork2.mojolicious.yml
if you want to modify settings in that file. - Copy
webwork2.nginx.dist.conf
towebwork2.nginx.conf
if you want to modify any settings. This will setup a reverse proxy for all webwork2 paths to proxy to the hypnotoad server. Usually this file will not need to be modified. You could even use the.dist
file directly in most cases. - Edit your nginx server configuration file (this may be in
/etc/nginx/conf.d
or/etc/nginx/sites-available
) and add the lineinclude /opt/webwork/webwork2/conf/webwork2.nginx.conf;
to the end of theserver
section in that file. - Execute the following from the
/opt/webwork/webwork2
directory to enable the webwork2 nginx configuration:
sudo systemctl restart nginx
Now set up the systemd service:
- Copy
webwork2.dist.service
towebwork2.service
. - Execute the following to enable and start the service:
sudo systemctl enable /opt/webwork/webwork2/conf/webwork2.service
sudo systemctl start webwork2
Some long running processes are not directly run by the webwork2 Mojolicious app. Particularly mass grade updates via LTI and sending of instructor emails. Instead these tasks are executed via the webwork2 Minion job queue.
Set up the job queue:
- Copy
webwork2-job-queue.dist.service
towebwork2-job-queue.service
.
Then execute the following to start the job queue:
sudo systemctl enable /opt/webwork/webwork2/conf/webwork2-job-queue.service
sudo systemctl start webwork2-job-queue