-
-
Notifications
You must be signed in to change notification settings - Fork 165
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.confReplacements
-
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 isww3 => 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.
Now that you have the ww3 code there are two was to integrate it with apache.
- Using a fast-cgi script (default)
- Use Proxy on apache and run dancer via a service
You should pick either the Fast CGI script option below or the Proxy Passthrough options below, but not both.
###Fast CGI script
This option uses Fast CGI
First, install fcgid using your distros package manager.
- CentOS, Fedora, etc...:
yum install mod_fcgid
- Ubuntu, Debian, etc...:
apt-get install libapache2-mod-fcgid
Make sure the webwork3 Fast CGI lines are uncommented in the apache configuration file. The important code is:
my $webwork3_htdocs_dir = $webwork_dir."/webwork3/public";
# Set up /webwork3 to point to the dispatch cgi
push @Alias, [ "/webwork3/js" => "$webwork3_htdocs_dir/js"];
push @Alias, [ "/webwork3/css" => "$webwork3_htdocs_dir/css"];
push @Alias, [ "/webwork3/images" => "$webwork3_htdocs_dir/images"];
push @PerlConfig, "ScriptAlias /webwork3 $webwork3_htdocs_dir/dispatch.fcgi";
# Allow cgi to run in the webwork3 dir
$Directory{"$webwork3_htdocs_dir"} = {
AllowOverride => "None",
Options => "+ExecCGI -MultiViews +SymLinksIfOwnerMatch",
Order => "allow,deny",
Allow => "from all",
AddHandler => "fcgid-script .fcgi",
};
Now restart the webserver. If it doesnt work here are some things you can do to troubleshoot
- From
webwork2
runperl webwork3/bin/app.pl
. This starts dancer manually and should run with no errors. - From
webwork2
runperl webwork3/public/dispatch.fcgi
. If running properly this should produce a single error about STDIN. - Sometimes the handle
fcgid-script
above should befcgi-script
. Its not clear when this happens and there aren't good errors.
* 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
- Start Dancer from command line and run it in background
- edit the script /opt/webwork/webwork2/bin/startDancer to ensure that the webwork2 and pg perl libraries are set correctly. (Note: we should have this detected automatically.)
-
startDancer
(or can run in background with & at the end) - Sample Output :
[23094] core @0.000015>
loading Dancer::Handler::Standalone handler in /Volumes/WW_test/opt/local/lib/perl5/site_perl/5.12.3/Dancer/Handler.pm l. 45
[23094] core @0.000281> loading handler 'Dancer::Handler::Standalone' in /Volumes/WW_test/opt/local/lib/perl5/site_perl/5.12.3/Dancer.pm l. 483
>> Dancer 1.3118 server 23094 listening on http://0.0.0.0:3000
>> Dancer::Plugin::Database::Core (0.04)
>> Dancer::Plugin::Database::Core::Handle (0.02)
>> Dancer::Plugin::Database (2.08)
>> Dancer::Plugin::Ajax (1.00)
== Entering the development dance floor ...
Keep this window open to see error messages from Dancer. Use control-C to end the job and close Dancer, unless you have set Dancer up as a background job.
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
- I have a request to install CPAN module Path::Class