From: Rui Carmo Title: Frequently Asked Questions (for Deployment) Date: 2007-09-03 18:28:52 Content-Type: text/x-textile bq. This "FAQ":FAQ assumes you read the "HOWTO":http://code.google.com/p/yaki/wiki/HOWTO and have, in fact, "Yaki":Yaki running. h2. Where is "Yaki":Yaki? All I can see is a "Snakelets":docs/Snakelets install. This may come in handy, then:
yaki --+-- serv.py (the start script)
|
+-- monitor.py (the process monitor, which you can run from cron to restart Snakelets automatically)
|
+-- docs (Snakelets original docs)
|
+-- logs (HTTP and app server log files)
|
+-- snakeserver (Snakelets itself, containing a few other directories)
|
+-- userlibs (where some Yaki dependencies are kept, shared across all Snakelets applications)
|
+-- webapps.disabled (some - disabled - sample Snakelets applications I included as reference)
|
+== webapps ==+== ROOT ==+== __init__.py (the main Yaki configuration file)
|
+-- plugins (Wiki plugins, basically Python classes that manage markup)
|
+-- space (the default path for page content, which you can - and should - change)
|
+-- web --+-- (static files and some dynamic helpers)
| |
| +-- themes (page templates and related stuff)
|
+== yaki (Yaki itself, which is where all the action is)
h2. Does it run under "Windows":Tao:Windows?
In the sense that it is regularly run and tested under "Cygwin":http://www.cygwin.com/, yes. Your mileage may vary, especially where "Yaki's":Yaki use of multiple threads for some tasks is concerned.
h2. What is your recommended setup?
Although this is not by any means a requirement ("Yaki":Yaki will run just fine wihtout this), most active deployments of "Yaki":Yaki run behind a "lighttpd":http://lighttpd.net server for "HTTP":Tao:HTTP multiplexing and "URL":Tao:URL sanitization.
Here's a snippet of code that should help you set up "lighttpd":http://lighttpd.net as a reverse proxy for "Yaki":Yaki.
$HTTP["host"] == "foo.org" {
# You may need other things here, like server.document-root, accesslog.filename, etc.
# Reverse proxy mapping
# - this assumes you're running Yaki/Snakelets bound to the loopback (as you should) and in the default port
$HTTP["url"] =~ "^/*" {
proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => 9080 ) ) )
}
# Filter out some bot nuisances (severely simplified to fit here)
$HTTP["useragent"] =~ "Exabot|MSRBOT|Sucker|BlackWidow|craftbot|ChinaClaw|DISCo|eCatch|Grabber|EmailSiphon" {
url.access-deny = ( "" )
}
# Sample redirects for root path and missing slash
url.redirect = (
"^/?$" => "http://foo.org/space/",
"^/space$" => "http://foo.org/space/"
)
}
Since "Snakelets":docs/Snakelets only supports "HTTP":Tao:HTTP 1.0, this allows you to take full advantage of "HTTP":Tao:HTTP 1.1 and have a more powerful way to control "URL":URLs, filter out nuisances, and (with further tweaking) offload compression and static file transfers[1].
h2. Alternatives to lighttpd
You can use just about any "HTTP":Tao:HTTP server that works as a reverse proxy, but the most common alternative is using no extra software at all - if you do require "Yaki":Yaki to work in "HTTP's":Tao:HTTP default port 80, you have several options:
* Use @iptables@, @ipf@ to redirect port 80 to port 9080 at the system firewall level
* Use @xinetd@ to do the same
* If you're using "Yaki":Yaki behind a cable or DSL router, map port 80 on the outside to port 9080 on your machine
* etc.
Running "Yaki":Yaki as @root@ in order to use port 80 is, in a word, stupid. In two words, stupid and senseless.
h2. What's @monitor.py@ for?
It acts as a watchdog to keep your "Snakelets":docs/Snakelets instance running. Edit it and change the following lines to suit the location where you unpacked "Yaki":Yaki:
# -------------- CONFIGURE BELOW: ------------------------ SERVER_HOST = '127.0.0.1' SERVER_DIR = "/home/user/yaki" # -------------- CONFIGURE ENDS --------------------------Then add it to your @crontab@ as such:
$ crontab -l */5 * * * * /home/user/yaki/monitor.py > /dev/null 2>&1In the (extremely unlikely) event that "Snakelets":docs/Snakelets stops (or, most likely, that your machine reboots) the script will automatically -- fn1. "Snakelets":docs/Snakelets has built-in (fast) support for file offsets, @gzip@ encoding, and the "Linux":Linux @sendfile()@ call, but if you're deploying "Yaki":Yaki on other platforms you may want to offload those to a better "HTTP":Tao:HTTP server.