diff --git a/README.rst b/README.rst index e5da6718..4c74b79d 100644 --- a/README.rst +++ b/README.rst @@ -54,7 +54,6 @@ Example with test app:: $ cd examples $ gunicorn --workers=2 test:app - Django projects +++++++++++++++ diff --git a/doc/htdocs/.nojekyll b/doc/htdocs/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/doc/htdocs/CNAME b/doc/htdocs/CNAME new file mode 100644 index 00000000..b9f0ffbc --- /dev/null +++ b/doc/htdocs/CNAME @@ -0,0 +1 @@ +gunicorn.org diff --git a/doc/htdocs/css/style.css b/doc/htdocs/css/style.css new file mode 100644 index 00000000..a81599bf --- /dev/null +++ b/doc/htdocs/css/style.css @@ -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; +} + + + diff --git a/doc/htdocs/faq.html b/doc/htdocs/faq.html new file mode 100644 index 00000000..26f7dadf --- /dev/null +++ b/doc/htdocs/faq.html @@ -0,0 +1,2 @@ +
+
diff --git a/doc/htdocs/index.html b/doc/htdocs/index.html new file mode 100644 index 00000000..46c5e59e --- /dev/null +++ b/doc/htdocs/index.html @@ -0,0 +1,72 @@ + + + + + Green Unicorn - Welcome + + + + + + + +
+ +
+

Green Unicorn

+

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 on Freenode.

+

Gunicorn is under MIT License. see 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 and Paster 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.
  • +
+
+
+ + + + + + +
+ + \ No newline at end of file diff --git a/doc/htdocs/installation.html b/doc/htdocs/installation.html new file mode 100644 index 00000000..20229ab2 --- /dev/null +++ b/doc/htdocs/installation.html @@ -0,0 +1,98 @@ + + + + + Green Unicorn - 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

+

Or fetch them with git. Therefore we have to install git 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
+
+
+
+
+ + + + + + +
+ + \ No newline at end of file diff --git a/doc/htdocs/tune.html b/doc/htdocs/tune.html new file mode 100644 index 00000000..17cd8020 --- /dev/null +++ b/doc/htdocs/tune.html @@ -0,0 +1,84 @@ + + + + + Green Unicorn - + + + + + + + +
+ + + + + +
+

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"
+
+
+
+ + + + + + +
+ + \ No newline at end of file diff --git a/doc/htdocs/usage.html b/doc/htdocs/usage.html new file mode 100644 index 00000000..4bdc5757 --- /dev/null +++ b/doc/htdocs/usage.html @@ -0,0 +1,142 @@ + + + + + Green Unicorn - 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

+

Here is how to launch your application in less than 30 seconds. Here is an example with our test application:

+
+$ 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 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
+
+
+
+ + + + + + +
+ + \ No newline at end of file diff --git a/doc/site/faq.rst b/doc/site/faq.rst new file mode 100644 index 00000000..e69de29b diff --git a/doc/site/index.rst b/doc/site/index.rst index 9f837e5b..356639d8 100644 --- a/doc/site/index.rst +++ b/doc/site/index.rst @@ -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 `_ on `Freenode`_. + +Gunicorn is under MIT License. see `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 `_ and `Paster `_ 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 diff --git a/doc/site/installation.rst b/doc/site/installation.rst new file mode 100644 index 00000000..a766d4a5 --- /dev/null +++ b/doc/site/installation.rst @@ -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 `_ + +Or fetch them with git. Therefore we have to `install git `_ 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 diff --git a/doc/site/tune.rst b/doc/site/tune.rst new file mode 100644 index 00000000..25c49048 --- /dev/null +++ b/doc/site/tune.rst @@ -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" \ No newline at end of file diff --git a/doc/site/usage.rst b/doc/site/usage.rst new file mode 100644 index 00000000..dbeed96d --- /dev/null +++ b/doc/site/usage.rst @@ -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 `_:: + + $ 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 `_ 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/ \ No newline at end of file diff --git a/doc/templates/base.html b/doc/templates/base.html index 641c40bf..6b7abd52 100644 --- a/doc/templates/base.html +++ b/doc/templates/base.html @@ -2,8 +2,7 @@ - Green Unicorn - Welcome - + Green Unicorn - {% block title %}Welcome{% endblock %} + + - {% block body %}{% endblock %} +
+ + {% block body %}{% endblock %} + {% block extra %}{% endblock %} + + +
diff --git a/doc/templates/doc.html b/doc/templates/doc.html new file mode 100644 index 00000000..b03b3b2c --- /dev/null +++ b/doc/templates/doc.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} + +{% block title %}{{ title }}{% endblock %} + +{% block body %} + + + + {{ stuff }} + +{% endblock %} \ No newline at end of file diff --git a/doc/templates/index.html b/doc/templates/index.html index 2d468ade..8d4d842f 100644 --- a/doc/templates/index.html +++ b/doc/templates/index.html @@ -1,3 +1,14 @@ {% extends "base.html" %} {% block body %}{{ stuff }}{% endblock %} + +{% block extra %} + +{% endblock %} +