Installing Refinery CMS

The following tutorial will show you how to set up Refinery CMS on a Ruby Simple Hosting instance.

$ rvm --default 1.9.3

First, install Refinery CMS on your local machine:

$ gem install refinerycms

Refinery CMS needs execjs and a JavaScript execution environment. You can use therubyracer:

gem install execjs
gem install therubyracer

Then, create a new application by indicating your working directory:

$ refinerycms /path/to/repo

Navigate to the directory where the application's code is located:

cd /path/to/repo

Before building the Gemfile.lock file containing the dependencies, it's necessary to indicate the execjs and therubyracer dependencies in the file Gemfile, and to modify it according the the type of database you chose for the instance:

For MySQL:

--
file: Gemfile
--

source 'https://rubygems.org'

gem 'rails', '3.2.18'
gem 'mysql2'
gem 'execjs'
gem 'therubyracer'
[...]

For PostgreSQL :

--
file: Gemfile
--

source 'https://rubygems.org'

gem 'rails', '3.2.18'
gem 'pg'
gem 'execjs'
gem 'therubyracer'
[...]

Database configuration

Next, configure the database for the production environment:

For MySQL:

--
file: config/database.yml
--

[...]
production:
  adapter: mysql2
  database: refinery
  socket: /srv/run/mysqld/mysqld.sock
  username: root
  password:
  encoding: utf8
  pool: 5
[...]

For PostgreSQL:

--
file: config/database.yml
--

[...]
production:
  adapter: postgresql
  template: template0
  database: refinery
  host: localhost
  port: 5432
  username: hosting-db
  password: 
  encoding: unicode
  pool: 5
[...]

Finally, we build the dependency file Gemfile.lock:

$ bundle install

Push to the instance

Now you can push the code to the instance:

In the commands below, replace LOGIN with your login, INSTANCE_ID with your instance ID, and and DC_ID with the ID of the datacenter where your instance lives (dc0 for Paris, dc1 for Baltimore, dc2 for Luxembourg).

$ git init 
$ git add .
$ git commit -am 'First install'
$ git remote add gandi git+ssh://LOGIN@git.DC_ID.gpaas.net/default.git
$ git push gandi master
$ ssh INSTANCE_ID@git.DC_ID.gpaas.net 'deploy default.git'

Deploy the application

Lastly, activate the SSH console from the instance control panel.

Connect via ssh, and execute the following command to initialize the database:

$ cd web/vhosts/default
$ rake db:setup
Last modified: 06/02/2014 at 22:14 by AJ B. (Gandi)