<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>semioticpixels scratch pad &#187; plone</title>
	<atom:link href="http://www.semioticpixels.com/category/plone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.semioticpixels.com</link>
	<description></description>
	<lastBuildDate>Sun, 23 May 2010 20:07:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Plone 2 -&gt; Plone 3 Migration: Setting up</title>
		<link>http://www.semioticpixels.com/2010/03/plone-2-plone-3-migration-setting-up/</link>
		<comments>http://www.semioticpixels.com/2010/03/plone-2-plone-3-migration-setting-up/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 01:22:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[plone]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=270</guid>
		<description><![CDATA[I have 2 old Plone 2.0 websites running on a single Zope instance that I need to:

migrate from it&#8217;s ancient host to a more modern server
upgrade to Plone 3

I&#8217;m migrating away from a 32 bit Red Hat 7(!) server to a 64 bit Ubuntu Hardy Virtual Machine.  The reasons should be obvious from that [...]]]></description>
			<content:encoded><![CDATA[<p>I have 2 old Plone 2.0 websites running on a single Zope instance that I need to:</p>
<ol>
<li>migrate from it&#8217;s ancient host to a more modern server</li>
<li>upgrade to Plone 3</li>
</ol>
<p>I&#8217;m migrating away from a 32 bit Red Hat 7(!) server to a 64 bit Ubuntu Hardy Virtual Machine.  The reasons should be obvious from that statement alone, but in short:  Red Hat 7 reached its end-of-life years ago.  It&#8217;s stable (so far) but all system maintenance has to be done manually with no package or dependency management.  There are many benefits to running within a virtualized environment, namely that I can clone it as many times as I like to develop and test other websites without having to set up a whole new server, and it simplifies our redundancy and backup process. </p>
<p>Anyway, this article is both a cheatsheet and an historical commentary for when I or someone else is trying to solve a problem and has a WTF moment regarding how and why things are set up the way they are. </p>
<p>The server environment I&#8217;m migrating away from is:<br />
- Server: Zope/(Zope 2.7.3-0, python 2.3.3)<br />
- ZServer/1.1<br />
- Plone/2.0.3</p>
<p>I&#8217;ll also be upgrading from Apache 1.3 to Apache 2 and switching from Squid to Varnish for caching </p>
<h3> Getting started: Migrating from Red Hat 7.3 to a Ubuntu 8 VM</h3>
<p>Zope is an &#8220;in-place&#8221; installation, which means it runs from the directory that you put it in.  This is nice and simple, makes it easier to run different versions of Zope on the same server with associated different versions of Python and Plone and, theoretically it should be easy to move to another system altogether.</p>
<p>So, my first pass, I rsynced the Zope directory over from the old server to the new one and tried to compile Python and Zope to see what would happen.  Unfortunately, when I compiled Python, I got a bunch of errors that indicated my version of  Python was optimized for a 32 bit system and &#8230; the new VM is 64 bit. E.g. </p>
<p><code>`Parser/tokenizer_pgen.o' is incompatible with i386:x86-64 output</code></p>
<p>Python  2.3.7 was the oldest version that I could get running on the new VM that didn&#8217;t throw 32 bit errors.  I briefly considered re-compiling Python 2.3.3 with -m32 option to GCC and I could have spent quite a lot of time researching and very likely could have gotten 2.3.3 running on the VM but 2.3.7 was a bugfix release and the most stable of the 2.3 releases and should work fine so I chose to save time by going with it.  We&#8217;ll see if I regret that later.  I was also reminded in the course of this process to clean up my mess with </p>
<p><code>$ sudo make clean</code></p>
<p>When I compiled Python, the following error occurred: <code> Can't locate Tcl/Tk libs and/or headers</code>, so I had to install the tcl/tk libraries (added to setup below)</p>
<p>Plone/2.0.3 is no longer available for download, although I was able to locate a copy of Plone/2.0.5.  I don&#8217;t have a development server to upgrade the website to 2.0.5 so if I have to use it, I  may have to keep my fingers crossed. Since Plone is installed as a Zope Product and doesn&#8217;t require compilation, I will first try to copy over the Products directory of the website and see if it&#8217;ll just work.</p>
<p>I will also need to install PIL and PyXML</p>
<p>When I compiled Zope the first time, I got error messages that zlib was missing. It turns out that Ubuntu ships with zlib, but not zlib-dev installed.  Also, when researching that error, I came across a comment that I would need to install system support (libjpeg62) for PIL so those 2 lines have been added to the VM setup below.</p>
<h3>Initial VM setup</h3>
<h4>update and install basics</h4>
<p><code><br />
$ sudo apt-get install update<br />
$sudo apt-get upgrade<br />
make sure gcc is up to date<br />
$sudo apt-get install build-essential<br />
$sudo apt-get install zlib1g zlib1g-dev libjpeg62 libjpeg62-dev tcl tcl-dev tk tk-dev vim-full lynx<br />
</code></p>
<p>update the locate db so you can find stuff </p>
<p><code>$sudo updatedb</code></p>
<p>change root password<br />
<code>$sudo passwd</code></p>
<p>create a user with sudo privileges:<br />
<code>$ useradd -m -c "real name" -s /bin/bash chris</code></p>
<p>The flags create a home directory with skel profile defaults and this account is linked to the defaults for bash shell, which is important if you like syntax coloring and tab completion.<br />
<code>$passwd chris<br />
$sudo visudo<br />
</code></p>
<p>Find the line that says #User Privilege specification and add<br />
<code><br />
chris ALL=(ALL) ALL<br />
shift ZZ to save and exit<br />
</code><br />
create zope user<br />
$useradd -m -c &#8220;zope&#8221; -s /bin/bash zope<br />
$passwd zope</p>
<p>Do not add zope user to the sudoers list.</p>
<p>Disable root login<br />
<code>$sudo vi /etc/ssh/sshd_config</code></p>
<p>Change &#8220;PermitRootLogin yes&#8221; to &#8220;PermitRootLogin no&#8221;<br />
Reload ssh<br />
<code>$sudo /etc/init.d/ssh reload</code></p>
<h3>create directory structure</h3>
<p>The Library directory in the below structure may look a little over-organized at first pass. However, my next project after completing this migration will be to upgrade from Plone 2.0.3 to Plone 3 which will require several interim upgrades.  This version of the website is running on Zope 2.7.3. Each interim upgrade will be installed to it&#8217;s respective directory within Library/Software keeping everything well organized and easy to roll back to if necessary.</p>
<p>in /usr/local</p>
<p>/usr/local/Zope<br />
&#8230;./Downloads: where downloads will be stored<br />
&#8230;./src: where software will be unarchived<br />
&#8230;./Library: where compiled software will be compiled to<br />
&#8230;&#8230;&#8230;./Software<br />
&#8230;&#8230;&#8230;&#8230;&#8230;/Zope273<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;../Python<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;./Zope<br />
&#8230;/Sites: where each website to be hosted lives<br />
&#8230;&#8230;&#8230;/instancename1<br />
&#8230;&#8230;../instancename2</p>
<p><code><br />
# cd /usr/local/Zope/Downloads<br />
# wget http://www.python.org/ftp/python/2.3.7/Python-2.3.7.tgz<br />
# wget http://www.zope.org/Products/Zope/2.7.0/Zope-2.7.0.tgz<br />
# wget http://internap.dl.sourceforge.net/sourceforge/plone/Plone-2.0.5.tar.gz<br />
# wget http://sourceforge.net/projects/pyxml/files/pyxml/0.8.4/PyXML-0.8.4.tar.gz<br />
# wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz</p>
<p>#cp * /usr/local/Zope/src/<br />
</code></p>
<h3>Install Python 2.3.7</h3>
<p>Build Python 2.3 from source with the following steps:<br />
<code><br />
cd /usr/local/Zope/src/<br />
tar -xvzf Python-2.3.7.tgz<br />
cd Python-2.3.7<br />
./configure --prefix=/usr/local/Zope/Library/Software/Zope273/Python<br />
make<br />
make install<br />
</code></p>
<h3> Install PIL</h3>
<p><a href=" http://www.pythonware.com/products/pil/">More info</a></p>
<p>At the time of this writing, PIL 1.1.6 is compatible with Python 1.5.2 and up and fixes some 64 bit compatibility errors in Python 2.5 (which we&#8217;re not using yet for this Zope installation)</p>
<p>On Ubuntu Hardy, you have to edit setup.py before installing PIL<br />
<code>#sudo vi /usr/local/Zope/src/Imaging-1.1.6/setup.py</code></p>
<p>find the line<br />
<code>#TCL_ROOT = None</code></p>
<p>and replace it with<br />
<code>TCL_ROOT = "/usr/include/tk"</code><br />
<code><br />
#/usr/local/Zope/Library/Software/Zope273/Python/bin/python2.3 setup.py build<br />
#/usr/local/Zope/Library/Software/Zope273/Python/bin/python2.3 setup.py install<br />
</code></p>
<h3>Install PyXML</h3>
<p><code>cd /usr/local/Zope/src/PyXML-0.8.4/</p>
<p>#/usr/local/Zope/Library/Software/Zope273/Python/bin/python2.3 setup.py build<br />
#/usr/local/Zope/Library/Software/Zope273/Python/bin/python2.3 setup.py install<br />
</code></p>
<h4> Other recommended packages </h4>
<p>elementree has been recommended, but it&#8217;s not installed on the old system so I&#8217;m not going to worry about it atm.</p>
<p>Also, the http://plone.org/documentation/kb/setup-from-source plone article recommends installing DocFinder as an invaluable development tool, but again, I don&#8217;t need this to get the website running so I&#8217;m going to come back to it.</p>
<h3>install zope 2.7.3</h3>
<p>Build Zope 2.7 from source with the following steps:<br />
<code><br />
cd /usr/local/Zope/src<br />
tar -xvzf Zope-2.7.3.tgz<br />
cd Zope-2.7.3<br />
./configure --with-python=/usr/local/Zope/Library/Software/Zope273/Python/bin/python2.3 --prefix=/usr/local/Zope/Library/Software/Zope273/Zope<br />
make<br />
make install<br />
</code></p>
<h4>create zope instance(s)</h4>
<p>The zope user must have write access to create the directory. After the instance is created, edit #&#8221;effective-user zope&#8221; into the etc/zope.conf file, so if you start it as root later it should #su itself to the non-root user. Again: make install should be run as root, #mkzopeinstance.py should not.</p>
<p>Initially, when I tried to create an instance, it failed with the error:<br />
<code># /usr/local/Zope/Library/Software/Zope273/Zope/bin/mkzopeinstance.py: /usr/local/Zope/bin/python: bad interpreter: No such file or directory<br />
</code></p>
<p>I think this was a result of not cleaning up a bad compilation. To fix this edit the first line in  mkzopeinstance.py from<br />
<code>#!/usr/local/Zope/bin/python</code><br />
To<br />
<code>#!/usr/local/Zope/LIbrary/Software/Zope273/Zope/bin/python</code></p>
<p>When Zope is compiled, one of the last things it does is create a symbolic link from where you told Zope the python interpreter you wanted it to use lives to Zope/bin/python. mkzopeinstance.py is looking for that symbolic link, and not looking for python itself.  This provides further separation so that we could theoretically upgrade python without touching Zope and then that symbolic link would only need to be changed.</p>
<p>The instance needs to be created with the zope user, NOT root<br />
<code><br />
# su zope<br />
# /usr/local/Zope/Library/Software/Zope273/Zope/bin/mkzopeinstance.py<br />
# when prompted for the path to your instance, use:<br />
# /usr/local/Zope/Sites/instance1  .... and so forth for each site.<br />
</code></p>
<h4>test Zope</h4>
<p>For the first instance, you can test by running /usr/local/Zope/Sites/instance1/bin/runzope. OR running /usr/local/Zope/Sites/instance1/bin/zopectl start</p>
<p>Once loaded, this will make Zope accessible on http://localhost:8080 (unless you changed the port), with the Zope Management Interface available on http://localhost:8080/manage (obviously if you&#8217;re accessing a remote server, then localhost might not work and you need to use the IP address)</p>
<p>shut down zone by either hitting ctrl+c if runzope was used or by running /usr/local/Zope/Sites/instance1/bin/zopectl stop if zopectl was used to start zone.</p>
<h3>Install the website</h3>
<p><code><br />
cp originalSite/Products/* /usr/local/Zope/Sites/instance1/Products/<br />
cp originalSite/var/Data.fs /usr/local/Zope/Sites/instance1/var/</p>
<p>/usr/local/Zope/Sites/instance1/bin/zopectl start<br />
</code><br />
navigate to the ZMI localhost:8080/manage<br />
(Note that the admin login credentials will match the credentials of the site migrated, not the credentials you compiled Zope with)<br />
The website I migrated over, even though I physically placed the files in the instance1 directory within /usr/local/Zope/Sites/instance1 are in the ZMI under &#8220;Plone&#8221;</p>
<p>click the Root Folder of the ZMI<br />
check the box beside &#8220;Plone&#8221;<br />
click the &#8220;rename&#8221; button and rename it to your instance1 site<br />
(at this point I discovered a dependency on lynx which I&#8217;ve added to the apt-get list above)</p>
<p>navigate to localhost:8080/instance1 to view the website</p>
<p>On first pass, everything worked!</p>
<h4>users</h4>
<p>make sure that all the Zope files belong to the zope user<br />
cd /usr/local<br />
chown zope -R Zope<br />
chgrp zope -R Zope<br />
//////</p>
<h4>start Zope</h4>
<p>Start Zope with the following command:<br />
su zope<br />
/usr/local/Zope/Sites/dev/bin/zopectl start</p>
<h3>check it out</h3>
<p>Go to the http://mydomain.com:8080/manage, log in, create a new Plone site object. </p>
<h3>resources/references</h3>
<ul>
<li><a href="http://plone.org/documentation/kb/setup-from-source">setup from source</a></li>
<li><a href="http://plone.org/documentation/kb/robust-installation">plone installation</a></li>
<p><a href="http://www.python-forum.org/pythonforum/viewtopic.php?f=1&#038;t=10977">resolving tcl/tk error when installing PIL on Ubuntu Hardy</a></li>
</ul>
<p>Next up:</p>
<ul>
<li>VirtualHostMonster and Apache with mod_rewrite &amp; mod_proxy</li>
<li>caching: Cachefu, Pound, Squid, Varnish</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2010/03/plone-2-plone-3-migration-setting-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>managing plone logs</title>
		<link>http://www.semioticpixels.com/2009/09/managing-plone-logs/</link>
		<comments>http://www.semioticpixels.com/2009/09/managing-plone-logs/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 01:32:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[plone]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=47</guid>
		<description><![CDATA[1. Add rotation script to logrotate
sudo vi /etc/logrotate.conf
add
# system-specific logs may be also be configured here.
/usr/local/Zope/Sites/SiteName/log/Z2.log {
        rotate 5
        weekly
        compress
        size=100k
      [...]]]></description>
			<content:encoded><![CDATA[<h3>1. Add rotation script to logrotate</h3>
<p>sudo vi /etc/logrotate.conf</p>
<p>add</p>
<p># system-specific logs may be also be configured here.<br />
/usr/local/Zope/Sites/SiteName/log/Z2.log {<br />
        rotate 5<br />
        weekly<br />
        compress<br />
        size=100k<br />
        sharedscripts<br />
        postrotate<br />
#close and re-open all Zope log files (z2.log, event.log) The common idiom after rotating Zope log files<br />
               /bin/kill -s SIGUSR2 `cat /usr/local/Zope/Sites/SiteName/var/Z2.pid`<br />
        endscript<br />
}</p>
<p>/usr/local/Zope/Sites/SiteName/log/event.log {<br />
        rotate 5<br />
        weekly<br />
        compress<br />
        size=100k</p>
<p>}</p>
<h3>2. Test log rotation</h3>
<p>Do a test run of the rotation without actually rotating anything:</p>
<p><code>/usr/sbin/logrotate -d /etc/logrotate.conf</code></p>
<p>if the test run completes without any erros, force a rotation:<br />
<code>/usr/sbin/logrotate -f /etc/logrotate.conf</code></p>
<h3>3. Automate with crontab</h3>
<p>On RedHat, crontab may be set up with runparts e.g.<br />
<code><br />
# run-parts<br />
01 * * * * root run-parts /etc/cron.hourly<br />
02 4 * * * root run-parts /etc/cron.daily<br />
22 4 * * 0 root run-parts /etc/cron.weekly<br />
42 4 1 * * root run-parts /etc/cron.monthly<br />
</code></p>
<p>In this case, place a script in the directory where it should run regularly.  I&#8217;m going to rotate weekly for now, so I&#8217;m placing a script in /etc/cron.weekly and naming it zope.cron (you can name it whatever you want. Any script in this directory will run weekely</p>
<p><code><br />
sudo vi /etc/cron.weekly/zope.cron</p>
<p>#rotate Z2.log and event.log in SiteName</p>
<p>0 01 * * * root /usr/sbin/logrotate /etc/logrotate.conf > /dev/null2>&#038;1</p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2009/09/managing-plone-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>installing plone on ubuntu/slicehost</title>
		<link>http://www.semioticpixels.com/2009/09/installing-plone-on-slicehost/</link>
		<comments>http://www.semioticpixels.com/2009/09/installing-plone-on-slicehost/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 02:00:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=36</guid>
		<description><![CDATA[Setting up the Slicehost Account
Update everything
sudo apt-get update
sudo apt-get upgrade
install vim full so you can edit files
apt-get install vim-full
update the &#8220;locate&#8221; db
sudo updatedb
Change the root password
sudo passwd
Set up Users
useradd zope (I like useradd because there&#8217;s no reason to have a home directory. If you want your user to have a home directory then use adduser [...]]]></description>
			<content:encoded><![CDATA[<h3>Setting up the Slicehost Account</h3>
<p><strong>Update everything</strong><br />
<code>sudo apt-get update</code><br />
<code>sudo apt-get upgrade</code></p>
<p><strong>install vim full so you can edit files</strong><br />
<code>apt-get install vim-full</code></p>
<p><strong>update the &#8220;locate&#8221; db</strong><br />
<code>sudo updatedb</code></p>
<p><strong>Change the root password</strong><br />
<code>sudo passwd</code></p>
<p><strong>Set up Users</strong><br />
<code>useradd zope</code> (I like useradd because there&#8217;s no reason to have a home directory. If you want your user to have a home directory then use <code>adduser</code> or <code>useradd -D zope</code> to create ~/home/zope)<br />
<code>passwd zope</code><br />
<code>useradd -m  -c "real name" -s /bin/bash auserwithsudoers</code> The flags create a home directory with skel profile defaults and this account is linked to the defaults for bash shell, which is important if you like syntax coloring and tab completion.<br />
<code>passwd auserwithsudoers</code><br />
<code>sudo visudo </code><br />
Find the line that says #User Privilege specification and add<br />
<code>auserwithsudoers ALL=(ALL) ALL</code><br />
<code>shift ZZ </code> to save and exit</p>
<p>Now log out as root and login as your new admin user and test sudo<br />
<code>su auserwithsudoers</code><br />
<code>sudo bash</code></p>
<p><strong> Disable root login</strong><br />
<code>su root</code><br />
<code>sudo vim /etc/ssh/sshd_config</code><br />
Change &#8220;PermitRootLogin yes&#8221; to &#8220;PermitRootLogin no&#8221;</p>
<p><strong>Reload the ssh config</strong><br />
<code>sudo /etc/init.d/ssh reload</code></p>
<h3>Ok! Now we&#8217;re ready to think about plone</h3>
<ol>
<li>Follow the plone install instructions <a href="http://www.semioticpixels.com/2007/12/install-plone-3-on-ubuntu-7-10/">here</a></li>
<li>install some products (<a href="http://plone.org/documentation/tutorial/third-party-products/installing">see plone documentation </a>on using buildout).  Here&#8217;s what I did to install a Press Release product
<ol>
<li>download the product. If there&#8217;s a choice of files, choose the one with the naming convention Products.package.tar.gz.  This is a python egg.</li>
<li><code>su zope<br />
vi /usr/local/Plone/zeocluster/buildout.cfg</code><br />
add the following:<br />
<code>[buildout]<br />
...<br />
eggs =<br />
Products.PressRelease<br />
</code><br />
and save (<code>ctrl + ZZ</code>)</li>
<li><code>sudo /usr/local/Plone/zeocluster/bin/buildout</code></li>
<li><code>sudo /usr/local/Plone/zeocluster/bin/plonectl restart</code></li>
<li>In each Plone site where you want to install the Product, go Site Setup&gt;Add/Remove Products and install the Product.</li>
</ol>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2009/09/installing-plone-on-slicehost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
