Hi all,
I’ve spent some time researching GTD apps and am still searching for the one that suits me best. My boss introduced me to Tracks and I have to say I’m impressed so far. To give it a fair go I installed in on my VPS (CentOS 5 x86_64) with SSL so that I can access it from anywhere securely. It took me a while to come up with all the bits - the information below is an amalgamation of lots of bits on the web so I hope someone will find it useful as it show’s a pretty complete install onto CentOS 5. Comments or thoughts welcome ![]()
This was performed in a CentOS 5.2 server (fully updated) and assumes that MySQL and Apache (the standard CentOS packages) are installed and working. It also requires mysql-devel to build the Ruby gem for MySQL.
1. Make sure the Ruby RPM’s are installed - the CentOS ones are 1.8.5 but these are known to work so we won’t do a recompile here.
# yum install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc
2. Install Ruby Gems.
# cd /usr/local/src
# mkdir -p rubygems/1.3.1
# cd rubygems/1.3.1
# wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
# tar -xzf rubygems-1.3.1.tgz
# cd rubygems-1.3.1
# ruby ./setup.rb
3. Install Rails
# gem install rails
4. Install the MySQL gem
# gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
(without these switches the install fails - it seems it can’t find the right MySQL files)
5. Set up the MySQL DB
# mysql -uroot -p
mysql> CREATE DATABASE tracks;
mysql> GRANT ALL PRIVILEGES ON tracks.* TO 'tracksuser'@'localhost' IDENTIFIED BY 'password-goes-here';
6. Unpack Tracks
# cd /var/www
# wget http://www.rousette.org.uk/projects/files/tracks-current.zip
# unzip tracks-current.zip
# ln -s tracks-1.6/ tracks
# rm -f tracks-current.zip
7. Create a user for tracks and update file ownership:
# useradd -d /var/www/tracks tracks
# chown -R tracks:tracks /var/www/tracks-1.6
8. Put this file into /etc/init.d so that tracks can be run at startup:
# cat /etc/init.d/tracks
#!/bin/bash
#
# tracks This shell script takes care of starting and stopping
# the standalonetracks web server.
#
# chkconfig: 345 60 50
# description: Tracks is a web-based application to help you implement David Allen's
# Getting Things Done. methodology. It was built using Ruby on Rails,
# and comes with a built-in webserver (WEBrick) which this script controls
# processname: ruby /var/www/tracks/script/server --daemon --environment=production
# config: /var/www/tracks/config/*.rb
# Source function library.
. /etc/rc.d/init.d/functions
PROC=/var/www/tracks/script/server
USER=tracks
PIDFILE=/var/run/tracks.pid
PATH="/sbin:/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
export PATH
LOCK=/var/lock/subsys/tracks
RETVAL=0
[ -x $PROC ] || exit 0
start() {
# Check if it is already running
if [ ! -f $LOCK ]; then
echo -n $"Starting Tracks: "
daemon --user=$USER $PROC --daemon --environment=production
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch $LOCK
pgrep -f -u $USER $"ruby $PROC --daemon --environment=production" > $PIDFILE
fi
echo
fi
return $RETVAL
}
stop() {
echo -n $"Stopping Tracks: "
killproc -p $PIDFILE tracks
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $LOCK
echo
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
condrestart)
if [ -f $LOCK ]; then
restart
fi
;;
status)
status -p $PIDFILE tracks
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac
exit $RETVAL
9. Configure tracks to run on startup
# chkconfig --add tracks
# chkconfig --list tracks
10. Set up the config files:
# cd /var/www/tracks/config
As per the Tracks web site:
• If you downloaded Tracks 1.6 via Subversion, you need to duplicate the files database.yml.tmpl and environment.yml.tmpl and remove the *.tmpl extension from the duplicates. Similarly, duplicate /log.tmpl and remove the *.tmpl extension, then edit the files as described in steps 2 and 3.
• Open the file /config/database.yml and edit the production: section with the details of your database. If you are using MySQL the adapter: line should read adapter: mysql, host: localhost (in the majority of cases), and your username and password should match those you assigned when you created the database. If you are using SQLite3, you should have only two lines under the production section: adapter: sqlite3 and database: db/tracks-15-blank.db. If you downloaded the zipped file, the database.yml file is already configured to use the provided SQLite3 file.
• Open the file /config/environment.rb, and read through the settings to make sure that they suit your setup. In most cases, all you need to change is the SALT = “change-me” line (change the string “change-me†to some other string of your choice), and the time zone setting.
11. Add the following to the end of config/environment.rb - this will enable us to run Tracks as http://www.example.com/tracks rather than as http://www.example.com/ as the Rails environment expects.
ActionController::AbstractRequest.relative_url_root = "/tracks"
12. Set up the DB schema
# rake db:migrate RAILS_ENV=production
