Todays topic to is tuneup a bit more server what was setup earlier.

Goal is to,

  • Improve logic for redeploy, thus to avoid breaking running server when doing new deploy
  • Remove dependency into private user account, but use instead account specific to this deploy only
  • To use server instance specific ruby version instead of globally installed OS default ruby version

1) Make my dreams true, aka. use separate release directory via symlink

Cleanup server directory structure
cd /home/www/virtual/
mkdir release_20150330
mv * release_20150330
mv .* release_20150330
ln -s release_20150330 current

Update config

# !!! Be sure to point DocumentRoot to ’public’!
DocumentRoot /home/www/virtual/

# if not specified, the global error log is used
ErrorLog /var/log/apache2/
CustomLog /var/log/apache2/ combined

# to allow symbolic link for server release

Options FollowSymLinks

# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you’re on Apache >= 2.4:
Require all granted


2) Get of my lawn, aka. use different user

adduser rails
chown -R rails

okey, server is going to broken at this point, and will be fixed into running stage in step (3). Meanwhile, need to setup ssh keys (Generating SSH keys) for ”rails” user to allow ”bundle install” to succeed later on

ssh-keygen -t rsa -C ””

3) Use server specific ruby version.

This is a bit trickier, i.e. instead of using globally installed ruby version, desire is to use ruby version specific to account owning rails app (aka. user ”rails” in this case).


# PassengerRuby ”/usr/bin/ruby”
PassengerRuby ”ruby”


Setup ruby (using RVM)
cd /home/www/virtual/
\curl -sSL | bash
rvm install 2.1.5
cd current
gem install passenger -v 4.0.53

Restart apache2
service apache2 restart


/ Development, Rails, Web