| Name |
Space |
Section |
Page |
Version |
Status |
Curator |
Reviewed |
Author(s) |
Date |
| Production deployment using supervisor Apache as a reverse proxy |
Pylons CookBook |
|
Production deployment using supervisor Apache as a reverse proxy |
1.0 |
Draft |
Graham Higgins |
False |
Max Ischenko |
2007-03-16 |
Production deployment using supervisor Apache as a reverse proxy
This document describes production deployment of Pylons application behind Apache, using WSGI server and supervisor2
to monitor application's status.
Application system environment
The general agreement seems to be that each application should be a "self-contained" box owned by a separate system account. Doing so is relatively easy:
- create a user, e.g. webuser (man adduser)
- su webuser and setup virtual python environment, instructions
- install your app as an egg or via ~/bin/python setup.py develop
Application configuration
Create production.ini config file. By default Pylons uses paste's httpserver. You could stick to it or use something different, say one from CherryPy 3.0:
1
2
3 | [server:main]
use = egg:PasteScript#cherrypy
;use = egg:Paste#http
|
(note: "#" here is part of the syntax and not a comment!)
Run ~/bin/paster serve production.ini to make sure application starts and works as expected.
Usual thing to watch for is permissions and file path. Since you have a separate account it's best to use paths relative to webuser's HOME directory owned by webuser.
Running application with supervisor2
Documentation moved to a [separate page]
Apache as a reverse proxy
See Apache as a reverse proxy for Pylons.
End
That's it. At this point you should have a running Pylons application on some non-privileged port, like 5000 and Apache which transparently forwards external requests to it and supervisor process which make sure your application starts again if it ever crashes.
See also
After successful deployment you're advised to check Issues with long-running Pylons processes.