Git Product home page Git Product logo

salt-django-provisioning's Introduction

Django app provisioning using Salt

Example Salt states for provisioning the infrastructure of a REST API implemented in Python with SQL persistence.

Infrastructure

DB

The DB used is PostgreSQL and runs in a single machine.

REST API

The API runs on a single machine.

The API uses the database from the DB machine.

The API is configured as a WSGI application and executed by gunicorn.

The gunicorn instance is watched by the supervisor service.

Nginx runs as a reverse proxy of gunicorn.

Salt

Salt runs on:

  • A Salt master machine
  • The REST API machine (running a Salt minion)
  • The DB machine (running a Salt minion)

Prerequisites

  • Python
  • Ruby
  • A VM Manager, either: ** VirtualBox or ** libvirt with vagrant-libvirt Vagrant plugin installed(vagrant plugin install vagrant-libvirt)
  • Vagrant

Initial VM Setup

The Vagrantfile already exist in this project. In order to create the VMs execute:

vagrant up

Cleanup

When finished working on this project, execute:

vagrant destroy -f

Salt

Configuration

Master

file_roots is set to directory saltstack/salt and pillar_roots to saltstack/pillar, both settings defined in saltstack/etc/master

Operation

Log into Salt master:

vagrant ssh master

Change to root user:

sudo su

Accept the keys of Salt minions:

salt-key -A

Provision all minions:

salt '*' state.apply

Provision Walkthrough

All the actions described below are performed automatically by Salt during provision.

API

The application code is cloned from a Github repository into a local directory.

The application relies on an .env file, which is filled with information read by Salt from Pillar and Mine.

Salt Pillar contains DB credentials.

Salt Mine provides the IP address of each machine, in particular the IP address of the DB server. Salt uses the DB IP address informed by Mine and fills the DB host parameter in the .env file.

salt-django-provisioning's People

Contributors

emystein avatar

Watchers

 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.