Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ courses.dist
library-directory-tree.json
library-subject-tree.json
textbook-tree.json
development.yml
*~
<<<<<<< HEAD
/webwork3/public/js/bower_components/*
Expand Down
36 changes: 26 additions & 10 deletions conf/webwork.apache2-config.dist
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
# The "show source" button is most useful for webwork "courses" used to train new authors
# It is not desirable to expose the code of regular homework questions to students

ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2


#ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2

PerlModule mod_perl2

Expand Down Expand Up @@ -97,7 +95,6 @@ eval "use lib '$pg_dir/lib'"; die $@ if $@;

require Apache::WeBWorK; # force compilation of pretty much everything


# At this point, the following configuration variables should be present for use
# in wiring WeBWorK into Apache:
#
Expand Down Expand Up @@ -149,18 +146,37 @@ if ($webwork_url eq "") {
$Location{$webwork_htdocs_url} = { SetHandler => "none" };
}

</Perl>

####################################################################
# The RESTful webservice is to be running on port 3000 and this allows
# proper connection to it.
####################################################################
##########################################################################
# WeBWork 3
# This sets up webwork 3 to be served via dancer via cgi
# If you want to serve webwork 3 directly through dancer comment
# out the following block, and then uncomment the proxy pass lines below
# You will need to start dancer manually, or set it up as service
##########################################################################

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 => "fastcgi-script .fcgi",
};

</Perl>

# These lines are for service WeBWork 3 through dancer directly.
#ProxyPass /webwork3 http://localhost:3000
#ProxyPassReverse /webwork3 http://localhost:3000


####################################################################
# WebworkSOAP handlers (for integration with moodle)
####################################################################
Expand Down
31 changes: 28 additions & 3 deletions conf/webwork.apache2.4-config.dist
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
# The "show source" button is most useful for webwork "courses" used to train new authors
# It is not desirable to expose the code of regular homework questions to students

ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2


#ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2

PerlModule mod_perl2

Expand Down Expand Up @@ -145,8 +143,35 @@ if ($webwork_url eq "") {
$Location{$webwork_htdocs_url} = { SetHandler => "none" };
}

##########################################################################
# WeBWork 3
# This sets up webwork 3 to be served via dancer via cgi
# If you want to serve webwork 3 directly through dancer comment
# out the following block, and then uncomment the proxy pass lines below
# You will need to start dancer manually, or set it up as service
##########################################################################

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",
Require => "all granted",
AddHandler => "fastcgi-script .fcgi",
};

</Perl>

# These lines are for service WeBWork 3 through dancer directly.
#ProxyPass /webwork3 http://localhost:3000
#ProxyPassReverse /webwork3 http://localhost:3000

####################################################################
# WebworkSOAP handlers (for integration with moodle)
####################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# configuration file for development environment

# configuration file for WeBWorK 3. This is a YAML formatted file, not Perl
# formatted like the other configuration files. The webwork_dir, pg_dir,
# and database information needs to be set for WeBWorK 3 to work.
#
# The webwork directory needs to be set

webwork_dir: "/opt/webwork/webwork2"
pg_dir: "/opt/webwork/pg"

# the logger engine to use
# console: log messages to STDOUT (your console where you started the
# application server)
# file: log message to a file in log/
# file: log message to a file in logs/
# Note: If you are running through apache and not a stand alone server you
# wont be able to see the log information. To see the log information you
# need to change this to file and then make sure that webwork2/webwork3/logs
# is owned, readable and writable by the wwdata group.
logger: "console"

# the log level for this environment
Expand Down
14 changes: 7 additions & 7 deletions webwork3/bin/app.pl
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/usr/bin/env perl
use Dancer;
use Dancer::Plugin::Database;
use WeBWorK::DB;

# link to WeBWorK code libraries
use lib config->{webwork_dir}.'/lib';
use lib config->{pg_dir}.'/lib';

use WeBWorK::CourseEnvironment;
use WeBWorK::DB;
use WeBWorK::Authen;

## note: Routes::Authenication must be passed first
Expand All @@ -14,10 +19,6 @@
use Routes::Settings;
use Routes::PastAnswers;





set serializer => 'JSON';

hook 'before' => sub {
Expand Down Expand Up @@ -77,7 +78,7 @@

} else {
return {logged_in=>0};
}
}
};


Expand All @@ -97,7 +98,6 @@
session_name=>config->{session_name},
session_secure=>config->{session_secure},
session_is_http_only=>config->{session_is_http_only},

};
};

Expand Down
1 change: 1 addition & 0 deletions webwork3/environments/development.yml
2 changes: 1 addition & 1 deletion webwork3/public/dispatch.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Plack::Runner;
# correctly to the dispatchers, so forcing PSGI and env here
# is safer.
set apphandler => 'PSGI';
set environment => 'production';
set environment => 'development';

my $psgi = path($RealBin, '..', 'bin', 'app.pl');
die "Unable to read startup script: $psgi" unless -r $psgi;
Expand Down
4 changes: 2 additions & 2 deletions webwork3/public/dispatch.fcgi
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use Plack::Handler::FCGI;
# correctly to the dispatchers, so forcing PSGI and env here
# is safer.
set apphandler => 'PSGI';
set environment => 'production';
set environment => 'development';

my $psgi = path($RealBin, '..', 'bin', 'app.pl');
my $app = do($psgi);
die "Unable to read startup script: $@" if $@;
my $server = Plack::Handler::FCGI->new(nproc => 5, detach => 1);
my $server = Plack::Handler::FCGI->new(nproc => 1, detach => 1);

$server->run($app);