| 1 | {{{ |
| 2 | #!rst |
| 3 | |
| 4 | ianBMS Setup |
| 5 | ============ |
| 6 | |
| 7 | This article will guide you through the steps required in order to |
| 8 | deploy and run the ianBMS web application on a UNIX machine behind the |
| 9 | Apache 2.x web server. |
| 10 | |
| 11 | First, you need to get the ianBMS web application sources. If for some |
| 12 | peculiar reason you weren't provided with a targz'ed source distro of |
| 13 | the application, then you will probably need to get (or even make) it |
| 14 | yourself. Go to the `ianbms subversion tags`__ for the latest stable |
| 15 | release (lookup the ``webif`` subdirectory). |
| 16 | |
| 17 | .. __: http://trac.priv.inaccessnetworks.com/rsc/browser/ianbms/tags |
| 18 | |
| 19 | Dependencies |
| 20 | ------------ |
| 21 | |
| 22 | The ianBMS web app depends on a number of Python libraries either |
| 23 | homegrown (developed at inAccess that is) or 3rd-party: |
| 24 | |
| 25 | - t3cl: The TEL3 configuration language library. Go to `t3cl |
| 26 | subversion tags`__ of the TEL3 distro and get anything equal or |
| 27 | greater than version **5.0**. |
| 28 | |
| 29 | .. __: http://trac.priv.inaccessnetworks.com/rsc/browser/tel3dist/t3cl/tags |
| 30 | |
| 31 | - logtools: A library (and set of tools) for creating, accessing and graphing IOB data. This |
| 32 | library is a custom wrapper over the rrdtool, and has the following dependencies: |
| 33 | |
| 34 | - python-dateutil_ version 1.3 |
| 35 | |
| 36 | .. _python-dateutil: http://labix.org/python-dateutil |
| 37 | |
| 38 | - rrdtool_ 1.2.19 or greater |
| 39 | |
| 40 | .. _rrdtool: http://oss.oetiker.ch/rrdtool/ |
| 41 | |
| 42 | - py-rrdtool_: Custom Python bindings for rrdtool (i.e. not the ones shipped in the |
| 43 | rrdtool distribution). |
| 44 | |
| 45 | .. _py-rrdtool: http://sourceforge.net/projects/py-rrdtool/ |
| 46 | |
| 47 | |
| 48 | |
| 49 | - CherryPy_: The web application framework. Version should be |
| 50 | **3.0.2** or higher. Chances are, your distro has not packaged a 3.x version |
| 51 | of our (at least at the time of this writing) favourite webdev framework. |
| 52 | |
| 53 | .. _CherryPy: http://www.cherrypy.org |
| 54 | |
| 55 | - Cheetah_: The template engine. Version should be **2.0.1** or |
| 56 | higher. Both Debian and Ubuntu should provide such a package. |
| 57 | |
| 58 | .. _Cheetah: http://www.cheetahtemplate.org |
| 59 | |
| 60 | - python-ldap_: Python library for communicating with LDAP |
| 61 | servers. Version should be **2.2.1** or higher. I bet you will find |
| 62 | the required version in a package under Debian / Ubuntu. |
| 63 | |
| 64 | .. _python-ldap: http://python-ldap.sourceforge.net/ |
| 65 | |
| 66 | - scgi_: The ``mod_csgi`` Apache 2.x module. You will be needing |
| 67 | version **1.12** or higher. You will be able to find this library wrapped |
| 68 | up in package under Debian or Ubuntu. |
| 69 | |
| 70 | .. _scgi: http://python.ca/scgi/ |
| 71 | |
| 72 | - flup_: A library providing a set of scgi servers. Version should be |
| 73 | equal or greater that **1.0**. Not sure if Debian or Ubuntu provides the |
| 74 | required version of this package. |
| 75 | |
| 76 | .. _flup: http://trac.saddi.com/flup |
| 77 | |
| 78 | mod_csgi configuration |
| 79 | ---------------------- |
| 80 | |
| 81 | A sample config file for the scgi apache module: :: |
| 82 | |
| 83 | /etc/apache2/mods-available/scgi.conf |
| 84 | |
| 85 | <IfModule mod_scgi.c> |
| 86 | <Location "/ianbms"> |
| 87 | # Enable SCGI delegation |
| 88 | SCGIHandler On |
| 89 | # Delegate requests in the "/ianbms" path to daemon on local |
| 90 | # server, port 4000 |
| 91 | SCGIServer 127.0.0.1:4000 |
| 92 | </Location> |
| 93 | </IfModule> |
| 94 | |
| 95 | For more info take a look at this__. |
| 96 | |
| 97 | .. __: http://trac.priv.inaccessnetworks.com/rsc/wiki/PythonWebAppDev#install-and-configure-the-scgi-module |
| 98 | |
| 99 | ianBMS installation |
| 100 | ------------------- |
| 101 | |
| 102 | I bet you know the drill: it's the usual ``python setup.py install`` |
| 103 | stuff. Use the ``--prefix=INSTALL_DIR`` or ``--home=POSSIBLY_A_HOME_DIR`` |
| 104 | to override the default installation path. Note that the init script that is automatically |
| 105 | generated causes the web app server to chuid to the user that installed the app, unless of course it's |
| 106 | root. For instance, if user "ianbms" installs the app, say in his home directory, then the init script |
| 107 | will cause the daemon to chuid to "ianbms". The setup attempts to install this init script under "/etc/init.d/", |
| 108 | and since user "ianbms" will probably not have write access to that directory, this will fail. So, the init script should |
| 109 | be sudo-copied there. It can be found in the "scripts" directory of the app's source distro under the name "ianbms". |
| 110 | |
| 111 | Configuring ianBMS |
| 112 | ------------------ |
| 113 | |
| 114 | Look for the ``ianbms.conf`` file under the ``etc`` subdirectory of |
| 115 | your root installation directory. This is a sample configuration file |
| 116 | that will be used by default. If you want to put it in an another |
| 117 | place, be user to update the ``/etc/init.d/ianbms`` init script |
| 118 | accordingly. |
| 119 | |
| 120 | Bringing the daemon to life |
| 121 | --------------------------- |
| 122 | |
| 123 | Simple as : :: |
| 124 | |
| 125 | /etc/init.d/ianbms start |
| 126 | |
| 127 | In order to shut it down: :: |
| 128 | |
| 129 | /etc/init.d/ianbms stop |
| 130 | |
| 131 | Testimonies |
| 132 | ----------- |
| 133 | |
| 134 | Deployment has already taken place on an Ubuntu machine running 7.04 |
| 135 | Feisty Fawn; it worked like a charm. Debian Etch will get on your nerves because most of the packages needed don't play with Python 2.5. Moreover, you will definitely need the attached patch for compiling python-ldap for python 2.5! |
| 136 | |
| 137 | Other useful stuff |
| 138 | ------------------ |
| 139 | |
| 140 | You may read :trac:`PythonWebAppDev npat's notes on Python web development`. |
| 141 | |
| 142 | |
| 143 | }}} |