Installing Tracks 2.1 on Ubuntu 12.04

Setup

You will need a few packages before installing Tracks.

sudo apt-get install rubygems build-essential libssl-dev libxml2-dev libxslt-dev libsqlite3-dev libmysqld-dev ruby-rvm
sudo rvm package install openssl

*Note: debian users will need to omit package from the last command above

Getting Ruby on Rails

Install ruby 1.8.7 with rvm:

sudo rvm install ruby-1.8.7 --with-openssl-dir=/usr/share/ruby-rvm/usr

Install Required Ruby Gems

sudo gem install rdoc bundle

Getting the Source Code

We now get the latest source code for Tracks and switch to the 2.1 branch. Navigate to the directory that you want to install Tracks in and do the following:

git clone https://github.com/TracksApp/tracks.git
cd tracks
git checkout 2.1_branch
cd ../
sudo chown -R www-data:www-data tracks

Getting the bundle gems

Using the right version on ZenTest

Update the Gemfile to use version 4.6.0 of ZenTest:

gem "ZenTest", "=4.6.0"

Only using the database you need

You can use MySQL、Postgresql or SQLite for the Tracks database. If you only plan to use one of these, edit the Gemfile and comment out the one you don’t want. For example, if you do not want to use SQLite, comment out the line requiring it like this.

# gem "sqlite3"

Install

Install for use with Ruby’s server

Install the remaining gems by calling bundle:

sudo bundle install

This might take a long time!

Install for use behind Apache

If you are planning to run Tracks under Apache with the Passenger module, keep in mind that Passenger will not recognize gems specified in the Gemfile as coming from Git. The workaround is to do the following instead:

sudo bundle pack
sudo bundle install --path vendor/cache

More details can be found in this forum post.

Setting up the Database

sudo cp config/database.yml.tmpl config/database.yml
sudoedit config/database.yml

Edit database.yml based on the type of database you plan to use. The minimal install uses SQLite 3 (this eliminates the need for installing and running MySQL) but you can easily use MySQL by editingdatabase.yml accordingly.

Configure site

sudo cp config/site.yml.tmpl config/site.yml
sudoedit config/site.yml

Initialize the Database

After creating the database, you need to initialize the database for the production system. You can also initialize it for the development system, however, for practical use, the production system is sufficient:

sudo bundle exec rake db:migrate RAILS_ENV=production

Running Tracks

Running Tracks with Ruby’s server

The easiest way for running tracks is using Ruby’s server. This eliminates the need for configuring Apache, Mongrel, etc. Hence, the setup also will not scale, if you intend to support multiple users. Just run the server with:

./script/server -e production

Your system should now be up and running. Try to access the website:

Running Tracks behind Apache

Install Passenger

sudo apt-get install libapache2-mod-passenger

Configure Apache

Configure Apache to use Passenger to run your Tracks site. This is beyond the scope of this document, but you can find some great documentation in the Passenger users guide.

Sample Configuration

A sample virtual host using libapache2-mod-passenger. Passenger will auto-detect the rails app.

<VirtualHost *:80>
ServerName tracks.local
DocumentRoot {PATH_TO_RAILS_APP}/public
</VirtualHost>

Start using Tracks!

Tracks should should now be online, either at http://example.com:3000 (if you are running Ruby’s server) or at whatever address you told Apache to use.

Leave a Reply

Your email address will not be published. Required fields are marked *