Skip to content
huerlisi edited this page Sep 13, 2010 · 10 revisions

Quick install guide for the enlightened:-)

We currently support installing on Debian 5.0 Lenny and Ubuntu 9.10 Karmic systems.

Install rubygems

To get access to the binaries provided by rails and other gems you need to extend your PATH.

export PATH=/var/lib/gems/1.8/bin:$PATH

On Debian 5.0 Lenny

We need to add lenny-backports support to get a rubygems version supporting rails 2.3.

Create the file /etc/apt/sources.list.d/lenny-backports.list with the following content:

deb http://www.backports.org/debian lenny-backports main contrib

Enable the backports repository and install rubygems:

sudo apt-get update
sudo apt-get install debian-backports-keyring
sudo apt-get install -t lenny-backports rubygems

On Ubuntu Karmic

A current rubygems is included in Ubuntu Karmic. Just install:

sudo apt-get install rubygems libruby-extras

Install Ruby’n’Rails

CyDoc is developed and tested using Rails 2.3.4.

Install rails using gem:

sudo gem install rails rake

Install CyDoc

Install current CyDoc from git repostory. We’ll use this checkout as working directory from now on:

sudo apt-get install git-core
sudo git clone http://github.com/huerlisi/CyDoc.git /srv/cydoc
cd /srv/cydoc
sudo mkdir -p vendor tmp log data/vesr
sudo cp config/database.yml.example config/database.yml

Install dependency gems:

sudo /var/lib/gems/1.8/bin/rake gems:install

Install dependency plugins:

# Install plugin package dependencies
sudo git submodule update --init
sudo git submodule update

# Run post-installation hooks
sudo /var/lib/gems/1.8/bin/rake auth:gen:site_key

Install and Configure Database

CyDoc is developed and tested using MySQL 5.0, but should work with more current MySQL version and even PostgreSQL or SQLite.

Install the MySQL server and Ruby bindings. You’ll be asked for a database root password. Just choose one, you’ll need it later on…

sudo apt-get install mysql-server libmysql-ruby

Now grant privileges to the cydoc user, replace SOME_PASSWORD with some password, you’ll need to fill in these values in the database.yml template.

mysqladmin -u root -p create cydoc_production
echo "GRANT ALL PRIVILEGES ON cydoc_production.* TO 'cydoc'@'localhost' IDENTIFIED BY 'SOME_PASSWORD'" | mysql -u root -p

Fill in above password in the database configuration:

# Edit config/database.yml

Setup database:

sudo RAILS_ENV=production /var/lib/gems/1.8/bin/rake db:setup

Finish up installation

Some parts of the ruby installation needs to be read or written by the web-server. Simplest way to grant those rights:

sudo chown -R www-data .

Restrict access to some files containing sensible information:

sudo chmod o-rwx database.yml environment.rb initializers/site_keys.rb

Install and Configure Webserver

CyLab is developed and tested using Apache 2.2 and Passenger, but should work any Webserver supporting Ruby applications.

Install Apache and Passenger:

sudo apt-get install libapache2-mod-passenger

Create a virtual host by adding a file like this to /etc/apache2/sites-available/cydoc:

<VirtualHost *:80>
    ServerName cydoc

    RailsEnv development
    DocumentRoot /srv/cydoc/public
    <Directory /srv/cydoc/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

Adapt the ServerName and probably DocumentRoot and Directory values.

Enable site and restart Apache:

sudo a2ensite cydoc
sudo a2enmod rewrite deflate

sudo /etc/init.d/apache2 restart

Install html2ps

Install the PHP commandline interpreter:

sudo apt-get install php5-cli

HTML2PS is quite heavy on memory and CPU, you thus probably need to lift resource restrictions:
Create a file /etc/php5/conf.d/cydoc.ini:

memory_limit = 512M      ; Maximum amount of memory a script may consume (32MB)

[Pcre]
;PCRE library backtracking limit.
pcre.backtrack_limit=300000

;PCRE library recursion limit.
;Please note that if you set this value to a high number you may consume all
;the available process stack and eventually crash PHP (due to reaching the
;stack size limit imposed by the Operating System).
pcre.recursion_limit=300000

HTML2PS needs write access to a cache directory:

sudo chown -R www-data /usr/local/share/html2ps/public_html/cache

Setup

See Create user

Import Databases

See Maintain External Data