From 1cc2914c5dba594daa98101221bff440e7d849db Mon Sep 17 00:00:00 2001 From: checktheroads Date: Sat, 11 May 2019 23:22:27 -0700 Subject: [PATCH] complete restructure --- ...ter-privileges.md => securing-router-access.md} | 0 docs/installation/wsgi.md | 14 ++++++++++++++ hyperglass/config/gunicorn_config.py | 7 +++++++ hyperglass/wsgi.py | 4 ++++ mkdocs.yml | 1 + 5 files changed, 26 insertions(+) rename docs/configuration/{router-privileges.md => securing-router-access.md} (100%) create mode 100644 docs/installation/wsgi.md create mode 100644 hyperglass/config/gunicorn_config.py create mode 100644 hyperglass/wsgi.py diff --git a/docs/configuration/router-privileges.md b/docs/configuration/securing-router-access.md similarity index 100% rename from docs/configuration/router-privileges.md rename to docs/configuration/securing-router-access.md diff --git a/docs/installation/wsgi.md b/docs/installation/wsgi.md new file mode 100644 index 0000000..b75e212 --- /dev/null +++ b/docs/installation/wsgi.md @@ -0,0 +1,14 @@ +For production builds, we'll want to have a real WSGI front end instead of the built in Flask developer web server. For time's sake, Ubuntu 18.04 instructions are provided. That said, this is a pretty generic setup and should be easily replicable to other platforms. + +# Gunicorn Installation + +Gunicorn is a WSGI server written in Python. + +## Install +```console +# pip3 install gunicorn +``` + +## Configure + +Locate your `gunicorn` executable with `which gunicorn` diff --git a/hyperglass/config/gunicorn_config.py b/hyperglass/config/gunicorn_config.py new file mode 100644 index 0000000..13ff6a9 --- /dev/null +++ b/hyperglass/config/gunicorn_config.py @@ -0,0 +1,7 @@ +import multiprocessing + +command = "/usr/local/bin/gunicorn" +pythonpath = "/opt/hyperglass/hyperglass" +bind = "[::1]:8001" +workers = multiprocessing.cpu_count() * 2 +user = "www-data" diff --git a/hyperglass/wsgi.py b/hyperglass/wsgi.py new file mode 100644 index 0000000..e15fce8 --- /dev/null +++ b/hyperglass/wsgi.py @@ -0,0 +1,4 @@ +import app + +if __name__ == "__main__": + app.run() diff --git a/mkdocs.yml b/mkdocs.yml index 911e524..5d053f4 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -18,6 +18,7 @@ nav: - 'Commands': 'configuration/commands.md' - 'Proxy': 'configuration/proxy.md' - 'Blacklist': 'configuration/blacklist.md' + - 'Securing Router Access': 'configuration/securing-router-access.md' - Caching: - 'caching.md' - Rate Limiting: