SyncCraft is a command-line shell script for sites powered by Craft that makes it simple to sync your database and assets to your local machine from a remote server. This is geeky and could go wrong if you aren't familiar with shell scripts. Please use with extreme caution.
SyncCraft downloads your remote database, deletes your local database, and imports the remote database into your local database. It then syncs down any new/unchanged assets from the folders you provide. It does this all via ssh
, mysqldump
, and rsync
.
my.cnf
files to set MySQL authentication, rather than setting them as variables in syncCraft.cfg
, but I'm open to suggestsionsThe easiest way to run the installer is to copy syncCraft.cfg
into each site directory, and for each: fill in the variables, and then copy the following line and run it from your terminal from that directory.
bash <(curl -s https://raw.githubusercontent.com/mattstauffer/syncCraft/master/syncCraft.sh)
You could even add that line as an "alias" to your shell. Edit your ~/.bash_profile
(or ~/.zshrc
if you use Zsh) and add this line at the bottom to make this a powerful and simple shortcut:
alias syncCraft="bash <(curl -s https://raw.githubusercontent.com/mattstauffer/syncCraft/master/syncCraft.sh)"
Now close ~/.bash_profile
and restart your terminal window. You can now run this command from any of your site directories just by running the command syncCraft
. That's it!
~/
)chmod +x ~/syncCraft.sh
syncCraft.cfg
into your site directory and fill in the variables~/syncCraft.sh
every time you want to sync it