diff --git a/src/postorius/doc/deployment.rst b/src/postorius/doc/deployment.rst new file mode 100644 index 0000000..2aa5757 --- /dev/null +++ b/src/postorius/doc/deployment.rst @@ -0,0 +1,129 @@ +============ +Deployment +============ + +.. note:: + This guide covers deployment options of Postorius. + + +Nginx with uwsgi +================ + +.. note:: + Please refer to nginx and uwsgi documentation for explanation of the shown + snippets. + +Below is an example uwsgi configuration file: + +:: + [uwsgi] + + chdir = /srv/django/mailman + module = postorius_standalone.wsgi + virtualenv = /srv/django/mailman/env + + master = true + processes = 4 + socket = /run/uwsgi/mailman.sock + #chmod-socket = 666 + + vacuum = true + plugin = python2 + + uid = http + gid = http + +And a nginx server section to with it: + +:: + + upstream mailman { + server unix:///run/uwsgi/mailman.sock; + } + + server { + listen 80; + # TODO Replace with your domain + server_name lists.example.com; + return 301 https://$server_name$request_uri; + + } + + ## Config for server secured with https + server { + listen 443; + + # TODO Replace with your domain + server_name lists.example.com; + + + ssl on; + # TODO Replace with your crt and key + ssl_certificate /etc/nginx/keys/lists.example.com.crt; + ssl_certificate_key /etc/nginx/keys/lists.example.com.key; + ssl_session_timeout 5m; + ssl_ciphers 'AES128+EECDH:AES128+EDH'; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_prefer_server_ciphers on; + add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"; + + charset utf-8; + + # max upload size + client_max_body_size 75M; # adjust to taste + + location /static { + # TODO Adjust to your static location + alias /srv/django/mailman/public/static; + } + + # Finally, send all non-media requests to the Django server. + location / { + uwsgi_pass mailman; + include /etc/nginx/uwsgi_params; # the uwsgi_params file you installed + } + } + + +Apache with mod_wsgi +==================== + +.. note:: + This guide assumes that you know how to setup a VirtualHost with Apache. + If you are using SQLite, the ``.db`` file as well as its folder need to be + writable by the web server. + +These settings need to be added to your Apache VirtualHost: + +:: + + Alias /static /path/to/postorius_standalone/static + + Order deny,allow + Allow from all + + + WSGIScriptAlias / /path/to/postorius_standalone/srv/postorius.wsgi + + Order deny,allow + Allow from all + + +The first Alias serves the static files (CSS, JS, Images, etc.). The +WSGIScriptAlias serves the Django application. The paths need to be changed +depending on which location you downloaded ``postorius_standalone`` to. + +Final setup instructions +======================== + +We're almost ready. But you need to create translations and collect the static +files from Postorius (which resides somewhere on your pythonpath) to be able to +serve them from the site directory. All you have to do is to change into the +``postorius_standalone`` directory and run: + +:: + + $ python manage.py compilemessages + $ python manage.py collectstatic + +After reloading the webserver Postorius should be running! diff --git a/src/postorius/doc/index.rst b/src/postorius/doc/index.rst index c4d09bf..1fa709a 100644 --- a/src/postorius/doc/index.rst +++ b/src/postorius/doc/index.rst @@ -16,3 +16,4 @@ news.rst setup.rst development.rst + deployment.rst diff --git a/src/postorius/doc/setup.rst b/src/postorius/doc/setup.rst index 943e7c5..62e86d0 100644 --- a/src/postorius/doc/setup.rst +++ b/src/postorius/doc/setup.rst @@ -102,43 +102,3 @@ You should use the development server only locally. While it's possible to make your site publicly available using the dev server, you should never do that in a production environment. - - -Running Postorius on Apache with mod_wsgi -========================================= - -.. note:: - This guide assumes that you know how to setup a VirtualHost with Apache. - If you are using SQLite, the ``.db`` file as well as its folder need to be - writable by the web server. - -These settings need to be added to your Apache VirtualHost: - -:: - - Alias /static /path/to/postorius_standalone/static - - Order deny,allow - Allow from all - - - WSGIScriptAlias / /path/to/postorius_standalone/srv/postorius.wsgi - - Order deny,allow - Allow from all - - -The first Alias serves the static files (CSS, JS, Images, etc.). The -WSGIScriptAlias serves the Django application. The paths need to be changed -depending on which location you downloaded ``postorius_standalone`` to. - -We're almost ready. But you need to collect the static files from Postorius -(which resides somewhere on your pythonpath) to be able to serve them from the -site directory. All you have to do is to change into the -``postorius_standalone`` directory and run: - -:: - - $ python manage.py collectstatic - -After reloading the webserver Postorius should be running!