Monday, December 29, 2008

Plone deployment using buildout

Prerequisites
* python2.4
* python-devel
* python-imaging - Python Imaging Library
* python-setuptools - setuptools

Under Ubuntu use:
$ sudo apt-get install python2.4 build-essential python2.4-dev python-imaging python-setuptools

Under openSUSE use:
$ sudo zypper in python-2.4 python-2.4-devel python-2.4-imaging python-2.4-xml

If you're using Linux and your distribution doesn't provide a package for setuptools, download ez_setup.py and run it with:
$ python2.4 ez_setup.py

Note: I got error here saying that directory structure doesn't exists. In that case just create it with mkdir command and try again:
mkdir -p /usr/local/lib64/python2.4/site-packages

This will download and install setuptools and the easy_install script. Watch the console output to understand where easy_install is installed. If this is not in your system PATH, you should add this directory to the path as well by adding following to lines to the end of $HOME/.bash_profile for one user, /etc/profile for all users except root, and /root/.bash_profile for root user.
PATH=$PATH:/path/to/easy_install
export PATH

Installation
$ sudo easy_install-2.4 -U ZopeSkel
$ cd /home/'your_username'
$ paster create --list-templates
$ paster create -t plone3_buildout myPloneProject
-----------------------------------------------------------------------------------
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) ['']: passwd
Enter http_port (HTTP port) [8080]:
Enter debug_mode (Should debug mode be "on" or "off"?) ['off']: on
Enter verbose_security (Should verbose security be "on" or "off"?) ['off']: on
-----------------------------------------------------------------------------------

Enter directory with created template:
$ cd myPloneProject

Create base directory structure, including scripts and latest version of the zc.buildout egg, for created template:
$ python2.4 bootstrap.py

Next step is time-consuming so after typing next command go for coffee. If you have some download running in background, stop it before doing online build with:
$ ./bin/buildout -v

This reads the generated buildout.cfg file and executes its various "parts", setting up Zope, creating a Zope instance, downloading and installing Plone.

You will need to run ./bin/buildout again each time you change buildout.cfg. If you do not want buildout to go online and look for updated versions of eggs or download other archives, you can run it in non-updating, offline mode, with using -o switch:
$ ./bin/buildout -o

Start your Zope instance in foreground so you can see debug info in console:
$ ./bin/instance fg

Start your Zope instance as background process in daemon mode:
$ ./bin/instance start

To run test use:
$ ./bin/instance test -s plone.portlets

Stop your instance with:
$ ./bin/instance stop

Resource:
http://plone.org/documentation/tutorial/buildout/tutorial-all-pages

No comments: