The Renewal
21 May 2013 · 978 words · 5 minute read
Introduction
This post summarises on the setup of Octopress on Openshift which utilizes Greyshade theme as per Unconventional.co.
As I have mentioned in my previous post, Unconventional.co is alive and kicking! Previously, it is hosted on Heroku and powered by Obtvse. After Heroku added a 10k rows of DB limit for its Development box, I thought it was time to explore on another Platform-as-a-Service (PaaS) and hopefully, I do not need to change to another service. Not to mention, I still got a lot to learn in terms of configuring a database (be it mysql or postgresql) to match it with a particular PaaS' offering (believe me, it is a pain in the a$$). Thus, having a blog that requires database configuration for a particular PaaS and maintenance is a hassle and I would much prefer to spend time to pen down ideas than to try to configure a database that works on one PaaS but does not work on another.
I have been working on Openshift for a fair bit and its pricing for its FreeShift is definitely attractive to most PaaS seekers out there (myself included). On the other hand, enlightenment dawns upon myself when I stumbled upon Octopress. Without the need to manage database for blogging and also utilizing the hacker way of publishing via git push
to push updates to the server.
There are three parts:
-
Setup an Openshift Account
-
Setup Octopress and Link to Openshift
-
Install Greyshade Theme
I would like to credit the deployment of Octopress to Openshift write-up to Shellcode and the Greyshade theme design to Shashank Mehta.
And so, it begins…
Setup an Openshift Account
On this part, it is mainly about getting your own Openshift account and perform the necessary settings to accommodate Octopress deployment (for further details, please refer to this).
The necessary steps are:
-
Click on Add Application in the dashboard of your Openshift account
-
Select and install Ruby 1.9 application
-
Copy the generated git repository URL (As an example
ssh://[email protected]/~/git/foobar.git/
)
Setup Octopress and Link to Openshift
Next, this will mainly describe on the necessary settings to setup Octopress in your local machine and subsequently push it to Openshift.
Below are the next steps:
-
In your terminal, enter
git clone git://github.com/imathis/octopress.git octopress
at wherever you want to have Octopress in your local machine -
Enter into the Octopress directory
-
In your terminal, enter
bundle install
to compile the Gemfile -
Next, type
bundle exec rake install
to complete Octopress setup
Then, the local Octopress and Openshift has to be linked together in order to make the deployment to the PaaS a success (that is why the generated git repo URL is copied earlier on!). I have been following Shellcode’s methodology in having a staging public directory. I think this methodology of having a staging public directory and utilizing only the necessary files to commit is disk-space relieving for most PaaS and I like it. Anyway, moving on:
-
Copy the Gemfile and config.ru file generated from the Octopress setup
-
Exit Octopress folder by going one level up or just enter
cd..
in your terminal -
Create a _deployment folder and enter into it
-
Paste the copied Gemfile and config.ru file into the _deployment folder
-
Type
bundle install
to generate a Gemfile.lock -
Create a public folder in it
-
Type
git init
to initialize the repository -
Type
git remote add openshift ssh://[email protected]/~/git/foobar.git/
-
Type
git add .
-
Type
git commit -m "Initial commit"
-
Exit _deployment folder by going one level up
-
Copy _deployment folder and enter Octopress folder
-
Paste _deployment folder within Octopress folder
-
Type
git add _deployment/
-
Type
bundle exec rake new_post['Hello World']
-
Edit the newly generated markdown file however you want and save it
-
Type
bundle exec rake generate
and this will generate some files within your public folder (octopress/public) -
Enter into the directory octopress/_deployment/public and delete everything inside there
-
Copy all the files generated from octopress/public to octopress/_deployment/public
-
Enter to the folder octopress/_deployment in your terminal
-
Type
git add .
to add all the new files to be pushed to the Openshift repo -
Type
git commit -m "New blog post"
-
Type
git push openshift master
Then you will see Openshift spewing some stuff out in your terminal to show the background jobs running and once you see remote: Done
, you can visit the URL of your blog in Openshift check how awesome it is to have it hosted there!
Setup Greyshade Theme
Finally, this is regarding the installation of Greyshade theme to Octopress. The few main reasons why utilize Greyshade theme are:
-
Responsiveness design (try use a mobile phone or tablet to view it, everything scales nicely)
-
Simple and clean user interface
-
Nicely designed favicon included for social media
The instructions for this portion is adopted from here. So the steps in this part are:
-
Enter into the octopress folder in your local machine via your terminal
-
Type
git clone [email protected]:shashankmehta/greyshade.git .themes/greyshade
-
Go to this website and pick a colour theme that you have not seen in here
-
In your terminal, type
echo "\$greyshade: *colour*;" >> sass/custom/_colors.scss //Substitue 'color' with your highlight color
; substitute colour with your chosen colour theme -
Type
bundle exec rake "install[greyshade]"
-
Delete everything that is within octopress/public and octopress/public/_deployment
-
Type
bundle exec rake generate
and copy the generated files in octopress/public to octopress/public/_deployment -
Add your updated files for pushing to Openshift repo by typing
git add .
-
Type
git commit -m "Updated theme for Octopress"
-
Push your update to Openshift repo by typing
git push openshift master
-
Go to the URL of your Openshift application and marvel upon the Greyshade themed Octopress, hosted by Openshift
Conclusion
Thus, with this unconventional way of blog setup (rather than using readily-made available services such as Tumblr, hosted Wordpress or Blogger), learning via technology and blogging would definitely be fun! Cheers for your attention!
P.S. If you see any mistakes or just want to say hi, just drop a note below!