Blog

  • It’s been 2 years!

    I can’t believe it’s been 2 years since I started working for Open Knowledge. I vaguely remember my first day on Oct 2, 2012. The strongest memory of the day is that it was a public holiday in India and my first day at work. I’ve looked through the commit history to figure out what I did that day. It seems I was setting up PyBossa and I fixed a bug in it on my first day! The project looks gorgeous these days thanks to Daniel’s amazing work!

    Team Picture in January 2014

    In the last two years, I’ve written lots of code; traveled to UK, Kenya, Tanzania, and Germany; managed servers and documentation for the systems team; and finally moved into a new role where I’m Senior Systems Administrator and Developer at the same time. It’s been a fabulous 2 years and I’m proud to work with my fantastic colleagues.

    Looking forward to more fun!

  • Goodbye Bangalore

    It’s done. On September 13th, I said good bye to Bangalore after about 7.5 years of calling it my home. It’s the city where I’ve lived the longest in one stretch. I’ll miss home.

    Bangalore airport

    Hello Delhi! I hope I don’t burn from your heat.

    Image Credit: Henry Lawford on Flickr. CC-BY.

  • The long run – Delhi

    The idea was born out of a picture from Reddit that I tweeted during the week. On Sunday morning, I found myself wearing my running gear, all set for a 13K run with Souvik, Bhavya, and Sumit . I’ve been doing the C25K since early this year and still haven’t finished it for various reasons. I’ve done two 5K races in Bangalore since then and this was my first really long run.

    I stepped out of the house at 0545 and headed towards the Hauz Khaz metro station. The plan was to start from there head to Central Secretariat, towards India gate, and then towards Lodi Gardens. I did a warm walk + run to the metro station and we started the “official” run from there (Part 1 and Part 2). I finished a 10K when we reached Central Secretariat because I started my warm up earlier. I didn’t run the whole way, clearly don’t have enough stamina for that, but hell, I got there. Alive. After a few minutes of rest while we waited for Bhavya to catch up, we went on Rajpath towards India gate, turned off, went towards Lodi garden, and ended the run at India Habitat Centre.

    Along the route

    The run on Rajpath towards India Gate was hell because of the sun. I ran about as fast as I could to get out of the direct sunlight. I had to stop running a little after that because my feet hurt too much. Eventually, when I reached American Diner, I’d finished 15K, a personal best. We spent a few hours at American Diner eating breakfast and re-hydrating and headed home elated.

    This run has given me a huge motivation boost. Running isn’t easy and every step of the way, you have to talk yourself into not giving up. My goal this year was to set a habit of running, I haven’t achieved a habit yet, but I’m finding running enjoyable rather than a chore and that is a victory.

  • Deploying automatically with webhooks

    Recently, we had a project deliverable to setup a repository that would auto-deploy to the staging server. I spent a bit of time getting this right, so I figured it’d be useful for someone else who had to do this.

    Code

    I wrote cloaked-spice, a tiny Flask app to do the job here. Flask documentation has a pretty neat example for doing request checksums. I’ve just modified it to work with HMAC and SHA1. It sounds simple, but thanks to silly mistakes, it took a few days to get it working 🙂

    Server Setup

    The Flask app is extremely limited in what it can do on the server. It is run as a user called deploy and a group called deploy. All the files that the app can update are owned by the group deploy and editable by the group. Thanks to sudo’s flexibility, it can only run one sudo command. Here’s the line in sudoers file:

    deploy ALL=(ALL) NOPASSWD: /usr/bin/service apache2 * 

    Serving cloaked-spice

    I’m using gunicorn and Nginx to serve the app and supervisor to manage the gunicorn process. I’m sure other wsgi servers would be up-to the job just as easily.

    Credits to Github for suggesting a name for this that sounds less boring that deploy.

  • Arrrgh! Tracebacks and Exceptions

    My colleague asked me to take a look at a logging issue on a server last week. He noticed that the error logs had way too little information about exceptions. In this particular instance, we had switched to Nginx + gunicorn instead of our usual Nginx + Apache + mod_wsgi (yeah, we’re weird). I took a quick look this morning and everything looked exactly like they should. I’ve read up more gunicorn docs today than I’ve ever done, I think.

    Eventually, I asked my colleague Tryggvi for help. I needed a third person to tell me if I was making an obvious mistake. He asked me if I tried running gunicorn without supervisor, which I hadn’t. I tried that locally first, and it worked! I was all set to blame supervisor for my woes and tried it on production. Nope. No luck. As any good sysadmin would do, I checked if the versions matched and they did. CKAN itself has it’s dependencies frozen, this lead to more confusion in my brain. It didn’t make sense.

    I started looking at the Exception in more detail, there was a note about email not working and the actual traceback. Well, since I didn’t actually have a mail server on my local machine, I commented those configs out, and now I just had the right Traceback. A few minutes later, it dawned on me. It’s a Pylons “feature”. The full traceback is printed to stdout if and only if there’s no email handling. Our default configs have an email configured and our servers have postfix installed on them and all the errors go to an email alias that’s way too noisy to be useful (Sentry. Soon). I went and commented out the relevant bits of configuration and voilà, it works!

    Palm Face

    Image source: Unknown, but provided by Tryggvi 🙂