Posted on

Having switched my blog from Wordpress to Hyde, my blogging workflow now looks something like this:

  1. Write the blog post in Markdown format
  2. Run it through a Markdown previewer to make sure it’s formatted the way I intended
  3. Attach the metadata to the finished post
  4. Create the appropriate directory structures if it doesn’t exists (I’m now organizing the post with each month having their own directories, like /blog/2012/01/) and copy the file into that particular folder
  5. Push it to Github to backup my work
  6. Run it through hyde gen to have the site generated
  7. Once the site is generated, rsync the directory into the server

Now, writing a blog post is already a laborious process in by itself and having to go through the menial and boring workflow like this is just going to sap and kill all the joy I derive from writing (and now I hold deep respect towards people who writes great blogging software and CMSes). So to smooth things over, an automated and pain-free solution is required. And it comes in two parts.

Preparing content for Hyde

Coming back to my workflow, this would be step 1 - 4 of the whole process. I’ve written a Python script that does just all that.

With this script, I’m now able to write my blog post as a plain text file, run it through this script, type in the title and tags I want to attach to this file and viola! The script will create the /blog/year/month directory structure and the file name of the post will be a proper URL slug derived from the title of the post, e.g. /2012/01/recovering-from-a-long-outage.html.

Automating deployment with Jenkins

If there’s a reason to stick to a blogging engine or CMS for your own site, this would be it: the time required to generate a Hyde blog is proportionate to the number of pages you have. There’s about 1600 posts in my blog and Hyde would need 9 minutes to generate the whole site. Nannying the generation and rsync script after a long night of writing == not fun, if not brutal. In my case, I get extremely cranky if my intense urge for my fluffy pillow and soft bed is hindered by a script.

To automate the build and deployment process, I’ve setup Jenkins on my server that would listen for any changes on Github and do the whole thing for me even in my sleep. Bliss.

As much as I find Jenkins really pleasant and easy to use (and I recommend that you check it out), I’ve fell through a lot of pitfalls in getting the configuration right. So to save you from the trouble of going through the knocks I’ve been through, here’s a checklist of setting up a fresh Jenkins instance that works on Ubuntu:

  1. Installing Jenkins for the first time: Instructions to install it on Ubuntu is on their website
  2. Host Jenkins on your domain: Decide on where you want to host Jenkins and do a proxy forwarding through Jenkin’s HTTP port - read it up on how to do it with Apache or Nginx
  3. Plugins to start off with: Jenkins Git plugin, Github plugin, Github Authentication plugin
  4. Enable Github authentication: In the Jenkins configuration screen, do the following:
    • Check the “Enable security” checkbox
    • Check the Github Authentication Plugin radio button
    • Visit Github’s OAuth Application page and register a new application with the following setting:
      • Main URL is the URL of your Jenkins instance
      • Callback URL should map to /securityRealm/finishLogin/ on your Jenkins’ URL
    • Get the Client ID and Client Secret from Github and paste it to its respective fields under “Global Github OAuth Settings”
    • Under “Authorization”, check the “Github Commiter Authorization Strategy” radio button
    • Under “Github Authorization Settings”, add your Github username to the “Admin User Names” field as a safety measure against locking yourself out from Jenkins :)
    • Check the “Grant READ permissions for /github-webhook” checkbox
  5. Other configuration settings
    • Under Git plugin, set “Global Config user.name Value” and “Global Config user.email Value”
    • Under Shell, set “Shell executable” to /bin/bash - the lack of features in /bin/sh makes young men like me cry
  6. Things to do while you’re SSH’ing into your server (and yes, some configuration from the commandline is necessary, unfortunately)
    • Once you logged in, execute sudo su - jenkins (i.e. perform everything from this point onwards as the jenkins user)
    • Perform ssh-keygen and attach your public RSA key from this user to your Github account (see Github’s help for details)
    • Perform ssh -T git@github.com to get Github’s host key
    • Logout as jenkins
    • Execute sudo apt-get install virtualenvwrapper pip
  7. Creating Jenkins project to autodeploy your Hyde blog
    • Add a Post-receive hooks on your Github repository to /github-webhook of your Jenkins URL
    • Click on “New Job” on Jenkins’ sidebar
    • Set the following configuration:
      • Project name
      • GitHub project - this will be the Github project where you host your blog files
      • Source Code Management - check the “Git” radio button and set the “Repository URL
      • Build Triggers - check the “Build when a change is pushed to Github” checkbox
      • Build - Click on “Add build step > Execute shell”, here’s the script I’ve set:
        VENV_ROOT=.env
        if [ ! -d "$VENV_ROOT" ]; then
        echo "**> creating virtualenv"
        virtualenv --no-site-packages "$VENV_ROOT"
        fi
        source "$VENV_ROOT/bin/activate"
        pip install -r requirements.txt
         
        # Start our deployment here
        fab publish

        Bash

Wrapping up

Phew! I have to say the whole process is indeed overwhelming as this whole experiment took me a whole day to get everything right.

If you’ve read up to this point, I really hope that you’d find this valuable… and that this would shave off hours in tinkering with the configuration. :)

Now if there’s a feature request in Hyde to selectively generate certain pages…

Posted on

'The Clean Up!' photo (c) 2008, One Hell Of A Loser - license: http://creativecommons.org/licenses/by-nd/2.0/

The whole ordeal started a month ago when my server decided to have temper tantrums and PHP and Nginx just mysteriously decided not to talk to each other again. And with that my Wordpress blogs are taken down with it.

Ouch.

Stress levels rising at an inopportune time when my workload was at an all time high. And it was additional salt rubbed on the injury as I was still scrambling to salvage deleted data from the only backup drive that I have. I totally don’t want to get into specifics, it’d probably stress you out as well.

Then again, I’ve had enough dealing with PHP so that makes the perfect time to migrate my blog away from Wordpress to Hyde - a static site generator. Yes, you read me correctly, it generates flat HTML files with no database what-so-ever. No more battling with CMS features that I don’t need (for a blog like mine, at least) and worrying about performance, caching and whether I remembered to make backups.

The Gory Details

As much as I’m able to knock everything out within days, it’s still a hard process to go through. Here’s a list of things that I’ve done to illustrate the point:

  • Restore the database and export the data using a local Wordpress instance (easy, some hiccups along the way due to the base URL options)
  • Write a XML parser that converts the exported XML file into small files representing every blog posts and pages (moderate, mostly just me learning lxml for the first time. You can grab my script here)
  • Converting an existing WooThemes template that my old blog uses
  • Working out the whole directory structure and baking in all the listings, tag pages and other what nots (turns out this is the hardest part as Hyde’s documentation is pretty bare. I’ve been referencing Steve Losh’s implementation and do a lot of code reading to know where goes where)
  • Writing out the Nginx rewrite rules (spent hours making it right)
  • Work out the deployment flow (glad that Steve Losh has a perfectly working Fabric script for that)

The result? Everything that I’ve posted on Github. And the sweet part about it is that it acts as my backup :).

What’s Next?

I’ll be doing more writing: the About Me page needs a complete overhaul (read: the current copy is so bad that I can’t take it any longer) and I’m excited about writing a new version of it with a different twist. I will need to write the customary 2011 review post for my own reference and stating my plans for 2012.

And I wanted to tackle some of the harder issues head on this year and be more transparent about my stand on certain issues and what I observed and believed.

And yeah, it’s going to be a very interesting 2012 all right.

Posted on

'Trapeze' photo (c) 2008, Kevin Jones - license: http://creativecommons.org/licenses/by/2.0/

Quitting – even after my fourth job, I still feel the nervous and uncomfortable twitching sensation within myself. Every time as the thought darts its way through my brain, the calculating part of the brain keeps on churning the numbers: the risk and rewards, the financial projections and whether will there be a serious impact towards my bank and retirement accounts, is the discomforts, frustrations and agony justifies the departure… what if things turn for the better after that?

Most of the time, I always decided to do nothing about it: delaying the decision. After all, I’m still getting paid well and I don’t really have any immediate plans and safety nets that would make the departure a no-brainer.

And so I procrastinate for a while… or so I thought a few days back.

Three days ago, my boss called me into his office, together with the project manager I’m now under. As I sat down, the boss started the conversation with a concerned tone that he’s noticing a significant drop in my work and productivity. And he went on describing his observations, my heart sank and I’m feeling the twitch – as I know I’m turning a blind eye towards what I’ve already suspected all this while…

“To be honest, I’m seriously thinking about quitting,” I blurted, with words bypassed my brain. And an awkward silence.

“… When are you planning to leave?”

“I’m not sure, am thinking end of January to early February.”

“Are you starting a company or are you going to take on another job?”

“… Honestly, I have no concrete plans at the moment.” That was me: in a sheepish tone.

And seriously, it’s totally out of my character to even have this conversation started. After all, I tend to be calculating and making sure all the i’s are dotted and the t’s are crossed before I make such a declaration: in the past, all my resignations happened with a firm offer on hand. That’s how risk averse I was.

After a few minutes, I left his office, while the project manager and the boss were still inside: behind closed doors.

While relieved, I’m still worried: quitting without a safety net being laid out properly. I’ll write more about the journey towards the unknown within the next week or so – or at least what going in my head now and my plans in search of what I’m going to do when the January deadline is up.

For now, this is what I’ve thought of all along.

Posted on

I was interviewed on BFM Radio together with Wu Han during noontime today :) – talking about Webcamp KL, which is a community that I’m actively participating in.

During the show, we talk about how Webcamp KL got started, what makes Webcamp valuable and our mission to nurture a community of great people who are passionate about technology.

Check out the full interview below. My part kicked in at the latter part of the show as I let Wu Han be the main spokesperson during the interview. :)

Posted on

'My Pet Swan…' photo (c) 2011, Adriane Dizon - license: http://creativecommons.org/licenses/by-nd/2.0/

You probably wouldn’t know this as I’m not able to bring myself to say it: that you mean everything to me since I felt the rush upon knowing you. In due course of time, I still find myself fixated over you despite the fact that I know I need you more than you’ll ever need me.

Maybe it’s just me seeing you as perfect the way you are, even with all the flaws and quirks. In a way that Bruno Mars struck an emotional chord in me when he sings his songs.

You have such honesty shining through in your words, your eyes and your expressions – so beautiful that I’ll try to capture them with my own eyes when I get every silver of a chance. Noticing even the slightest hint of a smile and frown on your face, leaving me trying to grasp the subtle traces and to wonder how’s your life have been.

From time to time, it does make my heart ache when I sensed some hurt and pain in your eyes or your voice. Is it real or am I imagining things? Up until now, I don’t really dared to ask to confirm or deny what I’m perceiving – as I thought that I’m in no place or position to delve into your personal matters.

… or maybe I prefer to step back, knowing that there’s someone you really like by your side – and letting her to take the supportive role that I wish I’m able to fill in. Maybe it’s just me: thinking that I’m probably asking too much to keep you by my side – like Elphaba singing under the rain, with an overwhelming cast of ambivalence above my head showering over me.

For now, I’m just trying my best to keep myself to experience the present in two sense of the word: being in the present moment when I’m with you; and fully soaking in the ecstasy from your being, which I think of it as a present received.

Posted on

How many times does one fall in love
to someone that is so beautiful and dear
and unable to grasp and hold it close

My gaze remain locked
at this beautiful thing
swimming about gracefully
without any concern of the attention it receives

I clasps my hands together
On one hand, it’s as if I’m begging
for it to come to me
While on the other, letting my internal tensions
fade away through my fingertips
slowly, gently, with ease…
and to let it go…

Full size art at DeviantArt, and you can buy it as a print if you like it.

Posted on

Here’s one unimportant fact that I never really divulged to anyone yet: I do tarot readings.

It’s not one of those skills that I practice daily. I do tarot readings exclusively for my benefit, mainly for one of the two possible reasons: either to seek guidance from the unknown or the subconscious; or as a means of having a lens to reflect upon.

To the skeptics, it may very well be an irrational act - one that appeals to my own primitive instincts to seek out patterns and retrofit whatever I perceive what the cards are showing, so to make sense something that’s totally random to begin with. In my experience, however, it doesn’t feel to me that way. Having done readings for more than eight years, there’s something that really appeal to me as the combinations of these cards always seem to carry a message that resonates with me to a certain degree.

And the particular fact that I unknowingly pay attention to certain cards more often than others - maybe due to the frequency it is being presented to me or the fact that my eyes are just simply drawn towards them every time they are shown. And often times those cards usually be a representation of an issue that I have yet to acknowledge, accept and act upon.

I couldn’t particularly describe the feeling, it is the same feeling that I felt when I wrote a great introspective blog post: that I feel the energies flow through me and all I’m doing is to channel this energy and manifest it in a way that solidifies its form. The message always feels as if they aren’t from me but from a higher power or an unknown source. And that message that’s manifested through that process gave me a reassurance, peace and calm.

It almost felt like a spiritual exercise and it is an instrument that I use in my own short meditation practice. It’s kind of like a beginner’s crutch for me to have something in front of me that acts like a goal, in this case to decipher my perceptions towards it, so that I’m able to direct my focus, calm my senses and slowly letting the inner peace sets in. And then silently tune into what’s within me: the energies that flows, my intuition and subconscious, the unknowns and the other things that I couldn’t find words to express. I may want to call it the Flow.

Guess that pretty much describes one aspect of myself that I find to be central towards my own spiritual development.

Posted on

Going through a slightly rougher patch in life at the moment. The only refuge I can take at the moment is to stay still and be in tune with my true self within.

Tags:

Posted on

To your right is a photo of the books that are no longer with me and found their new home at Fluentspace – a great co-working space that has just started in Malaysia. No questions asked, no favours expected.

And these are books that I still feel very dear to my heart and it’s almost like giving my child away. I still remember the sections and passages that has completely altered my thought process and worldview: the knowledge imparted generously by these authors becoming part of who I am now and still acts like a guiding light for me.

Why I’ve decided to give them away? Well, the logical answer is that it’s one very long-overdued task on my to-do list – ever since I embraced the minimalist philosophy and my ideal is to own fewer physical objects in life.

I know I have to get rid of my books eventually, and books are the very things that have a very strong emotional attachment – making them the hardest thing for me to let go off. So in a way, it is really a bittersweet achievement and milestone for me to be able to cut my book count. And that I’m confident that I’d give all my books away.

However, if you insist of wanting the truest answer I had in my heart, honestly, I’ve no clue myself. Somehow I could think of a lot of reasons to rationalize my decisions: that Fluentspace make a great home for my treasured library where freelancer and some budding startup founders call it their office, or that I’d love to see more people gaining wisdom from them instead of leaving on my shelf to dust… but those aren’t coming from my heart.

The only best way I could describe my real reason is that… I’m finally reached a point in life where I can give back. That it’s within my present ability to actually do something that I believe in.

… or maybe I’m just getting a little crazy, and it’s one of those crazy traits I don’t particularly mind having.

(p/s: with all fairness, I’m now buying books in digital form on a Kindle. And now I believe that dead tree books as great social objects that is meant to be shared and passed around to others.)