Browse files

add buildout support

  • Loading branch information...
1 parent 2f98d9d commit 03fae7d9230de01f7af7ca737a4782d454088807 @kiorky kiorky committed Nov 15, 2012
View
9 .gitignore
@@ -25,3 +25,12 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
+
+etc/apache/100-convertit.reverseproxy.conf
+etc/convertit.env
+etc/init.d/
+etc/wsgi/
+etc/logrotate.conf
+local.cfg
+
+src/convertit/tests/data/tmp/
View
1 LINK_TO_REGENERATE.html
@@ -0,0 +1 @@
+<html><body><a href="http://cgwb.cryptelium.net/collect/Generic%20Portal%20Pyramid?oldparams=eNqFVk2P2zYQ%2FTX2xYgh25s0PeiQJk0uOSzQ3oUROZZmTZEMSVlWf32HlmRLWhaFbUDmkPPx5s2j%0AOgp1UZKWpKviprqQfwflcdvFdds7aEgWeAuSHIqFcTpUetPa1KkGSKEbLb4tGwqFqLrym%2Bm0MiDz%0ApR8rzykvoZmvSghQgsfCOBAKR9MF%2B8446fPl0bNxDShRY9OnPEcz%2BTplKhEunPrfrh0NWFVF5RC1%0AwgkEq4zGwjojWxHWoRujKyPLZOr%2Bl6KAqbDeiAsGMimbsyKFvu1%2FTQmR9iSxaEhTgAqH7B1e0Xnk%0ANG994SMWmNch2MFLMEYVDq1xQcGU7eJINOWfs7FaLxzZWCxIDlNY8D4Cn3sUDsMTKtsr0kkqvZF%2B%0Ag%2BNoKVtSsjRMC2d0nu1Ou83xy%2FRjylh0V%2FLGFa3nbtxjbmvToI3lxSo2py%2Bb43f%2Bdl23r1CjI7EX%0AplnG7OoFop2vqBDgxzWwwLAU19r4UOi2KTnUIcu4REncCw0qljQ1%2BNHFpuc%2BpipkTDBcCbspgBdN%0AEXrLGVdbWQ6Ifnw5HVeNpIW3inxhK2fawMbRwIc1cP%2BmDsty1kWyfagZxSdno4sGrKZLKk2JZVvF%0AkyW4JBcFnM9GSc87BU%2B4QjnfFrtch0Z9VFQmx9ZBZBGozoG1DxmoYaBVBDs%2FHH%2FbZ%2Fw5zFu9snDN%0Ad%2BwsL%2FMAMubLOP%2BIZsJtWopxuW%2F5Yf8Cpy3He4vKJYxmQ6CwljahTLXKbiD9MTvM8NXG4wzcqW1K%0Agn1I3KOIu4Pfs%2Bye%2F3pKFvN1L1cZASo%2B3bm7sIMiZpvPS%2FL7xbY9r2yOXwO65XqUgQBKFQ0yH2R%2B%0AnzGm0Tiys0la4shqxRDpRC8%2FnBWEOHIToePkDSV%2BYh7PMBKGM39Iz8J%2FHIhI5wksaDk7l1%2FIuEu%2F%0A25y%2BDk%2Bbl%2BxRzeb057itwHiX5O%2B3zBXHWNTep0byQzTRRN8nPbJh16xvd%2By0wNN6FHmOBu1bGyoJ%0A7%2Ba2QmOTN04NWvKV6Oc21h4W%2FQdrfYJjyeCT8c2bRdMS1Uxyq0gwRDiIyI%2FXn%2F954LC6%2BSx5%2BJ8Y%0AL6nc1I2H8%2B5qPhupS%2BN5OcIs9iBsh89atnJOqnFOhxXWadYFn69I8fD4VI5hP7P8TFXrIIp7%2FmO4%0ANHavTGdQu9ehU1s8n1k06IrDwAzMW3UFGxFvjjQwiRG4vxOgrkjjsiH5H399mxVcvlPyyYPtRbD2%0AmJRralii4yvNaG0dLa%2FIutqfjdlrhpxFaV4W%2F13K0JPKgV%2Fh3lUZKeFtTfqWyoR7vnpXmSyiZuIp%0ANJonRPuaUpQRQG68rf8FRxEa4Q%3D%3D%0A">Click here to go to the generation service</a></body></html>
View
47 buildout-dev.cfg
@@ -0,0 +1,47 @@
+# Pyramid 'convertit' BUILDOUT
+# To run in WSGI, a long word to say how to start to serve your project:
+# bin/paster serve --reload etc/wsgi/instance.ini
+
+[buildout]
+extends=etc/base.cfg
+extends-cache=etc/cache
+
+[settings]
+debug=true
+
+[scripts]
+eggs+=
+ docutils
+ jarn.mkrelease
+ zest.releaser
+ ipython
+scripts+=
+ fullrelease
+ ipython
+ lasttagdiff
+ lasttaglog
+ longtest
+ mkrelease
+ nose
+ nosetests
+ package_svn_prepare
+ postrelease
+ prerelease
+ project_diff
+ project_eggs
+ project_md5
+ project_release
+ release
+ release_eggs
+ rst2html.py
+ rst2latex.py
+ rst2man.py
+ rst2odt_prepstyles.py
+ rst2odt.py
+ rst2pseudoxml.py
+ rst2s5.py
+ rst2xetex.py
+ rst2xml.py
+ rstpep2html.py
+
+# vim:set et ts=4 sts=4 ft=cfg:
View
27 buildout-prod.cfg
@@ -0,0 +1,27 @@
+# Pyramid 'convertit' BUILDOUT
+# To run your project, use supervisor (bin/supervisord & bin/supervisorctl)
+
+
+[buildout]
+extends=etc/base.cfg
+# uncommited local settings
+ local.cfg
+parts+=instance1
+ instance2
+ instance3
+ instance4
+ logrotate.conf
+ chown
+# activate to backup daily pgsql
+# backup_pgsql
+# backup_pgsql_daily
+# backup_pgsqlkeep
+# if you enable some crons, enable this also
+# chmodcron
+
+[instance]
+debug=false
+intercept_exc_debug=false
+debugtoolbar.eval_exc=false
+
+# vim:set et ts=4 sts=4 ft=cfg:
View
54 development.ini
@@ -1,54 +0,0 @@
-[app:main]
-use = egg:convertit
-
-pyramid.reload_templates = true
-pyramid.debug_authorization = false
-pyramid.debug_notfound = false
-pyramid.debug_routematch = false
-pyramid.default_locale_name = en
-pyramid.includes =
- pyramid_debugtoolbar
-
-download_dir = %(here)s/convertit/download_dir
-download_max_age = 60
-converted_dir = %(here)s/convertit/static/converted
-# The retrieve url of converted files
-# It can be a full url like http://static.domain.tld/full/path/
-converted_url = converted
-converted_max_age = 60
-
-[server:main]
-use = egg:waitress#main
-host = 0.0.0.0
-port = 6543
-
-# Begin logging configuration
-
-[loggers]
-keys = root, convertit
-
-[handlers]
-keys = console
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = console
-
-[logger_convertit]
-level = DEBUG
-handlers =
-qualname = convertit
-
-[handler_console]
-class = StreamHandler
-args = (sys.stderr,)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
-
-# End logging configuration
View
5 etc/apache/apache.cfg
@@ -0,0 +1,5 @@
+[apache_vhost]
+recipe = collective.recipe.template
+input =${buildout:directory}/etc/templates/apache/100-convertit.reverseproxy.conf.in
+output =${buildout:directory}/etc/apache/100-convertit.reverseproxy.conf
+
View
40 etc/base.cfg
@@ -0,0 +1,40 @@
+#
+# pyramid BUILDOUT
+#
+
+
+
+[buildout]
+extensions = buildout.minitagificator mr.developer buildout.dumppickedversions jarn.setuptoolsfixer
+dump-picked-versions-file =${buildout:directory}/etc/project/convertit-kgs.cfg
+
+extends=
+# set here your project specific settings
+ project/convertit.cfg
+ project/cluster.cfg
+# set here your projet version pins
+ project/sources.cfg
+ project/versions.cfg
+# project/convertit-kgs.cfg
+ project/patches.cfg
+ sys/settings.cfg
+# supervisor
+ sys/high-availability.cfg
+ sys/maintenance.cfg
+ apache/apache.cfg
+ sys/maintenance.cfg
+versions = versions
+parts =
+ scripts
+ convertit.test
+ omelette
+ instance
+ test
+ supervisor
+ supervisor-initd
+# apache
+ apache_vhost
+# security
+ chmod
+
+# vim:set et ts=4 sts=4 ft=cfg:
View
0 etc/cache/.empty
No changes.
View
38 etc/project/cluster.cfg
@@ -0,0 +1,38 @@
+#Add multiple zope instance here
+
+[instance1]
+<= instance
+name=instance1
+output = ${buildout:directory}/etc/wsgi/instance1.ini
+host=${hosts:instance1}
+port=${ports:instance1}
+
+[instance2]
+<= instance
+name=instance2
+output = ${buildout:directory}/etc/wsgi/instance2.ini
+host=${hosts:instance2}
+port=${ports:instance2}
+
+[instance3]
+<= instance
+name=instance3
+output = ${buildout:directory}/etc/wsgi/instance3.ini
+host=${hosts:instance3}
+port=${ports:instance3}
+
+[instance4]
+<= instance
+name=instance4
+output = ${buildout:directory}/etc/wsgi/instance4.ini
+host=${hosts:instance4}
+port=${ports:instance4}
+
+[supervisor]
+programs =
+ 70 instance1 ${buildout:directory}/bin/pserve [--pid-file=${buildout:directory}/var/instance1.pid --log-file=${buildout:directory}/var/log/instance1.log ${buildout:directory}/etc/wsgi/instance1.ini] ${buildout:directory} true ${users:pyramid}
+# 80 instance2 ${buildout:directory}/bin/pserve [--pid-file=${buildout:directory}/var/instance2.pid --log-file=${buildout:directory}/var/log/instance2.log ${buildout:directory}/etc/wsgi/instance2.ini] ${buildout:directory} true ${users:pyramid}
+# 90 instance3 ${buildout:directory}/bin/pserve [--pid-file=${buildout:directory}/var/instance3.pid --log-file=${buildout:directory}/var/log/instance3.log ${buildout:directory}/etc/wsgi/instance3.ini] ${buildout:directory} true ${users:pyramid}
+# 100 instance4 ${buildout:directory}/bin/pserve [--pid-file=${buildout:directory}/var/instance4.pid --log-file=${buildout:directory}/var/log/instance4.log ${buildout:directory}/etc/wsgi/instance4.ini] ${buildout:directory} true ${users:pyramid}
+
+# vim:set et ts=4 sts=4 ft=cfg:
View
51 etc/project/convertit-kgs.cfg
@@ -0,0 +1,51 @@
+[versions]
+WebTest = 1.4.0
+collective.recipe.omelette = 0.15
+collective.recipe.supervisor = 0.17
+collective.recipe.template = 1.9
+collective.xmltestreport = 1.2.8
+plone.recipe.command = 1.1
+supervisor = 3.0b1
+
+#Required by:
+#convertit 1.0dev0
+#WebError 0.10.3
+Paste = 1.7.5.1
+
+#Required by:
+#pyramid 1.4a3
+PasteDeploy = 1.5.0
+
+#Required by:
+#WebError 0.10.3
+#pyramid-debugtoolbar 1.0.3
+Pygments = 1.5
+
+#Required by:
+#convertit 1.0dev0
+coverage = 3.5.3
+
+#Required by:
+#supervisor 3.0b1
+meld3 = 0.6.9
+
+#Required by:
+#convertit 1.0dev0
+mock = 1.0.1
+
+#Required by:
+#convertit 1.0dev0
+plone.testing = 4.0.6
+
+#Required by:
+#plone.testing 4.0.6
+unittest2 = 0.5.1
+
+#Required by:
+#collective.xmltestreport 1.2.8
+z3c.recipe.scripts = 1.0.1
+
+#Required by:
+#collective.xmltestreport 1.2.8
+#plone.testing 4.0.6
+zope.testing = 4.1.1
View
104 etc/project/convertit.cfg
@@ -0,0 +1,104 @@
+########################################################################################################################
+# Project specific settings
+########################################################################################################################
+
+[buildout]
+find-links=${settings:find-links}
+# extra directories to add to the python path
+extra-paths+=
+# better have mr.developer mananing your eggs, see sources.cfg
+develop=.
+package=${settings:application}
+package-extras =[test]
+eggs=${buildout:package}
+
+
+[sources]
+# see http://pypi.python.org/pypi/mr.developer for documentation
+# better to edit ./sources.cfg
+
+[scripts]
+recipe=minitage.recipe.scripts
+# attacking zopepy:eggs make instance be built after zopepy
+# in any case thx to the buildout automatic parts sort.
+extra-paths=${buildout:extra-paths}
+eggs = ${buildout:eggs}
+ z3c.checkversions
+#Pyramid
+ CherryPy
+ gunicorn
+scripts=
+ bfg2pyramid
+ pcreate
+ pserve
+ pshell
+ proutes
+ pviews
+ ptweens
+ prequest
+ checkversions
+ paster
+#with_tool_bpython
+ bpython
+#with_tool_nose
+ nosetests
+ nose
+#with_tool_ipython
+ ipython
+interpreter = pyramidpy
+env-file=${buildout:directory}/etc/convertit.env
+dependent-scripts=true
+#paster-initialization=
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = ${scripts:eggs}
+script = selftest
+
+[omelette]
+order=${scripts:recipe}
+recipe = collective.recipe.omelette
+eggs = ${buildout:eggs}
+packages =${scripts:extra-paths}
+
+# zope.testing testrunner support
+[testenv]
+
+# This testrunner is a zc.recipe.testrunner like
+# See http://pypi.python.org/pypi/zc.recipe.testrunner/
+# It can do xml reports addon if you supply -x as a command line argument
+[convertit.test]
+recipe = collective.xmltestreport
+eggs =
+ ${buildout:package} ${buildout:package-extras}
+ ${scripts:eggs}
+extra-paths = ${scripts:extra-paths}
+defaults = ['--exit-with-status', '--auto-color', '--auto-progress', '-s', '${buildout:package}']
+environment = testenv
+
+[instance]
+recipe = collective.recipe.template
+server = egg:waitress#main
+# set here your project application wsgi application
+egg=${settings:application}
+name=instance
+ep=${instance:egg}
+input = ${buildout:directory}/etc/templates/wsgi/paster.ini.in
+output = ${buildout:directory}/etc/wsgi/instance.ini
+host=${hosts:instance}
+port=${ports:instance}
+intercept_exc_debug=debug
+debugtoolbar.eval_exc=true
+debug=true
+# points to egg/jinja2 directory
+jinja2_templates=${instance:egg}:jinja2
+commit_veto = pyramid_tm.default_commit_veto
+# scheme type can be zeo | file
+# see https://docs.pylonsproject.org/projects/pyramid_zodbconn/dev/
+zodb = zeo://${hosts:zeo}:${ports:zeo}
+
+[supervisor]
+programs =
+ 60 instance ${buildout:directory}/bin/pserve [--pid-file=${buildout:directory}/var/instance.pid --log-file=${buildout:directory}/var/log/instance.log ${buildout:directory}/etc/wsgi/instance.ini] ${buildout:directory} true ${users:pyramid
+
+# vim:set ft=cfg:
View
7 etc/project/patches.cfg
@@ -0,0 +1,7 @@
+[scripts]
+
+# testrunner problem with stdout munging -call to writeline fail)
+#hachoir-core-1.3.2-patches=${buildout:directory}/patches/hachoir.i18n.stdout.patch
+#hachoir-core-patch-options=-Np1
+
+# vim:set ft=cfg:
View
14 etc/project/sources.cfg
@@ -0,0 +1,14 @@
+########################################################################################################################
+# Externals mr.developer products & software not packages as python eggs.
+# see http://pypi.python.org/pypi/mr.developer for documentation
+########################################################################################################################
+
+[buildout]
+sources=sources
+sources-dir=${buildout:directory}/src.mrdeveloper
+auto-checkout +=
+#
+
+[sources]
+#
+# vim:set ft=cfg:
View
63 etc/project/versions.cfg
@@ -0,0 +1,63 @@
+
+
+
+# BASE VERSIONS PINNING
+[buildout]
+versions = versions
+
+[versions]
+#never pin thoses:
+PasteDeploy=
+PasteScript=
+Paste=
+
+
+# bin/buildout -Nvvvvv |sed -ne "s/.*satisfies '//p" |sed -re "s/==/=/g"| sed -re "s/'.//g"|sort | uniq
+pyramid=1.4a3
+
+# convertit=1.0
+# plone.reload > 1 is not compatible with plone3 (depends on Zope2, eggigied)
+#plone.reload=0.11
+# IPython py2.4 compatible version
+ipython = 0.13.1
+# zc.buildout core stuff
+zc.buildout = 1.6.3
+distribute = 0.6.30
+mocker = 1.0
+zc.recipe.egg = 1.3.2
+# pyramid base packages
+Chameleon = 2.10
+CherryPy = 3.2.0
+cryptacular = 1.4.1
+egenix-mx-base = 3.2.4
+gunicorn = 0.15.0
+Mako = 0.7.3
+nose = 1.2.1
+repoze.vhm = 0.14
+WebError = 0.10.3
+MarkupSafe = 0.15
+Pygments = 1.5
+Tempita = 0.5.1
+bpython = 0.11
+mr.developer = 1.22
+pbkdf2 = 1.3
+Pygments = 1.5
+pyramid-debugtoolbar = 1.0.3
+repoze.lru = 0.6
+repoze.tm2 = 1.0
+sqlalchemy = 0.7.9
+SQLAlchemy = 0.7.9
+transaction = 1.3.0
+translationstring = 1.1
+venusian = 1.0a7
+waitress = 0.8.1
+WebOb = 1.2.3
+z3c.checkversions = 0.4.1
+zc.recipe.testrunner = 1.4.0
+zope.deprecation = 4.0.0
+zope.exceptions = 4.0.1
+zope.interface = 4.0.1
+zope.testrunner = 4.0.4
+
+
+# vim:set et ts=4 sts=4 ft=cfg:
View
23 etc/sys/high-availability.cfg
@@ -0,0 +1,23 @@
+########################################################################################################################
+# High availability settings (production instances and load balancer)
+########################################################################################################################
+
+# for haproxy, look at the template in etc/templates/balancer.conf.template
+# regenerate with: buildout -c <CONFIG_FILE> install balancer.config
+# Think for enabling the log statement!
+
+
+[supervisor]
+recipe = collective.recipe.supervisor
+port = ${ports:supervisor}
+user = ${users:admin}
+password = ${passwords:admin}
+serverurl = http://${hosts:supervisor}:${ports:supervisor}
+
+
+[supervisor-initd]
+recipe = collective.recipe.template
+input = ${buildout:directory}/etc/templates/supervisor.initd
+output = ${buildout:directory}/etc/init.d/supervisor.initd
+
+# vim:set et ts=4 sts=4 ft=cfg:
View
56 etc/sys/maintenance.cfg
@@ -0,0 +1,56 @@
+#
+# Cron and logrotation related stuff
+#
+
+[chmodcron]
+recipe = plone.recipe.command
+update-command = ${chmodcron:command}
+command =
+ chmod -v 750 ${buildout:directory}/cron_scripts/*.sh
+
+[logrotate.conf]
+recipe = collective.recipe.template
+input = ${buildout:directory}/etc/templates/logrotate.conf.template
+output = ${buildout:directory}/etc/logrotate.conf
+
+[backup_pgsql]
+recipe = collective.recipe.template
+input =${buildout:directory}/etc/templates/backup_pgsql.sh.in
+output =${buildout:directory}/cron_scripts/backup_pgsql.sh
+
+# keep jkust the last backups
+[backup_pgsqlkeep]
+recipe = collective.recipe.template
+input =${buildout:directory}/etc/templates/keeplastbackups.sh.in
+output =${buildout:directory}/cron_scripts/pgsqlkeeplastbackups.sh
+to_keep=${backup_pgsql:to_keep}
+
+# backup FSS every day
+[backup_pgsql_daily]
+recipe = z3c.recipe.usercrontab
+times = ${crons:pgsql}
+command = ${backup_pgsql:output}
+
+[chmod]
+recipe = plone.recipe.command
+update-command = ${chmod:command}
+command=
+ chmod 600 .installed.cfg
+ chmod 744 ${buildout:directory}/bin/*
+ chmod -v 750 ${buildout:directory}/etc/init.d/*
+ chmod -Rf 700 ${buildout:directory}/etc
+ chmod -Rf 700 ${buildout:directory}/var
+ chmod 700 ${buildout:directory}
+
+[chown]
+recipe = plone.recipe.command
+update-command = ${chown:command}
+command=
+ chown -Rf ${users:pyramid} ${buildout:directory}/etc
+ chown -Rf ${users:pyramid} ${buildout:directory}/var
+ chown ${users:pyramid} ${buildout:directory}
+
+# find ${buildout:directory} -type d -name var -exec chown -R ${users:pyramid} {} \;
+
+
+# vim:set ft=cfg:
View
76 etc/sys/settings.cfg
@@ -0,0 +1,76 @@
+
+
+[settings]
+to_keep=16
+application = convertit
+debug=false
+find-links =
+ http://${mirrors:zope}/ppix/
+ http://gijsbert.org/downloads/cmemcache/
+ http://${mirrors:zope}/distribution/
+ http://gijsbert.org/downloads/cmemcache/
+ http://initd.org/pub/software/psycopg/PSYCOPG-2-0/
+ http://cairographics.org/releases/
+ http://dist.plone.org/thirdparty/
+ http://pypi.python.org/simple/ZODB4
+
+[reverse_proxy]
+scheme=http
+host=localhost.com
+port=80
+
+[hosts]
+instance= localhost
+instance1=localhost
+instance2=localhost
+instance3=localhost
+instance4=localhost
+#may not be used
+supervisor=127.0.0.1
+front=127.0.0.1
+zeo=
+
+[ports]
+instance=6543
+instance1=6544
+instance2=6545
+instance3=6546
+instance4=6547
+#may not be used
+supervisor=9001
+front=6544
+zeo=
+
+[users]
+admin=admin
+pyramid=
+[passwords]
+admin=secret
+pyramid=
+
+[locations]
+
+[crons]
+# at 3:00am NO WHITESPACE!!!
+buildbot-convertit=0 3 * * *
+pgsql = 15 1 * * *
+
+[backup_pgsql]
+# shall we do a full backup (set this to y)
+full=y
+host=localhost
+port=5432
+user=kiorky
+# space separated list of databases to save on this cluster
+databases=minitagedb
+# how much do we rotate ?
+# where to stock dumps
+dumps_path=${buildout:directory}/var/pgsql_dumps
+pgdump_args=-Fc
+pgdumpall_args=
+to_keep=${settings:to_keep}
+
+[mirrors]
+zope = download.zope.org
+
+# vim:set et ts=4 sts=4 ft=cfg:
View
37 etc/templates/apache/100-convertit.reverseproxy.conf.in
@@ -0,0 +1,37 @@
+<VirtualHost *:${reverse_proxy:port}>
+ServerAdmin kiorky@localhost
+DocumentRoot ${buildout:directory}
+ServerName ${reverse_proxy:host}
+ServerAlias bis.localhost.com.bis
+ServerAlias ter.localhost.com
+ErrorLog ${buildout:directory}/var/log/apache/${reverse_proxy:host}_log
+TransferLog ${buildout:directory}/var/log/apache/${reverse_proxy:host}-access_log
+CustomLog ${buildout:directory}/var/log/apache/${reverse_proxy:host}-access_log combined
+DirectoryIndex index.html index.htm
+<Directory "${buildout:directory}">
+ Options ExecCGI IncludesNOEXEC FollowSymLinks -Indexes
+ AllowOverride All
+ Order allow,deny
+ Allow from all
+</Directory>
+ProxyRequests off
+<Proxy *>
+ Order allow,deny
+ Allow from all
+</Proxy>
+RewriteEngine on
+RequestHeader add X-Vhm-Host ${reverse_proxy:scheme}://${reverse_proxy:host}:${reverse_proxy:port}
+
+# application mounted on / does not needs _vh_
+# supervisor
+ProxyPass /supervisor/ http://${hosts:supervisor}:${ports:supervisor}/
+ProxyPassReverse /supervisor/ http://${hosts:supervisor}:${ports:supervisor}/
+
+# /-> vhmonster proxyreverse because of redirects !
+ProxyPass / http://${hosts:front}:${ports:front}/
+ProxyPassReverse / http://${hosts:front}:${ports:front}/
+
+#RewriteLog "${buildout:directory}/var/log/apache/rewrite.log"
+#RewriteLogLevel 3
+# vim: set ft=xml:
+</VirtualHost>
View
27 etc/templates/backup_pgsql.sh.in
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+REPOSITORY="${dumps_path}"
+DATE="$(date "+%F")"
+pgdumpall_args="${pgdumpall_args}"
+pgdump_args="${pgdump_args}"
+envf="${buildout:directory}/sys/share/minitage/minitage.env"
+kl="${backup_pgsqlkeep:output}"
+if [[ -f "$envf" ]];then source "$envf";fi
+if [[ ! -d "$REPOSITORY" ]];then mkdir -p "$REPOSITORY";fi
+if [[ "${full}" == "y" ]];then
+ allfilep="$REPOSITORY/FULLS"
+ allfile="$allfilep/$DATE-fulldump.sql"
+ if [[ ! -d "$allfilep" ]];then mkdir -p "$allfilep";fi
+ pg_dumpall $pgdumpall_args -U "${user}" -p "${port}" -h "${host}">"$allfile"
+ tar cjf "$allfile.tbz2" "$allfile"
+ rm -f "$allfile"
+ "$kl" "$allfilep"
+fi
+for db in ${databases};do
+ dfilep="$REPOSITORY/$db"
+ dfile="$dfilep/$DATE-$db.sql"
+ if [[ ! -d "$dfilep" ]];then mkdir -p "$dfilep";fi
+ pg_dump $pgdump_args -U "${user}" -p "${port}" -h "${host}" "$db">"$dfile"
+ tar cjf "$dfile.tbz2" "$dfile"
+ rm -f "$dfile"
+ "$kl" "$dfilep"
+done
View
21 etc/templates/keeplastbackups.sh.in
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+FPATH="${backuppath}"
+NB_TO_KEEP="${to_keep}"
+files=$(find $FPATH -type f)
+to_keep=$( ls -t1 $files |head -n$NB_TO_KEEP)
+to_delete=""
+for f in $files;do
+ keep=""
+ for g in $to_keep;do
+ if [[ "$f" == "$g" ]];then
+ keep="a"
+ fi
+ done
+ if [[ -z $keep ]];then
+ to_delete="$to_delete $f"
+ fi
+done
+if [[ -n $to_delete ]];then
+ echo rm -rf $to_delete
+ rm -rf $to_delete
+fi
View
40 etc/templates/logrotate.conf.template
@@ -0,0 +1,40 @@
+rotate ${settings:to_keep}
+weekly
+create
+compress
+delaycompress
+${buildout:directory}/var/log/instance*.log {
+ compress
+ rotate ${settings:to_keep}
+ daily
+ notifempty
+ size 10M
+ sharedscripts
+ missingok
+ copytruncate
+ postrotate
+ ${buildout:directory}/bin/supervisorctl restart all
+ endscript
+}
+${buildout:directory}/var/log/supervisor*.log {
+ compress
+ rotate ${settings:to_keep}
+ daily
+ notifempty
+ size 10M
+ sharedscripts
+ missingok
+ copytruncate
+}
+
+${buildout:directory}/var/log/apache/*.log {
+ compress
+ rotate ${settings:to_keep}
+ daily
+ notifempty
+ size 10M
+ sharedscripts
+ missingok
+ copytruncate
+}
+
View
74 etc/templates/supervisor.initd
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+# RedHat startup script for a supervisor instance
+# chkconfig: - 90 15
+# description: supervisor init script
+
+### BEGIN INIT INFO
+# Provides: convertit
+# Required-Start: $syslog $network $time
+# Required-Stop: $syslog $network
+# Should-Start:
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: convertit
+# Description: convertit
+### END INIT INFO
+
+
+EFFECTIVE_USER="${users:pyramid}"
+INSTANCE_PATH="${buildout:directory}"
+INSTANCE_NAME="$(basename ${buildout:directory})"
+supervisorctl="${buildout:directory}/bin/supervisorctl"
+supervisord="${buildout:directory}/bin/supervisord"
+name="supervisord_$INSTANCE_NAME"
+lock="${buildout:directory}/var/$name "
+
+[ -f $supervisord ] || exit 1
+[ -f $supervisorctl ] || exit 1
+envf="${buildout:directory}/sys/share/minitage/minitage.env"
+
+
+RETVAL=0
+start() {
+ echo -n "Starting $name: "
+ if [[ `whoami` == root ]];then
+ su $EFFECTIVE_USER -c "if [ -f "$envf" ];then source $envf;fi;$supervisord"
+ else
+ if [ -f "$envf" ];then source $envf;fi;"$supervisord"
+ fi
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch $lock
+ chown $EFFECTIVE_USER $lock
+ echo
+ return $RETVAL
+}
+stop() {
+ echo -n "Stopping $name: "
+ if [[ `whoami` == root ]];then
+ su $EFFECTIVE_USER -c "$supervisorctl shutdown"
+ else
+ $supervisorctl shutdown
+ fi
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f $lock
+ echo
+ return $RETVAL
+}
+case "$1" in
+ start)
+ start
+ ;;
+
+ stop)
+ stop
+ ;;
+
+ restart)
+ stop
+ sleep 2
+ start
+ ;;
+esac
+exit $REVAL
+# vim:set ft=sh:
View
146 etc/templates/wsgi/paster.ini.in
@@ -0,0 +1,146 @@
+# WSGI CONFIGURATION FILE
+[DEFAULT]
+debug=${instance:debug}
+
+[composite:main]
+use=egg:Paste#urlmap
+/media/=pmedia
+/=pmain
+/threads/=watch_threads
+
+[pipeline:pmain]
+pipeline= fvhm exc translogger projectapp
+
+[pipeline:pmedia]
+pipeline= fvhm translogger exc staticapp
+
+[app:watch_threads]
+use=egg:Paste#watch_threads
+
+[filter:fvhm]
+use = egg:repoze.vhm#vhm_xheaders
+
+[filter:translogger]
+use=egg:Paste#translogger
+setup_console_handler = False
+logger_name = wsgi
+
+[filter:debug]
+use=egg:Paste#printdebug
+
+[filter:exc]
+use=egg:WebError#evalerror
+
+[app:projectapp]
+use=egg:${instance:ep}
+zcmls=
+# indicate here full path to zcmls or
+# relative path inside your egg
+pyramid.includes=
+
+# various addons pre configurations
+pyramid.default_locale_name = en
+mako.directories=${instance:egg}:templates
+pyramid.debug_all=${instance:debug}
+#pyramid.debug_authorization=${instance:debug}
+#pyramid.debug_routematch=${instance:debug}
+#pyramid.debug_templates=${instance:debug}
+pyramid.reload_all=${instance:debug}
+#pyramid.reload_assets=${instance:debug}
+#pyramid.reload_resources=${instance:debug}
+#pyramid.reload_templates=${instance:debug}
+pyramid.includes =
+ pyramid_debugtoolbar
+
+#debug toolbar
+debugtoolbar.intercept_exc=${instance:intercept_exc_debug}
+debugtoolbar.eval_exc=${instance:debug}
+debugtoolbar.enabled=${instance:debug}
+
+# oroject settings
+download_dir = ${buildout:directory}/src/convertit/download_dir
+download_max_age = 60
+converted_dir = ${buildout:directory}/src/convertit/static/converted
+# The retrieve url of converted files
+# It can be a full url like http://static.domain.tld/full/path/
+converted_url = converted
+converted_max_age = 60
+
+[app:staticapp]
+use = egg:Paste#pkg_resources
+egg=${instance:egg}
+resource_name=static/
+
+[loggers]
+keys = root,wsgi,routes
+
+[handlers]
+keys = fconsole,console,accesslog,errorlog
+
+[formatters]
+keys = generic,accesslog
+
+# Send warnings that are not caught by other loggers to the console
+[logger_root]
+level = NOTSET
+handlers = console,fconsole
+
+# Send all messages to the 'wsgi' logger to the accesslog and errorlog handlers
+[logger_wsgi]
+level = NOTSET
+handlers = accesslog,errorlog,console,fconsole
+qualname = wsgi
+propagate = 0
+
+# Routes (the URL dispatcher) sends debug information to the 'routes.middleware' logger
+# with DEBUG level.
+[logger_routes]
+level = NOTSET
+handlers = console,fconsole
+qualname = routes.middleware
+propagate = 0
+
+# Handler for printing messages to the console
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = INFO
+formatter = generic
+
+# Handler for writing access.log style log lines to an "access.log" file
+[handler_fconsole]
+class = FileHandler
+args = ('${buildout:directory}/var/log/${name}.console.log','a')
+level = INFO
+formatter = generic
+
+
+# Handler for writing access.log style log lines to an "access.log" file
+[handler_accesslog]
+class = FileHandler
+args = ('${buildout:directory}/var/log/${name}.access.log','a')
+level = INFO
+formatter = accesslog
+
+# Handler for writing error messages to an "error.log" file
+[handler_errorlog]
+class = FileHandler
+args = ('${buildout:directory}/var/log/${name}.error.log','a')
+level = WARNING
+formatter = generic
+
+# A generic formatter that prints the time, the logger's name, the level and the message
+[formatter_generic]
+format = %(asctime)s %(name)s[%(levelname)s] %(message)s
+
+# A trivial formatter that just passes-through the log message.
+# Translogger already creates Apache-style log messages. No need to change that.
+[formatter_accesslog]
+format = %(message)s
+
+[server:main]
+use=${server}
+host=${host}
+port=${port}
+
+# vim:set et ts=4 sts=4 ft=cfg:
View
3 local.cfg.in
@@ -0,0 +1,3 @@
+[buildout]
+[users]
+pyramid=ubuntu
View
44 production.ini
@@ -1,44 +0,0 @@
-[app:main]
-use = egg:convertit
-
-pyramid.reload_templates = false
-pyramid.debug_authorization = false
-pyramid.debug_notfound = false
-pyramid.debug_routematch = false
-pyramid.default_locale_name = en
-
-[server:main]
-use = egg:waitress#main
-host = 0.0.0.0
-port = 6543
-
-# Begin logging configuration
-
-[loggers]
-keys = root, convertit
-
-[handlers]
-keys = console
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = WARN
-handlers = console
-
-[logger_convertit]
-level = WARN
-handlers =
-qualname = convertit
-
-[handler_console]
-class = StreamHandler
-args = (sys.stderr,)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
-
-# End logging configuration

0 comments on commit 03fae7d

Please sign in to comment.