Giter VIP home page Giter VIP logo

ansible-django's Introduction

A Simple Ansible Playbook for Django

This project contains the simplest possible ansible playbook to provision a server for a django project and deploy new versions of the project.

Assumptions

This playbook assumes you have created an Ubuntu 14.04 server and have already set up ssh public key authentication on it. Assuming you have provisioned a server from a cloud provider such as AWS or Digital Ocean, you should have downloaded the private key when generating the server, or specified a keypair whose private key you already have saved.

It also assumes you are cool with Postgresql as your database.

How to use

  • Install ansible on your computer (sudo pip install ansible should do the trick).

  • Clone this project.

  • Edit the ansible/hosts file and enter the IP address of the server you are deploying to and edit the path to the private key file.

  • Edit the ansible/vars.yml file and enter values appropriate for your project.

  • Run the playbook:

     cd ansible
     ansible-playbook -i hosts provision.yml
    

That's it! Your project is now up and running and assuming you've set up a DNS record for your server, you can now visit your site.

As you make changes and commit to your django project you'll obviously want to push the new version to production, so to do that without having to run the full playbook, you can run this command (from the ansible directory): ansible-playbook -i hosts deploy.yml

That will check out the latest version of your code, install any new dependencies via pip if necessary, run the migrate and collectstatic django management commands, and restart nginx and gunicorn if necessary.

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.