Mediagoblin: Difference between revisions

From Bibliotheca Anonoma
No edit summary
No edit summary
Line 74: Line 74:


# If you have SELinux, [http://nathanielca.se/fossrit/deploying-mediagoblin-2-selinux.html see this guide] to make it allow uWSGI sockets.
# If you have SELinux, [http://nathanielca.se/fossrit/deploying-mediagoblin-2-selinux.html see this guide] to make it allow uWSGI sockets.
== Production Configurations and Systemd Configs ==
You will want to seperate out the Celery process from the server, now that mediagoblin's Paste server is running under a uWSGI socket, otherwise uploads won't be processed.
You can skip the paste systemd daemon setup, since having the uwsgi service takes care of that.
http://mediagoblin.readthedocs.io/en/latest/siteadmin/configuration.html

Revision as of 04:42, 9 July 2017

a quick and dirty guide, better docs and maybe puppet config later

Installation

Note: If you have SELinux, temporarily set it to Enforcing mode. After installation, a special rule can be set to allow Mediagoblin to function.
  1. follow Deploying guide using python3, up to the FastCGI and Nginx part where you stop, because flup doesn't work on python3 and uWSGI is better.
  2. Set up uWSGI with Nginx as you see in this guide.

Make sure to install nginx-full on Debian/Ubuntu, or nginx-all-modules on CentOS. Then add the following as stated in this guide:

/etc/nginx/uWSGI_params
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_ADDR $server_addr;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;

Though actually, instead of the config seen in the guide, use this one (since the guide has a typo for uwsgi_pass, and puts the site under domain.com/mediagoblin/, which is not what we want.)

/etc/nginx/conf.d/mediagoblin.conf
location / {
   include uWSGI_params;
   uwsgi_pass 127.0.0.1:26543;

   # our understanding vs nginx's handling of script_name vs
   # path_info don't match :)
   uwsgi_param SCRIPT_NAME "";
   uwsgi_modifier1 30;
}

uWSGI Emperor Config

It is a good idea to run the uWSGI apps as vassals to the uWSGI Emperor service. Install it with:

sudo yum install uwsgi uwsgi-plugin-python3

Then create a uwsgi config file for mediagoblin:

/etc/uwsgi.d/mediagoblin.ini
[uwsgi]
plugin=python3
uid=mediagoblin
gid=nginx
socket=127.0.0.1:26543
virtualenv=/srv/www/mediagoblin
chdir=/srv/www/mediagoblin
ini-paste=/srv/www/mediagoblin/paste.ini
logto=/srv/www/mediagoblin/mg.log

Most importantly, chown it to mediagoblin:nginx so that uwsgi will run the service with those permissions.

sudo chown mediagoblin:nginx /etc/uwsgi.d/mediagoblin.ini

Finally, run the uwsgi Emperor service.

sudo systemctl start uwsgi

If sudo systemctl restart uwsgi shows you that [emperor] vassal mediagoblin.ini is ready to accept requests, then enable the uwsgi service on boot:

sudo systemctl enable uwsgi

Notes

  1. If you have SELinux, see this guide to make it allow uWSGI sockets.

Production Configurations and Systemd Configs

You will want to seperate out the Celery process from the server, now that mediagoblin's Paste server is running under a uWSGI socket, otherwise uploads won't be processed.

You can skip the paste systemd daemon setup, since having the uwsgi service takes care of that.

http://mediagoblin.readthedocs.io/en/latest/siteadmin/configuration.html