mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Add a bit of info to the virtualenv notes.
This commit is contained in:
parent
099a0b8465
commit
6f92b91c59
@ -135,8 +135,8 @@ http {
|
||||
features like Comet, Long polling, or Web sockets, you need to turn off the
|
||||
proxy buffering. <strong>When you do this</strong> you must run with one of the async worker
|
||||
classes.</p>
|
||||
<p>To turn off buffering, you only need to add <tt class="docutils literal">proxy_buffering off;</tt> to your
|
||||
<tt class="docutils literal">location</tt> block:</p>
|
||||
<p>To turn off buffering, you only need to add <tt class="docutils literal"><span class="pre">proxy_buffering</span> <span class="pre">off;</span></tt> to your
|
||||
<tt class="docutils literal"><span class="pre">location</span></tt> block:</p>
|
||||
<pre class="literal-block">
|
||||
...
|
||||
location / {
|
||||
@ -158,6 +158,17 @@ location / {
|
||||
<p>To serve an app from a <a class="reference external" href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> it is generally easiest to just install
|
||||
Gunicorn directly into the Virtualenv. This will create a set of Gunicorn
|
||||
scripts for that Virtualenv which can be used to run applications normally.</p>
|
||||
<p>If you have Virtualenv installed, you should be able to do something like
|
||||
this:</p>
|
||||
<pre class="literal-block">
|
||||
$ mkdir ~/venvs/
|
||||
$ virtualenv ~/venvs/webapp
|
||||
$ source ~/venvs/webapp/bin/activate
|
||||
$ ~/venvs/webapp/bin/easy_install -U gunicorn
|
||||
$ deactivate
|
||||
</pre>
|
||||
<p>Then you just need to use one of the thee Gunicorn scripts that was installed
|
||||
into <tt class="docutils literal"><span class="pre">~/venvs/webapp/bin</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="daemon-monitoring">
|
||||
<h1>Daemon Monitoring</h1>
|
||||
|
||||
@ -55,12 +55,12 @@
|
||||
<a class="reference external" href="http://gunicorn.org/deployment.html">deployment</a> page. Test some more.</dd>
|
||||
<dt>What types of workers are there?</dt>
|
||||
<dd><p class="first">These can all be used with the <tt class="docutils literal"><span class="pre">-k</span></tt> option and specifying them
|
||||
as <tt class="docutils literal"><span class="pre">egg:gunicorn#$(NAME)</span></tt> where <tt class="docutils literal">$(NAME)</tt> is chosen from this list.</p>
|
||||
as <tt class="docutils literal"><span class="pre">egg:gunicorn#$(NAME)</span></tt> where <tt class="docutils literal"><span class="pre">$(NAME)</span></tt> is chosen from this list.</p>
|
||||
<ul class="last simple">
|
||||
<li><tt class="docutils literal">sync</tt> - The default synchronous worker</li>
|
||||
<li><tt class="docutils literal">eventlet</tt> - Asynchronous workers based on Greenlets</li>
|
||||
<li><tt class="docutils literal">gevent</tt> - Asynchronous workers based on Greenlets</li>
|
||||
<li><tt class="docutils literal">tornado</tt> - Asynchronous workers based on FriendFeed's Tornado server.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">sync</span></tt> - The default synchronous worker</li>
|
||||
<li><tt class="docutils literal"><span class="pre">eventlet</span></tt> - Asynchronous workers based on Greenlets</li>
|
||||
<li><tt class="docutils literal"><span class="pre">gevent</span></tt> - Asynchronous workers based on Greenlets</li>
|
||||
<li><tt class="docutils literal"><span class="pre">tornado</span></tt> - Asynchronous workers based on FriendFeed's Tornado server.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt>How might I test a proxy configuration?</dt>
|
||||
@ -87,8 +87,8 @@ $ kill -TTOU $masterpid
|
||||
<dd>Start gunicorn with an approximate number of worker processes. Then use the
|
||||
TTIN and/or TTOU signals to adjust the number of workers under load.</dd>
|
||||
<dt>How do I set SCRIPT_NAME?</dt>
|
||||
<dd>By default <tt class="docutils literal">SCRIPT_NAME</tt> is an empy string. The value could be set by
|
||||
setting <tt class="docutils literal">SCRIPT_NAME</tt> in the environment or as an HTTP header.</dd>
|
||||
<dd>By default <tt class="docutils literal"><span class="pre">SCRIPT_NAME</span></tt> is an empy string. The value could be set by
|
||||
setting <tt class="docutils literal"><span class="pre">SCRIPT_NAME</span></tt> in the environment or as an HTTP header.</dd>
|
||||
<dt>How can I name processes?</dt>
|
||||
<dd>You need to install the Python package <a class="reference external" href="http://pypi.python.org/pypi/setproctitle">setproctitle</a>. Then you can specify
|
||||
a base process name on the command line (<tt class="docutils literal"><span class="pre">-n</span></tt>) or in the configuration
|
||||
|
||||
@ -59,8 +59,8 @@
|
||||
</div>
|
||||
<div class="section" id="installing-with-easy-install">
|
||||
<h1>Installing with easy_install</h1>
|
||||
<p>If you don't already have <tt class="docutils literal">easy_install</tt> available you'll want to download
|
||||
and run the <tt class="docutils literal">ez_setup.py</tt> script:</p>
|
||||
<p>If you don't already have <tt class="docutils literal"><span class="pre">easy_install</span></tt> available you'll want to download
|
||||
and run the <tt class="docutils literal"><span class="pre">ez_setup.py</span></tt> script:</p>
|
||||
<pre class="literal-block">
|
||||
$ curl -O http://peak.telecommunity.com/dist/ez_setup.py
|
||||
$ sudo python ez_setup.py -U setuptools
|
||||
@ -89,7 +89,7 @@ $ git clone git://github.com/benoitc/gunicorn.git
|
||||
$ python setup.py install
|
||||
</pre>
|
||||
<p>If you've cloned the git repository, its highly recommended that you use the
|
||||
<tt class="docutils literal">develop</tt> command which will allow you to use Gunicorn from the source
|
||||
<tt class="docutils literal"><span class="pre">develop</span></tt> command which will allow you to use Gunicorn from the source
|
||||
directory. This will allow you to keep up to date with development on GitHub as
|
||||
well as make changes to the source:</p>
|
||||
<pre class="literal-block">
|
||||
@ -107,7 +107,7 @@ want to consider one of the alternate worker types.</p>
|
||||
<pre class="literal-block">
|
||||
$ easy_install -U eventlet
|
||||
</pre>
|
||||
<p>Replace <tt class="docutils literal">eventlet</tt> with <tt class="docutils literal">gevent</tt> to use to the <tt class="docutils literal">gevent</tt> based workers.</p>
|
||||
<p>Replace <tt class="docutils literal"><span class="pre">eventlet</span></tt> with <tt class="docutils literal"><span class="pre">gevent</span></tt> to use to the <tt class="docutils literal"><span class="pre">gevent</span></tt> based workers.</p>
|
||||
<div class="note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">If you encounter errors when compiling the extensions for <a class="reference external" href="http://eventlet.net">Eventlet</a> or
|
||||
@ -117,7 +117,7 @@ $ easy_install -U eventlet
|
||||
<div class="section" id="installing-on-ubuntu-debian-systems">
|
||||
<h1>Installing on Ubuntu/Debian systems</h1>
|
||||
<p>If you use <a class="reference external" href="http://www.ubuntu.com/">Ubuntu</a> karmic, you can update your system with packages from
|
||||
our <a class="reference external" href="https://launchpad.net/~bchesneau/+archive/gunicorn">PPA</a> by adding <tt class="docutils literal">ppa:bchesneau/gunicorn</tt> to your system's Software
|
||||
our <a class="reference external" href="https://launchpad.net/~bchesneau/+archive/gunicorn">PPA</a> by adding <tt class="docutils literal"><span class="pre">ppa:bchesneau/gunicorn</span></tt> to your system's Software
|
||||
Sources.</p>
|
||||
<p>Or this PPA can be added to your system manually by copying the lines below
|
||||
and adding them to your system's software sources:</p>
|
||||
|
||||
@ -50,27 +50,27 @@
|
||||
<div class="document" id="usage">
|
||||
<h1 class="title">Usage</h1>
|
||||
<p>After installing Gunicorn you will have access to three command line scripts
|
||||
that can be used for serving the various supported web frameworks: <tt class="docutils literal">gunicorn</tt>,
|
||||
<tt class="docutils literal">gunicorn_django</tt>, and <tt class="docutils literal">gunicorn_paster</tt>.</p>
|
||||
that can be used for serving the various supported web frameworks: <tt class="docutils literal"><span class="pre">gunicorn</span></tt>,
|
||||
<tt class="docutils literal"><span class="pre">gunicorn_django</span></tt>, and <tt class="docutils literal"><span class="pre">gunicorn_paster</span></tt>.</p>
|
||||
<div class="section" id="commonly-used-arguments">
|
||||
<h1>Commonly Used Arguments</h1>
|
||||
<blockquote>
|
||||
<ul class="simple">
|
||||
<li><tt class="docutils literal"><span class="pre">-c</span> CONFIG, <span class="pre">--config=CONFIG</span></tt> - Specify the path to a <a class="reference external" href="configuration.html">config file</a></li>
|
||||
<li><tt class="docutils literal"><span class="pre">-b</span> BIND, <span class="pre">--bind=BIND</span></tt> - Specify a server socket to bind. Server sockets
|
||||
can be any of <tt class="docutils literal">$(HOST)</tt>, <tt class="docutils literal"><span class="pre">$(HOST):$(PORT)</span></tt>, or <tt class="docutils literal"><span class="pre">unix:$(PATH)</span></tt>.
|
||||
An IP is a valid <tt class="docutils literal">$(HOST)</tt>.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">-w</span> WORKERS, <span class="pre">--workers=WORKERS</span></tt> - The number of worker processes. This
|
||||
<li><tt class="docutils literal"><span class="pre">-c</span> <span class="pre">CONFIG,</span> <span class="pre">--config=CONFIG</span></tt> - Specify the path to a <a class="reference external" href="configuration.html">config file</a></li>
|
||||
<li><tt class="docutils literal"><span class="pre">-b</span> <span class="pre">BIND,</span> <span class="pre">--bind=BIND</span></tt> - Specify a server socket to bind. Server sockets
|
||||
can be any of <tt class="docutils literal"><span class="pre">$(HOST)</span></tt>, <tt class="docutils literal"><span class="pre">$(HOST):$(PORT)</span></tt>, or <tt class="docutils literal"><span class="pre">unix:$(PATH)</span></tt>.
|
||||
An IP is a valid <tt class="docutils literal"><span class="pre">$(HOST)</span></tt>.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">-w</span> <span class="pre">WORKERS,</span> <span class="pre">--workers=WORKERS</span></tt> - The number of worker processes. This
|
||||
number should generally be between 2-4 workers per core in the server.
|
||||
Check the <a class="reference external" href="faq.html">FAQ</a> for ideas on tuning this parameter.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">-k</span> WORKERCLASS, <span class="pre">--worker-class=WORKERCLASS</span></tt> - The type of worker process
|
||||
<li><tt class="docutils literal"><span class="pre">-k</span> <span class="pre">WORKERCLASS,</span> <span class="pre">--worker-class=WORKERCLASS</span></tt> - The type of worker process
|
||||
to run. You'll definitely want to read the <a class="reference external" href="deployment.html">production page</a> for the
|
||||
implications of this parameter. You can set this to <tt class="docutils literal"><span class="pre">egg:gunicorn#$(NAME)</span></tt>
|
||||
where <tt class="docutils literal">$(NAME)</tt> is one of <tt class="docutils literal">sync</tt>, <tt class="docutils literal">eventlet</tt>, <tt class="docutils literal">gevent</tt>, or
|
||||
<tt class="docutils literal">tornado</tt>. <tt class="docutils literal">sync</tt> is the default.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">-n</span> APP_NAME, <span class="pre">--name=APP_NAME</span></tt> - If <a class="reference external" href="http://pypi.python.org/pypi/setproctitle/">setproctitle</a> is installed you can
|
||||
where <tt class="docutils literal"><span class="pre">$(NAME)</span></tt> is one of <tt class="docutils literal"><span class="pre">sync</span></tt>, <tt class="docutils literal"><span class="pre">eventlet</span></tt>, <tt class="docutils literal"><span class="pre">gevent</span></tt>, or
|
||||
<tt class="docutils literal"><span class="pre">tornado</span></tt>. <tt class="docutils literal"><span class="pre">sync</span></tt> is the default.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">-n</span> <span class="pre">APP_NAME,</span> <span class="pre">--name=APP_NAME</span></tt> - If <a class="reference external" href="http://pypi.python.org/pypi/setproctitle/">setproctitle</a> is installed you can
|
||||
adjust the name of Gunicorn process as they appear in the process system
|
||||
table (which affects tools like <tt class="docutils literal">ps</tt> and <tt class="docutils literal">top</tt>).</li>
|
||||
table (which affects tools like <tt class="docutils literal"><span class="pre">ps</span></tt> and <tt class="docutils literal"><span class="pre">top</span></tt>).</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<p>There are various other parameters that affect user privileges, logging, etc.
|
||||
@ -86,7 +86,7 @@ that don't require a translation layer. Basic usage:</p>
|
||||
<pre class="literal-block">
|
||||
$ gunicorn [OPTIONS] APP_MODULE
|
||||
</pre>
|
||||
<p>Where <tt class="docutils literal">APP_MODULE</tt> is of the pattern <tt class="docutils literal"><span class="pre">$(MODULE_NAME):$(VARIABLE_NAME)</span></tt>. The
|
||||
<p>Where <tt class="docutils literal"><span class="pre">APP_MODULE</span></tt> is of the pattern <tt class="docutils literal"><span class="pre">$(MODULE_NAME):$(VARIABLE_NAME)</span></tt>. The
|
||||
module name can be a full dotted path. The variable name refers to a WSGI
|
||||
callable that should be found in the specified module.</p>
|
||||
<p>Example with test app:</p>
|
||||
@ -102,7 +102,7 @@ applications. Basic usage:</p>
|
||||
<pre class="literal-block">
|
||||
$ gunicorn_django [OPTIONS] [SETTINGS_PATH]
|
||||
</pre>
|
||||
<p>By default <tt class="docutils literal">SETTINGS_PATH</tt> will look for <tt class="docutils literal">settings.py</tt> in the current
|
||||
<p>By default <tt class="docutils literal"><span class="pre">SETTINGS_PATH</span></tt> will look for <tt class="docutils literal"><span class="pre">settings.py</span></tt> in the current
|
||||
directory.</p>
|
||||
<p>Example with your Django project:</p>
|
||||
<pre class="literal-block">
|
||||
@ -111,7 +111,7 @@ $ gunicorn_django --workers=2
|
||||
</pre>
|
||||
<p>Alternatively, you can install some Gunicorn magic directly into your Django
|
||||
project and use the provided command for running the server.</p>
|
||||
<p>First you'll need to add <tt class="docutils literal">gunicorn</tt> to your <tt class="docutils literal">INSTALLED_APPS</tt> in the settings
|
||||
<p>First you'll need to add <tt class="docutils literal"><span class="pre">gunicorn</span></tt> to your <tt class="docutils literal"><span class="pre">INSTALLED_APPS</span></tt> in the settings
|
||||
file:</p>
|
||||
<pre class="literal-block">
|
||||
INSTALLED_APPS = (
|
||||
|
||||
@ -117,6 +117,17 @@ To serve an app from a Virtualenv_ it is generally easiest to just install
|
||||
Gunicorn directly into the Virtualenv. This will create a set of Gunicorn
|
||||
scripts for that Virtualenv which can be used to run applications normally.
|
||||
|
||||
If you have Virtualenv installed, you should be able to do something like
|
||||
this::
|
||||
|
||||
$ mkdir ~/venvs/
|
||||
$ virtualenv ~/venvs/webapp
|
||||
$ source ~/venvs/webapp/bin/activate
|
||||
$ ~/venvs/webapp/bin/easy_install -U gunicorn
|
||||
$ deactivate
|
||||
|
||||
Then you just need to use one of the thee Gunicorn scripts that was installed
|
||||
into ``~/venvs/webapp/bin``.
|
||||
|
||||
Daemon Monitoring
|
||||
-----------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user