seospace / HTTP200-ASAP

idiomatic guide to host your (python) applications on example.com ASAP #dokku #flask #domain #dns #digitalocean

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTTP200-ASAP

This guide shows the most simple, fast, cheap and idiomatic way i found to deploy multiple Python applications to yourdomain.tld

PLEASE READ IF YOU DONT KNOW HOW DNS WORKS
PLEASE READ IF YOU DONT KNOW HOW SSH AND DIGITALOCEAN WORKS
PLEASE INSTALL GIT

  1. Create your Dokku droplet
  2. When your Droplet is up and running visit ip address of your Droplet in your web-browser and finish setup (you can just click finish if you follow this guide) ( Warning: If you don't complete setup via the web installer (even if you set up SSH keys and virtual hosts otherwise) your Dokku installation will remain vulnerable to anyone finding the setup page and inserting their key.)
  3. SSH into your Droplet: ssh root@yourdroplet_ip_address

Now you are set, next steps can be reproduced for each new application:

  1. Your domain name DNS record A should point to your_droplet_ip_address.
  2. Create your application (your appname can be your domain name):
  • dokku apps:create appname
  1. Add your domain name to application:
  • dokku domains:add appname yourdomain.tld
  1. Cd into your flask application folder and run:
  • git init . (creates your git repository in current dir)
  • git add . (adds all files and folders in current dir to your repository)
  • git commit (commits changes)
  • git remote add dokku dokku@your_droplet_ip_address:appname (adds a remote named dokku)
  • git push dokku master (pushes your application to your droplet)
  1. You are done. Try to visit yourdomain.tld in your browser now.
  2. If you need SSL look here.

Default flask application can be found in example_app folder. Nginx config is configured to redirect www version to non-www version.

For your custom application you need only 3 files (nginx.conf.sigil is optional and configured to redirect "www" to "non-www"):

Make sure your SERVER_NAME in flask app config == yourdomain.tld

About

idiomatic guide to host your (python) applications on example.com ASAP #dokku #flask #domain #dns #digitalocean


Languages

Language:Python 84.4%Language:HTML 12.2%Language:CSS 3.4%