Installation instructions

epeli edited this page Jun 11, 2012 · 18 revisions

Background information

Operating system and versio: Ubuntu 10.4
Database: sqlite3 for development and PostgreSQL for production.

Get the sources

Get Puavo-users source code:

git clone git://github.com/opinsys/puavo-users.git

Fetch submodules

cd puavo-users
git submodule init
git submodule update

Dependencies

Ruby

sudo apt-get install ruby rubygems irb  ruby1.8-dev

Debian packages

Install following packages from Ubuntu repositories:

10.04 LTS (Lucid Lynx):

sudo apt-get install libxml2-dev libxslt-dev \
  libsqlite3-dev ldap-utils libpq-dev libmagick9-dev \
  libssl-dev build-essential libopenssl-ruby xpdf-utils

12.04 LRS (Precise Pangolin):

sudo apt-get install libxml2-dev libxslt-dev  \
  libsqlite3-dev libmagickwand-dev ldap-utils libpq-dev  \
  libssl-dev build-essential libopenssl-ruby xpdf-utils

Use bundler to install all the required Ruby Gems

sudo gem install bundler

and in puavo-users/

bundle install

RVM

If you are using RVM there are few gotchas we have to workaround.

Too new RubyGems. Fix it by downgrading:

gem update --system 1.5.3

Too new Rake. `bundle exec rake` can be used to spawn correct rake, but you can
also remove the new one from the global gemset.

rvm use @global
gem uninstall rake
rvm use @ # go back to your gemset

Configurations and database initialization

You can copy default configurations from example files:

cd puavo-users/config
cp organisations.yml.example organisations.yml
cp ldap.yml.example ldap.yml
cp database.yml.example database.yml

Check configurations and set your own values.

config/ldap.yml
Set correct password value (uid=puavo,o=puavo users’s password).

config/organisations.yml
If you have only one organisation you have to change only name, ldap_host and ldap_base to default organisation configuration.

default:
  name: Example organisation
  host: *
  ldap_host: localhost
  ldap_base: dc=edu,dc=example,dc=org

Puavo Users support multi-organisations. Application find organisation configuration from file by request host. If host not found using default organisation’s configuration (host: *).

Create sessions table to database

cd puavo-users
rake db:migrate
rake RAILS_ENV=test db:migrate
rake RAILS_ENV=production db:migrate

Production server setup

Is recommended to use Passenger when like to run Puavo Users in production. It is very easy!

Apache and Passenger installation

sudo apt-get install apache2 libapache2-mod-passenger

Apache example configuration

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        PassengerDefaultUser www-data

        DocumentRoot /var/www/puavo-users/public

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined

</VirtualHost>

SSL configuration using self-signed certificate

Create self-signed certificate

Enable ssl and create certificate:

sudo a2enmod ssl
sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf puavo.pem
# -> Domain name: *.puavo.net
sudo mkdir /etc/apache2/ssl
sudo cp puavo.pem /etc/apache2/ssl
sudo chown www-data.www-data /etc/apache/ssl/puavo.pem

Apache SSL example configuration

<VirtualHost *:443>
	SSLEngine On
	SSLCertificateFile /etc/apache2/ssl/puavo.pem

	ServerAdmin webmaster@puavo.net

        PassengerDefaultUser www-data

        DocumentRoot /var/www/puavo-users/public

	ErrorLog /var/log/apache2/error.log
	CustomLog /var/log/apache2/access.log combined
	LogLevel warn
</VirtualHost>

Development server

Start development server

cd puavo-users
./script/server