Deploying a Ruby on Rails application

Start the MySQL daemon if not already started:

 /etc/init.d/mysql start

Change into the webroot, backup the example railsapp and replace it with the to be deployed Rails application:

cd /var/www
mv railsapp railsapp.orig
mv /path/to/NEW_APP /var/www/railsapp

Initialize the database:

cp railsapp.orig/config/database.yml railsapp/config/
cd /var/www/railsapp
rake db:migrate RAILS_ENV="production"

Create the tmp directory (if missing):

mkdir -p tmp

Configure permissions:

chown -R root:www-data /var/www/railsapp
chown -R www-data:www-data /var/www/railsapp/tmp
chown -R www-data:www-data /var/www/railsapp/log
chmod 666 /var/www/railsapp/log/*

Optionally remove the example railsapp, and restart the database and webserver:

rm -rf /var/www/railsapp.orig
/etc/init.d/mysql restart
/etc/init.d/apache2 restart

Thats it, you're done!



mayer's picture

I recently installed ruby on rails to my linux server using these instructions.

The install worked and my test page worked, but since then I haven't been able to update or commit any of my code on subversion from my windows machine through eclispe.  in fact, svn just hangs and i have to kill eclipse manually.  ( i've had no issues with svn since i set it up over 6months ago.)

At one point, i saw the message "no connection could be made because the target machine actively refused it"

It's almost like rails took over the port i was using for svn, so when svn tries connecting through the normal port it rejects the request.  I've had svn working through eclipse for months and no changes/updates to windows or linux, except for rails, and i only did the steps listed in the document list above.  I'm running Apache 2.2 on linux, but i checked all files in apache that rails might have been modified and didn't see anything related to svn.

Anyone heard of this, have an idea of what it could be?