Coder Social home page Coder Social logo

leonsas / ansible-django-stack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jcalazan/ansible-django-stack

0.0 2.0 0.0 284 KB

Ansible Playbook for setting up a Django app with Nginx, Gunicorn, PostgreSQL, Celery, RabbitMQ, Supervisor, Virtualenv, and Memcached. A Vagrantfile for provisioning a VirtualBox virtual machine is included as well.

ansible-django-stack's Introduction

ansible-django-stack

Ansible Playbook designed for environments running a Django app. It installs and configures these applications that are commonly used in production Django deployments:

  • Nginx
  • Gunicorn (v18.0 only, v19.0 no longer supports running with manage.py)
  • PostgreSQL
  • Supervisor
  • Virtualenv
  • Memcached
  • Celery
  • RabbitMQ

Default settings are stored in roles/role_name/vars/main.yml. Environment-specific settings are in the env_vars directory.

Tested with OS: Ubuntu 12.04.4 LTS x64

Tested with Cloud Providers: Amazon, Rackspace, Digital Ocean

Getting Started

A quick way to get started is with Vagrant and VirtualBox.

Requirements

The main settings to change here is in the env_vars/base file, where you can configure the location of your Git project, the project name, and application name which will be used throughout the Ansible configuration.

I set some default values here using my open-source app, GlucoseTracker, so all you really have to do is type in this one command in the project root:

vagrant up

Wait a few minutes for the magic to happen. Access the app by going to this URL: http://192.168.33.15

Yup, exactly, you just provisioned a completely new server and deployed an entire Django stack in 5 minutes with two words :).

Additional vagrant commands

SSH to the box

vagrant ssh

Re-provision the box to apply the changes you made to the Ansible configuration

vagrant provision

Reboot the box

vagrant reload

Shutdown the box

vagrant halt

Running the Ansible Playbook on existing servers

Create a Playbook for that environment and specify the user accounts to use. See development.yml for an example.

If you only have 1 server, you can skip the other steps below and simply run the Playbook with this command: ansible-playbook -i 175.23.44.109, -v development.yml --ask-sudo-pass

If you have multiple servers, create an inventory file in the root folder for your environment and add your servers' hostnames or IP addresses there.

For example:

# development

[webservers]
webserver1.example.com
webserver2.example.com

[dbservers]
dbserver1.example.com

Run the Playbook:

ansible-playbook -i development -v development.yml --ask-sudo-pass

Useful Links

ansible-django-stack's People

Contributors

jcalazan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.