From 2f2bbd20b108023e3b52f8c4038936c8ee68b821 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Sat, 20 Feb 2010 14:47:25 -0500 Subject: [PATCH] Final edits to docs. --- doc/buildweb.py | 2 +- doc/htdocs/configuration.html | 20 +++-- doc/htdocs/deployment.html | 138 ++++++++++++++++++++++++++++++++++ doc/htdocs/faq.html | 20 +++-- doc/htdocs/index.html | 1 + doc/htdocs/installation.html | 1 + doc/htdocs/news.html | 1 + doc/htdocs/tune.html | 84 --------------------- doc/htdocs/tuning.html | 33 ++++---- doc/htdocs/tunning.html | 96 ----------------------- doc/htdocs/usage.html | 1 + doc/site/configuration.rst | 23 ++---- doc/site/deployment.rst | 86 +++++++++++++++++++++ doc/site/faq.rst | 23 +++--- doc/site/tuning.rst | 35 +++++---- doc/templates/doc.html | 2 +- doc/templates/index.html | 2 +- doc/templates/menu.html | 1 + 18 files changed, 309 insertions(+), 260 deletions(-) create mode 100644 doc/htdocs/deployment.html delete mode 100644 doc/htdocs/tune.html delete mode 100644 doc/htdocs/tunning.html create mode 100644 doc/site/deployment.rst diff --git a/doc/buildweb.py b/doc/buildweb.py index 7d590553..bed19e51 100755 --- a/doc/buildweb.py +++ b/doc/buildweb.py @@ -108,7 +108,7 @@ class Page(object): if not tmpl_name: return self.body - kwargs = {"conf": conf, "stuff": self.body, "url": self.url()} + kwargs = {"conf": conf, "body": self.body, "url": self.url()} kwargs.update(self.headers) return self.site.get_template(tmpl_name).render(kwargs) diff --git a/doc/htdocs/configuration.html b/doc/htdocs/configuration.html index dab7da07..716626cf 100644 --- a/doc/htdocs/configuration.html +++ b/doc/htdocs/configuration.html @@ -2,7 +2,7 @@ - Green Unicorn - Configuration + Green Unicorn - The Configuration File + + + + +
+ + + + + +
+

Production Setup

+

Although there are many HTTP proxies available, we strongly advise that you use Nginx. If you choose another proxy server you need to make sure that it buffers slow clients. Without this buffering Gunicorn will be easily susceptible to Denial-Of-Service attacks.

+
+

Nginx Config

+

An example configuration file for use with Nginx:

+
+worker_processes 1;
+
+user nobody nogroup;
+pid /tmp/nginx.pid;
+error_log /tmp/nginx.error.log;
+
+events {
+    worker_connections 1024;
+    accept_mutex off;
+}
+
+http {
+    include mime.types;
+    default_type application/octet-stream;
+    access_log /tmp/nginx.access.log combined;
+    sendfile on;
+
+    upstream app_server {
+        server unix:/tmp/gunicorn.sock fail_timeout=0;
+        # For a TCP configuration:
+        # server 192.168.0.7:8000 fail_timeout=0;
+    }
+
+    server {
+        listen 80 default;
+        client_max_body_size 4G;
+        server_name _;
+
+        keepalive_timeout 5;
+
+        # path for static files
+        root /path/to/app/current/public;
+
+        location / {
+            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+            proxy_set_header Host $http_host;
+            proxy_redirect off;
+
+            if (!-f $request_filename) {
+                proxy_pass http://app_server;
+                break;
+            }
+        }
+
+        error_page 500 502 503 504 /500.html;
+        location = /500.html {
+            root /path/to/app/current/public;
+        }
+    }
+}
+
+
+
+

Daemon Monitoring

+

A popular method for deploying Gunicorn is to have it monitored by runit. An example service definition:

+
+#!/bin sh
+
+GUNICORN=/usr/local/bin/gunicorn
+ROOT=/path/to/project
+PID=/var/run/gunicorn.pid
+
+APP=main:application
+
+if [ -f $PID ]; then rm $PID fi
+
+cd $ROOT
+exec $GUNICORN -C $ROOT/gunicorn.conf.py --pidfile=$PID $APP
+
+
+
+ + + + + + +
+ + \ No newline at end of file diff --git a/doc/htdocs/faq.html b/doc/htdocs/faq.html index de087dbf..ce9863f4 100644 --- a/doc/htdocs/faq.html +++ b/doc/htdocs/faq.html @@ -38,6 +38,7 @@