<< ALL BLOG POSTS

When the Plone installer isn't enough

Table of Contents

The Plone installer is possibly the easiest way to install plone. But when you're ready to take the next step, where do you turn?

Once you get to a certain point and want to really start doing "Plone" development work or a production deployment you will most likely want more flexibility than the standard installer you get from plone.org.

One of the easiest ways to achieve a development ready environment is by using ZopeSkel to get everything started. When we are done with this process we will have a buildout that is based on the latest best practices and is ready for us to add our products and add-ons into it.

 

Before you start, make sure you have the following installed

 

Mac OS X, Unix and Linux:
Python 2.4 (plus development libs)
Python Imaging Library (PIL)

If you are on windows, you are in luck because with this package we can make the experience the same as your *nix bretheren:
http://bit.ly/WindowsBuildout

This package will get windows setup with the needed tools and setup your %PATH% for the examples below to work.

All of the above now will need to get setuptools installed:
http://pypi.python.org/pypi/setuptools/

Pick the install that matches your environment and you're all set.

Here is the 10 minute getting started recipe.

If you don't have ZopeSkel installed you should install it now.

centaur% easy_install ZopeSkel

Or, if you do have it installed, you should make sure you have the latest version.

centaur% easy_install -U ZopeSkel
Searching for ZopeSkel
Reading http://pypi.python.org/simple/ZopeSkel/
Best match: ZopeSkel 2.11.1
Processing ZopeSkel-2.11.1-py2.4.egg
ZopeSkel 2.11.1 is already the active version in easy-install.pth

Using /Users/calvin/.virtualenvs/generic-plone/lib/python2.4/site-packages/ZopeSkel-2.11.1-py2.4.egg
Processing dependencies for ZopeSkel
Finished processing dependencies for ZopeSkel

Once you have the ZopeSkel it will take care of all the of boring boilerplate work that is typically where most of the mistakes are when getting started. In this case, we want a Plone 3 buildout that grabs the latest stable version of Plone.

centaur% paster create -t plone3_buildout mysite
Selected and implied templates:
  ZopeSkel#plone3_buildout  A buildout for Plone 3 projects

Variables:
  egg:      mysite
  package:  mysite
  project:  mysite
Enter plone_version (Which Plone version to install) ['3.2.1']: 
Enter zope2_install (Path to Zope 2 installation; leave blank to fetch one) ['']: 
Enter plone_products_install (Path to directory containing Plone products; leave blank to fetch one) ['']: 
Enter zope_user (Zope root admin user) ['admin']: 
Enter zope_password (Zope root admin password) ['']: admin
Enter http_port (HTTP port) [8080]: 
Enter debug_mode (Should debug mode be "on" or "off"?) ['off']: 
Enter verbose_security (Should verbose security be "on" or "off"?) ['off']: 
Creating template plone3_buildout
Creating directory ./mysite
  Copying README.txt to ./mysite/README.txt
  Copying bootstrap.py to ./mysite/bootstrap.py
  Copying buildout.cfg_tmpl to ./mysite/buildout.cfg
  Recursing into products
    Creating ./mysite/products/
    Copying README.txt to ./mysite/products/README.txt
  Recursing into src
    Creating ./mysite/src/
    Copying README.txt to ./mysite/src/README.txt
  Recursing into var
    Creating ./mysite/var/
    Copying README.txt to ./mysite/var/README.txt
-----------------------------------------------------------
Generation finished
You probably want to run python bootstrap.py and then edit
buildout.cfg before running bin/buildout -v

See README.txt for details
-----------------------------------------------------------

Now that you have the skeleton for the buildout you need to bootstrap it

centaur% cd mysite
centaur% python bootstrap.py
Creating directory '/Users/calvin/mysite/bin'.
Creating directory '/Users/calvin/mysite/parts'.
Creating directory '/Users/calvin/mysite/develop-eggs'.
Generated script '/Users/calvin/mysite/bin/buildout'.

and run the buildout (and get a coffee if this is the first time you have run this).

centaur% bin/buildout
Installing zope2.
Creating fake eggs
Installing productdistros.
Installing instance.
Generated script '/Users/calvin/mysite/bin/instance'.
Generated script '/Users/calvin/mysite/bin/repozo'.
Installing zopepy.
Generated interpreter '/Users/calvin/mysite/bin/zopepy'.

Your newly created Plone instance is ready to go!

centaur% bin/instance fg
/Users/calvin/mysite/parts/instance/bin/runzope -X debug-mode=on
2009-04-13 15:16:38 INFO ZServer HTTP server started at Mon Apr 13 15:16:38 2009
    Hostname: 0.0.0.0
    Port: 8080
/Users/calvin/.buildout/zope/Zope-2.10.6-final-py2.4/lib/python/zope/configuration/xmlconfig.py:323: DeprecationWarning: zope.app.annotation has moved to zope.annotation. Import of zope.app.annotation will become unsupported in Zope 3.5
  __import__(arguments[0])
2009-04-13 15:17:47 INFO Application New disk product detected, determining if we need to fix up any ZClasses.
2009-04-13 15:17:47 INFO Zope Ready to handle requests

Now you can go to the Zope Management Interface, login (http://localhost:8080/manage) and create your Plone Site instance. Now that you have a running Zope/Plone instance you can modify your buildout.cfg profile and add in third-party products or setup develop eggs for working on your own custom code for your Plone site.

The next step would be to create buildout profiles that extend one another and give you the flexibility to deploy to multiple environments such as a local.cfg, staging.cfg or a production.cfg. This will allow you to have repeatable deployments on each environment to achieve predictable results. It is even possible to "pin" or select the specific versions of all of the eggs involved so you are sure to get the same deployment every time you run bin\buildout.

Related Posts
How can we assist you?
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.