Refinery is totally free open source content management system. Today I'll demonstrate how to deploy it on Shelly Cloud.
Before moving on to Refinery, first make sure you have the required system tools installed:
- Ruby, version 1.9.3 or higher. On Shelly Cloud default Ruby version is 2.0.0 and it's generally better to have the same version locally.
- Working compiler (to install gems with native extensions)
- on OS X you will need XCode with command line tools
- for Ubuntu install at least build-essential and autoconf packages
- PostgreSQL headers
- for OS X install postgresql via Postgres.app
- for Ubuntu it will be required to have libpq-dev installed
Microsoft Windows isn't supported. We strongly discourage trying this walkthrough on operating systems different than OS X or Linux.
As for gems, you will need to install:
- RefineryCMS - it’s used to generate drafts of your future application
- ExecJS - it isn’t installed with Refinery gem but it’s required
You can do it by executing following command
gem install shelly execjs refinerycms.
Step by step installation guide
If you don't have a Shelly Cloud account yet use our sign up page to create one.
Login to Shelly Cloud via command line.
$ shelly login Email (email@example.com - default): [enter your email] Password: [enter your password] Login successful Uploading your public SSH key
- Now, we'll create our
$ refinerycms refinery-with-shelly ... === ACTION REQUIRED === Now you can launch your webserver using: cd refinery-with-shelly rails server This will launch the built-in webserver at port 3000. You can now see Refinery running in your browser at http://localhost:3000/refinery Thanks for installing Refinery CMS, we hope you enjoy crafting your application! ————
- Go to
$ cd refinery-with-shelly
- Edit Gemfile and add :production group to the end of file.
group :production do gem "shelly-dependencies" gem "pg" end
Added gems are standard shelly dependencies for Rails application with PostgreSQL database.
- To have assets working it’s required to use Shelly Cloud deployment hook support
a. First, update your environment configuration (usually
with following line:
```ruby # Enable serving assets, use far-future expiry header config.static_cache_control = "public, max-age=31536000" ```
b. Create three hook files which will set up sharing assets between virtual servers after precompilation.
```bash # config/deploy/shelly/link_assets_from_disk set -e # Link public/assets to disk/assets if needed if [ ! -L "public/assets" ]; then if [ -d "public/assets" ]; then rmdir public/assets fi mkdir -p disk/assets ln -s ../disk/assets public/assets fi ``` ```bash # config/deploy/shelly/before_migrate set -e # Make sure that public/assets is linked to disk/assets config/deploy/shelly/link_assets_from_disk # Precompile assets (this happens only on one of the servers) rake assets:precompile ``` ```bash # config/deploy/shelly/before_restart set -e # Make sure that public/assets is linked to disk/assets config/deploy/shelly/link_assets_from_disk ```
c. Add execute permission for
```bash $ chmod +x config/deploy/shelly/link_assets_from_disk ```
Test the application in local environement.
a. Precompile static assets.
```bash $ rake assets:precompile ```
.gitignore file. We don't want to have all
these files commited to the repository.
c. Run migrations
```bash $ RAILS_ENV="production" rake db:migrate ```
d. Run application
```bash $ rails s -e production ```
e. You can see it by entering http://localhost:3000/refinery in your browser. You can stop your local Rails server using CTRL+C.
- Initialize git repository and add all files to it.
$ git init $ git add . $ git commit -m "Initial commit of my Refinery instance"
Create an application on Shelly Cloud (you can respond to all questions with the default action).
$ shelly add $ git add Cloudfile $ git commit -m "Add application to Shelly Cloud" $ git push shelly master
Start the newly created cloud
$ shelly start
Go to http://refinery-with-shelly.shellyapp.com/refinery and create a first account.
Next you can continue with refinery guides.
We encourage you to try ShellyCloud with RefineryCMS by yourself. It's really simple!