As the Year of 2015 Draws to a Close…

…it makes me want to reflect on this past year and plans for the new year.

Professionally it has been a great year. I feel like an active and important part of the work we do at Points. Over the past year, I’ve gone for being mediocre in Javascript to someone who feels confident in working with that language. I have given talks both small and large, and people seek out my expertise. (Even though I don’t feel like I’m an expert at times in many things.) I have approached languages and frameworks like Erlang, Qt, C and OpenGL that in the past felt unapproachable, and have learned quite a bit about them. In general things are looking up, and hopefully next year I’ll continue this trend and expand my knowledge and experience in new directions.

Personally it has been a year of highs and lows. I am happy to feel that I’m on track with some of my personal goals. A large one was giving a talk at a PyCon, and that went pretty well. The steady progress on Rookeries has also been encouraging. I feel my faith has deepened which is an important aspect of my life. Also the realization and confirmation that I can be an interesting and fun person, that others want and seek out being with me, makes me feel better as a person. It has not been all been sunshine and roses, having to close down projects (like justCheckers) and give up on certain plans certainly has been disappointing. Also I have the nagging feeling of having not done enough writing. Hopefully I will rectify that, this upcoming year.

Maybe it is just a feeling; but seeing myself take on older projects and realize them feels empowering. There is still so much I want to do, but as this year draws to a close, I feel that I’ll be able to continue progressing forward. And I know this a bit premature, but since we are so close to the start of 2016: Happy New Year!

Merry Christmas

Today is Christmas Eve, and I just wanted to wish you dear reader: a very Merry and blessed Christmas to you and your family. And may the One who came into the world to save humanity, may also come into your life.

enter image description here

Switching to systemd

I recently upgraded my version of Ubuntu to 15.04. In the process, I found out that my init system had changed from Upstart to systemd. While having something as fundamental as the init system management was a bit annoying, it isn’t as bad as some folks are making it out on the Web. Here are some of the things I learned as worked with systemd in fixing my CouchDB server. Part of this is based on this excellent guide on using systemd for Upstart users. The other part is just experimentation on my part.

Checking the Status of All Services

sudo systemctl status

Hint: feel to grep through the output to find anything

Sidenote

At first I could not find the CouchDB service. I had to uninstall the package and purge the packages and then reinstall it:

sudo aptitude purge couchdb
sudo aptitude install couchdb

After that the service showed up in the systemd services, rather than just having an Upstart service.

Checking the Status of a Service

sudo systemctl status $MY_SERVICE

Starting and Stopping a Service

sudo systemctl [start|stop|restart] $MY_SERVICE

Logging Service Activity

This was an interesting thing in systemd. Normally one has to look at the Upstart log at /var/log/upstart/$JOB.log. systemd provides its own logging mechanism, so to see the log of a service you have to use the journalctl utility.

sudo journalctl -u $MY_SERVICE

The output behaves just like one would expect from less.

Overall Impressions

Once I got over my initial head scratching of how to use systemd, it was not bad. Rather it feels different, but not in a bad way honestly. I might look into this more closely and see if I prefer using something like systemd over supervisord for controlling even WSGI apps.

The one disappointing thing that I discovered related to my experiments with systemd, or rather specifically with CouchDB in Ubuntu 15.04. There doesn’t seem to be a way to configure CouchDB to have admin users with passwords for some reason I can’t quite fathom. In the meantime, I guess I’ll have to stick to running CouchDB from a Docker container until I can resolve the issue natively.

Sending Success and Failures Messages to SauceLabs for Splinter Web Tests

We use SauceLabs at work to handle the maintenance of environments specifically for running web tests. I highly recommend using SauceLabs over trying to maintain your own internal testing lab. (I know I helped create our Android web test environments and maintain the iOS Selenium environment. It was a lot of work and not a lot of fun especially with deadlines breathing down my neck.)

As mentioned in a previous post, my started using Splinter for writing web tests. Splinter has excellent support for running remote Selenium tests, and hence support for running tests in SauceLab virtual VMs. However one thing I drove me nuts is that when looking at the SauceLabs dashboard, I had no idea if a test scenario succeeded or not.

Adding Success and Failure Messages

It turns out that a SauceLabs VM has no notion of a successful or failed test… or more correctly a Selenium web driver doesn’t. But you can correlate a SauceLab VM test run (job) with a successful or failed test.

The only issue is that the example given uses nose and selenium rather than lettuce and splinter. So how did I get it working for splinter and lettuce? By adding the following code after a scenario is run:

@lettuce.after.each_scenario
def report_to_saucelabs(scenario):
     #Remember to quit your webdriver after you run your tests!
    scenario.browser.quit()  

    # This was the most sure fire way to check if this was a remote web driver vs a local one.
    if not isinstance(scenario.browser, splinter.driver.webdriver.remote.WebDriver):
        return 

    # Now gather all the failed steps and figure out what status needs to get sent
    failed_steps = [step for step in scenario.steps if step.failed]
    test_successful = bool(failed_steps) == False

    # Finally we have to connect to SauceLabs using the saucelabs Python client (pip install sauceclient)
    sc = sauceclient.SauceClient(SAUCELABS_ACCOUNT, SAUCELABS_ACCESS_KEY)
    sc.jobs.update_job(scenario.browser.driver.session_id, passed=test_successful)

PyCon Canada 2015 Talk – Fabric-less Deployment of WSGI Apps

As you may know, I presented a talk at PyCon Canada this year. And as promised I wanted to post the video and the associated content here. Hope you enjoy it!

Video of Talk

Abstract

Intermediate level talk about migrating a Fabric deployment to a more flexible setup using using Ansible and Invoke. Follows the journey of changing the deployment of a Flask based blogging app from a Fabric script and pre-provisioned server to a modular system with Invoke tasks and provisioning using Ansible. Discusses the advantages and cons of moving to a declarative system versus direct shell commands. Touches upon on Ansible Roles, Ansible Galaxy and Invoke.