This document contains a number of suggestions for deploying MediaGoblin in actual production environments. Consider “Deploying MediaGoblin” for a basic overview of how to deploy MediaGoblin.
The MediaGoblin WSGI application instance you get with ./lazyserver.sh is not ideal for a production MediaGoblin deployment. Ideally, you should be able to use an “init” or “control” script to launch and restart the MediaGoblin process.
Use the following command as the basis for such a script:
CELERY_ALWAYS_EAGER=true \
/srv/mediagoblin.example.org/mediagoblin/bin/paster serve \
/srv/mediagoblin.example.org/mediagoblin/paste.ini \
--pid-file=/var/run/mediagoblin.pid \
--server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
The above configuration places MediaGoblin in “always eager” mode with Celery, this means that submissions of content will be processed synchronously, and the user will advance to the next page only after processing is complete. If we take Celery out of “always eager mode,” the user will be able to immediately return to the MediaGoblin site while processing is ongoing. In these cases, use the following command as the basis for your script:
CELERY_ALWAYS_EAGER=false \
/srv/mediagoblin.example.org/mediagoblin/bin/paster serve \
/srv/mediagoblin.example.org/mediagoblin/paste.ini \
--pid-file=/var/run/mediagoblin.pid \
--server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
MediaGoblin uses Celery to handle heavy and long-running tasks. Celery can be launched in two ways:
[1] | The MediaGoblin WSGI application is the part that of MediaGoblin that processes HTTP requests. |
To launch Celery separately from the MediaGoblin WSGI application:
Make sure that the CELERY_ALWAYS_EAGER environment variable is unset or set to false when launching the MediaGoblin WSGI application.
Start the celeryd main process with
CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_celery ./bin/celeryd
We have a plugin for raven integration, see the “raven plugin” documentation.
Look in your system’s /etc/init.d/ or /etc/rc.d/ directory for examples of how to build scripts that will start, stop, and restart MediaGoblin and Celery. These scripts will vary by distribution/operating system.
These are scripts provided by the MediaGoblin community: