Skip to content

A test Django application to illustrate the practical differences between Ansible and Nix(OS/Ops)

Notifications You must be signed in to change notification settings

WeAreWizards/voting-deployment-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voting test application

This application is used to illustrate how a simple Django application can be deployed using Ansible and Nix.

Application structure

# The ansible playbook and its supporting files
sandbox1.pem # Not commited
playbook.yml
files/voting.ini.j2 # uwsgi configuration

# The nix configuration
default.nix # default nix expression for the app
voting.nix # nixops logical configuration
voting-aws.nix # nixops physical configuration
state.nixops # state file (not commited)

# Python project files
README.md
MANIFEST.in
setup.py

# Django project
voting/

Ansible deployment

To use the ansible deployment the environment should contain the following variables:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • EC2_REGION

Also, a AWS keypair named sandbox1 should be created in AWS and saved locally as sandbox1.pem.

Ansible and boto must also be installed

$ pip install ansible boto

Finally to actually run the deployment

$ ansible-playbook playbook.yml

Nix(ops) deployment

Install Nix http://nixos.org/nix/download.html and then nixops with

$ nix-env -i nixops

Then to build the package

$ nix-build

Or to access an environment with the package installed

$ nix-shell

The deployment happens in two phases, firstly by creating the deployment

$ nixops create ./voting.nix ./voting-aws.nix --state state.nixops --name voting

And then by executing the deployment

$ nixops deploy --state state.nixops

About

A test Django application to illustrate the practical differences between Ansible and Nix(OS/Ops)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published