Giter Site home page Giter Site logo

django-skinny-deploy's Introduction

Django Skinny Deploy

Simple, single file deploy a Django project to an Ubuntu host. Full-automatic, copy-paste Nginx/Gunicorn/Let's Encrypt HTTPS set up in minutes. Tested on Ubuntu 18.04 LTS/19.10 and Debian 10 images

              

Read full story on Medium

Why?

Because I didn't find any drop-and-run solution not overburdened with a lot of files for a simple project.

Prerequisites

  • Get your Virtual Private Server running (Digital Ocean, Linode, Vultr or on any other provider)
  • Buy and set up your domain (GoDaddy, Gandi, ...)

Ensure that your server is up and running and you can connect to them over ssh via domain name

What does this script do?

  • Postgresql/Nginx/Gunicorn installed and configured on the server
  • All code from a local directory synced to /srv/yourdomain.com on the server
  • yourdomain-com user and yourdomain-com database created on the Postgresql server
  • Let's Encrypt certificates requested, systemd timer installed for automatic renewal

https://yourdomain.com - becomes ready to serve.

Quick Start

The repository contains a quick django project template. It's just a raw django 3.0 startproject template with Pipenv and django-environ enabled. No extra heady sugar added.

python3 -m pip install --user django
django-admin.py startproject --template=https://github.com/viewflow/django-skinny-deploy/archive/template.zip mysite

For an existing project, you need to install pipenv, and modify project settings to use django-environ. Detailed instructions available in this article.

Deploy

To work on the proeject you need to have Pipenv and Ansible tools installed. I prefer to have pipenv installed for a user, and ansible as a development project dependency.

python3 -m pip install --user pipenv
pipenv -d install ansible
pipenv run ansible-playbook -i yourdomain.com, -u root deploy.yml

Please note the comma after the domain name. It's required and tells ansible that we have provided a domain name, instead of an inventory file name.

During the first deployment you will be asked for an email address for Let's Encrypt certificate registration.

That's all!

Update existing deployment

pipenv run ansible-playbook -i yourdomain.com, -u root deploy.yml -tags=update

Troubleshooting

Run ansible-playbook with -vvv flag:

Check service status on the server console:

$ service nginx status
$ service gunicorn_yourdomain_com status

Check logs at:

/var/nginx/logs

Contributing

Have an idea how to make this script smarter, smaller and cleaner? Pull requests are welcome!

License

Zero-Clause BSD (0BSD)

Copyright (C) 2019 by Mikhail Podgurskiy <[email protected]>

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

django-skinny-deploy's People

Contributors

kmmbvnr avatar xelarate86 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

django-skinny-deploy's Issues

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.