How to set up Sql-Ledger to serve from AOLserver

From AOLserver Wiki
Jump to navigation Jump to search

Install SQL-Ledger with the following modifications:

Note that I'm using this on an isolated LAN so have not done any testing to verify the integrity of SQL-Ledger security on it.

Be sure AOLserver is installed, and shutdown.

We adapt the instructions for setting setting up httpd (aolserver's nsd in this case):

  • Download and build the AOLserver nscgi module. Usually nscgi is already included with the AOLserver distribution.

You can see examples of how to build AOLserver modules by reading the AOLserver install docs for OpenACS 5.2.

In the OpenACS config.tcl file, activate the nscgi module in this section:

ns_section ns/server/${server}/modules 
ns_param   nscgi              ${bindir}/nscgi.so

And modify the nscgi module configuration in config.tcl to something like this:

ns_section "ns/server/${server}/module/nscgi"
ns_param   map "GET  /sql-ledger /usr/local/sql-ledger"
ns_param   map "GET  /sql-ledger/css /usr/local/sql-ledger/css"
ns_param   map "POST /sql-ledger /usr/local/sql-ledger"
# ns_param   map "POST /sql-ledger/css /usr/local/sql-ledger/css"
# there is no need to post to css files ;)
ns_param   Interps CGIinterps

ns_section "ns/interps/CGIinterps"
ns_param   .pl "/usr/bin/perl"

Security: Jon Griffin has some advice about nscgi and security at http://jongriffin.com/static/consultant/nscgi For greater security, map each .pl file individually that is in the directories mapped above. For example:

#      ns_param   map "GET  /sql-ledger /usr/local/sql-ledger"                                                              
# becomes:                                                      
      ns_param   map "GET  /sql-ledger/admin.pl /usr/local/sql-ledger/admin.pl"
      ns_param   map "GET  /sql-ledger/login.pl /usr/local/sql-ledger/login.pl"
      ns_param   map "GET  /sql-ledger/am.pl /usr/local/sql-ledger/am.pl"
      ns_param   map "GET  /sql-ledger/ap.pl /usr/local/sql-ledger/ap.pl"
      ns_param   map "GET  /sql-ledger/ar.pl /usr/local/sql-ledger/ar.pl"
      ns_param   map "GET  /sql-ledger/bp.pl /usr/local/sql-ledger/bp.pl"
      ns_param   map "GET  /sql-ledger/ca.pl /usr/local/sql-ledger/ca.pl"
      ns_param   map "GET  /sql-ledger/cp.pl /usr/local/sql-ledger/cp.pl"
      ns_param   map "GET  /sql-ledger/ct.pl /usr/local/sql-ledger/ct.pl"
      ns_param   map "GET  /sql-ledger/gl.pl /usr/local/sql-ledger/gl.pl"
      ns_param   map "GET  /sql-ledger/hr.pl /usr/local/sql-ledger/hr.pl"
      ns_param   map "GET  /sql-ledger/ic.pl /usr/local/sql-ledger/ic.pl"
      ns_param   map "GET  /sql-ledger/ir.pl /usr/local/sql-ledger/ir.pl"
      ns_param   map "GET  /sql-ledger/is.pl /usr/local/sql-ledger/is.pl"
      ns_param   map "GET  /sql-ledger/jc.pl /usr/local/sql-ledger/jc.pl"
      ns_param   map "GET  /sql-ledger/menu.pl /usr/local/sql-ledger/menu.pl"
      ns_param   map "GET  /sql-ledger/oe.pl /usr/local/sql-ledger/oe.pl"
      ns_param   map "GET  /sql-ledger/pe.pl /usr/local/sql-ledger/pe.pl"
      ns_param   map "GET  /sql-ledger/ps.pl /usr/local/sql-ledger/ps.pl"
      ns_param   map "GET  /sql-ledger/rc.pl /usr/local/sql-ledger/rc.pl"
      ns_param   map "GET  /sql-ledger/rp.pl /usr/local/sql-ledger/rp.pl"
      # skipping: setup.pl                                             
      # have to specify images too:                                                                                                 
      ns_param   map "GET  /sql-ledger/favicon.ico /usr/local/sql-ledger/favicon.ico"
      ns_param   map "GET  /sql-ledger/sql-ledger.gif /usr/local/sql-ledger/sql-ledger.gif"
      ns_param   map "GET  /sql-ledger/sql-ledger.png /usr/local/sql-ledger/sql-ledger.png"
                                                    
#       ns_param   map "GET  /sql-ledger/css /usr/local/sql-ledger/css/"                                                     
# becomes:                                                      
      ns_param   map "GET  /sql-ledger/css/sql-ledger-blue.css /usr/local/sql-ledger/css/sql-ledger-blue.css"
      ns_param   map "GET  /sql-ledger/css/sql-ledger-brown.css /usr/local/sql-ledger/css/sql-ledger-brown.css"
      ns_param   map "GET  /sql-ledger/css/sql-ledger-purple.css /usr/local/sql-ledger/css/sql-ledger-purple.css"
      ns_param   map "GET  /sql-ledger/css/sql-ledger-red.css /usr/local/sql-ledger/css/sql-ledger-red.css"
      ns_param   map "GET  /sql-ledger/css/sql-ledger-yellow.css /usr/local/sql-ledger/css/sql-ledger-yellow.css"
      ns_param   map "GET  /sql-ledger/css/sql-ledger.css /usr/local/sql-ledger/css/sql-ledger.css"
#      ns_param   map "POST /sql-ledger /usr/local/sql-ledger"                                                             
# becomes: 
      ns_param   map "POST /sql-ledger/admin.pl /usr/local/sql-ledger/admin.pl"
      ns_param   map "POST /sql-ledger/login.pl /usr/local/sql-ledger/login.pl"
      ns_param   map "POST  /sql-ledger/am.pl /usr/local/sql-ledger/am.pl"
      ns_param   map "POST  /sql-ledger/ap.pl /usr/local/sql-ledger/ap.pl"
      ns_param   map "POST  /sql-ledger/ar.pl /usr/local/sql-ledger/ar.pl"
      ns_param   map "POST  /sql-ledger/bp.pl /usr/local/sql-ledger/bp.pl"
      ns_param   map "POST  /sql-ledger/ca.pl /usr/local/sql-ledger/ca.pl"
      ns_param   map "POST  /sql-ledger/cp.pl /usr/local/sql-ledger/cp.pl"
      ns_param   map "POST  /sql-ledger/ct.pl /usr/local/sql-ledger/ct.pl"
      ns_param   map "POST  /sql-ledger/gl.pl /usr/local/sql-ledger/gl.pl"
      ns_param   map "POST  /sql-ledger/hr.pl /usr/local/sql-ledger/hr.pl"
      ns_param   map "POST  /sql-ledger/ic.pl /usr/local/sql-ledger/ic.pl"
      ns_param   map "POST  /sql-ledger/ir.pl /usr/local/sql-ledger/ir.pl"
      ns_param   map "POST  /sql-ledger/is.pl /usr/local/sql-ledger/is.pl"
      ns_param   map "POST  /sql-ledger/jc.pl /usr/local/sql-ledger/jc.pl"
      ns_param   map "POST  /sql-ledger/menu.pl /usr/local/sql-ledger/menu.pl"
      ns_param   map "POST  /sql-ledger/oe.pl /usr/local/sql-ledger/oe.pl"
      ns_param   map "POST  /sql-ledger/pe.pl /usr/local/sql-ledger/pe.pl"
      ns_param   map "POST  /sql-ledger/ps.pl /usr/local/sql-ledger/ps.pl"
      ns_param   map "POST  /sql-ledger/rc.pl /usr/local/sql-ledger/rc.pl"
      ns_param   map "POST  /sql-ledger/rp.pl /usr/local/sql-ledger/rp.pl"
      # skipping setup.pl                                                                                                   


Do *not* put the SQL-Ledger directory in the AOLserver's pageroot directory. Put sql-ledger dir in the /usr/local directory per SL docs:

mv sql-ledger /usr/local/.
# set permissions to match the rest of the aolserver files, for example:
cd /usr/local/
chown -R nsadmin:web sql-ledger
chmod -R 770 sql-ledger 
cd /usr/local/sql-ledger
chmod 640 *.gif
chmod 640 *.png
chmod 640 *.ico
cd css
chmod 660 *.css

Follow the SL directions to create a SQL-Ledger database and user for PostgreSQL, and proceed with the configuration in the SL README. Hopefully you see a login page at http://yourservername:port/sql-ledger/admin.pl and are able to follow standard SQL-Ledger configuration directions.