- Fork this repo, and clone your version into
/opt/banana
on the VPS
git clone https://github.com/<yourusername>/example-devops-app /opt/banana
- Begin setting up the server (paths below are relative to
/opt/banana
)
- Put all your config in
etc/
(e.g config fornginx
,supervisor
, etc) - Put all mutable data in
data/
(e.g.nginx
certs,postgres
database, logs) - Put all management scripts in
bin/
(e.g.start
,stop
,deploy
,backup
) - Put all application code in
code/
(e.g. django app code, python)
- Running nginx, postgres, and django, managed by a service (Docker-Compose)
- Django point to the local PostgreSQL v11 database for data
- Nginx running in front of django, proxying only page requests to Django.
- Accept http2 requests and return http2 responses (using the nginx http2 module)
- All code and data files only be readable/writable by their respective users and root (i.e. run nginx and django as www-data, postgres as the postgres user, etc.)
- store all logs, and other data in /opt/banana/data (this includes nginx logs, postgres logs, and the postgresql database files)
- close port 80 and 443 by using a cloudflare argo tunnel to serve the app (which avoids exposing the app server’s IP address to the public)
- Redirect all port 80 HTTP requests to HTTPS
- SSL CLoudflare (HTTP2)
- 4 Scripts in bash : bin/stop: stop django, nginx, and postgresql bin/start: start django, nginx, and postgresql bin/deploy: pull the latest version of the app code from github, run migrations, and restart the necessary services bin/backup: dump the postgresql database to a .sql file in /opt/banana/data/backups