Giter Site home page Giter Site logo

kuanyuchen / flask-live-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johnwheeler/flask-live-starter

0.0 1.0 0.0 57 KB

Fabric tasks to provision infrastructure and deploy Flask web applications

License: Apache License 2.0

Python 90.26% HTML 4.66% Smarty 5.08%

flask-live-starter's Introduction

Do it live!

Welcome to Flask-Live-Starter

Developing a Flask application locally is easy. However, getting it up and running on production infrastructure is harder.

Flask-Live-Starter prescribes a set of best-of-breed infrastructure components that make deploying to VPS instances a snap. It includes Fabric tasks that automate provisioning, deployment, and common post-deployment operations (database backup and log tailing). Deploy early and easily with Flask-Live-Starter!

Introduction

Flask-Live-Starter is a boilerplate Flask application with Fabric tasks that automate the installation and provisioning of:

  • A Linux box (Debian)
  • A WSGI server (Gunicorn)
  • An HTTPD server (Nginx)
  • An SSL certificate (LetsEncrypt)
  • A database server (Postgresql)
  • An in-memory cache (Redis)
  • A firewall (UFW)

In addition to provisioning your application's environment, Flask-Live-Starter makes it a snap to:

  • Deploy your Flask application
  • Backup your production database
  • Tail your production logs

Flask-Live-Starter is all about backend provisioning and deployment. It makes no assumptions about and gives no guidance on front-end frameworks. It only focuses on server-side code, so you're free to use JQuery, Angular, Bootstrap, or whatever you wish.

Quickstart

Let's setup a new application named myapp.

Download flask-live-starter

git clone https://github.com/johnwheeler/flask-live-starter myapp
rm -rf myapp/.git

Prepare your local development environment

cd myapp
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

Configure your application for development

cp fabfile/settings.py.example fabfile/settings.py
nano fabfile/settings.py

cp app/settings.cfg.example app/settings.cfg
nano app/settings.cfg

createuser <app_name> -P
createdb <app_name> -O <app_name>

# where <app_name> is the value of env._app_name in fabfile/settings.py

python app/views.py

Prepare the remote server

fab install.system install.postgres install.redis

fab provision.firewall provision.database

fab remote.deploy

fab provision.certificate

Fabric Tasks

The fabric tasks are broken into four namespaces that each focus on a separate deployment concern.

  • install is for installing system components including the stack for serving Flask apps, Postgresql, and Redis
  • provision is for provisioning a certificate, a firewall, and a database
  • remote includes tasks to deploy your application, backup your database, and tail and grep logs
  • local has one task that restores the latest backup to your local development database so you can work off your production dataset.

See the tasks in each namespace for details

flask-live-starter's People

Contributors

jeffgodwyll avatar

Watchers

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