Setting the time zone for a Zope deployment is usually a simple process of adding the following to the relevant instance section in the buildout:
zope-conf-additional =
<environment>
TZ America/New_York
</environment>
This works fine in any configuration where the instance is started using the script generated by plone.recipe.zope2instance (usually ‘./bin/instance’). However, we run most of our production environments using supervisor, which starts the instances using the runzope script buried within the buildout. This is where the problems happen.
When the instance is started using runzope, the timezone is not changed (in some circumstances the instance reports the correct time but the wrong time zone). I haven’t been able to find out what exactly is causing this, but I did find a workaround.
If you remove the TZ setting from the buildout completely, then set the TZ environment variable at the shell level (e.g. export TZ=America/New_York) it works! To fix this for supervisor deployments you need to set the ‘environment’ variable for each program in the supervisor config. At the moment this isn’t possible using the collective.recipe.supervisor (0.8) recipe, since it doesn’t allow the process_opts values to contain ‘=’ characters. There’s a fix for this in trunk. With a good version of the recipe, the program configuration for a zope instance looks like this:
10 instance1 (environment=TZ=America/New_York) ${instance1:location}/bin/runzope ${instance1:location} true
(all on one line obviously)











