M100306: Web site management - the webupdate process


The ManageSoft websites data files are managed using a script 'webupdate', which handles the devel->review->prod development cycle of the website information, and replication of this info to the external webservers. This article details its processes and usage.

The webupdate script

Webupdate must be run as marcom: eg $ sudo -u marcom webupdate -r -i It runs from tweb01a (the development webserver) Generally, it is run with one or both of, the '-r' (push changes to review servers) and '-i' (push review into live server). It is based around the 'rsync' command, which ensures that only the differences between the area's are transferred.

The syntax is: webupdate [-r] [-i] files/dirs to sync. It MUST be run from anywhere underneath the /www/mgsft/devel tree on tweb01a, or it will fail to execute. Webupdate updates servers sequentially, not concurrently, so a push to a slow network will slow down the whole process. The process is as follows:


Pushing to review

1. Echo a datestamp into the devel/htdocs/updated.txt file

2. Push files with rsync from devel to review on sugar.

3. Push files with rsync from devel to review on ext web servers, restarting the webserver with 'apachectl restart' on each.


Pushing to live

The push to live is more complicated. For each server (tweb01a, web01a, web04a, web06a) the following process is run:


Note: This process is run *entirely* on the remote server - no files are transferred across the wire.


1. If an 'undo' directory exists on the server, this is moved to 'new', otherwise 'new' is created.

2. The existing 'live' environment is then rsync'd on top of this 'new' dir. WARNING: If 'undo' did not exist, this process could take a remarkably long time - 'live' is approx 1Gb in size and growing.

3. The selected files/dirs (on the webupdate cmd line) is then rsync'd from the review area to the 'new' dir. This process makes the 'new' dir a copy of the 'live' dir, but with the required updates made.

4. The 'live' dir is moved to 'undo', so is available as the 'previous live' area in the event of a serious problem.

5. The 'new' dir is moved to 'live', effectively pushing it into live usage.

6. apachectl restart is run to pick up any config changes. This completes the live push. Running review and live options together:

The 'review' and 'live' options are generally run together (webupdate -r -i {file}). This is perfectly ok, and all that happens is that the review push occurs, and then the live push, in the same manner listed above.


Some Notes

In the event of an 'undo' directory not being present at the remote end, the rsync from 'live' to the (empty) 'new' dir will take a long time. This 'locks' up the webupdate process, so is somewhat of a pain. To speed this up, log onto the remote server and copy the 'live' directory to 'undo' prior to running the webupdate command. Ensure that the permissions of 'undo' are recursively set to 'marcom.marcom' with group write set on all dir/files. Running the copy *as* marcom will do this automagically. Rsync has also been know to lock up on transfers of large amounts of data, both in review push and live push processes. In this event. The remote area's should be tweeked so that little data is transferred (use the notes on the above processes to do this).


Powered by Zendesk