From fa708663e10dce088732a344d5a95cc45936fc0f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 11 Dec 2021 22:44:00 +0100 Subject: [PATCH] Replaced command-line uwsgi wrapper in the backend.http docs with gunicorn gunicorn makes it easier to set up a uWSGI wrapper around the web application, and it's easier to install and document than handling uwsgi as an external system dependency. --- platypush/backend/http/__init__.py | 21 +++++++++++---------- platypush/backend/http/manifest.yaml | 1 + setup.py | 4 +--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/platypush/backend/http/__init__.py b/platypush/backend/http/__init__.py index e2fb28d9..2e3cb396 100644 --- a/platypush/backend/http/__init__.py +++ b/platypush/backend/http/__init__.py @@ -155,19 +155,20 @@ class HttpBackend(Backend): * **bcrypt** (``pip install bcrypt``) * **magic** (``pip install python-magic``), optional, for MIME type support if you want to enable media streaming - * **uwsgi** (``pip install uwsgi`` plus uwsgi server installed on your - system if required) - optional but recommended. By default the - Platypush web server will run in a process spawned on the fly by - the HTTP backend. However, being a Flask app, it will serve clients - in a single thread and won't support many features of a full-blown - web server. + * **gunicorn** (``pip install gunicorn``) - optional but recommended. - Base command to run the web server over uwsgi:: + By default the Platypush web server will run in a + process spawned on the fly by the HTTP backend. However, being a + Flask app, it will serve clients in a single thread and it won't + support many features of a full-blown web server. gunicorn allows + you to easily spawn the web server in a uWSGI wrapper, separate + from the main Platypush daemon, and the uWSGI layer can be easily + exposed over an nginx/lighttpd web server. - uwsgi --http :8008 --module platypush.backend.http.uwsgi --master --processes 4 --threads 4 + Command to run the web server over a gunicorn uWSGI wrapper:: + + gunicorn -w -b :8008 platypush.backend.http.uwsgi - Bear in mind that the main webapp is defined in ``platypush.backend.http.app:application`` - and the WSGI startup script is stored under ``platypush/backend/http/uwsgi.py``. """ _DEFAULT_HTTP_PORT = 8008 diff --git a/platypush/backend/http/manifest.yaml b/platypush/backend/http/manifest.yaml index 5215fbd3..a0865537 100644 --- a/platypush/backend/http/manifest.yaml +++ b/platypush/backend/http/manifest.yaml @@ -5,5 +5,6 @@ manifest: - flask - bcrypt - python-magic + - gunicorn package: platypush.backend.http type: backend diff --git a/setup.py b/setup.py index a4c7dff4..9bdaa658 100755 --- a/setup.py +++ b/setup.py @@ -78,9 +78,7 @@ setup( # Support for Pushbullet backend and plugin 'pushbullet': ['pushbullet.py @ https://github.com/rbrcsk/pushbullet.py/tarball/master'], # Support for HTTP backend - 'http': ['flask', 'bcrypt', 'python-magic'], - # Support for uWSGI HTTP backend - 'uwsgi': ['flask', 'uwsgi', 'bcrypt', 'python-magic'], + 'http': ['flask', 'bcrypt', 'python-magic', 'gunicorn'], # Support for MQTT backends 'mqtt': ['paho-mqtt'], # Support for RSS feeds parser