One of the features that makes Castfire scalable is the ability for most of our production servers to run any part of our codebase. From acting as the cms, serving videos, joining files or ingesting files over ftp, each of our servers can play any role that is required.
Having a distributed codebase can lead to a difficult release process, especially when pushing code to live production servers. However, utilizing rsync, we wrote custom release scripts that enable code to be pushed to a single production server or all servers. The scripts called cfsync, cfsyndir, and cfsyncfile are used daily and make it easy to push out code quickly.
cfsync --dry-run cms01 www
See which corporate site files would be pushed to cms01.
cfsync --live all www
Push the corporate site to all servers.
cfsyncfile --live all www.castfire.com/index.html
Push the corporate index.html file to all servers.
cfsyncdir --dry-run www.castfire.com/css/
See which files would be pushed to the css dir on the corporate site.
The rsync options that make pushing files to live servers successful are:
--archive --human-readable -P --itemize-changes --delay-updates --dry-run
--delay-updates is the most important option because it copies all transferred files into place at the end of the transfer — if a changed file references another changed file, both files need to be in place at the same time or errors will be thrown. Without this atomic copy, a server would need to be taken out of rotation for the code push.
--dry-run is handy to verify which files will be pushed before actually pushing the files. I always dry-run before a push, to verify that no other files were commited but not pushed.
The other options are standard rsync options for display and permissions.
Using rsync, Castfire stays agile. We are able to push code easily and quickly to all our live production servers.