Commits

Davi Lima  committed 5ecd5b5

Commit inicial

  • Participants

Comments (0)

Files changed (10)

+=======================
+Using a custom buildout
+=======================
+
+Note: If you are using Windows, if you do not have PIL installed, or you are
+not using Python 2.4 as your main system Python, please see the relevant
+sections below.
+
+You probably got here by running something like:
+
+ $ paster create -t plone3_buildout
+
+Now, you need to run:
+
+ $ python bootstrap.py
+
+This will install zc.buildout for you.
+
+To create an instance immediately, run:
+
+ $ bin/buildout
+
+This will download Plone's eggs and products for you, as well as other
+dependencies, create a new Zope 2 installation (unless you specified
+an existing one when you ran "paster create"), and create a new Zope instance
+configured with these products.
+
+You can start your Zope instance by running:
+
+ $ bin/instance start
+
+or, to run in foreground mode:
+
+ $ bin/instance fg
+
+To run unit tests, you can use:
+
+ $ bin/instance test -s my.package
+
+Installing PIL
+--------------
+
+To use Plone, you need PIL, the Python Imaging Library. If you don't already
+have this, download and install it from http://www.pythonware.com/products/pil.
+
+Using a different Python installation
+--------------------------------------
+
+Buildout will use your system Python installation by default. However, Zope
+2.10 (and by extension, Plone) will only work with Python 2.4. You can verify
+which version of Python you have, by running:
+
+ $ python -V
+
+If that is not a 2.4 version, you need to install Python 2.4 from
+http://python.org. If you wish to keep another version as your main system
+Python, edit buildout.cfg and add an 'executable' option to the "[buildout]"
+section, pointing to a python interpreter binary:
+
+ [buildout]
+ ...
+ executable = /path/to/python
+
+Working with buildout.cfg
+-------------------------
+
+You can change any option in buildout.cfg and re-run bin/buildout to reflect
+the changes. This may delete things inside the 'parts' directory, but should
+keep your Data.fs and source files intact.
+
+To save time, you can run buildout in "offline" (-o) and non-updating (-N)
+mode, which will prevent it from downloading things and checking for new
+versions online:
+
+ $ bin/buildout -Nov
+
+Creating new eggs
+-----------------
+
+New packages you are working on (but which are not yet released as eggs and
+uploaded to the Python Package Index, aka PYPI) should be placed in src. You can do:
+
+ $ cd src/
+ $ paster create -t plone my.package
+
+Use "paster create --list-templates" to see all available templates. Answer
+the questions and you will get a new egg. Then tell buildout about your egg
+by editing buildout.cfg and adding your source directory to 'develop':
+
+ [buildout]
+ ...
+ develop =
+    src/my.package
+
+You can list multiple packages here, separated by whitespace or indented
+newlines.
+
+You probably also want the Zope instance to know about the package. Add its
+package name to the list of eggs in the "[instance]" section, or under the
+main "[buildout]" section:
+
+ [instance]
+ ...
+ eggs =
+    ${buildout:eggs}
+    ${plone:eggs}
+    my.package
+
+Leave the ${buildout:eggs} part in place - it tells the instance to use the
+eggs that buildout will have downloaded from the Python Package Index
+previously.
+
+If you also require a ZCML slug for your package, buildout can create one
+automatically. Just add the package to the 'zcml' option:
+
+ [instance]
+ ...
+ zcml =
+    my.package
+
+When you are finished, re-run buildout. Offline, non-updating mode should
+suffice:
+
+ $ bin/buildout -Nov
+
+Developing old-style products
+-----------------------------
+
+If you are developing old-style Zope 2 products (not eggs) then you can do so
+by placing the product code in the top-level 'products' directory. This is
+analogous to the 'Products/' directory inside a normal Zope 2 instance and is
+scanned on start-up for new products.
+
+Depending on a new egg
+----------------------
+
+If you want to use a new egg that is in the Python Package Index, all you need
+to do is to add it to the "eggs" option under the main "[buildout]" section:
+
+ [buildout]
+ ...
+ eggs =
+    my.package
+
+If it's listed somewhere else than the Python Package Index, you can add a link
+telling buildout where to find it in the 'find-links' option:
+
+ [buildout]
+ ...
+ find-links =
+    http://dist.plone.org
+    http://download.zope.org/distribution/
+    http://effbot.org/downloads
+    http://some.host.com/packages
+
+Using existing old-style products
+---------------------------------
+
+If you are using an old-style (non-egg) product, you can either add it as an
+automatically downloaded archive or put it in the top-level "products" folder.
+The former is probably better, because it means you can redistribute your
+buildout.cfg more easily:
+
+ [productdistros]
+ recipe = plone.recipe.distros
+ urls =
+    http://plone.org/products/someproduct/releases/1.3/someproduct-1.3.tar.gz
+
+If someproduct-1.3.tar.gz extracts into several products inside a top-level
+directory, e.g. SomeProduct-1.3/PartOne and SomeProduct-1.3/PartTwo, then
+add it as a "nested package":
+
+ [productdistros]
+ recipe = plone.recipe.distros
+ urls =
+    http://plone.org/products/someproduct/releases/1.3/someproduct-1.3.tar.gz
+ nested-packages =
+    someproduct-1.3.tar.gz
+
+Alternatively, if it extracts to a directory which contains the version
+number, add it as a "version suffix package":
+
+ [productdistros]
+ recipe = plone.recipe.distros
+ urls =
+    http://plone.org/products/someproduct/releases/1.3/someproduct-1.3.tar.gz
+ version-suffix-packages =
+    someproduct-1.3.tar.gz
+
+You can also track products by adding a new bundle checkout part. It
+doesn't strictly have to be an svn bundle at all, any svn location will do,
+and cvs is also supported:
+
+ [buildout]
+ ...
+ parts =
+    plone
+    zope2
+    productdistros
+    myproduct
+    instance
+    zopepy
+
+Note that "myproduct" comes before the "instance" part. You then
+need to add a new section to buildout.cfg:
+
+ [myproduct]
+ recipe = plone.recipe.bundlecheckout
+ url = http://svn.plone.org/svn/collective/myproduct/trunk
+
+Finally, you need to tell Zope to find this new checkout and add it to its
+list of directories that are scanned for products:
+
+ [instance]
+ ...
+ products =
+    ${buildout:directory}/products
+    ${productdistros:location}
+    ${plonebundle:location}
+    ${myproduct:location}
+
+Without this last step, the "myproduct" part is simply managing an svn
+checkout and could potentially be used for something else instead.
+
+=============
+Using Windows
+=============
+
+To use buildout on Windows, you will need to install a few dependencies which
+other platforms manage on their own.
+
+Here are the steps you need to follow (thanks to Hanno Schlichting for these):
+
+Python (http://python.org)
+--------------------------
+
+  - Download and install Python 2.4.4 using the Windows installer from
+    http://www.python.org/ftp/python/2.4.4/python-2.4.4.msi
+    Select 'Install for all users' and it will put Python into the
+    "C:\Python24" folder by default.
+
+  - You also want the pywin32 extensions available from
+    http://downloads.sourceforge.net/pywin32/pywin32-210.win32-py2.4.exe?modtime=1159009237&big_mirror=0
+
+  - And as a last step you want to download the Python imaging library available
+    from http://effbot.org/downloads/PIL-1.1.6.win32-py2.4.exe
+
+  - If you develop Zope based applications you will usually only need Python 2.4
+    at the moment, so it's easiest to put the Python binary on the systems PATH,
+    so you don't need to specify its location manually each time you call it.
+
+    Thus, put "C:\Python24" and "C:\Python24\Scripts" onto the PATH. You can
+    find the PATH definition in the control panel under system preferences on
+    the advanced tab at the bottom. The button is called environment variables.
+    You want to add it at the end of the already existing PATH in the system
+    section. Paths are separated by a semicolons.
+
+  - You can test if this was successful by opening a new shell (cmd) and type
+    in 'python -V'. It should report version 2.4.4 (or whichever version you
+    installed).
+
+    Opening a new shell can be done quickly by using the key combination
+    'Windows-r' or if you are using Parallels on a Mac 'Apple-r'. Type in 'cmd'
+    into the popup box that opens up and hit enter.
+
+
+Subversion (http://subversion.tigris.org)
+-----------------------------------------
+
+  - Download the nice installer from
+    http://subversion.tigris.org/files/documents/15/35379/svn-1.4.2-setup.exe
+
+  - Run the installer. It defaults to installing into
+    "C:\Program Files\Subversion".
+
+  - Now put the install locations bin subfolder (for example
+    "C:\Program Files\Subversion\bin") on your system PATH in the same way you
+    put Python on it.
+
+  - Open a new shell again and type in: 'svn --version' it should report
+    version 1.4.2 or newer.
+
+
+MinGW (http://www.mingw.org/)
+-----------------------------
+
+  This is a native port of the gcc compiler and its dependencies for Windows.
+  There are other approaches enabling you to compile Python C extensions on
+  Windows including Cygwin and using the official Microsoft C compiler, but this
+  is a lightweight approach that uses only freely available tools. As
+  it's used by a lot of people chances are high it will work for you and there's
+  plenty of documentation out there to help you in troubleshooting problems.
+
+  - Download the MinGW installer from
+    http://downloads.sourceforge.net/mingw/MinGW-5.1.3.exe?modtime=1168794334&big_mirror=1
+
+  - The installer will ask you which options you would like to install. Choose
+    base and make here. It will install into "C:\MinGW" by default. The install
+    might take some time as it's getting files from sourceforge.net and you
+    might need to hit 'retry' a couple of times.
+
+  - Now put the install location's bin subfolder (for example "C:\MinGW\bin") on
+    your system PATH in the same way you put Python on it.
+
+  - Test this again by typing in: 'gcc --version' on a newly opened shell and
+    it should report version 3.4.2 or newer.
+
+
+Configure Distutils to use MinGW
+--------------------------------
+
+  Some general information are available from
+  http://www.mingw.org/MinGWiki/index.php/Python%20extensions for example but
+  you don't need to read them all.
+
+  - Create a file called 'distutils.cfg' in "C:\Python24\Lib\distutils". Open it
+    with a text editor ('notepad distutils.cfg') and fill in the following lines:
+
+    [build]
+    compiler=mingw32
+
+    This will tell distutils to use MinGW as the default compiler, so you don't
+    need to specify it manually using "--compiler=mingw32" while calling a
+    package's setup.py with a command that involves building C extensions. This
+    is extremely useful if the build command is written down in a buildout
+    recipe where you cannot change the options without hacking the recipe
+    itself. The z2c.recipe.zope2install used in ploneout is one such example.
+[buildout]
+parts =
+    instance
+    zopepy
+
+unzip = true
+
+# Change the number here to change the version of Plone being used
+extends =
+    http://good-py.appspot.com/release/plone.app.theming/1.0b1?plone=4.1b2
+versions = versions
+
+find-links =
+    https://simplesnet.com.br/pacotes/catalogo/simple
+    http://dist.plone.org/thirdparty
+
+eggs =
+    Plone
+    ploneorgbr.portal.policy
+
+develop =
+
+zcml =
+
+[versions]
+
+[instance]
+recipe = plone.recipe.zope2instance
+user = admin:admin
+effective-user = ${users:zope}
+http-address = 8080
+#debug-mode = on
+#verbose-security = on
+blob-storage = var/blobstorage
+environment-vars =
+    PYTHON_EGG_CACHE ${buildout:directory}/var/.python-eggs
+    zope_i18n_compile_mo_files true
+    PTS_LANGUAGES en, pt-br, es
+eggs =
+    Zope2
+    ${buildout:eggs}
+
+# If you want to register ZCML slugs for any packages, list them here.
+# e.g. zcml = my.package my.other.package
+zcml =
+    ${buildout:zcml}
+products =
+    ${buildout:directory}/products
+
+[supervisor-settings]
+user = admin
+password = 4dm1n${users:zope}
+
+[hosts]
+supervisor = 0.0.0.0
+instance = 0.0.0.0
+zeoserver = 127.0.0.1
+
+[ports]
+instance = 8080
+instance1 = 8081
+instance2 = 8082
+zeoserver = 8100
+supervisor = 9001
+
+[users]
+zope = plone
+os = plone
+
+[zopepy]
+recipe = zc.recipe.egg
+eggs = ${instance:eggs}
+interpreter = zopepy
+scripts = zopepy
+
+[i18ndude]
+unzip = true
+recipe = zc.recipe.egg
+eggs = i18ndude
+
+[test]
+recipe = zc.recipe.testrunner
+defaults = ['--auto-color', '--auto-progress']
+eggs =
+    ${instance:eggs}
+
+[zopeskel]
+unzip = true
+recipe = zc.recipe.egg
+eggs =
+    ZopeSkel
+    ${instance:eggs}

File bootstrap.py

+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+"""
+
+import os, shutil, sys, tempfile, urllib2
+from optparse import OptionParser
+
+tmpeggs = tempfile.mkdtemp()
+
+is_jython = sys.platform.startswith('java')
+
+# parsing arguments
+parser = OptionParser()
+parser.add_option("-v", "--version", dest="version",
+                          help="use a specific zc.buildout version")
+parser.add_option("-d", "--distribute",
+                   action="store_true", dest="distribute", default=False,
+                   help="Use Disribute rather than Setuptools.")
+
+parser.add_option("-c", None, action="store", dest="config_file",
+                   help=("Specify the path to the buildout configuration "
+                         "file to be used."))
+
+options, args = parser.parse_args()
+
+# if -c was provided, we push it back into args for buildout' main function
+if options.config_file is not None:
+    args += ['-c', options.config_file]
+
+if options.version is not None:
+    VERSION = '==%s' % options.version
+else:
+    VERSION = ''
+
+# We decided to always use distribute, make sure this is the default for us
+# USE_DISTRIBUTE = options.distribute
+USE_DISTRIBUTE = True
+args = args + ['bootstrap']
+
+to_reload = False
+try:
+    import pkg_resources
+    if not hasattr(pkg_resources, '_distribute'):
+        to_reload = True
+        raise ImportError
+except ImportError:
+    ez = {}
+    if USE_DISTRIBUTE:
+        exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
+                         ).read() in ez
+        ez['use_setuptools'](to_dir=tmpeggs, download_delay=0, no_fake=True)
+    else:
+        exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                             ).read() in ez
+        ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+    if to_reload:
+        reload(pkg_resources)
+    else:
+        import pkg_resources
+
+if sys.platform == 'win32':
+    def quote(c):
+        if ' ' in c:
+            return '"%s"' % c # work around spawn lamosity on windows
+        else:
+            return c
+else:
+    def quote (c):
+        return c
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+ws  = pkg_resources.working_set
+
+if USE_DISTRIBUTE:
+    requirement = 'distribute'
+else:
+    requirement = 'setuptools'
+
+if is_jython:
+    import subprocess
+
+    assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
+           quote(tmpeggs), 'zc.buildout' + VERSION],
+           env=dict(os.environ,
+               PYTHONPATH=
+               ws.find(pkg_resources.Requirement.parse(requirement)).location
+               ),
+           ).wait() == 0
+
+else:
+    assert os.spawnle(
+        os.P_WAIT, sys.executable, quote (sys.executable),
+        '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout' + VERSION,
+        dict(os.environ,
+            PYTHONPATH=
+            ws.find(pkg_resources.Requirement.parse(requirement)).location
+            ),
+        ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout' + VERSION)
+import zc.buildout.buildout
+zc.buildout.buildout.main(args)
+shutil.rmtree(tmpeggs)

File desenvolvimento.cfg

+[buildout]
+extends =
+    base.cfg
+    sources.cfg
+
+parts +=
+    omelette
+#    ptprofiler
+#    zopeprofiler
+#    zptdebugger
+#    deadlockdebugger
+#    roadrunner
+
+extensions +=
+    mr.developer
+
+sources = sources
+
+auto-checkout =
+    *
+
+develop =
+
+eggs +=
+    Products.DocFinderTab
+    Products.PDBDebugMode
+#    Products.PrintingMailHost
+#    Products.Clouseau
+#    Products.Gloworm
+#    Products.DCWorkflowGraph
+    plone.reload
+#    uwosh.northstar
+#    threadframe
+
+zcml +=
+   plone.reload
+#   uwosh.northstar
+
+[roadrunner]
+recipe = roadrunner:plone
+zope2-instance = instance
+packages-under-test = my.package
+
+[ptprofiler]
+recipe = plone.recipe.bundlecheckout
+url = https://svn.infrae.com/PTProfiler/trunk
+subfolder = PTProfiler
+
+[zopeprofiler]
+recipe = plone.recipe.distros
+urls = http://www.dieter.handshake.de/pyprojects/zope/ZopeProfiler.tgz
+
+[zptdebugger]
+recipe = plone.recipe.bundlecheckout
+url = https://svn.plone.org/svn/collective/ZPTDebugger/trunk
+subfolder = ZPTDebugger
+
+[deadlockdebugger]
+recipe = plone.recipe.bundlecheckout
+url = http://svn.nuxeo.org/pub/Zope2/DeadlockDebugger/trunk
+subfolder = DeadlockDebugger
+
+[instance]
+port-base = 0
+debug-mode = on
+verbose-security = on
+event-log-level = DEBUG
+zope-conf-additional =
+    http-realm Desenv
+
+[omelette]
+recipe = collective.recipe.omelette
+eggs = ${buildout:eggs}
+products = ${instance:products}

File etc/logrotate.conf.tmpl

+rotate 4
+weekly
+create
+compress
+delaycompress
+
+\${buildout:directory}/var/log/zeo.log {
+    postrotate
+        \${buildout:bin-directory}/zeo logreopen
+    endscript
+}
+
+\${buildout:directory}/var/log/instance.log ${buildout:directory}/var/log/instance-Z2.log {
+    sharedscripts
+    postrotate
+        /bin/kill -USR2 \$(cat ${buildout:directory}/var/instance.pid)
+    endscript
+}
+
+\${buildout:directory}/var/log/instance1.log ${buildout:directory}/var/log/instance1-Z2.log {
+    sharedscripts
+    postrotate
+        /bin/kill -USR2 \$(cat ${buildout:directory}/var/instance1.pid)
+    endscript
+}
+
+\${buildout:directory}/var/log/instance2.log ${buildout:directory}/var/log/instance2-Z2.log {
+    sharedscripts
+    postrotate
+        /bin/kill -USR2 \$(cat ${buildout:directory}/var/instance2.pid)
+    endscript
+}

File homologa.cfg

+[buildout]
+extends =
+    base.cfg
+    sources.cfg
+
+parts += 
+
+extensions +=
+    mr.developer
+
+sources = sources
+
+auto-checkout = 
+        * 
+
+develop =
+
+eggs +=
+
+zcml +=
+
+[instance]
+port-base = 0
+debug-mode = on
+verbose-security = on

File producao.cfg

+[buildout]
+
+extends =
+    versions.cfg
+    base.cfg
+
+extensions -=
+    buildout.dumppickedversions
+
+parts +=
+    zhw
+    instance1
+    instance2
+    zeo
+    backup
+    backup-diario
+    backup-semanal
+    logrotate
+    logrotate-diario
+    supervisor
+
+overwrite-picked-versions-file = true
+
+develop =
+
+eggs +=
+
+zcml +=
+
+[zhw]
+recipe = zc.recipe.egg
+eggs = ZopeHealthWatcher
+scripts = zope_health_watcher
+
+[instance]
+http-address = ${hosts:instance}:${ports:instance}
+port-base = 1
+zodb-cache-size = 55000
+#zeo-client-cache-size = 100MB
+debug-mode = off
+#zserver-threads = 2
+zeo-client = true
+zeo-address = ${zeoserver:zeo-address}
+blob-storage = ${zeoserver:blob-storage}
+effective-user = ${users:os}
+zope-conf-additional +=
+      python-check-interval 1200
+
+[instance1]
+recipe = collective.recipe.zope2cluster
+instance-clone = instance
+http-address = ${hosts:instance}:${ports:instance1}
+
+[instance2]
+recipe = collective.recipe.zope2cluster
+instance-clone = instance
+http-address = ${hosts:instance}:${ports:instance2}
+
+[supervisor]
+recipe = collective.recipe.supervisor
+plugins =
+       supervisor>2.1
+       superlance
+port = ${ports:supervisor}
+user = ${supervisor-settings:user}
+password = ${supervisor-settings:password}
+serverurl = http://${hosts:supervisor}:${ports:supervisor}
+programs =
+    10 zeo        (autostart=true  startsecs=10)  ${zeoserver:location}/bin/runzeo                   true  ${users:zope}
+    20 instance1  (autostart=true  startsecs=30)  ${buildout:directory}/parts/instance1/bin/runzope  true  ${users:zope}
+    20 instance2  (autostart=true  startsecs=30)  ${buildout:directory}/parts/instance2/bin/runzope  true  ${users:zope}
+
+eventlisteners =
+    Memmon        TICK_60   ${buildout:directory}/bin/memmon [-p instance1=400MB -p instance2=400MB -m suporte@tangrama.com.br]
+#    HttpOk        TICK_60   ${buildout:directory}/bin/httpok [-p instance1 -t 20 http://${hosts:instance}:${ports:instance2}]
+#    CrashMail     TICK_60   ${buildout:directory}/bin/crashmail [-p in  stance1 -p instance2 -m suporte@tangrama.com.br]
+
+logfile = ${buildout:directory}/var/log/supervisord.log
+logfile_maxbytes = 5MB
+logfile_backups = 10
+loglevel = info
+pidfile = ${buildout:directory}/var/supervisord.pid
+nodaemon = false
+
+[zeo]
+recipe = plone.recipe.zope2zeoserver
+zope2-location = ${zope2:location}
+zeo-address = ${hosts:zeoserver}:${ports:zeoserver}
+blob-storage = ${zeo:zeo-var}/blobstorage
+eggs = plone.app.blob
+
+[backup]
+recipe = collective.recipe.backup
+
+[backup-diario]
+recipe = z3c.recipe.usercrontab
+times = 0 3 * * 0-6
+command = ${buildout:directory}/bin/backup
+
+[backup-semanal]
+recipe = z3c.recipe.usercrontab
+times = 0 3 * * 7
+command = ${buildout:directory}/bin/zeopack -p 8000 -d 1 && ${buildout:directory}/bin/backup
+
+[logrotate]
+recipe = collective.recipe.template
+input = etc/logrotate.conf.tmpl
+output = etc/logrotate.conf
+
+[logrotate-diario]
+recipe = z3c.recipe.usercrontab
+times = 0 6 * * *
+command = /usr/sbin/logrotate --state ${buildout:directory}/var/logrotate.status ${buildout:directory}/${logrotate:output}

File products/README.txt

+Old-style Zope products you are developing can be added here
+[sources]
+ploneorgbr.portal.policy = hg https://bitbucket.org/ploneorgbr/ploneorgbr.portal.policy

File var/README.txt

+This directory contains the Data.fs ZODB data storage, and other runtime files