From 6a105487cf82ab1741adcfc67ed5e42003f4a00b Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 24 May 2010 19:07:13 -0400 Subject: [PATCH 1/4] Fix forced builds. --- doc/buildweb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/buildweb.py b/doc/buildweb.py index bd5e1194..50092d7c 100755 --- a/doc/buildweb.py +++ b/doc/buildweb.py @@ -89,7 +89,7 @@ class Page(object): return "/".join([self.site.url, path]) def needed(self): - for f in "force --force -f": + for f in "force --force -f".split(): if f in sys.argv[1:]: return True From 79d3688aba3602f4f5d0f752803085879c9f570d Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 24 May 2010 19:08:17 -0400 Subject: [PATCH 2/4] Minor nit with header underlines. --- doc/site/news.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/site/news.rst b/doc/site/news.rst index 4ff4f565..5f6a3f1a 100644 --- a/doc/site/news.rst +++ b/doc/site/news.rst @@ -5,7 +5,7 @@ News ==== 0.9.0 2010-05-22 ------------------- +---------------- - Added *when_ready* hook. Called just after the server is started - Added *preload* setting. Load application code before the worker processes From 38a1448a9c85093cb37a65c8408ecf53ffa778e5 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 24 May 2010 19:08:35 -0400 Subject: [PATCH 3/4] Update generated HTML. --- doc/htdocs/deployment.html | 6 +++--- doc/htdocs/faq.html | 14 +++++++------- doc/htdocs/installation.html | 14 +++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/htdocs/deployment.html b/doc/htdocs/deployment.html index 6a3a5305..34cf3ce0 100644 --- a/doc/htdocs/deployment.html +++ b/doc/htdocs/deployment.html @@ -135,8 +135,8 @@ http { features like Comet, Long polling, or Web sockets, you need to turn off the proxy buffering. When you do this you must run with one of the async worker classes.

-

To turn off buffering, you only need to add proxy_buffering off; to your -location block:

+

To turn off buffering, you only need to add proxy_buffering off; to your +location block:

 ...
 location / {
@@ -168,7 +168,7 @@ $ ~/venvs/webapp/bin/easy_install -U gunicorn
 $ deactivate
 

Then you just need to use one of the three Gunicorn scripts that was installed -into ~/venvs/webapp/bin.

+into ~/venvs/webapp/bin.

Daemon Monitoring

diff --git a/doc/htdocs/faq.html b/doc/htdocs/faq.html index 6c8a0613..bc38c22e 100644 --- a/doc/htdocs/faq.html +++ b/doc/htdocs/faq.html @@ -55,12 +55,12 @@ deployment page. Test some more.
What types of workers are there?

These can all be used with the -k option and specifying them -as egg:gunicorn#$(NAME) where $(NAME) is chosen from this list.

+as egg:gunicorn#$(NAME) where $(NAME) is chosen from this list.

    -
  • sync - The default synchronous worker
  • -
  • eventlet - Asynchronous workers based on Greenlets
  • -
  • gevent - Asynchronous workers based on Greenlets
  • -
  • tornado - Asynchronous workers based on FriendFeed's Tornado server.
  • +
  • sync - The default synchronous worker
  • +
  • eventlet - Asynchronous workers based on Greenlets
  • +
  • gevent - Asynchronous workers based on Greenlets
  • +
  • tornado - Asynchronous workers based on FriendFeed's Tornado server.
How might I test a proxy configuration?
@@ -87,8 +87,8 @@ $ kill -TTOU $masterpid
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.
How do I set SCRIPT_NAME?
-
By default SCRIPT_NAME is an empy string. The value could be set by -setting SCRIPT_NAME in the environment or as an HTTP header.
+
By default SCRIPT_NAME is an empy string. The value could be set by +setting SCRIPT_NAME in the environment or as an HTTP header.
How can I name processes?
You need to install the Python package setproctitle. Then you can specify a base process name on the command line (-n) or in the configuration diff --git a/doc/htdocs/installation.html b/doc/htdocs/installation.html index e6313d33..9cc3033c 100644 --- a/doc/htdocs/installation.html +++ b/doc/htdocs/installation.html @@ -59,8 +59,8 @@

Installing with easy_install

-

If you don't already have easy_install available you'll want to download -and run the ez_setup.py script:

+

If you don't already have easy_install available you'll want to download +and run the ez_setup.py script:

 $ 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
 

If you've cloned the git repository, its highly recommended that you use the -develop command which will allow you to use Gunicorn from the source +develop 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:

@@ -111,20 +111,20 @@ $ easy_install -U gevent    # For gevent workers
 

Note

-

If installing greenlet fails you probably need to install +

If installing greenlet fails you probably need to install the Python headers. These headers are available in most package managers. On Ubuntu the package name for apt-get is python-dev.

-

Gevent also requires that libevent 1.4.x or 2.0.4 is installed. +

Gevent also requires that libevent 1.4.x or 2.0.4 is installed. This could be a more recent version than what is available in your -package manager. If Gevent fails to build even with libevent +package manager. If Gevent fails to build even with libevent installed, this is the most likely reason.

Installing on Ubuntu/Debian systems

If you use Ubuntu karmic, you can update your system with packages from -our PPA by adding ppa:bchesneau/gunicorn to your system's Software +our PPA by adding ppa:bchesneau/gunicorn to your system's Software Sources.

Or this PPA can be added to your system manually by copying the lines below and adding them to your system's software sources:

From ce5527d682135d38fdb18133fc07bfc0228c2f93 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Tue, 25 May 2010 11:44:33 -0400 Subject: [PATCH 4/4] Allow string values to be None. --- gunicorn/config.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/gunicorn/config.py b/gunicorn/config.py index 6febbe24..b0553016 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -181,6 +181,8 @@ def validate_pos_int(val): return val def validate_string(val): + if val is None: + return None if not isinstance(val, basestring): raise TypeError("Not a string: %s" % val) return val.strip() @@ -381,6 +383,7 @@ with Setting("pidfile") as s: s.cli = ["-p", "--pid"] s.meta = "FILE" s.validator = validate_string + s.default = None s.fmt_desc("""\ A filename to use for the PID file. @@ -391,6 +394,7 @@ with Setting("user") as s: s.section = "Server Mechanics" s.cli = ["-u", "--user"] s.validator = validate_string + s.default = None s.fmt_desc("""\ Switch worker processes to run as this user. @@ -403,6 +407,7 @@ with Setting("group") as s: s.section = "Server Mechanics" s.cli = ["-g", "--group"] s.validator = validate_string + s.default = None s.fmt_desc("""\ Switch worker process to run as this group. @@ -432,6 +437,7 @@ with Setting("tmp_upload_dir") as s: s.section = "Server Mechanics" s.meta = "DIR" s.validator = validate_string + s.default = None s.fmt_desc("""\ Directory to store temporary request data as they are read. @@ -524,6 +530,19 @@ with Setting("post_fork") as s: new Worker. """) +with Setting("when_ready") as s: + s.section = "Server Hooks" + s.validator = validate_callable(1) + s.type = "callable" + def def_start_server(server): + pass + s.default = def_start_server + s.fmt_desc("""\ + Called just after the server is started. + + The callable needs to accept a single instance variable for the Arbiter. + """) + with Setting("pre_exec") as s: s.section = "Server Hooks" s.validator = validate_callable(1) @@ -537,16 +556,3 @@ with Setting("pre_exec") as s: The callable needs to accept a single instance variable for the Arbiter. """) - -with Setting("when_ready") as s: - s.section = "Server Hooks" - s.validator = validate_callable(1) - s.type = "callable" - def def_start_server(server): - pass - s.default = def_start_server - s.fmt_desc("""\ - Called just after the server is started - - The callable needs to accept a single instance variable for the Arbiter. - """)