Blog / Devops

Using Docker and Docker Compose for local Django development (replacing virtualenv)

April 30, 2015

Before Docker came along, virtualenv was pretty much the tool of choice for Python developers as it allows you to separate package dependencies for different applications you're working on without having to create separate virtual machines for each one. It worked very well for me.

However, there are still some annoying things the developers will have to deal with. Such things include having to install additional applications and services required by the project such as …

Haystack with Solr: Indexing Tips

January 22, 2015

I was troubleshooting an issue a couple of weeks ago with some of our Django views taking too long to return a response. The issue was due to post_save and post_delete signals making a request to Solr to update the index with the 'commit' parameter set to 'true' (Haystack default). This basically tells Solr to do the indexing right away (hard commit) and it was taking a few seconds to finish.

Below are some tips …

Docker Cleanup Commands

October 4, 2014

I've been working quite a bit with Docker these last few weeks and one thing that I found really annoying was all these unused containers and images taking up precious disk space.

I wish Docker has a 'docker clean' command that would delete stopped containers and untagged images. Perhaps sometime in the near future as the project is very active. But for the time being, these commands should do the job.

Kill all running containers …

Ansible Playbook for a Django Stack (Nginx, Gunicorn, PostgreSQL, Memcached, Virtualenv, Supervisor)

April 20, 2014

I decided to create a separate GitHub project for the Ansible playbook I'm currently using to fully provision a production server for my open-source app, GlucoseTracker, so it can be reused by people who are using the same stack.

You can download the playbook here: https://github.com/jcalazan/ansible-django-stack

The playbook can fully provision an Ubuntu 12.04 LTS server (will test 14.04 soon) from the base image with the following applications, which are quite popular in the …

How to configure Nginx so you can quickly put your website into maintenance mode

April 6, 2014

I had to rebuild my Rackspace VPS last night where my Django app runs as I wanted to downgrade it because it was underutilized. Since I was already at the lowest tier for that category of servers, there's no option to resize it down, I would need to spin up a new server from a different server category.

Thanks to Ansible, though, provisioning a new server with all the applications and configurations I needed …