Aegir CMS - Open Source Content Management

Latest news

3rd Feb. 2003: New Installation Guide

31st Jan. 2003: OSCOM opens conference planning

Aegir CMS provides user-friendly functionality

MS Word compatible content editing

Multi-company hosting

User interface in local language

Staging and scheduled approvals

More...




1980 downloads

Staging setup

In most Aegir CMS setups it is desirable that content is shown on the site only when it is approved, and that changes in content also require approval. Typically the staging/live concept is used here.

In staging/live you have two Midgard databases, either running on same system or on separate computers.

One of the databases is called staging, and that is where content is created and tested.

When content is approved it is then replicated to the live database.

This replication process is handled with Repligard. Repligard itself doesn't know anything about checking approvals, so some 3rd party scripts are needed.

The aegir-dirs package provides these scripts for you:

downgrade_unapproved.pl
This script is called by the staging_to_live script. It goes through the Midgard database and determines which objects are approved and which are not. It then modifies the repligard table in the database, setting the "updated" field to NULL for each unapproved object. Because updated is marked as NULL repligard should not include these objects to the replication run.
repligard_staging_to_live.sh
This script runs the required commands for transferring content from staging database to live database. The commands are:
  • Downgrade "updated" fields for unapproved content
  • Export updated objects from staging database
  • Import the exported file to live database

Note that these scripts assume that they're located in /var/nadmin/bin, and that they have the required configuration files (also from aegir-dirs package) in /var/nadmin/etc.

To make this replication process automatic, you should add the repligard_staging_to_live.sh command to cron. Typical way to run it is hourly.

In addition, Aegir has the "Publish" button in main navigation. If you want this button to initiate almost-instanteous replication, you can add the following command to be run every minute from cron:

if [ -r "/tmp/runreplication" ]
  then
    /var/nadmin/bin/repligard_staging_to_live.sh > /dev/null
    rm /tmp/runreplication
fi

More information about replication can be found from Midgard Manual.