Skip to content

Latest commit

 

History

History
67 lines (35 loc) · 3.43 KB

README.md

File metadata and controls

67 lines (35 loc) · 3.43 KB

Server Config Instructions & Files

SABIO's backend is a Python Flask application that uses NGINX as reverse-proxy and Gunicorn as WSGI HTTP server. It has been developed on a Ubuntu 20.04.3 LTS server.

Requirements, installation instructions and configuration files can be found in this directory.

Installation

OS install (self-standing applications; used Ubuntu's apt package manager):

  • nginx
  • certbot (sets up certificates for HTTPS, incl redirect in the NGINX config; followed the certbot installation instructions for NGINX + Ubuntu 20) -- NB: certbot requires the HTTP server to be already installed and configured (as it needs to change that configuration))

Python install (used Python's pip3):

  • gunicorn
  • flask
  • pipenv
  • other required Python packages -> see requirements.txt

Need to create a virtual environment in the directory /var/www/flask/sabio/ (with python -m venv /var/www/flask/sabio/)

Files in this directory

  • flask.service: defines a service for the Flask app (actually for Gunicorn, which is responsible for starting Python workers),
    located in /lib/systemd/system/, service can then be started/monitored/stopped with (sudo) systemctl start/status/stop flask

  • nginx.service: defines a service for the NGINX reverse-proxy server, located in /lib/systemd/system/,
    service can then be started/monitored/stopped with (sudo) systemctl start/status/stop nginx, this file is
    automatically created when installing NGINX (not manually modified)

  • reverse-proxy.conf: the config file for the NGINX reverse-proxy server, located in /etc/nginx/sites-enabled/

  • start.sh: executed by flask.service (this bash script actually runs gunicorn), located in /var/www/flask/sabio/, activates the Python virtual environment and runs gunicorn with the Python script app.py and appropriate parameters

Useful Tutorials

list of Flask/Gunicorn/Nginx setup tutorials that were followed to create the SABIO backend; needed to diverge from their instructions a number of times but they might still be helpful references (and explain some configurations in more detail):