Updated raven plugin
[mediagoblin.git] / docs / source / siteadmin / production-deployments.rst
CommitLineData
473a4431
CAW
1.. MediaGoblin Documentation
2
3 Written in 2011, 2012 by MediaGoblin contributors
4
5 To the extent possible under law, the author(s) have dedicated all
6 copyright and related and neighboring rights to this software to
7 the public domain worldwide. This software is distributed without
8 any warranty.
9
10 You should have received a copy of the CC0 Public Domain
11 Dedication along with this software. If not, see
12 <http://creativecommons.org/publicdomain/zero/1.0/>.
13
b25b00d2 14=========================================
15Considerations for Production Deployments
16=========================================
17
18This document contains a number of suggestions for deploying
19MediaGoblin in actual production environments. Consider
076bf0cf 20":doc:`deploying`" for a basic overview of how to deploy MediaGoblin.
b25b00d2 21
a085dda5 22Deploy with Paste
23-----------------
24
25The instance configured with ``./lazyserver.sh`` is not ideal for a
26production MediaGoblin deployment. Ideally, you should be able to use
27an "init" or "control" script to launch and restart the MediaGoblin
28process.
29
30Use the following command as the basis for such a script: ::
31
076bf0cf
WKG
32 CELERY_ALWAYS_EAGER=true \
33 /srv/mediagoblin.example.org/mediagoblin/bin/paster serve \
34 /srv/mediagoblin.example.org/mediagoblin/paste.ini \
35 --pid-file=/var/run/mediagoblin.pid \
36 --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
a085dda5 37
38The above configuration places MediaGoblin in "always eager" mode
39with Celery, this means that submissions of content will be processed
40synchronously, and the user will advance to the next page only after
41processing is complete. If we take Celery out of "always eager mode,"
42the user will be able to immediately return to the MediaGoblin site
43while processing is ongoing. In these cases, use the following command
44as the basis for your script: ::
45
076bf0cf
WKG
46 CELERY_ALWAYS_EAGER=false \
47 /srv/mediagoblin.example.org/mediagoblin/bin/paster serve \
48 /srv/mediagoblin.example.org/mediagoblin/paste.ini \
49 --pid-file=/var/run/mediagoblin.pid \
50 --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
a085dda5 51
52Separate Celery
53---------------
b25b00d2 54
55While the ``./lazyserer.sh`` configuration provides an efficient way to
56start using a MediaGoblin instance, it is not suitable for production
57deployments for several reasons:
58
a085dda5 59In nearly every scenario, work on the Celery queue will need to
60balance with the demands of other processes, and cannot proceed
61synchronously. This is a particularly relevant problem if you use
62MediaGoblin to host video content. Processing with Celery ought to be
63operationally separate from the MediaGoblin application itself, this
64simplifies management and support better workload distribution.
b25b00d2 65
a085dda5 66Basically, if you're doing anything beyond a trivial workload, such as
67image hosting for a small set of users, or have limited media types
68such as "ASCII art" or icon sharing, you will need to run ``celeryd``
69as a separate process.
b25b00d2 70
71Build an :ref:`init script <init-script>` around the following
076bf0cf 72command::
b25b00d2 73
076bf0cf 74 CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_celery ./bin/celeryd
b25b00d2 75
76Modify your existing MediaGoblin and application init scripts, if
77necessary, to prevent them from starting their own ``celeryd``
78processes.
79
f3f53028 80.. _sentry:
f8107ccc 81
f3f53028
JW
82Set up sentry to monitor exceptions
83-----------------------------------
f8107ccc 84
f3f53028
JW
85We have a plugin for `raven`_ integration, see the ":doc:`/plugindocs/raven`"
86documentation.
f8107ccc 87
f3f53028 88.. _`raven`: http://raven.readthedocs.org
f8107ccc 89
f8107ccc 90
b25b00d2 91.. _init-script:
92
93Use an Init Script
a085dda5 94------------------
95
96Look in your system's ``/etc/init.d/`` or ``/etc/rc.d/`` directory for
97examples of how to build scripts that will start, stop, and restart
98MediaGoblin and Celery. These scripts will vary by
84336a46
JW
99distribution/operating system.
100
101These are scripts provided by the MediaGoblin community:
102
103Debian
104 * `GNU MediaGoblin init scripts
105 <https://github.com/jwandborg/mediagoblin-init-scripts>`_
106 by `Joar Wandborg <http://wandborg.se>`_
107
108Arch Linux
109 * `MediaGoblin - ArchLinux rc.d scripts
110 <http://whird.jpope.org/2012/04/14/mediagoblin-archlinux-rcd-scripts>`_
111 by `Jeremy Pope <http://jpope.org/>`_
112 * `Mediagoblin init script on Archlinux
113 <http://chimo.chromic.org/2012/03/01/mediagoblin-init-script-on-archlinux/>`_
114 by `Chimo <http://chimo.chromic.org/>`_
a085dda5 115
116.. TODO insert init script here
076bf0cf 117.. TODO are additional concerns ?
a085dda5 118 .. Other Concerns
119 .. --------------