Ditto is Rsync for deployment.
Sometimes you dont want to worry about running git, composer or other commands on your production servers. Ditto uses rsync to duplicate applications quickly and easily across many environments.
- Clone
$ git clone https://github.com/outrunthewolf/ditto.git
- Make ditto executable and global
$ chmod +x ditto.sh
$ mv ditto.sh /usr/local/bin/ditto
Ditto requires a configuration file for the various environments you'd like to keep in sync. Your configuration file will be in the root directory, the same place as your git files are stored.
staging_user=human
staging_address=192.168.1.1
staging_port=22
production_user=git
production_address=192.168.1.1
production_port=22
safety_mode=true
remote_directory=/home/user/app
You can add as many environments as you like and they will be available to ditto. You can then sync environments with push and pull.
$ ditto pull staging # Rsync your staging files against your local files
$ ditto push production # Rsync your local files against your production files
The remote directory for ditto to push to defaults to your current directory. You can override this in the config file
remote_directory=/home/use/app
Ditto contains a safety mode on push and pull, the safety mode is enabled by default but you can override it by specifying the following in the config file
safety_mode=false
To see a full list of commands run
$ ditto help
Remember to add ditto and any config files to your gitignore or you could end up exposing private information.