Posted on Leave a comment

Remote deployment script for Magento extensions using modman and rsync

Magento Logo

In order to have an efficient way of deploying Magento extensions to (remote) Magento setups I’ve created a simple deployment script based on modman and rsync.

How it works

This script copies your Magento extension to the .modman directory of your destination Magento project and deploys it there using modman. In addition, it exludes files and folders (such as .git) so that only relevant files are copied. This script uses rsync to copy files to your (remote) Magento project.

For example:

  1. Let’s say you develop a Magento extension in /home/my_user/workspace/MyExtension
  2. Your development Magento setup is located at /var/www/magento-dev1/
  3. This script copies your Magento extension from /home/my_user/workspace/MyExtension to /var/www/magento-dev1/.modman/ and automatically deploys it using modman.


Although you could do the copying alone using the modman configuration file modman does not offer the possibility to exclude certain files for the deployment process. In addition, this script uses rsync, thus giving you the possibility to remotely deploy your Magento extension.

Download script

Feel free to grab the script from Github. Also, in case you have suggestions for improvements don’t hesitate to drop a comment below.

Posted on Leave a comment

Rsync’ing folders between remote machines

Rsync is an extremely powerful tool to transfer data between machines. Most of the time I use the following command to synchronize data between two machines.

rsync -razvute 'ssh -i /root/.ssh/id_rsa' SRC DST

Whereas the above command merely adds updated files from SRC to DST, use –delete to delete orphaned files in DST, i.e. files that have been deleted in SRC and should be deleted in DST too.

Also, in case you want to run rsync (for intance as a cron job) without having access to the remote machine’s private key try using sshpass. sshpass gives you the possibilitiy to enter password directly without requiring the remote machine’s private key.