Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add openrc init script and recommend users use uwsgi #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ Example instructions for debian based systems, if you don't use debian check you
You probably also want to use something else then ``apt-get`` on non debian based distributions.

In this example we will install the flask http server and proxy requests from an already installed and configured webserver (nginx) to the flask http server.
It is also possible to run the python script with ``wsgi`` which should yield in better performance.
You should not use the flask http server in production.
Instead, run the python script with ``wsgi`` which should yield in better performance and security.

I assume your webserver uses ``www-data`` as service account. If you have a different user update the systemd service and the permissions for the data directory.

Expand Down Expand Up @@ -87,4 +88,15 @@ Enable systemd service::
Configure your webserver:

As final step you need to point your external webserver to your xmpp-http-upload flask app.
Check the ``contrib`` directory, there is an example for nginx there.
Check the ``contrib`` directory, there is an example for nginx there.

Uwsgi
=================================

Instead of setting up the systemd service as above, install uswgi and run the following commands using your service manager (systemd, openrc, etc.)::

cd /opt/xmpp-http-upload
export XMPP_HTTP_UPLOAD_CONFIG=/opt/xmpp-http-upload/config.py
uwsgi --plugins http,python --http 127.0.0.1:5002 --module xhu

There is a example init script for openrc in the contrib folder.
17 changes: 17 additions & 0 deletions contrib/xmpp-http-upload.openrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/sbin/openrc-run

name=$RC_SVCNAME
pidfile="/var/run/$RC_SVCNAME.pid"
command_background="yes"
command="/usr/sbin/uwsgi"
command_args="--plugins http,python --http 127.0.0.1:5002 --module xhu"
command_user="nginx:nginx"

depend() {
after prosody
}

start_pre() {
cd /opt/xmpp-http-upload
export XMPP_HTTP_UPLOAD_CONFIG=/opt/xmpp-http-upload/config.py
}