Skip to main content

Choosing Octopress for Blogging

·9 mins

When I have initially started this blog, my first choice of a blogging platform was Blogspot by Google. My old blog is still there, but in the meantime I have migrated to my new blog where you are right now. It is based on Octopress and hosted at Heroku.

What I have liked about Google Blogspot #

First and foremost, the main reason why I have chosen Blogspot at that time was its simplicity. You can get a blog up and running at no time. Since I already had a Google account, it was the most logical way to go. After a while I have started writing my articles in MarsEdit for writing and Voila for screen captures. Write some text in MarsEdit, take a screenshot with Voila, copy and paste it into MarsEdit and publish the whole thing to Blogspot.

The in-built analytics functions in Blogspot come in handy as well if you are start writing a blog. Nothing to set-up, it is just there and waits to be used.

My Requirements for Blogging #

After a while I got a bit tired of formatting stuff in MarsEdit and the way it showed up on Blogspot. Additionally, I just wanted to write and not click around for formatting. Plus, I had no way of versioning my work.

Therefore, two requirements came out of this. A natural solution to the formatting issue is the Markdown language. For versioning I am used to SVN and GIT. I wanted to integrate that into my blogging workflow.

Choosing Octopress as new Blogging Platform #

After googling for a while and reading along I have found the blog post “Choosing a Blogging Platform” by Mark Birbeck.

My final choice came down to Octopress. As a coder who has done projects with Ruby on Rails this seemed like a natural fit.

Setting up Octopress #

Octopress makes it easy to start with since it comes with some fine documentation. The following steps were taken from here to setup Octopress.

First I have created the directory where my blog would live.

{% highlight none %} mkdir <my_project_dir>/blog {% endhighlight %}

A little foreword on the next steps. If you are on a Mac and already have a native Ruby installation read about the problems I have encountered, especially at the end of this post. Am still not clear enough about the dependencies. If you can enlighten me feel free to do so in the comments at the end of this post.

Next, I had to get RVM since I needed Ruby 1.9.3 additionally to my 1.8.7 installation

{% highlight none %} curl -L get.rvm.io | bash -s stable {% endhighlight %}

Installing LLVM and libksba was the next step

{% highlight none %} brew install llvm brew install libksba {% endhighlight %}

Actually, when I was trying to install libksba at the time I setup the blog, I got an error message saying that it could not connect. While polishing this article I checked again, this time it worked without any problems.

Anyways, it’s time to install Ruby 1.9.3

{% highlight none %} rvm install 1.9.3 {% endhighlight %}

Here, I got another error saying

{% highlight none %} Error running ’tar xjf /Users/twiss1/.rvm/archives/ruby-1.9.3-p194.tar.bz2 -C /Users/twiss1/.rvm/tmp/rvm_src_78868 ‘, please read /Users/twiss1/.rvm/log/ruby-1.9.3-p194/extract.log {% endhighlight %}

The mentioned log file extract.log showed the following

{% highlight none %} ruby-1.9.3-p194/template/encdb.h.tmpl: (Empty error message) tar: Error exit delayed from previous errors. {% endhighlight %}

Thanks to this post I have found a solution.

{% highlight none %} wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.bz2 mv ruby-1.9.3-p194.tar.bz2 /Users/twiss1/.rvm/archives/ rvm install ruby-1.9.3-p194 rvm use 1.9.3 {% endhighlight %}

Checked everything with ruby -v.

But now I had a problem whenever I wanted to use vagrant. A temporary solution was executing

{% highlight none %} CC=/usr/bin/gcc rvm install 1.8.7 –enable-shared {% endhighlight %}

After loging into my terminal the other day, I could only use rvm as root and not as my normal user. Even when I wanted to change my ruby version with rvm use 1.9.3 I got the following error

{% highlight none %} RVM is not a function, selecting rubies with ‘rvm use …’ will not work. You need to change your terminal settings to allow shell login. Please visit https://rvm.io/workflow/screen/ for example. {% endhighlight %}

So I put source ~/.rvm/scripts/'rvm' into my .bash_profile and was done with it.

What you read here about my problems with RVM and Ruby was just the tip of the iceberg, but there is more info on it at the end of this post.

Finally I came to the point of installing Octopress:

{% highlight none %} git clone https://github.com/imathis/octopress.git octopress gem install bundler bundle install rake install {% endhighlight %}

For setting up deployment I followed this article.

My decision of where to deploy was Heroku, since I am a big fan of their services and love the idea behind it.

{% highlight none %} gem install heroku heroku create git config branch.master.remote heroku {% endhighlight %}

Now, remove entry public from the .gitignore file

{% highlight none %} rake generate git add . git commit -m “initial commit” git push heroku master {% endhighlight %}

With the last step I got the following error:

{% highlight none %} Permission denied (publickey). fatal: The remote end hung up unexpectedly {% endhighlight %}

Okay, that’s easy, we need to generate ourselves a private and a public ssh-key pair.

{% highlight none %} cd ~/.ssh ssh-keygen -t rsa {% endhighlight %}

Have saved the keys as id_rsa.heroku with an empty passphrase.

Back in my project directory I did the following

{% highlight none %} heroku keys:add ~/.ssh/id_rsa.heroku.pub {% endhighlight %}

Even now, when trying to push everything to Heroku it still did not work and I got the same error message as above.

But executing ssh-add ~/.ssh/id_rsa.heroku resolved this issue.

You could also add the following line

{% highlight none %} IdentityFile ~/.ssh/id_rsa.heroku {% endhighlight %}

to the file ~/.ssh/config

So, again git push heroku master and everything worked fine and I got the following output

Of course, I was eager to see what I will see under that URL.

There you go. Very nice!

Ok! It is time to tailor that to my needs by changing the blog URL.

{% highlight none %} heroku apps:rename rampmeupscotty {% endhighlight %}

Let’s check that on “My Apps” on heroku.

Cool, that’s it for now. Next steps were more configuration changes to the blog by continuing here and then I have migrated all the content.

Some notes on RVM and Ruby #

As mentioned above, while installing Octopress on my Mac, I wanted to do vagrant up while working on another project, but got this:

{% highlight none %} /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in report_activate_error': Could not find RubyGem vagrant (>= 0) (Gem::LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in activate’ from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem’ from /usr/bin/vagrant:18 {% endhighlight %}

Okay, I have tried to install vagrant again with gem install vagrant, but got this

{% highlight none %} /Users/twiss1/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-darwin11.4.0] {% endhighlight %}

Ohoh, something is pretty messed up and I have tried resolving that as follows

{% highlight none %} brew remove ruby rvm remove 1.8.7 CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" rvm install 1.8.7 gem install vagrant {% endhighlight %}

That worked! Wait a minute … I left the terminal to do something else, when coming back I had the same error again and I have tried the following

{% highlight none %} rvm remove 1.8.7 rvm install 1.8.7 –with-gcc=clang gem install vagrant vagrant up {% endhighlight %}

And again, when I left the terminal session the same problem of being unable to find the vagrant gem.

Running {% highlight none %} gem list {% endhighlight %} came back empty and again I did {% highlight none %} rvm gem install vagrant {% endhighlight %}

I wanted to know more about my gems with rvm 1.9.3 do gem listthat came back with a long list, but rvm 1.8.7 do gem list came back empty.

After some googling I have found this article and did rvm remove 1.8.7 and also went into ~/.rvm and removed everything that had “1.8.7” in its filename.

Came also across this post, where I first got to know about the thing about the MacOS gcc.

Okay, that was a lead and I have check with gcc -v that came back with

{% highlight none %} Using built-in specs. Target: i686-apple-darwin11 Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.922/src/configure –disable-checking –enable-werror –prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 –mandir=/share/man –enable-languages=c,objc,c++,obj-c++ –program-prefix=llvm- –program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ –with-slibdir=/usr/lib –build=i686-apple-darwin11 –enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.922/dst-llvmCore/Developer/usr/local –program-prefix=i686-apple-darwin11- –host=x86_64-apple-darwin11 –target=i686-apple-darwin11 –with-gxx-include-dir=/usr/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00) {% endhighlight %}

Getting a non-LLVM based gcc was next, thanks to this post that helped a lot.

{% highlight none %} mkdir /tmp curl -O http://opensource.apple.com/tarballs/gcc/gcc-5666.3.tar.gz tar zxf gcc-5666.3.tar.gz cd gcc-5666.3 mkdir -p build/obj build/dst build/sym sudo ditto build/dst / {% endhighlight %}

One of my problmes, generally spoken, is, when not understanding what I am doing. {% highlight none %} CC=/usr/bin/gcc rvm install 1.8.7 –enable-shared {% endhighlight %} should have been {% highlight none %} CC=/usr/bin/gcc-4.2 rvm install 1.8.7 –enable-shared {% endhighlight %}

Now, when doing

{% highlight none %} rvm use 1.8.7 rvm 1.8.7 do gem list {% endhighlight %} brought back the following list of gems:

{% highlight none %} bundler (1.1.4) rake (0.9.2.2) rubygems-bundler (1.0.3) rvm (1.11.3.4) {% endhighlight %}

After doing {% highlight none %} rvm 1.8.7 do gem install vagrant rvm 1.8.7 do gem list {% endhighlight %} I got a little more.

{% highlight none %} archive-tar-minitar (0.5.2) bundler (1.1.4) childprocess (0.3.2) erubis (2.7.0) ffi (1.0.11) i18n (0.6.0) json (1.5.4) log4r (1.1.10) net-scp (1.0.4) net-ssh (2.2.2) rake (0.9.2.2) rubygems-bundler (1.0.3) rvm (1.11.3.4) vagrant (1.0.3) {% endhighlight %}

Logged out of my terminal, logged in, WOHOOOOOO!

A side note: If some, or all, of the stuff that I am writing here about the problems I had with RVM and LLVM based GCC compiler, don’t worry, that is perfectly fine. After trying to solve the problem with googling and reading article after article, I was trying stuff without understanding it, in the hope the problem would just magically vanish.

I should do the whole procedure again on a clean MacOS installation, without a native Ruby installation, but only using RVM in the first place and getting a non-LLVM based GCC compiler. Feel free to donate a Mac for this purpose. I will happily provide you with my address to send your donation to me …

Anyways, am happy with my new blog and again I have learned a ton.

Done for today!