Skip to content

Instantly share code, notes, and snippets.

@toutpt
Created January 27, 2012 13:21
Show Gist options
  • Save toutpt/1688734 to your computer and use it in GitHub Desktop.
Save toutpt/1688734 to your computer and use it in GitHub Desktop.
cyn.in production configuration
# This is the default haproxy load balancing configuration. It uses will
# load balance four ZEO clients.
#
# Note that balancer.conf is generated from balancer.conf.template.
#
global
log ${host:syslog} local6
# We manage this with supervisor
# user ${user:balancer}
maxconn 1024
ulimit-n 65536
nbproc 1
# Run in non-daemon mode so that supervisor can keep control
# daemon
defaults
# log global
mode http
# The zope instances have maxconn 1, and it is important that
# unused/idle connections are closed as soon as possible.
option httpclose
# Remove requests from the queue if people press stop button
option abortonclose
# option httplog
# option dontlognull
retries 3
option redispatch
monitor-uri /haproxy-ping
timeout connect 7s
timeout queue 15s
timeout client 300s
timeout server 300s
stats enable
stats uri /_balancer_status_
stats refresh 5s
stats realm Haproxy\ statistics
frontend zopecluster
bind ${host:balancer}:${port:balancer}
default_backend zope
capture cookie __ac len 10
option httplog
log ${host:syslog} local6
# Load balancing over the zope instances
backend zope
appsession __ac len 32 timeout 1d
balance roundrobin
cookie SERVERID insert indirect
option httpchk GET /
server zope0101 ${host:instance1}:${port:instance1} cookie z0101 check maxconn 2 maxqueue 50
server zope0102 ${host:instance2}:${port:instance2} cookie z0102 check maxconn 2 maxqueue 50
server zope0103 ${host:instance3}:${port:instance3} cookie z0103 check maxconn 2 maxqueue 50
server zope0104 ${host:instance4}:${port:instance4} cookie z0104 check maxconn 2 maxqueue 50
[buildout]
extends =
buildout.cfg
var/sys.cfg
versions.cfg
parts+=
productdistros
maildrophost
zopepy
# i18noverrides
# pyofc2git
#All new parts must be **above** this line.
zope2
instance
chown
precompile
allsrc
backup
zeoserver
instance1
instance2
instance3
instance4
supervisor
haproxy.conf
eggs=
Plone
${cyninbase:eggs}
lxml
[haproxy.conf]
recipe=collective.recipe.template
input = ${buildout:directory}/templates/balancer.conf.template
output = ${buildout:directory}/var/haproxy.conf
[supervisor]
recipe = collective.recipe.supervisor
port = ${port:supervisor}
user = ${user:supervisor}
password = ${password:supervisor}
serverurl = http://${host:supervisor}:${port:supervisor}
programs =
10 zeoserver ${zeoserver:location}/bin/runzeo ${zeoserver:location} true ${user:zope}
20 instance1 ${buildout:directory}/parts/instance1/bin/runzope true ${user:zope}
20 instance2 ${buildout:directory}/parts/instance2/bin/runzope true ${user:zope}
20 instance3 ${buildout:directory}/parts/instance3/bin/runzope true ${user:zope}
20 instance4 ${buildout:directory}/parts/instance4/bin/runzope true ${user:zope}
30 balancer /usr/sbin/haproxy [-f ${buildout:directory}/var/haproxy.conf -db] true ${user:balancer}
40 maildrophost ${buildout:directory}/bin/maildropctl true
[instance]
zeo-client=on
zeo-address=${zeoserver:zeo-address}
zcml =
${cyninbase:zcml}
[zeoserver]
recipe = plone.recipe.zope2zeoserver
zeo-address = ${port:zeoserver}
zope2-location=${zope2:location}
[instance1]
<= instance
http-address = ${port:instance1}
[instance2]
<= instance
http-address = ${port:instance2}
[instance3]
<= instance
http-address = ${port:instance3}
[instance4]
<= instance
http-address = ${port:instance4}
[versions]
archetypes.schemaextender = 1.6
plone.reload = 1.5
[instance]
debug-mode = off
verbose-security = off
effective-user = zope
[host]
supervisor = 127.0.0.1
balancer = 0.0.0.0
instance1 = 127.0.0.1
instance2 = 127.0.0.1
instance3 = 127.0.0.1
instance4 = 127.0.0.1
instance5 = 127.0.0.1
instance6 = 127.0.0.1
syslog = 127.0.0.1
[port]
balancer = 6060
instance = 6068
instance1 = 6061
instance2 = 6062
instance3 = 6063
instance4 = 6064
supervisor = 6001
zeoserver = 6059
[user]
balancer = zope
zope = zope
supervisor = zope
cache = zope
instance = admin
[password]
supervisor = admin
plonesite = admin
[path]
plonesite = /plone
var-directory = ${buildout:directory}/var
bin-directory = ${buildout:directory}/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment