Installing WB

Luca Fini (lfini@arcetri.astro.it). September 2006

About Install Config Usage Copyright F.A.Q.

Moving files to place

To proceed with WB installation you must first locate two directories on the machine which holds your web server: the CGI directory and the document root. The CGI directory is where you must put CGI executables so that the Web server can execute them. This may vary for different sites; usual places are:
/usr/local/apache/cgi-bin
/var/www/cgi-bin
The document root will also be somewhere, depending on the configuration of your server; usual places are:
/var/www/html
/opt/htdocs
/var/htdocs
and the like.

Note: If you're running an apache Web server you can find out the location of the two directories into the configuration file (httpd.conf). You must look for the variables: ScriptAlias and DocumentRoot.

WB installation is made in a few steps:

  1. Create a subdirectory under the document root to hold all your billboards; E.g.:
    > mkdir /var/www/html/BillBoards

  2. Unpack the WB files into the billboard directory just created. E.g.:
    > tar xvfz wb.tgz
    or
    > gunzip -c wb.tgz | tar xvf

  3. Move the programs wb.py and wbmgmt.py into the CGI directory. E.g.:
    > mv wb.py wbmgmt.py /var/www/cgi-bin

  4. The http server must have permission to write to this directory. The easiest way is to define the userid which is running the server as owner of the directory. You must check your particular installation to know which is the actual userid (it is usually "apache", or maybe "cochise" or even "nobody"). You may use the ps command as follows:
    : ps -ef | grep httpd
        root   624     1  0   Jul 05 ?        0:09 /usr/local/apache2/bin/httpd 
     cochise 27509   624  0 16:34:03 ?        0:00 /usr/local/apache2/bin/httpd
     cochise 27421   624  0 16:33:05 ?        0:00 /usr/local/apache2/bin/httpd
     ..... more lines ...
    Ignore the "root" line. The other are the actual userid you need.

    Note: various Unix(Linux) versions may have sligtly different syntax for the ps command. E.g: ps aux

  5. Finally edit the wb.py code to reflect the details of you installation. Here follows the involved lines:
    # Start customization section  
    root_http   = 'http://www.my.domain/BillBoards'  
    root_dir    = '/var/www/html/BillBoards'  
    domain      = 'my.domain'         # e-mail domain  
    smtphost    = 'smtp.my.domain'    # smtp host  
    def_lang    = 'us'                # Get language from directory _lang_us
    auth_mode   = 'unix'              # Specify user authorization method
    debug       = 0                   # Set to 1 for debug output  
    def_ttl     = 600                 # Session expiring time  
    dolog       = 1                   # Set to 0 for no logging 
    As a starting point you only need to modify the first five items, as follows:

    root_http
    The URL of the BillBoard directory on your web server. In the example above we have supposed that the billboard directory has been created just under the Document Root.

    root_dir
    The directory path of the same BillBoard directory.

    domain
    Mail domain you want to be used to send notify messages. Messages will be sent as coming from the address: wb@my.domain

    smtphost
    The outgoing mail server for your domain

    def_lang
    The name of the vocabulary file supporting the desired default language (Note: different languages can be selected for each billboard defined. See: configuration).

    auth_method
    This variable may be either 'unix', or 'local'. User access for adding or updating document is protected by userid/password check. If the value is 'unix' the password check is performed with the standard unix mechanism, i.e.: authorized users must be registered as unix users on the host running the system.
    If the value is 'local' user authentication is performed against a WB specific password file which is independent from host user authentication. The local password file may be managed by using wb.py -u, wb.py -l, wb.py -r.

  6. As a final step you must ensure that the wb.py program can be executed by the web server, and the support files stored in the billboard root can be read by wb.py. For doing that you may need to properly modify the ownership or the rights of the files.

Testing the installation

  1. Try to run the wb.py from a command line, just to see what happens. E.g.:
    > python wb.py wb.py - L.Fini (lfini@arcetri.astro.it). Version 4.11, October 2005 Usage: wb.py -i directory show billboard info wb.py -m [directory] perform billboard maintenance [only on specified dir] wb.py -s bboard doc show document file structure wb.py -u user passwd add user/password to local password file wb.py -v directory show available languages
    Note: You may notice that the program wb.py can also be run as an usual program from a command line. This is useful to perform programmed maintenance on the billboards (see below).

  2. Check the "self run" line, by running again the program. E.g.:
    > /var/www/cgi-bin/wb.py
    And you should see the same output as above. If it doesn't work, check the exact path of your python interpreter. E.g.:
    > which python
    /usr/bin/python
    The same path must be written in the very first line of wb.py, as follows:
    #!/usr/bin/python

  3. Check if you can run the wb.py program as a CGI application. Just point your browser to the right URL, from anywhere on the Internet:
    http://www.my.domain/cgi-bin/wb.py
    And you should see a list of available billboards. Note: You will not actually see any billboard, because you haven't defined one as yet!

It is now time to proceed to configuration in order to define your first billboard.

Billboard directory maintenance

Expired documents can be removed from the billboard directory. It is not easy to do it at the O.S. level: file names are not obvius and documents may have attachments which must be also deleted. WB provides a function in its "maintenance" toolset to do that from the Web interface, but a system manager may want to do it automatically.

This is as simple as setting up a "cron" item which is started once per day and launches the wb.py script in maintenance mode. E.g.:

> python /var/www/cgi-bin/wb.py -m /var/www/html/BillBoards/myboard
Where "myboard" is the name of a billboard file you want to be maintained clean. The command will check all documents and orderly remove expired ones.

Debugging WB

When everything fails, you may activate a debug mode in two ways:
  1. You can copy the wb.py script into a file named wt.py (note the final "t" in the file name), and then launch wb with the new name.
  2. Editing wb.py and setting the debug variable to 1 (don't forget to set it back to 0 when finished).

When in debug mode WB will output much information when running and the standard CGI/python traceback function will be enabled.