Plone "Top Five"

Plone (or wcms.inf.ed.ac.uk and various aliases) is a Web Content Management System that we use to host various project web sites and, increasingly, more Informatics-based content. Currently hosted on cigarvm.inf, it is built using the Zope web application server written in Python. The VM is currently on the vmhost azul in the Forum.

We also run a Plone instance on www.inf.ed.ac.uk these days, and it provides the /student-services/ and /school-services/ content (though they mostly redirect to content on web.inf.ed.ac.uk now). What follows will mostly apply to what's running on www.inf too, but paths will be different eg /disk/data/plone/zope/ for the instance location.

Although Zope provides its own HTTP server, Zserver (so Apache isn't actually needed), we do put Apache in front of the Zserver to give us Cosign authentication and other functionality. The Zserver running on cigarvm.inf only listens to port 8080 on the loopback device (127.0.0.1), so browsing to http://cigarvm.inf.ed.ac.uk:8080/ shouldn't (and better not!) work.

Apache handles the various requests for the virtual hosts, eg www.emime.org, www.not-a-service.inf.ed.ac.uk, etc, and proxies the request to localhost:8080/.... It also passes authentication information (which is taken as gospel by the Zserver), which is why you don't want the outside world to be able to talk directly to the Zserver on port 8080.

If you do need to talk directly to the Zserver, then you can log into cigarvm.inf and run firefox locally to talk to localhost:8080. I do

 firefox --no-remote localhost:8080 

Or use some tunneling or SOCKS proxying.

Things of Note

There is not a zope or plone component. Instead zope is started via systemd which uses the /etc/init.d/plone script. Which is added to systemd.wanted_units_multiusertarget. The file compoment is used to populate /etc/sysconfig/plone with the location of the instance by setting the INSTANCE variable.

INSTANCE is set to /opt/wcms/zope/ which is actually a symlink to /disk/data/wcms/zope/ (this is all the data and config for the zope part of the service). It is part of /disk/data/wcms/ and this is what needs to be restored following a disaster).

The Zope and Plone software ships in a single, locally built, plone RPM.

You can't just upgrade the Plone RPM and expect things to keep working - you need to go through additional steps, mainly the "portal_migration" tool for each site in the ZMI. If you must do this, try it on a clone of the wcms server first.

Cigarvm has a virtual network interface defined for all the service IP, it should be what wcms.inf.ed.ac.uk resolves to.

Apache is configured using the apacheconf component, which expects the included apache config files to live in /etc/httpd/conf.d/. We maintain our apache config files in /opt/wcms/apache/ (a symlink to /disk/data/...) so it gets mirrored - which means that we have to symlink (via the file component) from files in /opt/wcms/apache/ to /etc/httpd/conf.d/.

How it works

See ServicesUnitPloneWCMSManagement for a bit more detail, but simply:

  • a new Plone site is created in the Zope via the Zope Management Interface (ZMI) and given an id eg "dice". You need to know the zope admin username and password. - You shouldn't be doing this any more. We want to be retiring the Plone service.

  • At this point (due to the way Apache is set up to proxy zope), the site is now live at the URL wcms.inf.ed.ac.uk/zope/dice/

  • If you want a friendlier URL, eg
    • wcms.inf.ed.ac.uk/dice/, then you need to update the two wcms.conf and wcms80.conf apache config files with the required Proxy and potential access restrictions
    • or something like www.dice.org or www.dice.inf.ed.ac.uk needs more work:
      • create the new X509 certificate.
      • create a new virtualhost (via LCFG, using the macros, as we are using apacheconf) and the corresponding config file(s) with the necessary Proxy and access restrictions.
  • If you do want to restrict access to certain groups of people (even before zope/plone does its own authorisation) then you can do this using various apache techniques, the most common being the require group ... where the group is defined in the apache/htgroups file.

Apache is partly configure via the apacheconf component and partly by the config files in /opt/wcms/apache/ (really /disk/data/wcms/apache).

Common Problems

HTTPS funnies

Though we used to have this problem regularly, we are now running with threads turned off in the Zserver, which seems to have solved the problem. What happened was that the Zserver would serve the wrong content, eg the browser would ask for an image and it would get a style sheet instead, or any other odd combination. Obviously this would cause havoc with a web page. Unfortunately once a browser has what it thinks is an image for example, it will continue to use its own wrong cached copy, even though a new request to the Zserver would probably now give the correct content. So a "shift reload" is sometimes all it needs to fix a corrupt render of the web page.

Alternatively have them try accessing the site via an alternative wcms.inf.ed.ac.uk/zope/<site-id> URL. Note this will only work for DICE users, not iFriends, and may have further restrictions as defined in the apache config.

We have yet to have any reports of this mis-caching on HTTP sites.

Sites just not there

This has only happened if the network is down (someone else's problem) or if apacheconf hasn't restarted following the Sunday morning logrotate restart (very rare). However if networking is fine, then check if:

  • apache is running - grep for httpd processes on cigarvm
  • Zserver is running - grep for zope owned proceses on cigarvm, you
should see something like:
root     26583     1  0 Sep12 ?        00:00:07 /usr/lib64/plone/Python-2.4/bin/python /usr/lib64/plone/Zope-2.10.7-final-py2.4/lib/python/zdaemon/zdrun.py -S /usr/lib64/plone/Zope-2.10.7-final-py2.4/lib/python/Zope2/Startup/zopeschema.xml -b 10 -d -s /disk/data/wcms/zope/var/instance/zopectlsock -x 0,2 -z /disk/data/wcms/zope/parts/instance /disk/data/wcms/zope/parts/instance/bin/runzope
zope     26584 26583  7 Sep12 ?        1-06:13:35 /usr/lib64/plone/Python-2.4/bin/python /usr/lib64/plone/Zope-2.10.7-final-py2.4/lib/python/Zope2/Startup/run.py -C /disk/data/wcms/zope/parts/instance/etc/zope.conf

You can just try restarting apache if it isn't running, using the component. If it doesn't start, try looking in the /var/lcfg/log/apacheconf and apacheconf.error files for clues.

You may also want to check the memory footprint of zope via "top", eg

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
26584 zope      20   0 2702m 2.2g 3440 S  0.0 57.3   1813:55 python             

There appears to be a memory leak in the current zope, and it can get pretty large, so restarting it can free up lost resources.

If you want to try restarting zope, ideally do it via the zope interface at http://localhost:8080/manage, then click on "Control_Panel in the upper left, and then click the "Restart" button on the main page. This is quicker, but still leaves the site inaccessible for a while.

Alternatively stop and start it via systemd, though this takes longer to restart the service.

  systemctl stop plone
  systemctl start plone

Zope takes a while to start up (this can be 2-3 mins), so keep an eye on the log file /opt/wcms/zope/var/log/instance.log. When it is ready it will say "INFO Zope Ready to handle requests", or give error messages saying why it didn't start. Good luck if that's the case! Though the only time I've seen that happen is when there's been a change to the ../zope/products/ directory, eg something got deleted or there's been a major version change of something. Try reverting back to the last known good state from the backups/mirrors.

I should also say the the Zserver logs its HTTP requests like apache does, but to the file /opt/wcms/zope/var/log/instance-Z2.log. Remember that /opt/wcms/zope/ is a symlink to /disk/data/zope/, which does sometimes lead to confusing warnings about "duplicate products detected" from the alternative path.

Disaster recovery

Assuming it has all gone bang, and you need to rebuild the service, then life will be a lot simpler if the new hardware re-uses all the same DNS names and IP addresses as the current cigarvm.inf, otherwise you'll have to track down all the sites that have non-wcms.inf.ed.ac.uk URLs, eg www.emime.org, www.classic-project.org, and update the DNS to point at the new name/IP addresses.

The service isn't completely wrapped-up in dice/options/plone-wcms-server.h, so you will also have to look at the current cigarvm profile and make some appropriate changes to fstab, various virtual network interfaces and #defines.

Assuming that you have now re-installed cigarvm, or have an equivalent machine, you should have a vanilla zope instance and a broken apache - as the data/config that is the service needs to be restored from the mirror.

(For more detail, see ServicesUnitPloneWCMSManagement#Backup_and_Restore_Disaster_Reco)

That's it.

-- NeilBrown - 11 Mar 2019

Topic revision: r10 - 11 Mar 2019 - 16:22:33 - NeilBrown
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
This Wiki uses Cookies