WeBWorK3 is the next generation of WeBWorK, an online open-source homework system. This version is a complete rewrite of the webwork2 system using more modern database, backend and UI frameworks, described below.
There are three main parts of this repository:
- webwork-db: basic functionality (database and other utils)
- webwork-mojo: mojolicious server backend to handle api requests.
- webwork-front-end: new webwork interface.
This is code to handle a new database structure for webwork and other utilities needed for non-gui webwork functionality.
See docs/db.md
for more information on the database.
We use Mojolicious to handle the webservices. These include some basic webpages for accessing, but more-importantly a CRUD api webservice for interacting at a service level to webwork.
The front end/client side of webwork uses quasar, a highly flexible set of interactice web components used with VueJS. The result is a Single Page Application (SPA) that runs extremely fast in that most of the client-side code is loaded at the beginning and only small api webservice requests are made and often handled in the background.
The current version of this is for DEVELOPMENT ONLY and used as a proof of concept. All of the instructions below are assuming terminal/shell commands.
- Clone the webwork3 code with
git clone https://github.com/openwebwork/webwork3.git
- Change directory to the webwork3 directory:
cd webwork3
- Copy
conf/webwork3.dist.yml
toconf/webwork3.yml
and modify it appropriately if needed.
- Make sure that
node
andnpm
are installed. - Install the Quasar cli using:
npm install -g @quasar/cli
- Make sure that you have perl (at least version 5.20) installed.
- Install
cpanm
from perl and install Mojolicious withcpanm Mojolicious
. A one-liner install is available at the Mojolicious homepage. - Start mojolicious (from the
webwork3
directory) withmorbo bin/webwork3
. - Note if there are missing perl packages, it will let you know and you can install those with
cpanm
. Also, there may missing plugins, likeDBIC
. Any Mojolicious plugins have a prefix ofMojolicious::Plugin
, so to install theDBIC
plugin, entercpanm Mojolicious::Plugin::DBIC
- If you get the message
Web application available at http://127.0.0.1:3000
then mojolicious is running and waiting for any requests.
-
Clone the repository with
git clone --recursive https://github.com/openwebwork/renderer
-
copy
render_app.conf.dist
torender_app.conf
and make any desired modifications including changing the ports from 3000 to 3001 -
install other dependencies a.
cd lib/WeBWorK/htdocs
b.npm install
-
Either install the webwork open problem library or link to a current one with a. change to the top directory of the renderer b.
ln -s PATH_TO_OPL
(end withwebwork-open-problem-library
) -
Start the standalone server with
morbo -l "http://*:3001" script/render_app
There is some fake data to get started with so there are a few courses and users. The users are all based on Simpson's characters.
- Build the database as a sqlite database. Again, from the
webwork3
directory,perl t/db/build_db.pl
. There shouldn't be an errors or output. - You can run database test, but unnecessary.
prove t/db/*.t
and hopefully (again) no errors will pop up.
This section builds all of the UI code using webpack and fires up a browser window to view the webwork3 interface.
-
Inside the
webwork3
directory, executeyarn install
ornpm install
. If you don't have yarn or npm installed, see yarn homepage or npm homepage.There are some warnings (mostly deprecations) that can be ignored.
-
Start the development server with
quasar dev
and again hopefully there are no errors. -
Visit
http://localhost:8080/webwork3/#
(or perhaps a different port) in your web browser (the output of the thequasar dev
command says where to go). -
You should get a "Login to WeBWorK" screen. You can use the Lisa Simpson account with the username
lisa
and the passwordlisa
.
TODO: add instructions for other servers and operating systems and add a docker deployment approach
- Install node version 16 with the following.
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install nodejs
-
Inside the
webwork3
directory, executeyarn install
ornpm install
. -
Build the client side user interface with
quasar build
ornpm run build
. -
Copy
webwork3/dist/spa
to/var/www/html/webwork3
(or create a link). -
Enable the necessary apache2 modules.
sudo a2enmod headers proxy proxy_http rewrite
- Copy
conf/apache2/webwork3-apache2.dist.conf
toconf/apache2/webwork3-apache2.conf
, and create a link to that file in/etc/apache2/conf-enabled
. This can be accomplished by executing the following commands from the webwork3 directory.
cp conf/apache2/webwork3-apache2.dist.conf conf/apache2/webwork3-apache2.conf
sudo ln -s $(pwd)/conf/apache2/webwork3-apache2.conf /etc/apache2/conf-enabled
-
Restart apache2 with
sudo systemctl restart apache2
. -
Set up permissions for the api with the following commands executed from the webwork3 directory.
sudo chown -R youruser:www-data logs
sudo chmod g+rw logs/*
- Copy
conf/apache2/webwork3.dist.service
toconf/apache2/webwork3.service
and modifyWorkingDirectory
with the correct path to the webwork3 location. Make sure to uncomment the hypnotoadpid_file
setting in thewebwork3.yml
file. Then enable and start the webwork3 api service by executing the following from within thewebwork3
directory.
sudo systemctl enable $(pwd)/conf/apache2/webwork3.service
sudo systemctl start webwork3
- Set up permissions for the renderer with the following commands executed from the renderer directory.
sudo chown -R youruser:www-data logs
sudo chmod g+rw logs/standalone_results.log
sudo chmod -R g+rw lib/WeBWorK/tmp/* lib/WeBWorK/htdocs/tmp/*
- Copy
conf/apache2/renderer.dist.service
toconf/apache2/renderer.service
and modifyWorkingDirectory
in the copied file with the correct path to the webwork3 location. Addpid_file => '/var/run/webwork3/renderer.pid'
andproxy => 1
to the hypnotoad configuration in therender_app.conf
file. Then enable and start the renderer service by executing the following from within thewebwork3
directory.
sudo systemctl enable $(pwd)/conf/apache2/renderer.service
sudo systemctl start renderer
Note that anytime the server is rebooted the webwork3 api and renderer services will be automatically started.
- Visit
localhost/webwork3
.