Quick deploy with rSync

1 year, 10 months ago | Tags: in My work, Terminal stuff | No Comments »

A month ago I discovered rSync (Wikipedia) it made the deployment of websites so much easier for me!! The nice thing is it only transfers the files you’ve changed. That’s much faster that copying all the files over FTP.

I made a video of the deployment of my latest project;

What it does:

  • Export the MySQL database (both local and online)
  • Commit the SQL files to a subversion server
  • Uploads the complete website to my webserver with an option to sync the uploaded files from the cms. (transfer is done over SSH)

If you want this for yourself check the basic version of the script below; (If you want to backup a MySQL server like I do, contact me)

#!/bin/sh
path="/Users/jankees/Documents/work/Blond/frontend/web/"
exclude_path="/Users/jankees/Documents/work/Blond/rsync/"
online_path="~/base42.nl/subdomains/projects/blond/flash/"
mysqldump_path="/Applications/MAMP/Library/bin/mysqldump"
mysqldumpsql_path="/Users/jankees/Documents/work/Blond/backend/sql"
svn_path="/opt/subversion/bin/svn"
 
echo ""
echo "------------------------------------------"
echo "- website syncing tool version 0.5"
echo "- Jankees van Woezik 2008"
echo "------------------------------------------"
echo ""
echo "------------------------------------------"
echo "- VARIABLES:"
echo "- exclude: ${exclude_path}"
echo "- local storage path: ${path}"
echo "- online storage path: ${online_path}"
echo "- mysqldumppath: ${mysqldump_path}"
echo "- local sql path: ${mysqldumpsql_path}"
echo "------------------------------------------"
echo ""
echo "Let's start."
echo ""
echo "------------------------------------------"
 
echo "- Do some rSync? [yes/no]:"
read do_rsync
 
if [ $do_rsync = "yes" ];  then
 
			rsync --recursive --checksum --progress --compress --update --delete -e ssh \
			 $path \
			user@yourdomein.com:"${online_path}"
else
        echo "- Skipping rSync.."
fi
echo ""
echo "------------------------------------------"

If you don’t like the terminal check arSync.

Comments:

No comments yet, be the first!

Nobody

Please leave a comment