Skip to content

Installing WeBWorK3

Peter Staab edited this page May 8, 2020 · 3 revisions

Instructions for installing WeBWorK3

Make sure that you are successfully running the current version of WeBWork2. Information on this can be found on the main webwork webpage.

The first step to installing WeBWorK3 is to get the ww3-vue branch from pstaabp repository.

NOTE: UPDATE THIS WHEN THIS GET PULLED INTO openwebwork.

  • Use git to pull the branch with new features from the openwebwork account

    • cd $WEBWORK_ROOT
    • git remote add pstaabp http://github.com/pstaabp/webwork2.git -- add the openwebwork github as remote
    • git fetch pstaabp -- update data on the server
    • git branch -t ww3-vue pstaab/ww3-vue -- create a local branch which tracks the WW3 repo
    • git checkout ww3-vue -- checkout this local branch
    • git pull -- get recent updates (probably not needed this first time)
  • Install Dancer and it's dependencies (NOTE: other modules may be needed)

    • perl /opt/webwork/webwork2/bin/check_modules.pl apache2

      This should show you want modules still need to be installed.

  • Configure Dancer

    • cp webwork3.conf.dist webwork3.conf -- copy the distribution file to your version of webwork3.conf

      Replacements

      • webwork_dir: /opt/webwork/webwork2 -- define toplevel webwork directory
      • top_dir: webwork3/ -- defines that URL route starts with webwork3
      • pg_dir: /opt/webwork/pg -- define pg directory
      • plugins:Database:password: "password" -- replace password with the webworkWrite password for mysql
    • Edit file: webwork2/conf/localOverrides.conf

    • This should be copied from or updated from localOverrides.conf.dist. The key line is ww3 => 1 which has to be part of the %showEditors hash. NOTE: This doesn't work yet.

    • Edit file: webwork2/conf/webwork.apache2.4-config as appropriate.

    • This should be copied from or updated from the corresponding .dist file. The important lines are around line 200:

ServerName localhost # set this if not above.
    SSLProxyEngine On
    SSLProxyCheckPeerCN on
    SSLProxyCheckPeerExpire on

ProxyPass /webwork3/ http://localhost:5000/
ProxyPassReverse /webwork3/ http://localhost:5000/

If you have SSL on the server the top 3 lines need to be set.

Set up webwork3 Dancer2 code as a standalone service.

There are a number of ways to do this and tie into apache, which is important to keep the webwork2 side of things functional. See the Dancer2 deployment page for other options. Here we are going to set up Dancer2 as a standalone service.

Note: the fast cgi script option seems to be deprecated.

Proxy Passthrough

* Make sure the mod_proxy and mod_proxy_http are installed and enabled for apache (not commented out).
    * In the httpd.conf file -- the locations of the .so files may vary.
        * `LoadModule proxy_module ( modules/mod_proxy.so)`
        * `LoadModule proxy_http_module (modules/mod_proxy_http.so )`
    * or use a2enmod  or symlinks to enable these modules (e.g. in ubuntu)
* Add this to webwork2/conf/webwork.apache2-config   just after the <Perl>... </Perl> section:
* These lines are in webwork.apache2-config.dist where they are commented out.
  ProxyPass /webwork3 http://localhost:3000
  ProxyPassReverse /webwork3 http://localhost:3000
  <Proxy *>
      Order allow,deny
      Allow from all
  </Proxy>
  • Permissions

    • cd .../logs
    • chmod 777 debug.log -- so that both Dancer and apache can write to log
    • if this is a brand new installation there are other permissions that need to be set on webwork2 directories
  • Restart apache and webwork

  • Setting up the dancer2 application as a system service. Note: these are instructions for ubuntu and other server systems are similar.

    1. copy $WEBWORK_HOME/conf/webwork3.server.dist to /etc/systemd/system/webwork3.service
    2. Make any path changes to /etc/systemd/system/webwork3.service especially if $WEBWORK_HOME is not /opt/webwork/webwork2.
    3. Make any path changes to $WEBWORK_HOME/bin/webwork3.sh especially if $WEBWORK_HOME is not /opt/webwork/webwork2.
    4. start up webwork3 using sudo systemctl start webwork3.
    5. check that it is running by sudo systemctl status webwork3. It should look like:
    ● webwork3.service - webwork3 perl dancer2 service
       Loaded: loaded (/etc/systemd/system/webwork3.service; enabled; vendor preset: enabled)
       Active: active (running) since Wed 2020-05-06 17:15:57 UTC; 1 day 21h ago
       Main PID: 23251 (webwork3-servic)
         Tasks: 2 (limit: 1078)
         Memory: 173.3M
         CGroup: /system.slice/webwork3.service
            ├─23251 /bin/bash /opt/webwork/webwork2/bin/webwork3-service.sh
            └─23252 /usr/local/bin/plackup
    

Testing Webwork 3

TODO: UPDATE THIS SECTION

Note: this is assuming it is running on localhost. If not, below replace localhost with your server name.

  • localhost:3000
    • should return 404 error page with "Powered by Dancer" at the bottom.
    • messages should appear in the window running dancer
    • means Dancer is running
  • localhost/webwork3
    • should give the same error page signed by Dancer
    • messages should appear in the window running dancer
    • Proxy redirect to Dancer works
  • localhost/webwork3/app-info
    • Should return a JSON object similar to:
{
   "session_is_http_only" : null,
   "template" : "template_toolkit",
   "session_name" : null,
   "appdir" : "/opt/webwork/webwork2/webwork3/bin/..",
   "startup_info" : 1,
   "port" : "3000",
   "environment" : "development",
   "content_type" : "text/html",
   "session" : "YAML",
   "session_secure" : null,
   "server" : "0.0.0.0",
   "session_expires" : null,
   "logger" : "console"
}

However the parameter could differ depending on your setup. Dancer is running this is info about the webwork3 webapp.

  • localhost/webwork2 -- choose your course -- everything will work perfectly!!!!

  • testing fcgi

    • run httpd -M to see if mod_fcgid is there
    • you can run perl on webwork3/public/dispatch.fcgi
  • Report issues using "Bugs" button in new-ui

What could possibly go wrong?

  • I have a request to install CPAN module Path::Class