Plone with a clean development environment on Leopard

I still have a G5 PowerMac. It runs Mac OS X 10.5 Leopard. I know it’s old, but since replica cartier love bracelet it’s a PowerPC I can’t upgrade the MacOS. It’s still very relevant for doing Plone development, as Apple has a long history of installing old libraries anyway, so managing bracelet replica cartier that stuff cartier love bracelet ebay fake
is just part of life with Apple. Here’s how I set it up to do development for Plone in a clean way:

When you install Plone using the installers with default options you get a virtual environment. Changes you make to your buildout in there generally don’t affect your operating system. When you want to develop a Plone product or do core development, however, you’ll be working from a Subversion working copy, not a normally-installed Plone setup. The development environment instructions gets you set up with some nice tools, but there are a couple of additional steps you can do to keep your development environment nice and tidy.

Things you’ll need to have a sane development situation on OS X:

  • XCode Tools – Version 3.1.4 seems to be the last PPC-compatible version. It’s there, but you’ll need to register cartier bracelet of anastasia steele actress
    and dig for it. XCode 3.1.4 includes…
  • Subversion – version 1.4.4, [update: Plone now uses git] which seems to be just new enough to work. If you are reading this later
    on and 1.4.4 doesn’t work anymore, install a new version using…
  • Homebrew – or another package manager of some kind. I’ve used MacPorts, Fink, Gentoo Prefix, and now I’m on the PowerPC branch of Homebrew. I got this idea from David Glick. However, I almost gave up when complications arose from removing MacPorts. I’m sure you can adapt these instructions to whatever package manager you want. I like Homebrew because it doesn’t duplicate what the OS provides, such as…
  • Python – but Plone doesn’t work with Python 2.5, so you’ll need to install Python manually, because Homebrew doesn’t duplicate what the OS provides. You’ll want Python 2.6 for Plone 4 and Python 2.4 for Plone 3. For 2.4 you’ll want to compile it with a special MACOSX_DEPLOYMENT_TARGET=10.5 flag. Whatever Python you have, you’ll want…
  • PIP – You can get by with easy_install, but despite OS X having surprisingly good segregation for site-packages, who wants to live without uninstall? Just easy_install pip, and never use easy_install again. Then use pip to install…
  • virtualenv – Creates silos in which to put Plone setups so they don’t contaminate your system and your system doesn’t contaminate your Plone. You can pip install this with the system Python and point it to a specific Python version later, when you use it.

How to set up a virtualized Plone development environment:

Set up a virtual environment.
$ virtualenv -v -p /usr/local/bin/python2.6 --no-site-packages --distribute ./py26env
Check out the Plone development buildout.
$ svn co  https://svn.plone.org/svn/plone/buildouts/plone-coredev/branches/4.1/ ./plone41devel

[Update: Plone now uses git.]

Change directories into your working copy.
$ cd ./plone41devel
Invoke bootstrap.py with the virtualenv’s python.
$ ../py26env/bin/python bootstrap.py && bin/buildout

Set up a local buildout configuration

The buildout configuration files for Plone are in Subversion. If you are a core developer and make a change you run the risk of accidentally committing that change to the core. A file named ‘local.cfg’ should be in svn:ignore, which means you can create it and edit it to your heart’s content without worrying replica cartier about it getting caught up in your feverish fixing. It needs to hook back into the real buildout.cfg though, so it should look something like this:

[buildout]
extends =
	buildout.cfg

Then you just run bin/buildout -c local.cfg and after that you can use bin/develop rb.

Fixing PIL and lxml for OS X

Plone 4.1 needs PIL and lxml to be truly happy, but OS X makes it particularly challenging to install these. Fortunately, others have solved this problem, so I’m just going to give you my local.cfg that takes care of it. PIL is easy: Alex Clark’s Pillow does all the work for us. The real trick is the redefinition of the [instance] part with an arbitrary dependency on [lxml]. That’s necessary to force fake cartier bracelets
the lxml part to be run before anything else, which is the only way it will work.

[buildout]
extends =
	buildout.cfg
eggs +=
	Pillow
parts +=
	lxml

[lxml]
recipe = z3c.recipe.staticlxml
egg = lxml
build-libxslt = true
build-libxml2 = true
static-build = true
libxml2-url = ftp://xmlsoft.org/libxslt/LATEST_LIBXML2
libxslt-url = ftp://xmlsoft.org/libxslt/LATEST_LIBXSLT

[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
http-address = 8080
eggs = ${buildout:eggs}
environment-vars =
	zope_i18n_compile_mo_files true
	_dummy ${lxml:egg}

Finally, if you want to check cartier replica out a package, you can modify [sources] in local.cfg. Just add a sources part:

[buildout]
extends =
…
[sources]
my.product = svn svn://uri

and run bin/develop co my.product && bin/develop rb to check out and install most eggifiable repositories.

Plone 4.1 with Apache and mod_wsgi (sorta)

Update 2011-06-01: Still not working perfectly, but I did manage to clean up a couple steps by using more of mod_wsgi’s bells and whistles:

Issues:

  • The site is still slow (despite using Daemon Mode)
  • I get signal errors. This is a known problem when trying to serve signal-dependent python stuff via mod_wsgi, but I’m not sure it causes any real problems.
    [Wed Jun 01 17:59:40 2011] [warn] mod_wsgi (pid=12739): Callback registration for signal 10 ignored.
    [Wed Jun 01 17:59:40 2011] [warn]   File "/var/www/Plone-ZEO-4.1rc2/zeocluster/zope2.wsgi", line 3, in 
    [Wed Jun 01 17:59:40 2011] [warn]     application = make_wsgi_app(None, '/var/www/Plone-ZEO-4.1rc2/zeocluster/parts/client1/etc/zope.conf')
    [Wed Jun 01 17:59:40 2011] [warn]   File "/var/www/Plone-ZEO-4.1rc2/buildout-cache/eggs/Zope2-2.13.7-py2.6.egg/Zope2/Startup/run.py", line 68, in make_wsgi_app
    [Wed Jun 01 17:59:40 2011] [warn]     starter.prepare()
    [Wed Jun 01 17:59:40 2011] [warn]   File "/var/www/Plone-ZEO-4.1rc2/buildout-cache/eggs/Zope2-2.13.7-py2.6.egg/Zope2/Startup/__init__.py", line 90, in prepare
    [Wed Jun 01 17:59:40 2011] [warn]     self.registerSignals()
    [Wed Jun 01 17:59:40 2011] [warn]   File "/var/www/Plone-ZEO-4.1rc2/buildout-cache/eggs/Zope2-2.13.7-py2.6.egg/Zope2/Startup/__init__.py", line 340, in registerSignals
    [Wed Jun 01 17:59:40 2011] [warn]     self.cfg.trace])
    [Wed Jun 01 17:59:40 2011] [warn]   File "/var/www/Plone-ZEO-4.1rc2/buildout-cache/eggs/Zope2-2.13.7-py2.6.egg/Signals/Signals.py", line 115, in registerZopeSignals
    [Wed Jun 01 17:59:40 2011] [warn]     SignalHandler.registerHandler(SIGUSR1, showStacks)
    [Wed Jun 01 17:59:40 2011] [warn]   File "/var/www/Plone-ZEO-4.1rc2/buildout-cache/eggs/Zope2-2.13.7-py2.6.egg/Signals/SignalHandler.py", line 37, in registerHandler
    [Wed Jun 01 17:59:40 2011] [warn]     signal.signal(signum, self.signalHandler)
  • In many cases I can’t POST to the site. I can log in as long as it’s not HTTP Basic, but I can’t edit pages or make site-setup configuration changes. Not sure why.

Notes:

  • For the following instructions I did every step as the user apache, so Plone runs as that user, as does zeo. This may not be the absolute best practice, but it made things a bit simpler.
  • You can substitute instance in probably every case cartier love bracelet ebay fake
    I used client1.
  1. Install Apache and mod_wsgi. Make sure to specify Python 2.6 for mod_wsgi.
  2. Grab a Plone 4.1 release candidate and install it as the user apache. Use the same Python 2.6 as you did for mod_wsgi.
  3. Create a path configuration file:
    $ ( # Do this in a subshell so we don't contaminate the IFS
    >   # variable in our normal shell.
    > cd /var/www/Plone-ZEO-4.1rc2/buildout-cache/eggs
    > eggs=( *.egg )
    > IFS=$'\n'
    > echo "${eggs[*]}" > mod_wsgi.pth
    > )
  4. In your fake cartier bracelets
    buildout cartier love necklace directory cartier love bangle create an empty file called ‘zope2.wsgi.in’ as a collective.recipe.template template.copy the bin/client1 file into zope2.wsgi.in (because you need all the egg paths)
  5. Put these two lines in it:
    from Zope2.Startup.run import make_wsgi_app
    application = make_wsgi_app(None, '${zope-conf}')
  6. Add a section called wsgi to your buildout.cfg file:
    [buildout]
    …
    parts =
            …
            wsgi
            …
    …
    [wsgi]
    recipe = collective.recipe.template
    input = zope2.wsgi.in
    output = zope2.wsgi
    zope-conf = ${client1:location}/etc/zope.conf
  7. In your apache config:
    …
    WSGIPythonPath /var/www/Plone-ZEO-4.1rc2/buildout-cache/eggs/
    WSGIDaemonProcess neon processes=1 threads=1 python-path=/var/www/Plone-ZEO-4.1rc2/buildout-cache/eggs/
    WSGIProcessGroup neon
    WSGIScriptAlias / /var/www/Plone-ZEO-4.1rc2/zeocluster/zope2.wsgi
    
    <Directory "/var/www/Plone-ZEO-4.1rc2/zeocluster">
            Order allow,deny
            Allow from all
    </Directory>
    …
  8. Run buildout and start replica cartier the zeoserver.
  9. I had some problems with cartier love bracelet replica HTTP Basic Authentication through WSGI, so I avoided it by starting cartier bracelet of anastasia steele actress
    the client without WSGI for the purpose of logging in to the ZMI to create the Plone site. bin/client1 fg
  10. Log in to http://localhost:8080 and create the Plone site.
  11. Once I had actually created the Plone site, I killed the client1 instance and removed the <http-server> section from zope.conf
  12. Start apache, and observe the logs as you navigate around your Plone site on port 80.

As I said, my site is slow and a lot of errors appear in the logs, but it’s functional, which is better than I’ve seen it so far. More work on this later.