Skip to content
This repository was archived by the owner on Mar 18, 2022. It is now read-only.

Installationinstructions

spawnazzo edited this page May 11, 2012 · 1 revision

Prerequisites

Open WISP Geographic Monitoring is currently being developed with Ruby on Rails 3.0.3. Being a RoR application, it can be deployed using any of the methods Rails supports. Even so, what we are currently using (and find quite stable) is the following environments:

You should take these steps to ensure you have the right gems installed on your system.

gem install bundler

bundle install --deployment

Rails 3 is much more robust when it comes to managing gems. Everything will be handed for you, you just need to use bundler to install all the required gems (along with the correct gem versions). Install the gems using the @bundler install@ command, it will also install Rails 3 itself (if required).

Downloading

Although there some beta-releases do exists, at present time the only way to download Open WISP Geographic Monitoring is to check out its svn repository

svn export https://spider.caspur.it/svn/owgm/tags/<release> owgm

You can see the releases list browsing the "OWGM Repository":http://openwisp.caspur.it/projects/owgm/repository/show/tags/

Installation

Once downloaded from the svn repository and installed the proper gem dependencies (along with any system library a specific gem may need), you can proceed installing the application.

Once deployed using your favourite environment, you need to configure one deamon Open WISP Geographic Monitoring needs to perform its usual activities (mainly checking which access point is up/down or unknown).

To do this, you can use the following @init.d@ script (customization may be needed, this script was coded for @Ubuntu 10.04@).

Startup script

The script is needed to check if access points are up or down (based on ICMP Echo requests).

The following script (Ubuntu/Debian style) should be named @owgm-daemons@. It assumes Open WISP Geographic Monitoring is running on @ruby enterprise@ and that the application was deployed to @/var/rails/owgm@. Of course you can change any of that to whatever fits your needs.

#!/bin/sh
### BEGIN INIT INFO
# Provides:          owgm-daemons
# Required-Start:    $local_fs $network  
# Required-Stop:     $local_fs $network 
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starting owgm-daemons
# Description:       Starting owgm-daemons
### END INIT INFO#

########## Variables for openwisp-daemons ##########

# The directory in which all the various OpenWisp
# applications are deployed. Generally it's /var/www
# or /var/rails
OPENWISP_BASE_PATH="/var/rails"

# The daemon you wish to start with this script
# (it must have already been deployed of course).
OPENWISP_APP="owgm" 

# The Rails environment in which the script must be run.
# It will almost always be set to production.
RAILS_ENV="production" 

####################################################

export PATH RAILS_ENV

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

bundle_exec() {
  cd $1 && bundle exec $2
  return $?
}

openwisp_daemons_start() {
  bundle_exec $OPENWISP_BASE_PATH/$OPENWISP_APP 'rake daemons:start'
}

openwisp_daemons_stop() {
  bundle_exec $OPENWISP_BASE_PATH/$OPENWISP_APP 'rake daemons:stop'
}

openwisp_daemons_restart() {
  bundle_exec $OPENWISP_BASE_PATH/$OPENWISP_APP 'rake daemons:restart'
}

openwisp_daemons_status() {
  bundle_exec $OPENWISP_BASE_PATH/$OPENWISP_APP 'rake daemons:status'
}

case "$1" in
  start)
    log_daemon_msg "Starting OpenWISP daemon" "$NAME" 
    openwisp_daemons_start
    RET="$?" 
    log_end_msg $RET
    return $RET
    ;;
  stop)
    log_daemon_msg "Stopping OpenWISP daemon" "$NAME" 
    openwisp_daemons_stop
    RET="$?" 
    log_end_msg $RET
    return $RET
    ;;
  restart)
    log_daemon_msg "Restarting OpenWISP daemon" "$NAME" 
    openwisp_daemons_restart
    RET="$?" 
    log_end_msg $RET
    return $RET
    ;;
  status)
    openwisp_daemons_status
    RET="$?" 
    return $RET
    ;;
  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}" >&2
    exit 1
    ;;
esac

exit 0

As usual, you need to

chmod +x owgm-daemons
/etc/init.d/owgm-daemons start

and enable the script to be run at boot (e.g.: with the @update-rc.d@ command).

Sample web server configuration

If you are going to use Apache2 and Passenger, you should include the following snippet to your virtual host configuration:

PassengerDefaultUser www-data

Alias /owgm "<RAILS BASE PATH>owgm/public/"
<Directory <RAILS BASE PATH>owgm/public>
   Options ExecCGI FollowSymLinks
   AllowOverride all
   Order allow,deny
   Allow from all
   RailsEnv production
   RackBaseURI "/owgm"
</Directory>

Final Configuration

In order to finalize OWGM's installation, you also have to specify some environment variables. Mostly, you have to decide if OWGM will be taking its data from a real database table or from database views built on Open Wisp Manager's data (OWM). This behaviour can be configured in the @application.rb@ file (as usual kept in the config directory) which contains the following:

DATA_FROM = {
    :table => false,
    :owm => true
}

Obviously DATA_FROM must be configured @before@ you run any database migrations (@rake db:migrate@). Please also note that currently using views build on top of OWM's data is only tested with MySQL so using other databases could result in troubles. If you have any special needs, like using database views from tables different than OWM's, you have to manually edit the SQL code in @db/migrate/@.

Clone this wiki locally