DOCS:: #675 revision to deployment and production documents
[mediagoblin.git] / docs / source / production-deployments.rst
CommitLineData
b25b00d2 1=========================================
2Considerations for Production Deployments
3=========================================
4
5This document contains a number of suggestions for deploying
6MediaGoblin in actual production environments. Consider
7":doc:`deploying`" for a basic overview of how to deploy Media
8Goblin.
9
a085dda5 10Deploy with Paste
11-----------------
12
13The instance configured with ``./lazyserver.sh`` is not ideal for a
14production MediaGoblin deployment. Ideally, you should be able to use
15an "init" or "control" script to launch and restart the MediaGoblin
16process.
17
18Use the following command as the basis for such a script: ::
19
20 CELERY_ALWAYS_EAGER=true \
21 /srv/mediagoblin.example.org/mediagoblin/bin/paster serve \
22 /srv/mediagoblin.example.org/mediagoblin/paste.ini \
23 --pid-file=/var/run/mediagoblin.pid \
24 --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 \
25
26The above configuration places MediaGoblin in "always eager" mode
27with Celery, this means that submissions of content will be processed
28synchronously, and the user will advance to the next page only after
29processing is complete. If we take Celery out of "always eager mode,"
30the user will be able to immediately return to the MediaGoblin site
31while processing is ongoing. In these cases, use the following command
32as the basis for your script: ::
33
34 CELERY_ALWAYS_EAGER=false \
35 /srv/mediagoblin.example.org/mediagoblin/bin/paster serve \
36 /srv/mediagoblin.example.org/mediagoblin/paste.ini \
37 --pid-file=/var/run/mediagoblin.pid \
38 --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 \
39
40Separate Celery
41---------------
b25b00d2 42
43While the ``./lazyserer.sh`` configuration provides an efficient way to
44start using a MediaGoblin instance, it is not suitable for production
45deployments for several reasons:
46
a085dda5 47In nearly every scenario, work on the Celery queue will need to
48balance with the demands of other processes, and cannot proceed
49synchronously. This is a particularly relevant problem if you use
50MediaGoblin to host video content. Processing with Celery ought to be
51operationally separate from the MediaGoblin application itself, this
52simplifies management and support better workload distribution.
b25b00d2 53
a085dda5 54Basically, if you're doing anything beyond a trivial workload, such as
55image hosting for a small set of users, or have limited media types
56such as "ASCII art" or icon sharing, you will need to run ``celeryd``
57as a separate process.
b25b00d2 58
59Build an :ref:`init script <init-script>` around the following
60command.
61
62 CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_celery ./bin/celeryd
63
64Modify your existing MediaGoblin and application init scripts, if
65necessary, to prevent them from starting their own ``celeryd``
66processes.
67
68.. _init-script:
69
70Use an Init Script
a085dda5 71------------------
72
73Look in your system's ``/etc/init.d/`` or ``/etc/rc.d/`` directory for
74examples of how to build scripts that will start, stop, and restart
75MediaGoblin and Celery. These scripts will vary by
76distribution/operating system. In the future, MediaGoblin will provide
77example scripts as examples.
78
79.. TODO insert init script here
80.. TODO are additional concernts ?
81 .. Other Concerns
82 .. --------------