GithubHelp home page GithubHelp logo

bakodo / salt-django-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akoumjian/salt-django-example

0.0 3.0 0.0 103 KB

An example of a salt state tree for Django deployment

Scheme 32.70% Python 67.30%

salt-django-example's Introduction

salt-django-example

A salt state tree for deploying a django app to a production server.

The Stack

  • __Ubuntu 12.04 64bit __: The package names and the rest of the stack are only known to work with Ubuntu 12.04
  • NGINX: As a reverse proxy for the wsgi container and to serve static content
  • gunicorn: As our wsgi container
  • circus: Process watcher for gunicorn
  • git: For deploying our web application
  • pip & virtualenv: For installing our requirements

The Setup

There is no one click solution here, but when you are complete you will be able to deploy stateless web applications with relative easy and consistency. This tutorial does not include:

  1. Setting up a salt-master
  2. Configuring the salt-minion conf
  3. Creating and hosting your database

When you are certain you already have those setup, you can continue.

Deploy Keys

If you don't already have a deploy key for your application, you will want to create one. This guide assumes you are deploying from a private repository on github. See the guide here for details: https://help.github.com/articles/managing-deploy-keys

After you have created your deploy key, you will want to place the keypair in salt/deploy/ as id_rsa and id_rsa.pub respectively. If you name them something different, you will need to go into salt/webserver/init.sls and change the reference.

Entering your details

Now you will need to edit the pillar/settings.sls file. Here you will enter the string values for your git repository, the branch or commit you wish to deploy, and your database settings.

You will now need to copy over your settings from settings.py to the one located in salt/webserver/settings.py. Make sure to you do not overwrite the template pillar fields and that you have included gunicorn in the installed apps.

Check to make sure that the static folder specified in salt/webserver/nginx.conf correlates to the location of your static files.

Deploying

Make sure you've placed your this state tree on the file_root for your salt-master (normally /srv/salt). From your salt master you can now run salt '*' state.highstate.

Notes

The example is still missing conditional states to initiate your database with syncdb, run migrations, or running collectstatic on your files. These will be added in an upcoming release.

salt-django-example's People

Contributors

akoumjian avatar valberg avatar

Watchers

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