Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

A standalone Docker stack serving the California Civic Data Coalition's applications for analyzing the California Secretary of State’s CAL-ACCESS database

License

Notifications You must be signed in to change notification settings

palewire/django-calaccess-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-calaccess-docker

A standalone Docker stack serving the California Civic Data Coalition's applications for analyzing the California Secretary of State’s CAL-ACCESS database.

Layers

Settings

The following environmental options must be configured at runtime when initializing a new container.

ENV variable Definition
MYSQL_DATABASE The name of the MySQL database
MYSQL_USER The MySQL database user's name
MYSQL_PASSWORD The password for the MySQL user
DJANGO_USER The name of the Django admin super user
DJANGO_EMAIL The email of the Django admin super user
DJANGO_PASSWORD The password of the Django admin super user

Getting started

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 [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.

Deploying to Amazon Web Services via Elastic Beanstalk

First you must have an AWS account configured for Elastic Beanstalk and install the eb command line utility. You'll need to use eb init and eb create to get a repository ready to roll.

Then create a Dockerrun.aws.json file that looks something like this.

{
  "AWSEBDockerrunVersion": "1",
  "Image": {
    "Name": "ccdc/django-calaccess:0.6",
    "Update": "true"
  },
  "Ports": [
    {
      "ContainerPort": "80"
    }
  ],
  "Logging": "/var/log/"
}

Create a new directory for Elastic Beanstalk configuration.

$ mkdir .ebextensions

Then add a file called 01env.config and configure the environment variables with your own credentials.

option_settings:
  - option_name: MYSQL_DATABASE
    value: calaccess
  - option_name: MYSQL_USER
    value: ccdc
  - option_name: MYSQL_PASSWORD
    value: yourcrazypassword
  - option_name: DJANGO_USER
    value: admin
  - option_name: DJANGO_EMAIL
    value: [email protected]
  - option_name: DJANGO_PASSWORD
    value: yourdjangopassword

Fire away!

$ eb deploy

Building the Docker image from source

Create a virtual enviroment to work inside.

$ virtualenv django-calaccess-docker

Jump in and turn it on.

$ cd django-calaccess-docker
$ . bin/activate

Clone this repository and jump in that.

$ git clone https://github.com/california-civic-data-coalition/django-calaccess-docker.git repo
$ cd repo

Compile the image from the Dockerfile.

$ sudo docker build -t ccdc/django-calaccess ./src/

Then fire up a container.

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

About

A standalone Docker stack serving the California Civic Data Coalition's applications for analyzing the California Secretary of State’s CAL-ACCESS database

Resources

License

Stars

Watchers

Forks

Packages