zena@dreamhost

An article by Gaspard Bucher

Once you are familiar with the basics of dreamhost cpanel and app deployment, you can install Zena on a shared host starting from version 1.1.0.

Installation and setup

rvm

You need to install your own set of gems, so let’s start with the ruby gem manager rvm :

$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
$ source .bashrc

ruby 1.8.7

$ rvm install 1.8.7
$ rvm use 1.8.7 --default

ImageMagick

$ wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
$ tar xzf ImageMagick.tar.gz
$ cd ImageMagick-*/
$ ./configure --without-perl --without-magick-plus-plus --prefix=$HOME/local
$ make && make install

Add this line at the top of your ”.bashrc” file so that “rmagick” can find the required headers and library files:

export PATH=$PATH:$HOME/local/bin
export RAILS_ENV=production

Source the bashrc:

$ source .bashrc

gems

$ gem install rake     --no-ri --no-rdoc
$ gem install zena     --no-ri --no-rdoc
$ gem install mysql    --no-ri --no-rdoc
$ gem install rmagick  --no-ri --no-rdoc

create application

$ zena new myapp
$ cd myapp

We are now in the applications directory

configure environment

Find the current gem path (“INSTALLATION DIRECTORY”):

$ gem env

Edit “config/environment.rb” and add the following line at the top of the file (replacing THE_PATH with the proper gem path:

ENV['GEM_PATH']="THE_PATH"

configure database

Create a database in dreamhost control panel and edit “config/database.yml” :

login: &mysql_login
  adapter: mysql
  host: mysql.YOURDOMAIN.com
  port: 3306
  username: SOME_USER
  password: SOME_PASSWORD

production:
  database: APP_NAME
  encoding: utf8
  <<: *mysql_login

Create website

$ zena mksite HOST=YOURDOMAIN.com PASSWORD=ADMIN_PASSWORD LANG=en

In order for Zena’s caching to work, you need to enable single website mode by editing “config/bricks.yml” :

production:
  ...
  single: ON

Configure dreamhost domain

In the configuration panel for the domain, set “run user” to the user where all this is installed and set the public directory to:

/home/username/myapp/public

This configuration can take a couple of minutes to update.

Final note

This is a basic setup without some of the advance features of zena (worker, sphinx indexing, pdf generation, etc). This installation should let you get started but there are still some things you should take care of:

  1. log/production.log will grow forever and crash your app if you do not logrotate or use a cron job to truncate it.
  2. upload progress will not work (you need a drb worker for this to work)

Once your application is running, you can have a look at some existing websites with their templates to get you started: sites running zena.

Have fun and let us know if this documentation is outdated so that we can fix it.