Yodiaditya

NodeJS, PHP, Python, Ruby and Web Apps.

Github Custom Domain With Octopress in Ubuntu Oneiric 11.10

In past, I have posted about Octopress installation in that only works in Ubuntu Natty 11.04. Use my previous post on Ubuntu 11.10 Oneiric will make several problem. This is because rake and liquid version that little buggy.

Here are the steps to build Octopress on Ubuntu 11.10 :

1. Create github repository


As described on Pages github, if we want host our sites then we should make repository username.github.com.

So, i log into my Github account and create repository yodiaditya.github.com

2. Know how it works


Github will detecting and create pages automatically after we create username.github.com repository (take several minutes). To make it’s works, we should have conditions :

1. Pointing Our Domain into Github
2. Using CNAME files for set our domain name into github
3. Creating .nojekyll files for telling Github we use another engine

3. How to pointing our domain into Github ?

Go to your domain name registrar, edit DNS management and use A record pointing into github. For example, i use Name.com, so use ns1.name.com and ns2.name.com. On DNS Management (sidebar):

A    www.yodi.me     207.97.227.245
A    yodi.me         207.97.227.245

Remember, it will take 1 day for DNS propagation, be patient & do this step for the first priority.

4. Start Installation

A. Install RVM

bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Then we need to pointing rvm environment :

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source ~/.bash_profile

B. Configure Github Repository Clone Octopress Repository :

git clone git://github.com/imathis/octopress.git octopress

Go to Octopress folder and you will get RVM notification like this :

==============================================================================
= NOTICE                                                                     =
==============================================================================
= RVM has encountered a new or modified .rvmrc file in the current directory =
= This is a shell script and therefore may contain any shell commands.       =
=                                                                            =
= Examine the contents of this file carefully to be sure the contents are    =
= safe before trusting it! ( Choose v[iew] below to view the contents )      =
==============================================================================
Do you wish to trust this .rvmrc file? (/home/ubuntu/octopress/.rvmrc)
y[es], n[o], v[iew], c[ancel]> yes

C. Installing RVM Packages

rvm install ruby-1.9.2-p290
gem install bundler
bundle install
bundle update
rake install

When you doing rake install and get error like this :

rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. Using bundle exec may solve this.

The solution is do bundle update and rake install again.

D. Fixing Liquid

If you use codeblock plugin, then you will facing error :

Liquid error: undefined method `join’ for #<String:0x00000001b65f70>

This because liquid 2.3.0 have some bug when converting syntax.

All you need is revert back to liquid 2.2.2.

Edit Gemfile and add gem 'liquid', '2.2.2' into group :development do.

group :development do
    gem 'rake'
    gem 'rack'
    gem 'jekyll'
    gem 'rdiscount'
    gem 'pygments.rb'
    gem 'RedCloth'
    gem 'haml', '>= 3.1'
    gem 'compass', '>= 0.11'
    gem 'rubypants'
    gem 'rb-fsevent'
    gem 'stringex'
    gem 'liquid', '2.2.2'
end

Update bundle by :

gem uninstall liquid
bundle update

5. Configure Octopress with Github Pages

Go to octopress folder and do rake setup_github_pages. Fill with your read+write access URL github repository. This setup will create new branch called “source”.

Then do rake generate & rake deploy.

Remember, the workflow for deployment are :

1. All your website contents located in master branch.
2. Your files & any changes should do in source branch.
3. Writing content using rake new_post["title"].
4. Content located in source/_posts.
5. `rake generate` & `rake deploy` to update website & contents.
6. Rake will generate from source folder and deploy to _public folder.
7. Always do `push origin source` to update your Github Repository

6. Configure custom domain and jeykll

Remember, all files for development located in source folder. Go to source folder and create 2 files :

cd source
touch CNAME
touch .nojekyll

CNAME which contain your domain (ex : www.yodi.me ). NoJekyll files will make Octopress works in Github Pages.

git add -A
git commit -m 'domain configuration'
git push origin source
rake generate
rake deploy

Github need time to read your CNAME and updating the sites.

At this steps, you should have your custom domain works with Octopress.

Happy blogging like Hacker! :)

PS : You can grab my sites on Github

Comments