Rating: 4.6/5 (5 votes)


push is a directory synchronization / code deployment command-line tool built to reduce human error when deploying projects to remote server farms. Configuration is stored in a "push.xml" configuration file in the project root, which contains details about which files need to go where, and any commands to execute before, during and after the push.

Synchronization can be done over rsync (via SSH or rsync server) or FTP. FTP synchronization analyzes file sizes and modification times to only push files that have changed, similar to rsync behavior.

Dependencies are listed at the bottom of the page. Complete usage instructions and config file specifications are available in the README file.



push [options] [target [target2 [target3] ...]]

Options: -p <file> Only push the specified file or directory. --partial=<file> -c, --clean Remove remote files and directories that don't exist locally (same as <sync clean="true"> in config). -f, --force Force update all remote files, even if sizes and modtimes match (may take a long time). -h, --help Print this help message.

Configuration Examples

Simple configuration, synchronizing to a single server:

<push name="myProject" id="myProject" default="live"> <target id="init"> <serverset id="myproject.primary-colo" user="www" mode="ssh" path="/usr/local/www/myproject.com/www"> <server></server> </serverset> </target> <target id="live" depends="init"> <sync localdir="www"> <serverset>myproject.proofing</serverset> </sync> </target> </push>

Complex configuration, deploying to multiple server pools, and reloading web server configuration remotely after pushing to each server:

<push name="myProject" id="myProject" default="proofing"> <target id="init"> <serverset id="myproject.primary-colo" user="www" mode="ssh" path="/usr/local/www/myproject.com/www"> <server></server> <server></server> <server></server> </serverset> <serverset id="myproject.backup-colo" user="www" mode="ssh" path="/usr/local/www/myproject.com/www"> <server></server> <server></server> <server></server> </serverset> <serverset id="myproject.staging" user="www" mode="ssh" path="/usr/local/www/myproject.com/www"> <server></server> </serverset> <serverset id="myproject.proofing" user="www" mode="ssh" path="/usr/local/www/proofing//myproject.com/www"> <server></server> </serverset> <commandset id="updateconfig" scope="group"> <command>cp ${root}/config/default.php ${root}/www/lib/config/</command> </commandset> <commandset id="reloadapache" scope="single" execute="remote"> <command>sudo /usr/local/apache22/bin/apachectl reload</command> </commandset> </target> <target id="live" depends="init"> <sync localdir="www"> <path-exclude>lib/local.inc.php</path-exclude> <prepcmd>updateconfig</prepcmd> <serverset>myproject.primary-colo</serverset> <serverset>myproject.backup-colo</serverset> <postcmd>reloadapache</postcmd> </sync> </target> <target id="staging" depends="init"> <sync localdir="www"> <path-exclude>lib/local.inc.php</path-exclude> <serverset>myproject.staging</serverset> </sync> </target> <target id="proofing" depends="init"> <sync localdir="www"> <path-exclude>lib/local.inc.php</path-exclude> <serverset>myproject.proofing</serverset> </sync> </target> </push>


Perl libraries:

  • XML::Simple
  • Getopt::Long
  • LWP::UserAgent
  • File::Basename

Local executables:

  • ssh (only if using mode="ssh")
  • ftp (only if using mode="ftp")
  • whoami (only if using ${user} variable)
  • rsync

Remote executables:

  • sshd (only if using mode="ssh")
  • rsync