Rebuilding The Codedependant Blog

I

t has been about 3 years since I launched my blog. At the time the tech was pretty interesting. It was a Django project on mongrel2 app server backed by ZeroMQ and xapian as the search engine. I built out a modular Web UI with a WYSIWYG editor using mootools. But it was rather clunky in how it actually generated HTML and usually required some manual tweaking.

Out With The Old

The WYSIWYG Editor was probably the biggest problem. It took serious liberties in cleaning the HTML and usually resulted in me editing the code by hand in the end. Interesting code blocks with highlighting was a 3 step process and was almost always formatted wrong.

Managing Images was a real pain as well. Dealing images though Django is actually a bit of a cumbersome event in it self. More over, I needed separate servers to serve static files, as well as run Mongrel, including something called procer and m2sh before I could run the actual Django app. 5 process to run a simple blog site. As a colleague of mine once said

Django

Its such a framework-y ass framework

There a lot of moving part when all I really want to to save some text and images.

Writting new entries for my blog was rather painful, which is the exact opposite of what a blogging experience should be. It was time to say good-bye to Django, and find something else.

In With The New

The biggest pain point with the old site was I always ended up writing HTML. After a while I would write the post in Markdown off line and do a lot of copy and paste. What I really wanted was to just write markdown and be done. I wasn't really sold on the all static site generators like jekyll or metalsmith. I new I was going to want to add custom functionality like search indexing, custom management tools and have a place to try new things. I also wanted to build a full stack JavaScript app with Node.js. So I settled on Ghost.

Ghost
Ghost Blog Logo


The thing that attracted me to ghost was mainly that it had data driven template, a markdown based text engine under the hood, and, could be used a regular NPM module so I could build my own apps and just use ghost for writing / serving content.

Node.js

Another big attraction to the Node.js based servers was the lack of servers. In contrast to the traditional WSGI based servers of the python ( and Django ), all I/O in node is non-blocking and asynchronous. Meaning I can use a single Node server to do the work of 4 or 5 Django process. For comparison, The old Django / Mongrel 2 setup had 4 workers and 2 nginx workers for serving static files - That set up could handle about 30 req/s w/ 30 concurrent connections. The new Node / Ghost set up can handle ~ 60 req/s w/ 30 concurrent connections. Nearly double the workload with a fraction of the server processes working.

While I haven't rebuilt my search functionality, My plan is to move from Xapian to elasticsearch. Mainly because their aren't decent or well maintained JavaScript bindings for Xapian. But on the upside, querying the index is quite a bit easier with elastic search. It's very similar to querying Mongodb, where as Xapian's API is a bit clunky. It was one of those things were once you got it to work, you set it on the shelve and never looked at it again.

Of course, Ghost is not with out its share of problems, which I'll go into more later. But overall, I'm excited for this new start and am planning to put up a lot more content now that it isn't as much of a chore.

elasticsearch django mongrel2 zmq codedependant ghost node.js