Repligard

flack edited this page Feb 8, 2015 · 1 revision

Repligard is a command-line utility for replicating content between databases. Repligard was used for Staging/Live setups, for backups and for installing new applications (almost all of them were shipped as gzipped Repligard xml packages).

Version 1.8. stills uses Repligard for installing legacy applications, but it is considered deprecated. Its role in the Staging/Live process was taken by Exorcist in Midgard 1.7.x. Repligard doesn't work for Multilang enabled installations, which is the default

Usage

Basically, the following four command-line options are used most of the time:

-i filename import data from a repligard package

-e filename export data from a database into a repligard package (which is a gzipped XML file)

-a export or import all content (instead of last modified)

-c configfile specifies the location of the config file to be used.

Common Problems

Please also note that for a successfull replication, the application must be Repligard-safe, which is to say it should not rely on Object IDs, but use GUIDs instead

  • the most common problem with Repligard is the error message "repligard-CRITICAL **: Error in DB connection". It usually means that the username or password in the config file are not correct.
  • the command <nowiki><replicate all ="yes"/></nowiki> is commented out in the standard version of this file and has to be enabled beofre any replicate commands can be effective

Setup

Enabling Staging/Live requires a working installation of the Midgard Framework, Aegir and two scripts from the YAMP package. To convert existing sites to Staging/Live, you'll also need Aegir's Tools AddOn.

Configuration

Configuration is not exactly straightforward, as the main documentation is outdated. The main difference is that for Content Approvals to be respected, you need to install two scripts from YAMP, namely

remove_unapproved.pl delete_expired.pl

Please note that there are three different variants of remove_unapproved, the standard one, one with sitegroup support and one with sitegroup and multilang support.

These new scripts require modifications to /var/lib/aegir/bin/repligard_staging_to_live.sh. Here's a version that is known to work on a SuSE 9.0 system. To make it work on a Debian 3.0 system, just uncomment the lines regarding the character set conversion (the line starting with iconv and the one below.)

 #!/bin/bash

 #script to transfer data from staging database to live database.
 REPLIGARD=/usr/local/bin/repligard
 if [ -e /usr/bin/repligard ] ; then
   REPLIGARD=/usr/bin/repligard
 fi
 #0. fudge the page updates based on approval status

 PERL=`which perl`

 #${PERL} /var/lib/aegir/bin/downgrade_unapproved.pl

 #1. dump the changes to a file
 THISDATE=`/bin/date  %Y%m%d%H%M`

 $REPLIGARD -c /var/lib/aegir/etc/repligard_hourly_dump_staging.conf -e /tmp/hourly_export_${THISDATE}.xml.gz

 gunzip /tmp/hourly_export_${THISDATE}.xml.gz

 ${PERL} /var/lib/aegir/bin/remove_unapproved.pl /tmp/hourly_export_${THISDATE}.xml

 ${PERL} /var/lib/aegir/bin/delete_expired.pl /var/lib/aegir/etc/repligard_hourly_dump_staging.conf /tmp/hourly_export_${THISDATE}.xml


 #2. import the data into the live server

 #iconv -f UTF-8 -t ISO_8859-1 /tmp/hourly_export_${THISDATE}.xml.new -o /tmp/hourly_export_${THISDATE}_conv.xml
 #$REPLIGARD -c /var/lib/aegir/etc/repligard_hourly_import_live.conf -i /tmp/hourly_export_${THISDATE}_conv.xml
 $REPLIGARD -c /var/lib/aegir/etc/repligard_hourly_import_live.conf -i /tmp/hourly_export_${THISDATE}.xml.new

 #3. delete the file!

 rm /tmp/hourly_export_${THISDATE}.xml
 rm /tmp/hourly_export_${THISDATE}_conv.xml</code>

?>

Category:Midgard Category:Deprecated