How To Deploy on Site5
Here’s a guide on how to set up RadiantCMS in a few minutes on Site 5. I changed my shell from the default jailshell to bash by simply toggling shell access off and then back on again. I don’t know if this is required for the following (I don’t think it should, but it’s nice to be able to see the whole server).
This guide assumes you:- Know how to use the shell
- Know how to use ssh
Install Your Own Gems
First, you need to tell RubyGems where to install your own custom gems since Radiant is not preinstalled on Site5’s servers. We’ll use the folder gems. SSH into your site and create the folder. Then, create the file ~/.gemrc with the following content (with, of course, your username in place of username):
gemhome: /home/username/gems
gempath:
- /home/username/gems
- /usr/lib/ruby/gems/1.8
Ensure that your changes took effect:
$ gem env
RubyGems Environment:
- VERSION: 0.9.2 (0.9.2)
- INSTALLATION DIRECTORY: /home/username/gems
- GEM PATH:
- /home/username/gems
- /usr/lib/ruby/gems/1.8
- REMOTE SOURCES:
- http://gems.rubyforge.org
Although not required for the basic installation, some of the rake tasks depend upon the shell variables $GEM_HOME and $GEM_PATH. It’s not a bad idea to add them to your .bash_profile like so:
export GEM_PATH=/home/username/gems:/usr/lib/ruby/gems/1.8
export GEM_HOME=/home/username/gems
Install the Radiant Gem and Unpack the App
Great! Now this is very simple:
$ gem install --include-dependencies radiant
Just one note here: Every time I tried this (and it was several), I needed to do it twice. The first time it would always fail, claiming it couldn’t find the Radiant Gem. But the second time it would find it and work install without trouble.
Unpack the application using the radiant command into the directory radapp (it will create the directory if it does not exist).
$ ~/gems/bin/radiant --database mysql radapp
Configuration
Now, you should have the new folder radapp in your current directory. Using Site5’s SiteAdmin on your domain (located at yourdomain.com/siteadmin), create the databases radiantdev, radianttest, and radiantlive (note that your username_ is prepended to all those table and user names). Create a new MySQL user radiant, and give it access to all functions on all those databases (watch out—those checkboxes to give privileges on the MySQL user page don’t mirror your current settings. To see that, you need to go to the databases page.) Once that is all completed, edit radapp/config/database.yml with those settings; the file should look something like this:
development:
adapter: mysql
database: username_radiantdev
username: username_radiant
password: pword
host: localhost
test:
adapter: mysql
database: username_radianttest
username: username_radiant
password: pword
host: localhost
production:
adapter: mysql
database: username_radiantlive
username: username_radiant
password: pword
host: localhost
Now edit the file radapp/config/environment.rb. You need to uncomment a line and add one more, so the following line (should be the 8th line down):
# ENV['RAILS_ENV'] ||= 'production'
becomes…
ENV['RAILS_ENV'] ||= 'production'
ENV['GEM_PATH'] = '/home/username/gems:/usr/lib/ruby/gems/1.8'
Bootstrap your Database
Okay! All of the config files are setup. Now in the radiant application folder, run the rake task to bootstrap the database. Answer the prompts to your liking.
$ cd radapp/
$ rake production db:bootstrap
Setup the Symbolic Link
Just create the symlink and you’re done! From your home directory, just do this:
$ mv public_html public_html_bak
$ ln -s ~/radapp/public ~/public_html
Now point your browser to http://your.website.com/. It should be RadiantCMS! To edit pages, go to http://your.website.com/admin.
It should be possible to place that symbolic link inside your public_html folder (instead of replacing it), but in my quick testing it, I can’t seem to setup Radiant to recognize that it’s in a subdirectory. If you figure it out, add that information here.
