Hosting documentation/Scripting languages
From Bioinformatics.Org Wiki
Hosted projects can make use of a variety of scripting languages and their associated packages. For example, you can build MVC style web-applications using:
- Perl + Catalyst
- Python + Django
- PHP + Symphony
All driven from a variety of delicious database backends.
Contents |
Perl
Local installation
Perl modules are notoriously difficult to centrally maintain on shared project servers. For this reason, and because of RedHat's slightly less than shiny reputation with managing Perl distributions, we recommend individual projects to install LOCAL copies of all Perl modules.
Oh no, bootstrap local-lib, you cry? Not so, it's much easier these days using mcpan.
Within your project directory, you can do the following:
## Step 1, install a local cpanm (and some deps) curl -k -L http://cpanmin.us \ | perl - -l local-lib App::cpanminus
This pulls down cpanm from the web, and runs it though Perl with two options, 1) telling it to install everything it needs into a directory called local-lib, and 2) telling it to install itself!
If you know what you are doing, some variant of the above is all you need. But I like to have local::lib around to help set up my shell configuration:
## Step 2, install local::lib ./local-lib/bin/cpanm \ -l local-lib local::lib
If you understood step 1, this should now be clear. So...
## Step 3, get local::lib to write out some handy config... perl \ -Ilocal-lib/lib/perl5/ \ -Mlocal::lib=`pwd`/local-lib \ > local-lib.sh ## and don't forget to 'source' the resulting config into your shell! source local-lib.sh
Seriously, don't forget that step. Put it in your diary, put it on your wall, put it in your .bashrc.
Finally, install any packages you need using cpanm, which is conveniently now in your path, and will conveniently use the 'local-lib' directory:
## Step 4, install Foo::From::CPAN
cpanm Foo::From::CPAN
Now if this is an Apache web-app, you'll need to put the above local-lib.sh configuration into your apache.conf ... or .htaccess ... if that is being used... SetEnv ... OK?
Error reporting
For debugging a Perl CGI script, you should redirect the output of error messages. Please read the following:
- CGI::Carp - CGI routines for writing to the HTTPD (or other) error log
Python
Local installation
Our Apache installation defaults to running mod_python on .py scripts. If you don't want to use the standard installation that we have, you may install Python in your home directory using Python's altinstall option, e.g.:
make altinstall prefix=~ exec-prefix=~
And then in your script, you can add the local installation path to the system path:
sys.path.insert(0,'/your/path/to/python')
We recommend that you keep some or all of your Python dependencies local. This is a good idea because server upgrades can change the versions of your dependencies and cause errors to pop up at a later date.
For Apache to run a Python binary that's installed in your local directory, you'd need to use the cgi-bin directory or WSGI. Please contact the systems administrators to set this up.
Error reporting
For debugging a Python CGI script, you should redirect the output of tracebacks. Please read the following:
- traceback — Print or retrieve a stack traceback
PHP
TBD