Skip to content

Installing in a Hosted Environment

Marvin Frederickson edited this page Feb 28, 2014 · 1 revision

As August mentioned in one of his group postings concerto is really intended to be installed on a server where you have root access so you can affect changes to OS level files (services, gems, etc.) However, I was able to get it working on a hostmonster.com basic, shared hosting account by doing the following. The only drawback is that you'll need something in the cron to check and make sure the "services" are running and if not, restart them.

ssh into your account. Get the concerto code and put it under rails_apps/concerto. Add directories for log and tmp. This grabs the master branch, you might want to switch to the latest release once you git clone it.

mkdir rails_apps
cd rails_apps
git clone https://github.com/concerto/concerto
cd concerto
mkdir log
mkdir tmp

Set up your hostmonster account for a ruby on rails app, according to https://my.hostmonster.com/cgi/help/rails, by doing the following:

Place the following in your ~/.bashrc file:

export HPATH=$HOME
export GEM_HOME=$HPATH/ruby/gems
export GEM_PATH=$GEM_HOME:/lib64/ruby/gems/1.9.3
export GEM_CACHE=$GEM_HOME/cache
export PATH=$PATH:$HPATH/ruby/gems/bin
export PATH=$PATH:$HPATH/ruby/gems

Load those by running . ~/.bashrc at the shell prompt.

Go into your control panel and add a subdomain called concerto, this will also create a directory under your public_html directory called concerto. We need to remove that directory and replace it with a link (for phusion passenger).

cd 
cd public_html
rmdir concerto
ln -s ~/rails_apps/concerto/public concerto

Now we need to set up phusion passenger in the .htaccess file in the ~/public_html/concerto directory. So put the following into that file, but be sure that GEM_HOME (the last line) is set to the ruby/gems folder under your home directory (not my example home directory of home2/mstarrus).

Options -MultiViews
PassengerResolveSymlinksInDocumentRoot on
#Set this to whatever environment you'll be running in
RailsEnv production
RackBaseURI /
SetEnv GEM_HOME /home2/mstarrus/ruby/gems

You should use a mysql database, but I'm going to use sqlite in this example. Copy over the database configuration file. In your rails_apps/concerto directory, do the following:

cd config
cp database.yml.sqlite database.yml
cd ..

With the current 0.8.7 version of concerto, I had to fix the protocol for the docsplit gem in the Gemfile, change the line that says gem 'docsplit', :git => 'git://github.com/augustf/docsplit.git', :branch => 'imagemagick' to gem 'docsplit', :git => 'https://github.com/augustf/docsplit.git', :branch => 'imagemagick'

Run bundle to get everything you need. This will take a while, be patient.

bundle install

Precompile the assets. This may take a while, be patient.

RAILS_ENV=production bundle exec rake assets:precompile

Now you should be able to browse to your site http://concerto.whatever and after a short wait, see the concerto setup screen.

We still need to get the background services running, so back in your hosting account, create a file called background_services in the rails_apps/concerto folder that contains the following:

export PORT=5000; RAILS_ENV=production bundle exec clockwork lib/cron.rb >> log/clock-1.log 2>&1 & echo \$! > tmp/clock.1.pid
export PORT=5100; RAILS_ENV=production bundle exec rake jobs:work >> log/worker-1.log 2>&1 & echo \$! > tmp/worker.1.pid

Then run the following to make it executable, and kick it off.

chmod u+x background_services
./background_services

You can check to see if they are running by running ps -ef as shown here:

mstarrus@mstarr.us [~/rails_apps/concerto]# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
mstarrus 17384 17321  0 10:12 pts/1    00:00:00 -bash
mstarrus 17414 17384  0 11:07 pts/1    00:00:00 ps -ef
mstarrus 24042     1  0 10:14 pts/1    00:00:17 ruby /home2/mstarrus/rails_apps/concerto/vendor/bundle/ruby/1.9.3/bin/clockwork lib/cron.rb
mstarrus 24043     1  0 10:14 pts/1    00:00:30 ruby /home2/mstarrus/rails_apps/concerto/vendor/bundle/ruby/1.9.3/bin/rake jobs:work

It appears that these services died overnight for my testing, so you might want to create a cron job that looks for these and if it doesn't find them, then kick them off again.

Something went wrong with that request. Please try again.