Plone配置文件赏析

Plone配置文件赏析
Plone部署配置文件
包含多个实例、MySQL数据库支持
# Deployment buildout # =================== [buildout] parts = instance1 instance2 instance3 instance4 zodbpack zodbpack-config supervisor ${buildout:memcached-parts} ${buildout:haproxy-parts} ${buildout:varnish-parts} ${buildout:nginx-parts} extends = packages.cfg buildout.d/memcached.cfg buildout.d/haproxy.cfg buildout.d/varnish.cfg buildout.d/nginx.cfg # Create local caches so that we get completely self-contained buildouts. # These directories must be created before the buildout is run the first time. eggs-directory = ${buildout:directory}/var/cache/eggs download-cache = ${buildout:directory}/var/cache/downloads extends-cache = ${buildout:directory}/var/cache/extends # If you release internal eggs to an internal server, you should reference # a page that lists all those eggs here. The easiest way is to allow scp # access to a directory that's served by nginx or Apache and enable automatic # directory indexing/listing of that directory. Then use ./bin/mkrelease to # release your internal eggs here, and add to the [versions] block in # versions.cfg. # find-links = http://my-internal-server/eggs # Packages to check out/update when buildout is run # Clear this out if you want to stick to internally released eggs - see above. auto-checkout = optilux.policy optilux.theme optilux.cinemacontent optilux.facebookauth # Make sure buildout never attempts to update packages automatically for # production use. always-checkout = false # Host names/IP addresses. See below for corresponding ports. [hosts] # The public hostname used in virtual hosting, i.e. the public facing domain public = localhost # The host that nginx proxies to nginx-backend = ${:varnish} # The hostname/address that Varnish binds to varnish = localhost # The hosts that are allowed to issue PURGE reuqests to Varnish allow-purge = localhost # The IP address that Varnish proxies to (do not use a hostname) varnish-backend = 127.0.0.1 # The hostname that HAProxy binds to haproxy = localhost # The IP addresses of each Zope instance instance1 = 127.0.0.1 instance2 = 127.0.0.1 instance3 = 127.0.0.1 instance4 = 127.0.0.1 # Where to find the syslog deamon to log to syslog = localhost # The hostname that memcached binds to memcached = localhost # The hostname where the database server is found database = localhost # The hostname that supervisord binds to supervisor = localhost # Port corresponding to the hostnames above. Note that to bind to ports # < 1024, you will need to run ./bin/supervisord as root! [ports] http = 80 https = 443 nginx-backend = ${:varnish} varnish = 8100 varnish-backend = ${:haproxy} haproxy = 8200 haproxy-stats = 8222 instance1 = 8001 instance2 = 8002 instance3 = 8003 instance4 = 8004 syslog = 514 memcached = 11211 database = 3306 supervisor = 9001 [users] # Process owners for nginx, varnish, haproxy, memcached and Zope nginx = nobody varnish = nobody haproxy = nobody zope-process = nobody memcached = nobody # System user accounts for Zope root admin, database access and Supervisor zope-admin = admin database = zope supervisor-admin = admin # Passwords for the accounts above [passwords] zope-admin = secret database = secret supervisor-admin = secret # Database instances for SQLAlchemy and RelStorage [databases] optilux = optilux zodb = zodb # How should varnish store its cache? Increase thesize, in megabytes, as required [varnish-options] storage = malloc,128M [limits] # How many open files are allowed? This affects the number of concurrent # connections. On some operating systems, this is set on startup per user # as the ulimit open-files = 100 # Timeout of inactivity for Beaker sessions session-timeout = 600 [urls] # This URL is used in the nginx configuration to serve an error page when # HAProxy detects no viable backend fallback = /system_error [sites] # Plone site ids - used in virtual hosting main = Plone # Zope instance template [instance] recipe = plone.recipe.zope2instance user = ${users:zope-admin}:${passwords:zope-admin} debug-mode = off verbose-security = off effective-user = ${users:zope-process} http-fast-listen = off zserver-threads = 2 zodb-cache-size = 10000 eggs = ${eggs:main} RelStorage # Configure SQLAlchemy zcml-additional = <configure xmlns="http://namespaces.zope.org/zope" xmlns:db="http://namespaces.zope.org/db"> <include package="z3c.saconfig" file="meta.zcml" /> <db:engine name="optilux" url="mysql://${users:database}:${passwords:database}@${hosts:database}:${ports:database}/${databases:optilux}" /> <db:session engine="optilux" /> </configure> # Configure Beaker sessions with file storage zope-conf-additional = <product-config beaker> session.type ext:memcached session.lock_dir ${buildout:directory}/var/sessions/lock session.url ${hosts:memcached}:${ports:memcached} session.key beaker.session session.secret secret session.secure true session.timeout ${limits:session-timeout} session.cookie_expires True </product-config> # Configure logging to syslog event-log-custom = <syslog> level all format zope[%(process)s]: [%(levelname)s] %(name)s: %(message)s facility local1 address ${hosts:syslog}:${ports:syslog} </syslog> # Configure RelStorage rel-storage = type mysql blob-dir ${buildout:directory}/var/blobstorage cache-servers ${hosts:memcached}:${ports:memcached} db ${databases:zodb} user ${users:database} passwd ${passwords:database} # Configure BLOB storage shared-blob = on [instance1] <= instance http-address = ${hosts:instance1}:${ports:instance1} [instance2] <= instance http-address = ${hosts:instance2}:${ports:instance2} [instance3] <= instance http-address = ${hosts:instance3}:${ports:instance3} [instance4] <= instance http-address = ${hosts:instance4}:${ports:instance4} # Install the bin/zodbpack script # Run: ``bin/zodbpack etc/zodbpack.conf`` [zodbpack] recipe = zc.recipe.egg eggs = RelStorage MySQL-python scripts = zodbpack # Generate ``etc/zodbpack.conf`` [zodbpack-config] recipe = collective.recipe.template input = ${buildout:directory}/buildout.d/templates/zodbpack.conf output = ${buildout:directory}/etc/zodbpack.conf # Install supervisor, which runs on port 9001 # Run: ``bin/supervisord`` # Run: ``bin/supervisorctl --help`` [supervisor] recipe = collective.recipe.supervisor port = ${ports:supervisor} user = ${users:supervisor-admin} password = ${passwords:supervisor-admin} serverurl = http://${hosts:supervisor}:${ports:supervisor} programs = 0 memcached ${memcached-build:location}/bin/memcached true ${users:memcached} 10 instance1 ${buildout:directory}/bin/instance1 [console] true ${users:zope-process} 10 instance2 ${buildout:directory}/bin/instance2 [console] true ${users:zope-process} 10 instance3 ${buildout:directory}/bin/instance3 [console] true ${users:zope-process} 10 instance4 ${buildout:directory}/bin/instance4 [console] true ${users:zope-process} 20 haproxy ${buildout:directory}/bin/haproxy [-f ${buildout:directory}/etc/haproxy.conf] true ${users:haproxy} 30 varnish ${varnish-build:location}/sbin/varnishd [-F -s ${varnish-options:storage} -f ${buildout:directory}/etc/varnish.vcl -a ${hosts:varnish}:${ports:varnish} ${varnish-options:tuning}] true ${users:varnish} 40 nginx ${nginx-build:location}/sbin/nginx true
设置