Permalink
Browse files

update docs and add new preferred deploy method with uWSGI

  • Loading branch information...
posativ committed Aug 27, 2012
1 parent 86ba1a2 commit 316a6ee4cf4d6a69d2bc2ea31bf20847cf680f08
Showing with 69 additions and 30 deletions.
  1. +4 −1 README.md
  2. +65 −29 doc/DEPLOYMENT.md
View
@@ -19,7 +19,7 @@ of choice (Debian Squeeze!).
$ brew install mongodb
$ mongod --dbpath foo/ &
-Now install Regenwolken and its dependencies:
+Now install regenwolken and its dependencies:
$ easy_install regenwolken
$ easy_install pygments PIL markdown # optional
@@ -31,6 +31,9 @@ Modify /etc/hosts, launch regenwolken and register a new account
[... open Cloud.app or another client and register a new account]
$ rwctl activate USERNAME
+You can change that behavior to instantly activate new users. See the configuration
+part below.
+
## How to use regenwolken
As an alternative CloudApp-server, you have to edit their DNS *my.cl.ly*
View
@@ -1,7 +1,7 @@
-Deploying regenwolken
-=====================
+Deploy regenwolken
+==================
-You'll need at [python][1] ≥ 2.6, [Flask][2] and [pymongo][3] for [MongoDB][4] bindings
+You'll need at [python][1] ≥ 2.5, [Flask][2] and [pymongo][3] for [MongoDB][4] bindings
and a working MongoDB instance:
On a debian-like system run:
@@ -10,59 +10,95 @@ On a debian-like system run:
and then
- easy_install -U regenwolken
+ pip install regenwolken # or master from GitHub
+ pip install --upgrade git+git://github.com/posativ/regenwolken.git#egg=regenwolken
If you want additional syntax highlighting, markdown support and image
thumbnailing, also run `easy_install -U pygments markdown PIL` respectively.
-*NOTE:* if you're using python 2.5, you'll need `easy_install -U simplejson`.
+*NOTE:* if you're using python 2.5, you'll also need `simplejson`.
[1]: http://python.org/
[2]: http://flask.pocoo.org/
[3]: http://api.mongodb.org/python/current/
[4]: http://www.mongodb.org/
-using lighttpd + `mod_proxy`
-----------------------------
+[uWSGI][5]
+----------
-Recommended way. Use some proxy-magic and run it as non-privileged user. Edit
-your /etc/lighttpd/lighttpd.conf to something like this:
+uWSGI has explicit support for virtual environments, so I highly recommend this
+method! But unfortunately uWSGI is not shipped with Debian Squeeze, so we have to
+type two additional commands as root.
- $HTTP["host"] =~ "cloud.org|my.cl.ly" {
+ # apt-get install build-essential python-dev libxml2-dev
+ # easy_install uwsgi virtualenv
- # some other stuff related to cloud.org
+Now as regular user, choose a path where you want a isolated environment.
- $HTTP["host"] =~ "my.cloud.org|my.cl.ly" {
- proxy.server = ("" =>
- (("host" => "127.0.0.1", "port" => 9000)))
- }
- }
+ $ virtualenv /path/to/regenwolken/
+ $ cd /path/to/regenwolken && source bin/activate
-- start mongodb via `invoke-rc.d start mongodb` (if not already running)
-- set "port: 9000" in your *regenwolken.cfg*
-- run `regenwolken` as non-privileged user
+Now we can install all python eggs outside from the system's python. The following
+will install regenwolken and libraries for thumbnail support, syntax highlighting and
+markdown conversion of text snippets.
-quick & dirt testing as HTTP server
------------------------------------
+ $ easy_install regenwolken PIL pygments markdown
+ $ uwsgi -H /path/to/regenwolken/ --http :3000 -M -w "regenwolken:Regenwolken()"
-*NOTE:* not recommended for production usage, because it requires to be run as root
+I usually run my services with `start-stop-daemon` (Debian/Ubuntu) so I can manage them
+as root but they still run in user space. The following assumes you have your configuration
+file stored in `/path/to/regenwolken/rw.cfg`.
-- start mongodb via `invoke-rc.d start mongodb` (if not already running)
-- set "port: 80" in your *regenwolken.cfg*
-- run `sudo regenwolken` as non-privileged user
+ $ cat /etc/init.d/regenwolken
+ #!/bin/sh
+ NAME=regenwolken
+ CHDIR=/path/to/regenwolken/
+ USER=py
+ DAEMON_OPTS="-H ${CHDIR} --http :8012 -M --env REGENWOLKEN_SETTINGS=${CHDIR}rw.cfg -w regenwolken:Regenwolken()"
-[gunicorn][5] and lighttpd + `mod_proxy` (or similar proxy method)
-------------------------------------------------------------------
+ case $1 in
+ start)
+ echo -n "Starting $NAME: "
+ start-stop-daemon --start --pidfile /var/run/$NAME.pid --chdir $CHDIR \
+ --chuid $USER --make-pidfile --background --exec /usr/local/bin/uwsgi -- $DAEMON_OPTS || true
+ echo "$NAME."
+ ;;
+ stop) kill -9 $(cat /var/run/$NAME.pid)
+ ;;
+ esac
+
+[5]: http://projects.unbit.it/uwsgi/
+
+[gunicorn][6] and lighttpd + `mod_proxy` (or similar proxy methods)
+-------------------------------------------------------------------
Running regenwolken with gunicorn achieves the best performance. See
`gunicorn -h` to get a full list of options. Install [gunicorn][5] via
easy_install -U gunicorn
- gunicorn -w 4 -b localhost:9000 "regenwolken:Regenwolken()"
+ gunicorn -w 4 -b localhost:3000 "regenwolken:Regenwolken()"
to run it with four workers. (`sudo guni... -b localhost:80` works too,
but is not recommended because of root privileges.)
-[5]: http://gunicorn.org/
+[6]: http://gunicorn.org/
+
+using lighttpd + `mod_proxy`
+----------------------------
+
+Recommended way. Use some proxy-magic and run it as non-privileged user. Edit
+your /etc/lighttpd/lighttpd.conf to something like this:
+
+ $HTTP["host"] =~ "domain.tld|my.cl.ly" {
+
+ # some other stuff related to domain.tld
+ $HTTP["host"] =~ "domain.tld|my.cl.ly" {
+ proxy.server = ("" =>
+ (("host" => "127.0.0.1", "port" => 3000)))
+ }
+ }
+
+- start mongodb via `invoke-rc.d start mongodb` (if not already running)
+- run `regenwolken` as non-privileged user

0 comments on commit 316a6ee

Please sign in to comment.