changeset 382:5c723d4bd2e4

docs: Add documentation for deploying as a dynamic CMS.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 10 May 2015 23:26:44 -0700
parents 4c9eab0e283b
children 44cf6ce62467
files docs/docs/11_deploying.md docs/docs/11_deploying/01_deploy-with-werkzeug.md docs/docs/11_deploying/02_deploy-with-gunicorn.md
diffstat 3 files changed, 85 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/docs/11_deploying.md	Sun May 10 23:26:44 2015 -0700
@@ -0,0 +1,22 @@
+---
+title: Deploying
+---
+
+PieCrust can be used either as a static website generator or as a dynamic CMS.
+This section is about deploying a PieCrust website as a dynamic CMS. For how to
+bake a website and publish it statically, see the [publishing
+documentation][publish].
+
+Using PieCrust as a dynamic CMS requires setting up a web server to execute code
+and serve requests. PieCrust itself can be wrapped in a [WSGI
+application][wsgi], so there are many different ways to do it. The following
+ways have been tested to work, and should perform very well in a production
+environment:
+
+{% for p in family.children %}
+* [{{p.title}}]({{p.url}}): {{p.summary}}
+{% endfor %}
+
+[publish]: {{docurl('publishing')}}
+[wsgi]: https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/docs/11_deploying/01_deploy-with-werkzeug.md	Sun May 10 23:26:44 2015 -0700
@@ -0,0 +1,27 @@
+---
+title: Deploy with Werkzeug
+summary: Using Werkzeug with Apache
+---
+
+Werkzeug is an HTTP and WSGI toolkit for Python that PieCrust uses to run the
+preview server when you invoke `chef serve`. It can be used to serve PieCrust
+using the very popular Apache web server, but has several other ways to work, as
+listed on the [Werkzeug application deployment documentation][2].
+
+Whether you'll be using [`mod_wsgi`][3] or [FastCGI][4], you'll need a WSGI
+application for your PieCrust website. This is how you do it:
+
+```
+from piecrust.wsgiutil import get_app
+application = get_app('/path/to/website/rootdir')
+```
+
+You can then follow the rest of the Werkzeug deployment instructions, which
+mostly includes setting up an Apache configuration section for your website.
+
+
+[1]: http://werkzeug.pocoo.org/docs/0.10/
+[2]: http://werkzeug.pocoo.org/docs/0.10/deployment/
+[3]: http://werkzeug.pocoo.org/docs/0.10/deployment/mod_wsgi/
+[4]: http://werkzeug.pocoo.org/docs/0.10/deployment/fastcgi/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/docs/11_deploying/02_deploy-with-gunicorn.md	Sun May 10 23:26:44 2015 -0700
@@ -0,0 +1,36 @@
+---
+title: Deploy with Gunicorn
+summary: Using Gunicorn with Nginx
+---
+
+[Gunicorn][1] is a WSGI HTTP server for UNIX. It's popular with people looking
+for something more lightweight -- and potentially more performant -- than
+Apache, since it primarily works hand in hand with Nginx. It will, however,
+require a bit more configuration work.
+
+Using Gunicorn usually starts with running the Gunicorn server, pointing it to your
+WSGI application. Although you can write a [quick WSGI script][4] to get one
+pointing to your website root, there's a nice shortcut in the form of the
+`piecrust.wsgiutil.cwdapp` module. It will automatically create a WSGI
+application for the current directory.
+
+So you can easily run Gunicorn without writing anything:
+
+```
+cd /path/to/website/rootdir
+gunicorn piecrust.wsgiutil.cwdapp:app
+```
+
+Of course, you may want to use custom command-line parameters -- see the
+documentation on [running Gunicorn][2] for more information.
+
+After that, you can configure Nginx (or any other web server that can do HTTP
+proxying) to handle requests and responses. See the documentation on [deploying
+Gunicorn][3] for more information on that.
+
+
+[1]: http://gunicorn.org/
+[2]: http://docs.gunicorn.org/en/19.3/run.html
+[3]: http://docs.gunicorn.org/en/19.3/deploy.html
+[4]: {{docurl('deploying/deploy-with-werkzeug')}}
+