Deploy Octopress on Openshift

Recently I decided to switch over to OpenShift (RedHat) for Octopress (Jekyll) and other small projects. Github is nice to work with for public repo’s and forkable stuff but if you want something to be private you have to have another pricing plan, which OpenShift doesn’t have (3 free apps with enough resources). Heroku is also a nice environment, but can only have 1 app, the other one(s) will be helt asleep after x hours, and there are no resources available, you’ll have to buy extra dyno’s which are quit expensive to be honest.

I always use a VM for my Ruby (or other) projects, from which I work in, so I can make snapshots, revert any things etc. Before installing OpenShift I had an up- and running Ruby environment, so my tutorial might slighty look different from yours.

Create OpenShift account

  • Click on Add Application
  • Install Ruby 1.9 application (click on the cartridge)
  • Leave all settings at default and put in your application name
  • Copy the git repository URL that OpenShift gives you on step 2 and write it down somewhere. Example:
1
ssh://[email protected]/~/git/octopress.git/

Install Octopress

All roads lead to Rome, so like I said it might be slightly different from how this works out for you, but this should be the way to go (for me):

  • Open the terminal in the folder where you put your projects in
  • Open bash and create folder:
1
2
/bin/bash --login
git clone ssh://[email protected]/~/git/octopress.git/
1
cd octopress
  • Clone octopress and copy all the content in the octopress folder:
1
2
git clone git://github.com/imathis/octopress.git
cp -r /home/DEV/octopress/octopress/* /home/DEV/octopress/
  • Remove the folder:
1
rm -r  /home/DEV/octopress/
  • Check Ruby version and install bundler:
1
2
ruby --version
gem install bundler
  • Run and clone theme you like:
1
2
bundle install
git clone https://github.com/bkutil/bootstrap-theme.git
  • Command following:
1
2
3
4
5
rake install
rake generate 
git add .
git commit -m 'this is a test'
git push

Custom domain

Your Octopress instance will now be available on the URL octopress-user.rhcloud.com but suppose that is not desirable.

Comments