Ansible Playbook designed for running a Raycrafter Master Server and Crafter Nodes. It installs and configures applications that are needed for production deployments.
It deploys a Django project and sets up Gunicorn and Nginx to serve your site. PostgreSQL is used as database backend for Django. RabbitMQ for sending task to Celery workers (a asynchronous task queue). The workers live on the crafter nodes. They can also transfer files via GridFTP to the cluster.
On top of that a logging server is deployed. In this case it is Graylog, which depends on Elasticsearch and MongoDB.
Overview:
- Nginx
- Gunicorn
- PostgreSQL
- Supervisor
- Virtualenv
- Memcached
- Celery
- RabbitMQ
- Elasticsearch
- MongoDB
- Graylog Server/Web Interface
- GridFTP
Tested with OS: Ubuntu 14.04 LTS x64
This project started as a fork from https://github.com/jcalazan/ansible-django-stack but developed into something different. A lot of credit goes to Jonathan Calazan for his awesome project.
A fast way to test the setup is with Vagrant and VirtualBox.
Install all ansible requirements. You might have to specify a path for the roles where you have permissions. You can use the example below. Make sure not to commit the downloaded roles.:
$ ansible-galaxy install -r requirements.txt -p ./roles
There are two sets of configurations: env_vars/vagrant.yml
and env_vars/production.yml
.
Here you configure your setup, like the location of your Git project, the project name, and application name which will be used throughout the Ansible configuration.
For more details see the documentation.
I set some default values in env_vars
based on a test project Djangotest.
If you want to create your own Django project I recommend to use the Cookiecutter template: Cookiecutter-Django. It is supposed to work out of the box with this setup. For more specific information on how to setup your Django project see the documentation.
After installing Ansible, Vagrant and VirtualBox you simply execute:
vagrant up
Wait a few minutes for the magic to happen. Access the Django site by goingto this URL: https://192.168.33.15
Access the Graylog web-interface via: https://192.168.33.15:9000
That's it. One command, a little waiting and you are good to go. For information on how to setup remote machines without vagrant see the documentation.