wiki:InstallationGuidelines/Cherokee

Version 18 (modified by Fran Boon, 13 years ago) ( diff )

--

Installation on Cherokee

This is supposed to be the fastest system for High-Volume sites

Main docs are here: InstallationGuidelines/Linux/Server/CherokeePostgreSQL

This page provides some supplementary notes

uWSGI

uWSGI allows different virtual hosts to reload their modules without restarting for other users.

Install uWSGI

Needs installing from Source:

apt-get install -y libxml2-dev make
wget http://projects.unbit.it/downloads/uwsgi-0.9.7.2.tar.gz
tar zxvf uwsgi-0.9.7.2.tar.gz
cd uwsgi-0.9.7.2
make
cp uwsgi /usr/local/bin
cd ..

Install Cherokee

Whilst there is a version in Squeee, better to install the latest to gain performance advantages on static content:

apt-get install -y gettext libgeoip-dev libssl-dev rrdtool make
apt-get install -y git devscripts git-buildpackage bison flex autotools-dev libpam0g-dev libldap-dev libmysqlclient-dev libavformat-dev libavcodec-dev libavutil-dev libpcre3-dev libbz2-dev
git clone git://git.debian.org/collab-maint/cherokee.git
cd cherokee
uscan --force
git-buildpackage
cd ../build-area/
dpkg -i libcherokee-base0_1.2.2-2_i386.deb
dpkg -i libcherokee-client0_1.2.2-2_i386.deb
dpkg -i libcherokee-server0_1.2.2-2_i386.deb
dpkg -i libcherokee-mod-libssl_1.2.2-2_i386.deb
dpkg -i libcherokee-mod-rrd_1.2.2-2_i386.deb
dpkg -i cherokee_1.2.2-2_i386.deb
dpkg -i cherokee-admin_1.2.2-2_i386.deb

Configure Cherokee for uWSGI

Be sure to set the default app in routes.py:

cat << EOF > "/home/web2py/routes.py"
#!/usr/bin/python
default_application = 'eden'
default_controller = 'default'
default_function = 'index'
routes_onerror = [
        ('eden/400', '!'), 
        ('eden/401', '!'),
        ('eden/*', '/eden/errors/index'),
        ('*/*', '/eden/errors/index'),
    ]
EOF

Set Workers to #CPU cores +1

cat << EOF > "/home/web2py/uwsgi.xml"
<uwsgi>
    <pythonpath>/home/web2py/</pythonpath>
    <app mountpoint="/">
        <script>wsgihandler</script>
    </app>
    <workers>3</workers>
</uwsgi>
EOF

vi /etc/cherokee/cherokee.conf
# Add
server!timeout = 300
vserver!20!collector!enabled = 1
vserver!20!directory_index = index.html
vserver!20!document_root = /var/www
vserver!20!error_writer!filename = /var/log/cherokee/cherokee.error
vserver!20!error_writer!type = file
vserver!20!logger = combined
vserver!20!logger!access!buffsize = 16384
vserver!20!logger!access!filename = /var/log/cherokee/cherokee.access
vserver!20!logger!access!type = file
vserver!20!match = wildcard
vserver!20!match!domain!1 = *
vserver!20!match!nick = 0
vserver!20!nick = maintenance
vserver!20!rule!210!handler = file
vserver!20!rule!210!match = fullpath
vserver!20!rule!210!match!fullpath!1 = /maintenance.html
vserver!20!rule!110!handler = redir
vserver!20!rule!110!handler!rewrite!10!regex = ^/*
vserver!20!rule!110!handler!rewrite!10!show = 1
vserver!20!rule!110!handler!rewrite!10!substring = /maintenance.html
vserver!20!rule!110!match = directory
vserver!20!rule!110!match!directory = /
vserver!20!rule!10!handler = common
vserver!20!rule!10!handler!iocache = 1
vserver!20!rule!10!match = default
vserver!30!collector!enabled = 1
vserver!30!directory_index = index.html
vserver!30!document_root = /var/www
vserver!30!error_writer!filename = /var/log/cherokee/cherokee.error
vserver!30!error_writer!type = file
vserver!30!logger = combined
vserver!30!logger!access!buffsize = 16384
vserver!30!logger!access!filename = /var/log/cherokee/cherokee.access
vserver!30!logger!access!type = file
vserver!30!match = wildcard
vserver!30!match!domain!1 = *
vserver!30!match!nick = 0
vserver!30!nick = Production
vserver!10!collector!enabled = 1
vserver!10!directory_index = index.html
vserver!10!document_root = /var/www
vserver!10!error_writer!filename = /var/log/cherokee/cherokee.error
vserver!10!error_writer!type = file
vserver!10!logger = combined
vserver!10!logger!access!buffsize = 16384
vserver!10!logger!access!filename = /var/log/cherokee/cherokee.access
vserver!10!logger!access!type = file
vserver!10!nick = default
vserver!10!rule!10!handler = common
vserver!10!rule!10!handler!iocache = 1
vserver!10!rule!10!match = default
vserver!20!collector!enabled = 1
vserver!20!directory_index = index.html
vserver!20!document_root = /var/www
vserver!20!error_writer!filename = /var/log/cherokee/cherokee.error
vserver!20!error_writer!type = file
vserver!20!logger = combined
vserver!20!logger!access!buffsize = 16384
vserver!20!logger!access!filename = /var/log/cherokee/cherokee.access
vserver!20!logger!access!type = file
vserver!20!match = wildcard
vserver!20!match!domain!1 = *
vserver!20!match!nick = 0
vserver!20!nick = maintenance
vserver!20!rule!210!handler = file
vserver!20!rule!210!match = fullpath
vserver!20!rule!210!match!fullpath!1 = /maintenance.html
vserver!20!rule!110!handler = redir
vserver!20!rule!110!handler!rewrite!10!regex = ^/*
vserver!20!rule!110!handler!rewrite!10!show = 1
vserver!20!rule!110!handler!rewrite!10!substring = /maintenance.html
vserver!20!rule!110!match = directory
vserver!20!rule!110!match!directory = /
vserver!20!rule!10!handler = common
vserver!20!rule!10!handler!iocache = 1
vserver!20!rule!10!match = default
vserver!30!collector!enabled = 1
vserver!30!directory_index = index.html
vserver!30!document_root = /var/www
vserver!30!error_writer!filename = /var/log/cherokee/cherokee.error
vserver!30!error_writer!type = file
vserver!30!logger = combined
vserver!30!logger!access!buffsize = 16384
vserver!30!logger!access!filename = /var/log/cherokee/cherokee.access
vserver!30!logger!access!type = file
vserver!30!match = wildcard
vserver!30!match!domain!1 = *
vserver!30!match!nick = 0
vserver!30!nick = Production
vserver!30!rule!400!document_root = /home/web2py/applications/eden/static
vserver!30!rule!400!encoder!deflate = allow
vserver!30!rule!400!encoder!gzip = allow
vserver!30!rule!400!expiration = time
vserver!30!rule!400!expiration!time = 7d
vserver!30!rule!400!handler = file
vserver!30!rule!400!match = fullpath
vserver!30!rule!400!match!fullpath!1 = /favicon.ico
vserver!30!rule!400!match!fullpath!2 = /robots.txt
vserver!30!rule!400!match!fullpath!3 = /crossdomain.xml
vserver!30!rule!300!document_root = /home/web2py/applications/eden/static
vserver!30!rule!300!encoder!deflate = allow
vserver!30!rule!300!encoder!gzip = allow
vserver!30!rule!300!expiration = time
vserver!30!rule!300!expiration!time = 7d
vserver!30!rule!300!handler = file
vserver!30!rule!300!match = directory
vserver!30!rule!300!match!directory = /eden/static/
vserver!30!rule!300!match!final = 1
vserver!30!rule!200!encoder!deflate = allow
vserver!30!rule!200!encoder!gzip = allow
vserver!30!rule!200!handler = uwsgi
vserver!30!rule!200!handler!balancer = round_robin
vserver!30!rule!200!handler!balancer!source!10 = 1
vserver!30!rule!200!handler!check_file = 0
vserver!30!rule!200!handler!error_handler = 1
vserver!30!rule!200!handler!modifier1 = 0
vserver!30!rule!200!handler!modifier2 = 0
vserver!30!rule!200!handler!pass_req_headers = 1
vserver!30!rule!200!match = directory
vserver!30!rule!200!match!directory = /
vserver!30!rule!100!handler = common
vserver!30!rule!100!handler!iocache = 1
vserver!30!rule!100!match = default
source!1!env_inherited = 1
source!1!group = web2py
source!1!host = 127.0.0.1:59025
source!1!interpreter = /usr/local/bin/uwsgi -s 127.0.0.1:59025 -x /home/web2py/uwsgi.xml
source!1!nick = uWSGI 1
source!1!timeout = 300
source!1!type = interpreter
source!1!user = web2py

Emperor mode can be used to put the site into maintenance:

Create a simple uwsgi app & swap in a config file for this - uwsgi will reload automatically.

Static home page

ConfigurationGuidelines#StaticHomePage

vserver!30!rule!300!document_root = /home/web2py/applications/eden/static
vserver!30!rule!300!handler = redir
vserver!30!rule!300!handler!rewrite!10!regex = ^.*$
vserver!30!rule!300!handler!rewrite!10!show = 1
vserver!30!rule!300!handler!rewrite!10!substring = /eden/static/index.html
vserver!30!rule!300!match = and
vserver!30!rule!300!match!final = 1
vserver!30!rule!300!match!left = fullpath
vserver!30!rule!300!match!left!fullpath!1 = /
vserver!30!rule!300!match!right = not
vserver!30!rule!300!match!right!right = header
vserver!30!rule!300!match!right!right!complete = 0
vserver!30!rule!300!match!right!right!header = Cookie
vserver!30!rule!300!match!right!right!match = re
vserver!30!rule!300!match!right!right!type = regex

FastCGI

http://web2py.com/AlterEgo/default/show/17


InstallationGuidelines

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.