New packages deploy CAL-ACCESS apps with Docker, Chef

Take a hack at these new tools for spinning up our stack

This morning we’re releasing a set of open-source packages that aim to make it easier to deploy our tools for acquiring and analyzing CAL-ACCESS, the California Secretary of State’s campaign finance database.

django-calaccess-project-template is a custom template for initializing a preconfigured Django project with our applications already installed and ready to roll.

It works by taking advantage of the underused templating options deep within Django’s startproject command.

# Create a new empty repo
$ git init repo

# Drop in our project
$ django-admin.py startproject --extension=py,.gitignore --template=https://github.com/california-civic-data-coalition/django-calaccess-project-template/archive/master.zip project repo

django-calaccess-docker is a Docker image ready to boot a standalone stack that serves a fully-functioning Django project.

To create a container using this image, start by retriving the image from Docker Hub.

$ sudo docker pull ccdc/django-calaccess:0.6

Then fire up the container with all the required environmental settings included as options.

$ sudo docker run \
    -p 127.0.0.1:80:80 \
    --name my-calaccess \
    -e MYSQL_DATABASE=calaccess \
    -e MYSQL_USER=ccdc \
    -e MYSQL_PASSWORD=mycrazypassword \
    -e DJANGO_USER=admin \
    -e DJANGO_EMAIL=[email protected] \
    -e DJANGO_PASSWORD=mydjangopassword \
    -d ccdc/django-calaccess:0.6

Once that finishes, visit localhost in your browser to see the stack in action. The database will be empty but is set to fill once the daily cron rolls around.

django-calaccess-cookbook also serves the full stack by provisioning a server from Amazon Web Services EC2 service with Chef and Fabric.

Once you have the repository installed locally, firing up a working server should be as simple as:

$ fab ec2bootstrap

All three projects are experimental and in the early stages of development. The aim is to make it easier for others to install, explore and improve our code base. But we know the code isn’t perfect and we want for feedback from hackers like you to make it better. So break it. Please.