Publishing in a Multi-Server Environment
In multi-server environments it is often necessary to replicate files across many web server front ends. There are a number of reasons you may wish to do this:
- to provide redundancy for your web site - by having your site replicated across multiple machines, one of those machines can suffer an outage without affecting the availability of your web site or content
- to provide increased performance during peak load - by having your content replicated across multiple machines, those machine can share the load generated by your readers and users during times of peak load.
This feature will properly publish the following:
- Index templates
- Archive templates
- Uploaded files
- Generated thumbnails
Publish Queue is a facility in Movable Type that allows files to published in the background, dramatically improving the performance of the core web application. When Publish Queue is finished publishing a file it can optionally distribute that file, or rsync that file to multiple servers.
This feature requires the rsync utility to be available and findable via the web server (typically by making sure it is found within the web server user’s PATH). This feature is enabled by running the run-periodic-tasks script found in Movable Type’s
To signal Publish Queue to rsync your files to multiple machines, you will need to add the following configuration directives to your
SyncTarget requires that you specify the full and complete path to directory path you wish to publish. Do not use relative paths.
In addition, the sync process expects the
TempPath for Movable Type to be writable (default location is ‘/tmp’). This can be modified by setting the
TempPath configuration directive in
SyncTarget hostname:/ RsyncOptions -e ssh
Publish Queue is managed and executed via the
run-periodic-tasks script found the Movable Type’s
tools directory. When the script is run using the
--verbose flag, Publish Queue will output additional information to STDERR pertaining to the status of rsyncing files to the designated servers.
To avoid getting prompted for a password by rsync over ssh, you can set up a SSH key pair to allow uninterrupted authentication. This allows for this syncing operation to be run without human intervention or oversight. You can also specify the username for login with the
SyncTarget option (
SyncTarget username@hostname:/), or in your local SSH config file.
You may define multiple
SyncTarget configuration directives and it will republish the files to each of those servers.