mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
doc in progress
This commit is contained in:
parent
cb0097663c
commit
c41da7175f
@ -54,7 +54,6 @@ Example with test app::
|
||||
$ cd examples
|
||||
$ gunicorn --workers=2 test:app
|
||||
|
||||
|
||||
Django projects
|
||||
+++++++++++++++
|
||||
|
||||
|
||||
0
doc/htdocs/.nojekyll
Normal file
0
doc/htdocs/.nojekyll
Normal file
1
doc/htdocs/CNAME
Normal file
1
doc/htdocs/CNAME
Normal file
@ -0,0 +1 @@
|
||||
gunicorn.org
|
||||
107
doc/htdocs/css/style.css
Normal file
107
doc/htdocs/css/style.css
Normal file
@ -0,0 +1,107 @@
|
||||
body {
|
||||
font-size: 100%;
|
||||
background: #fff;
|
||||
|
||||
}
|
||||
|
||||
|
||||
div.container {
|
||||
display: block;
|
||||
width: 40em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
a { color: #569633; }
|
||||
|
||||
pre {
|
||||
font-size: 1em;
|
||||
font-family: 'andale mono', 'lucida console', monospace;
|
||||
white-space:pre;
|
||||
margin: 3px;
|
||||
padding: 8px 20px;
|
||||
background: #ffd;
|
||||
}
|
||||
|
||||
h1.title {
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
background: #489848;
|
||||
color: #65e565;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
h2 { background: #ddd; text-align: center; padding: 4px; }
|
||||
div.document {
|
||||
width: 100%;
|
||||
clear: both;
|
||||
padding-top: 1.5em;
|
||||
}
|
||||
|
||||
#green-unicorn p { font-size: 1.3em; color: #444; padding: 1px 10px; }
|
||||
|
||||
#footer {
|
||||
clear: both;
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding-top: 3em;
|
||||
text-align: center;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
#footer a { color: #444; }
|
||||
|
||||
#bottom { text-align:center; font-size:14px; padding: 10px 30px; background: #fda; }
|
||||
|
||||
.info, .fork { padding: 10px; }
|
||||
.content { font-size: 1.2em; }
|
||||
|
||||
|
||||
|
||||
#links { padding: 10px; }
|
||||
#links a { font-weight: bold; }
|
||||
|
||||
#header #links { text-align:right; font-size: 18px; }
|
||||
|
||||
h1.logo {
|
||||
display: block;
|
||||
z-index: 90;
|
||||
height: 20px;
|
||||
float: left;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
h1.logo a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.title { color: #a10; background: #f86; font-size: 1.4em; font-weight:bold; padding: 3px 8px; margin-bottom: 10px; }
|
||||
.title a { color: #a10; }
|
||||
.section p { padding: 1px 14px; font-size: 1.1em; margin-top: 20px; }
|
||||
|
||||
|
||||
ul#actions {
|
||||
list-style: none;
|
||||
clear: both;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
ul#actions li {
|
||||
display: block;
|
||||
float: left;
|
||||
margin-left: 0.6em;
|
||||
margin-top: 0.6em;
|
||||
background: #000;
|
||||
|
||||
}
|
||||
|
||||
ul#actions li a {
|
||||
font-style: bold;
|
||||
font-size: 2em;
|
||||
text-transform: capitalize;
|
||||
color: #fff;
|
||||
padding: 0.6em;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
2
doc/htdocs/faq.html
Normal file
2
doc/htdocs/faq.html
Normal file
@ -0,0 +1,2 @@
|
||||
<div class="document">
|
||||
</div>
|
||||
72
doc/htdocs/index.html
Normal file
72
doc/htdocs/index.html
Normal file
@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Green Unicorn - Welcome</title>
|
||||
<link rel="alternate" type="application/rss+xml" href="/feed.xml" />
|
||||
|
||||
<!--[if IE]>
|
||||
<script>
|
||||
document.createElement('section');
|
||||
document.createElement('article');
|
||||
document.createElement('aside');
|
||||
document.createElement('footer');
|
||||
document.createElement('header');
|
||||
document.createElement('nav');
|
||||
document.createElement('time');
|
||||
</script>
|
||||
|
||||
<![endif]-->
|
||||
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div id="header">
|
||||
|
||||
<h1 class="logo"><a href="http://gunicorn.org">gunicorn</a></h1>
|
||||
|
||||
<div id="links">
|
||||
get the source in
|
||||
<a href="http://github.com/benoitc/gunicorn">git</a> then
|
||||
<a href="http://github.com/benoitc/gunicorn/issues">send feedback</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="document" id="green-unicorn">
|
||||
<h1 class="title">Green Unicorn</h1>
|
||||
<p>gunicorn 'Green Unicorn' is a WSGI HTTP Server for UNIX, fast clients and nothing else.</p>
|
||||
<p>This is a port of Unicorn (<a class="reference external" href="http://unicorn.bogomips.org/">http://unicorn.bogomips.org/</a>) in Python. Meet us on <a class="reference external" href="http://webchat.freenode.net/?channels=gunicorn">#gunicorn irc channel</a> on <a class="reference external" href="http://freenode.net">Freenode</a>.</p>
|
||||
<p>Gunicorn is under MIT License. see <a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/LICENSE">LICENSE</a> file for more details.</p>
|
||||
<div class="section" id="features">
|
||||
<h1>Features</h1>
|
||||
<ul class="simple">
|
||||
<li>Designed for WSGI, Unix and fast clients.</li>
|
||||
<li>Compatible with Python 2.x superior to 2.5</li>
|
||||
<li>Easy integration with <a class="reference external" href="http://djangoproject.com">Django</a> and <a class="reference external" href="http://pythonpaste.org/">Paster</a> compatible applications (Pylons, Turbogears 2, ...)</li>
|
||||
<li>Process management: <a class="reference external" href="http://gunicorn.org">Gunicorn</a> reap and restart workers that die.</li>
|
||||
<li>Load balancing done by the os</li>
|
||||
<li>Graceful restart of workers</li>
|
||||
<li>Upgrade "àla nginx" without losing connections</li>
|
||||
<li>Simple and easy Python DSL for configuration</li>
|
||||
<li>Decode chunked transfers on-the-fly, allowing upload progress notifications or
|
||||
stream-based protocols over HTTP.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<ul id="actions">
|
||||
<li><a href="installation.html">Installation</a></li>
|
||||
<li><a href="usage.html">Usage</a></li>
|
||||
<li><a href="configuration.html">Configuration</a></li>
|
||||
<li><a href="tune.html">Tune</a></li>
|
||||
<li><a href="faq.html">FAQ</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<div id="footer">
|
||||
<p>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
98
doc/htdocs/installation.html
Normal file
98
doc/htdocs/installation.html
Normal file
@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Green Unicorn - Installing Gunicorn</title>
|
||||
<link rel="alternate" type="application/rss+xml" href="/feed.xml" />
|
||||
|
||||
<!--[if IE]>
|
||||
<script>
|
||||
document.createElement('section');
|
||||
document.createElement('article');
|
||||
document.createElement('aside');
|
||||
document.createElement('footer');
|
||||
document.createElement('header');
|
||||
document.createElement('nav');
|
||||
document.createElement('time');
|
||||
</script>
|
||||
|
||||
<![endif]-->
|
||||
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div id="header">
|
||||
|
||||
<h1 class="logo"><a href="http://gunicorn.org">gunicorn</a></h1>
|
||||
|
||||
<div id="links">
|
||||
get the source in
|
||||
<a href="http://github.com/benoitc/gunicorn">git</a> then
|
||||
<a href="http://github.com/benoitc/gunicorn/issues">send feedback</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="menu">
|
||||
<ul id="actions">
|
||||
<li><a href="installation.html">Installation</a></li>
|
||||
<li><a href="usage.html">Usage</a></li>
|
||||
<li><a href="configuration.html">Configuration</a></li>
|
||||
<li><a href="tune.html">Tune</a></li>
|
||||
<li><a href="faq.html">FAQ</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<p>This is a manual for installing Gunicorn and its dependencies.</p>
|
||||
<div class="section" id="installing-gunicorn">
|
||||
<h1>Installing Gunicorn</h1>
|
||||
<p>Gunicorn requires <strong>Python 2.x superior to 2.5</strong> to work. Python 3.x will be supported soon.</p>
|
||||
<div class="section" id="installing-with-easy-install">
|
||||
<h2>Installing with easy_install</h2>
|
||||
<p>To install Gunicorn using easy_install you must make sure you have a recent version of setuptools installed (as of this writing, 0.6c6 (0.6a9 on windows) or later):</p>
|
||||
<pre class="literal-block">
|
||||
$ curl -O http://peak.telecommunity.com/dist/ez_setup.py
|
||||
$ sudo python ez_setup.py -U setuptools
|
||||
</pre>
|
||||
<p>To install or upgrade to the latest released version of Gunicorn:</p>
|
||||
<pre class="literal-block">
|
||||
$ sudo easy_install -U gunicorn
|
||||
</pre>
|
||||
<div class="section" id="installing-from-source">
|
||||
<h3>Installing from source</h3>
|
||||
<p>To install Gunicorn from source, simply use the normal procedure for installing any Python package. Since Gunicorn uses setuptools, all dependencies (including setuptools itself) will be automatically acquired and installed for you as appropriate.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="fetch-sources">
|
||||
<h2>Fetch sources</h2>
|
||||
<p>You could download latest sources from <a class="reference external" href="http://github.com/benoitc/gunicorn/downloads">Github Downloads</a></p>
|
||||
<p>Or fetch them with git. Therefore we have to <a class="reference external" href="http://git-scm.com/">install git</a> and then run:</p>
|
||||
<pre class="literal-block">
|
||||
$ git clone git://github.com/benoitc/gunicorn.git
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="install-gunicorn">
|
||||
<h2>Install Gunicorn</h2>
|
||||
<pre class="literal-block">
|
||||
$ python setup.py install
|
||||
</pre>
|
||||
<p>If you're using a git clone, it's recommended to use the setuptools <cite>develop</cite> command, which will simply activate Gunicorn directly from your source directory. This way you can do a hg fetch or make changes to the source code without re-installing every time:</p>
|
||||
<pre class="literal-block">
|
||||
$ python setup.py develop
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="footer">
|
||||
<p>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
84
doc/htdocs/tune.html
Normal file
84
doc/htdocs/tune.html
Normal file
@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Green Unicorn - </title>
|
||||
<link rel="alternate" type="application/rss+xml" href="/feed.xml" />
|
||||
|
||||
<!--[if IE]>
|
||||
<script>
|
||||
document.createElement('section');
|
||||
document.createElement('article');
|
||||
document.createElement('aside');
|
||||
document.createElement('footer');
|
||||
document.createElement('header');
|
||||
document.createElement('nav');
|
||||
document.createElement('time');
|
||||
</script>
|
||||
|
||||
<![endif]-->
|
||||
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div id="header">
|
||||
|
||||
<h1 class="logo"><a href="http://gunicorn.org">gunicorn</a></h1>
|
||||
|
||||
<div id="links">
|
||||
get the source in
|
||||
<a href="http://github.com/benoitc/gunicorn">git</a> then
|
||||
<a href="http://github.com/benoitc/gunicorn/issues">send feedback</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="menu">
|
||||
<ul id="actions">
|
||||
<li><a href="installation.html">Installation</a></li>
|
||||
<li><a href="usage.html">Usage</a></li>
|
||||
<li><a href="configuration.html">Configuration</a></li>
|
||||
<li><a href="tune.html">Tune</a></li>
|
||||
<li><a href="faq.html">FAQ</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document" id="kernel-parameters">
|
||||
<h1 class="title">Kernel Parameters</h1>
|
||||
<p>There are various kernel parameters that you might want to tune in order to deal with a large number of simultaneous connections. Generally these should only affect sites with a large number of concurrent requests and apply to any sort of network server you may be running. They're listed here for ease of reference.</p>
|
||||
<p>The commands listed are tested under Mac OS X 10.6. Your flavor of Unix may use slightly different flags. Always reference the appropriate man pages if uncertain.</p>
|
||||
<div class="section" id="increasing-the-file-descriptor-limit">
|
||||
<h1>Increasing the File Descriptor Limit</h1>
|
||||
<p>One of the first settings that usually needs to be bumped is the maximum number of open file descriptors for a given process. For the confused out there, remember that Unices treat sockets as files.</p>
|
||||
<pre class="literal-block">
|
||||
$ sudo ulimit -n 1024
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="increasing-the-listen-queue-size">
|
||||
<h1>Increasing the Listen Queue Size</h1>
|
||||
<p>Listening sockets have an associated queue of incoming connections that are waiting to be accepted. If you happen to have a stampede of clients that fill up this queue new connections will eventually start getting dropped.</p>
|
||||
<pre class="literal-block">
|
||||
$ sudo sysctl -w kern.ipc.somaxconn="1024"
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="widening-the-ephemeral-port-range">
|
||||
<h1>Widening the Ephemeral Port Range</h1>
|
||||
<p>After a socket is closed it eventually enters the TIME_WAIT state. This can become an issue after a prolonged burst of client activity. Eventually the ephemeral port range is used up which can cause new connections to stall while they wait for a valid port.</p>
|
||||
<p>This setting is generally only required on machines that are being used to test a network server.</p>
|
||||
<pre class="literal-block">
|
||||
$ sudo sysctl -w net.inet.ip.portrange.first="8048"
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="footer">
|
||||
<p>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
142
doc/htdocs/usage.html
Normal file
142
doc/htdocs/usage.html
Normal file
@ -0,0 +1,142 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Green Unicorn - Command line usage</title>
|
||||
<link rel="alternate" type="application/rss+xml" href="/feed.xml" />
|
||||
|
||||
<!--[if IE]>
|
||||
<script>
|
||||
document.createElement('section');
|
||||
document.createElement('article');
|
||||
document.createElement('aside');
|
||||
document.createElement('footer');
|
||||
document.createElement('header');
|
||||
document.createElement('nav');
|
||||
document.createElement('time');
|
||||
</script>
|
||||
|
||||
<![endif]-->
|
||||
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div id="header">
|
||||
|
||||
<h1 class="logo"><a href="http://gunicorn.org">gunicorn</a></h1>
|
||||
|
||||
<div id="links">
|
||||
get the source in
|
||||
<a href="http://github.com/benoitc/gunicorn">git</a> then
|
||||
<a href="http://github.com/benoitc/gunicorn/issues">send feedback</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="menu">
|
||||
<ul id="actions">
|
||||
<li><a href="installation.html">Installation</a></li>
|
||||
<li><a href="usage.html">Usage</a></li>
|
||||
<li><a href="configuration.html">Configuration</a></li>
|
||||
<li><a href="tune.html">Tune</a></li>
|
||||
<li><a href="faq.html">FAQ</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document" id="command-line-usage">
|
||||
<h1 class="title">Command line usage</h1>
|
||||
<p><a class="reference external" href="http://gunicorn.org">Gunicorn</a> can easily be launched from the command line. This manual will show you how to use it with:</p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#wsgi-applications">WSGI applications</a></li>
|
||||
<li><a class="reference internal" href="#django-projects">Django projects</a></li>
|
||||
<li><a class="reference internal" href="#paste-compatible-projects">Paste-compatible projects</a></li>
|
||||
</ul>
|
||||
<div class="section" id="wsgi-applications">
|
||||
<h1>WSGI applications</h1>
|
||||
<p>Here is how to launch your application in less than 30 seconds. Here is an example with our <a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/examples/test.py">test application</a>:</p>
|
||||
<pre class="literal-block">
|
||||
$ cd examples
|
||||
$ gunicorn --workers=2 test:application
|
||||
</pre>
|
||||
<div class="section" id="full-command-line-usage">
|
||||
<h2>Full command line usage</h2>
|
||||
<pre class="literal-block">
|
||||
$ gunicorn --help
|
||||
Usage: gunicorn [OPTIONS] [APP_MODULE]
|
||||
|
||||
Options:
|
||||
-c CONFIG, --config=CONFIG
|
||||
Config file. [none]
|
||||
-b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or
|
||||
unix:/tmp/gunicorn.sock
|
||||
-w WORKERS, --workers=WORKERS
|
||||
Number of workers to spawn. [1]
|
||||
-p PIDFILE, --pid=PIDFILE
|
||||
set the background PID FILE
|
||||
-D, --daemon Run daemonized in the background.
|
||||
-m UMASK, --umask=UMASK
|
||||
Define umask of daemon process
|
||||
-u USER, --user=USER Change worker user
|
||||
-g GROUP, --group=GROUP
|
||||
Change worker group
|
||||
--log-level=LOGLEVEL Log level below which to silence messages. [info]
|
||||
--log-file=LOGFILE Log to a file. - equals stdout. [-]
|
||||
-d, --debug Debug mode. only 1 worker.
|
||||
--version show program's version number and exit
|
||||
-h, --help show this help message and exit
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="django-projects">
|
||||
<h1>Django projects</h1>
|
||||
<p><a class="reference external" href="http://djangoproject.com">Django</a> projects can be handled easily by <a class="reference external" href="http://gunicorn.org">Gunicorn</a> using the <cite>gunicorn_django</cite> command:</p>
|
||||
<pre class="literal-block">
|
||||
$ cd yourdjangoproject
|
||||
$ gunicorn_django --workers=2
|
||||
</pre>
|
||||
<p>But you can also use <cite>run_gunicorn</cite> <a class="reference external" href="http://docs.djangoproject.com/en/dev/howto/custom-management-commands/">admin command</a> like all other commands.</p>
|
||||
<p>add <cite>gunicorn</cite> to INSTALLED_APPS in the settings file:</p>
|
||||
<pre class="literal-block">
|
||||
INSTALLED_APPS = (
|
||||
...
|
||||
"gunicorn",
|
||||
)
|
||||
</pre>
|
||||
<p>Then run:</p>
|
||||
<pre class="literal-block">
|
||||
python manage.py run_gunicorn
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="paste-compatible-projects">
|
||||
<h1>Paste-compatible projects</h1>
|
||||
<p>For <a class="reference external" href="http://pythonpaste.org/script/">Paste</a> compatible projects (like <a class="reference external" href="http://pylonshq.com/">Pylons</a>, <a class="reference external" href="http://turbogears.org/2.0/">TurboGears 2</a>, ...) use the <cite>gunicorn_paste</cite> command:</p>
|
||||
<pre class="literal-block">
|
||||
$ cd your pasteproject
|
||||
$ gunicorn_paste --workers=2 development.ini
|
||||
</pre>
|
||||
<p>or usual <strong>paster</strong> command:</p>
|
||||
<pre class="literal-block">
|
||||
$ cd your pasteproject
|
||||
$ paster serve development.ini workers=2
|
||||
</pre>
|
||||
<p>In this case don't forget to add a server section for <a class="reference external" href="http://gunicorn.org">Gunicorn</a>. Here is an example that use gunicorn as main server:</p>
|
||||
<pre class="literal-block">
|
||||
[server:main]
|
||||
use = egg:gunicorn#main
|
||||
host = 127.0.0.1
|
||||
port = 5000
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="footer">
|
||||
<p>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
0
doc/site/faq.rst
Normal file
0
doc/site/faq.rst
Normal file
@ -3,5 +3,25 @@ template: index.html
|
||||
Green Unicorn
|
||||
=============
|
||||
|
||||
It does stuff.
|
||||
gunicorn 'Green Unicorn' is a WSGI HTTP Server for UNIX, fast clients and nothing else.
|
||||
|
||||
This is a port of Unicorn (http://unicorn.bogomips.org/) in Python. Meet us on `#gunicorn irc channel <http://webchat.freenode.net/?channels=gunicorn>`_ on `Freenode`_.
|
||||
|
||||
Gunicorn is under MIT License. see `LICENSE <http://github.com/benoitc/gunicorn/blob/master/LICENSE>`_ file for more details.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- Designed for WSGI, Unix and fast clients.
|
||||
- Compatible with Python 2.x superior to 2.5
|
||||
- Easy integration with `Django <http://djangoproject.com>`_ and `Paster <http://pythonpaste.org/>`_ compatible applications (Pylons, Turbogears 2, ...)
|
||||
- Process management: `Gunicorn`_ reap and restart workers that die.
|
||||
- Load balancing done by the os
|
||||
- Graceful restart of workers
|
||||
- Upgrade "àla nginx" without losing connections
|
||||
- Simple and easy Python DSL for configuration
|
||||
- Decode chunked transfers on-the-fly, allowing upload progress notifications or
|
||||
stream-based protocols over HTTP.
|
||||
|
||||
.. _freenode: http://freenode.net
|
||||
.. _Gunicorn: http://gunicorn.org
|
||||
|
||||
47
doc/site/installation.rst
Normal file
47
doc/site/installation.rst
Normal file
@ -0,0 +1,47 @@
|
||||
template: doc.html
|
||||
title: Installing Gunicorn
|
||||
|
||||
|
||||
This is a manual for installing Gunicorn and its dependencies.
|
||||
|
||||
Installing Gunicorn
|
||||
=====================
|
||||
|
||||
Gunicorn requires **Python 2.x superior to 2.5** to work. Python 3.x will be supported soon.
|
||||
|
||||
Installing with easy_install
|
||||
++++++++++++++++++++++++++++
|
||||
|
||||
To install Gunicorn using easy_install you must make sure you have a recent version of setuptools installed (as of this writing, 0.6c6 (0.6a9 on windows) or later)::
|
||||
|
||||
$ curl -O http://peak.telecommunity.com/dist/ez_setup.py
|
||||
$ sudo python ez_setup.py -U setuptools
|
||||
|
||||
To install or upgrade to the latest released version of Gunicorn::
|
||||
|
||||
$ sudo easy_install -U gunicorn
|
||||
|
||||
Installing from source
|
||||
----------------------
|
||||
|
||||
To install Gunicorn from source, simply use the normal procedure for installing any Python package. Since Gunicorn uses setuptools, all dependencies (including setuptools itself) will be automatically acquired and installed for you as appropriate.
|
||||
|
||||
Fetch sources
|
||||
+++++++++++++
|
||||
|
||||
You could download latest sources from `Github Downloads <http://github.com/benoitc/gunicorn/downloads>`_
|
||||
|
||||
Or fetch them with git. Therefore we have to `install git <http://git-scm.com/>`_ and then run::
|
||||
|
||||
$ git clone git://github.com/benoitc/gunicorn.git
|
||||
|
||||
Install Gunicorn
|
||||
++++++++++++++++
|
||||
|
||||
::
|
||||
|
||||
$ python setup.py install
|
||||
|
||||
If you're using a git clone, it's recommended to use the setuptools `develop` command, which will simply activate Gunicorn directly from your source directory. This way you can do a hg fetch or make changes to the source code without re-installing every time::
|
||||
|
||||
$ python setup.py develop
|
||||
37
doc/site/tune.rst
Normal file
37
doc/site/tune.rst
Normal file
@ -0,0 +1,37 @@
|
||||
template: doc.html
|
||||
|
||||
Kernel Parameters
|
||||
-----------------
|
||||
|
||||
There are various kernel parameters that you might want to tune in order to deal with a large number of simultaneous connections. Generally these should only affect sites with a large number of concurrent requests and apply to any sort of network server you may be running. They're listed here for ease of reference.
|
||||
|
||||
The commands listed are tested under Mac OS X 10.6. Your flavor of Unix may use slightly different flags. Always reference the appropriate man pages if uncertain.
|
||||
|
||||
Increasing the File Descriptor Limit
|
||||
++++++++++++++++++++++++++++++++++++
|
||||
|
||||
One of the first settings that usually needs to be bumped is the maximum number of open file descriptors for a given process. For the confused out there, remember that Unices treat sockets as files.
|
||||
|
||||
::
|
||||
|
||||
$ sudo ulimit -n 1024
|
||||
|
||||
Increasing the Listen Queue Size
|
||||
++++++++++++++++++++++++++++++++
|
||||
|
||||
Listening sockets have an associated queue of incoming connections that are waiting to be accepted. If you happen to have a stampede of clients that fill up this queue new connections will eventually start getting dropped.
|
||||
|
||||
::
|
||||
|
||||
$ sudo sysctl -w kern.ipc.somaxconn="1024"
|
||||
|
||||
Widening the Ephemeral Port Range
|
||||
+++++++++++++++++++++++++++++++++
|
||||
|
||||
After a socket is closed it eventually enters the TIME_WAIT state. This can become an issue after a prolonged burst of client activity. Eventually the ephemeral port range is used up which can cause new connections to stall while they wait for a valid port.
|
||||
|
||||
This setting is generally only required on machines that are being used to test a network server.
|
||||
|
||||
::
|
||||
|
||||
$ sudo sysctl -w net.inet.ip.portrange.first="8048"
|
||||
98
doc/site/usage.rst
Normal file
98
doc/site/usage.rst
Normal file
@ -0,0 +1,98 @@
|
||||
template: doc.html
|
||||
title: Command line usage
|
||||
|
||||
Command line usage
|
||||
==================
|
||||
|
||||
`Gunicorn`_ can easily be launched from the command line. This manual will show you how to use it with:
|
||||
|
||||
- `WSGI applications`_
|
||||
- `Django projects`_
|
||||
- `Paste-compatible projects`_
|
||||
|
||||
WSGI applications
|
||||
-----------------
|
||||
|
||||
Here is how to launch your application in less than 30 seconds. Here is an example with our `test application <http://github.com/benoitc/gunicorn/blob/master/examples/test.py>`_::
|
||||
|
||||
$ cd examples
|
||||
$ gunicorn --workers=2 test:application
|
||||
|
||||
Full command line usage
|
||||
+++++++++++++++++++++++
|
||||
|
||||
::
|
||||
|
||||
$ gunicorn --help
|
||||
Usage: gunicorn [OPTIONS] [APP_MODULE]
|
||||
|
||||
Options:
|
||||
-c CONFIG, --config=CONFIG
|
||||
Config file. [none]
|
||||
-b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or
|
||||
unix:/tmp/gunicorn.sock
|
||||
-w WORKERS, --workers=WORKERS
|
||||
Number of workers to spawn. [1]
|
||||
-p PIDFILE, --pid=PIDFILE
|
||||
set the background PID FILE
|
||||
-D, --daemon Run daemonized in the background.
|
||||
-m UMASK, --umask=UMASK
|
||||
Define umask of daemon process
|
||||
-u USER, --user=USER Change worker user
|
||||
-g GROUP, --group=GROUP
|
||||
Change worker group
|
||||
--log-level=LOGLEVEL Log level below which to silence messages. [info]
|
||||
--log-file=LOGFILE Log to a file. - equals stdout. [-]
|
||||
-d, --debug Debug mode. only 1 worker.
|
||||
--version show program's version number and exit
|
||||
-h, --help show this help message and exit
|
||||
|
||||
Django projects
|
||||
---------------
|
||||
|
||||
`Django`_ projects can be handled easily by `Gunicorn`_ using the `gunicorn_django` command::
|
||||
|
||||
$ cd yourdjangoproject
|
||||
$ gunicorn_django --workers=2
|
||||
|
||||
|
||||
But you can also use `run_gunicorn` `admin command <http://docs.djangoproject.com/en/dev/howto/custom-management-commands/>`_ like all other commands.
|
||||
|
||||
add `gunicorn` to INSTALLED_APPS in the settings file::
|
||||
|
||||
INSTALLED_APPS = (
|
||||
...
|
||||
"gunicorn",
|
||||
)
|
||||
|
||||
Then run::
|
||||
|
||||
python manage.py run_gunicorn
|
||||
|
||||
|
||||
Paste-compatible projects
|
||||
-------------------------
|
||||
|
||||
For `Paste`_ compatible projects (like `Pylons`_, `TurboGears 2`_, ...) use the `gunicorn_paste` command::
|
||||
|
||||
$ cd your pasteproject
|
||||
$ gunicorn_paste --workers=2 development.ini
|
||||
|
||||
or usual **paster** command::
|
||||
|
||||
$ cd your pasteproject
|
||||
$ paster serve development.ini workers=2
|
||||
|
||||
In this case don't forget to add a server section for `Gunicorn`_. Here is an example that use gunicorn as main server::
|
||||
|
||||
[server:main]
|
||||
use = egg:gunicorn#main
|
||||
host = 127.0.0.1
|
||||
port = 5000
|
||||
|
||||
|
||||
.. _Gunicorn: http://gunicorn.org
|
||||
.. _Django: http://djangoproject.com
|
||||
.. _Paste: http://pythonpaste.org/script/
|
||||
.. _Pylons: http://pylonshq.com/
|
||||
.. _Turbogears 2: http://turbogears.org/2.0/
|
||||
25
doc/templates/base.html
vendored
25
doc/templates/base.html
vendored
@ -2,8 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Green Unicorn - Welcome</title>
|
||||
<link rel="stylesheet" href="/css/style.css" type="text/css" />
|
||||
<title>Green Unicorn - {% block title %}Welcome{% endblock %}</title>
|
||||
<link rel="alternate" type="application/rss+xml" href="/feed.xml" />
|
||||
|
||||
<!--[if IE]>
|
||||
@ -16,9 +15,29 @@
|
||||
document.createElement('nav');
|
||||
document.createElement('time');
|
||||
</script>
|
||||
|
||||
<![endif]-->
|
||||
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
<div class="container">
|
||||
<div id="header">
|
||||
|
||||
<h1 class="logo"><a href="http://gunicorn.org">gunicorn</a></h1>
|
||||
|
||||
<div id="links">
|
||||
get the source in
|
||||
<a href="http://github.com/benoitc/gunicorn">git</a> then
|
||||
<a href="http://github.com/benoitc/gunicorn/issues">send feedback</a>
|
||||
</div>
|
||||
</div>
|
||||
{% block body %}{% endblock %}
|
||||
{% block extra %}{% endblock %}
|
||||
|
||||
<div id="footer">
|
||||
<p>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
19
doc/templates/doc.html
vendored
Normal file
19
doc/templates/doc.html
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ title }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
<div id="menu">
|
||||
<ul id="actions">
|
||||
<li><a href="installation.html">Installation</a></li>
|
||||
<li><a href="usage.html">Usage</a></li>
|
||||
<li><a href="configuration.html">Configuration</a></li>
|
||||
<li><a href="tune.html">Tune</a></li>
|
||||
<li><a href="faq.html">FAQ</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{{ stuff }}
|
||||
|
||||
{% endblock %}
|
||||
11
doc/templates/index.html
vendored
11
doc/templates/index.html
vendored
@ -1,3 +1,14 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block body %}{{ stuff }}{% endblock %}
|
||||
|
||||
{% block extra %}
|
||||
<ul id="actions">
|
||||
<li><a href="installation.html">Installation</a></li>
|
||||
<li><a href="usage.html">Usage</a></li>
|
||||
<li><a href="configuration.html">Configuration</a></li>
|
||||
<li><a href="tune.html">Tune</a></li>
|
||||
<li><a href="faq.html">FAQ</a></li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user