I'm going to go over the flow I use for web development. It seems pretty straightforward and logical to me now, but it took a pretty long time to get to this point, so I figure writing it down for me to look at a few years from now, and maybe to be useful incase someone is looking for a more streamlined flow, couldn't hurt.
Background
I'll start off with how I first started doing dev. I was on a windows box, using frontpage. Only thing I really wrote was html, and then slowly transitioned into JS and CSS (this was in the late 90's).
Over time I switched over to a program called HAPEdit. I swore by it, and used it for probably 4 years or so. I was running WAMP, PHPMyAdmin for DB access (locally) and deployed to a shared server that was running some flavour of linux.
It took until 2007 for me to switch over to OSX. I started to see pretty quickly the advantage of it since OSX is based on unix, and shared more similarities with my production server then Windows did. Fewer DLL/apache/php extension issues and a more streamlined process.
It wasn't until 2009 that my current work flow started to come together.
Current Flow
I currently host all my dev work on Slicehost, which is a very bare-bones setup. You're given an empty OS (whichever linux flavour you want) and are expected to setup all your applications on your own. This is good and bad, which I'll go into later.
My currently offline (local machine) workflow is as follows:
- I do all my developing in coda.
- I do this dev in my
~/Sites/
directory - I run Ubuntu 10.10 on a Parallels VM instance
- This instance has apache, php, etc. all setup on it
- I use Sequel Pro to access my DB's (mysql variety)
- I edit my OSXs
/etc/hosts
directory to have certain development-domains propagate to the IP address of my Parallels Ubuntu VM - I run the following rsync command to push my code after every save in Coda to the VM:
rsync --delete --archive --quiet --progress --stats --compress --rsh='ssh \
-p[PORT]' --exclude '.svn' --exclude '.DS_Store' --exclude '.' --exclude '..' \
--exclude '.localized' --exclude 'thumbs.db' --exclude 'apc.php' --exclude \
'*/tmp/*' --exclude '*/application/tmp/cookies.txt' --exclude \
'*/application/logs/' --exclude '*/application/webroot/uploads/a' \
/Users/olivernassar/Sites/ onassar@[VM-IP]:/var/www/; /usr/local/bin/growlnotify \
-a Coda -m 'Boom goes the dynamite!';
- This code pushes it, and runs a growl notification when the save has been completed (I've created this as a plugin to Coda so I just have a keystroke-combo that runs this). I'm using the growlnotify extension
And that's about it. A lot of the credit for this flow goes to a former co-worker/manager of mine, Mariano Peterson who exposed me to apache and linux config hugely, and got me into Slicehost which forced me to learn the command line dramatically.
What I like about this flow
The flow might seem convoluted; I have a lot of moving parts, I have to press a series of keys every time I save to push the code over to my VM, etc. But what I like most about it is that my environments are perfectly synced (with the exception of application-level code and network-level logic, which are intrinsically exempt). My slice is running the exact same OS, packages, and memory (since in Parallels you can assign harddisk and memory spec's). I don't have to worry about consistency issues; I've got the code running decoupled from my OS; it's easy to backup (eg. copy/paste the VM image).
One of the things I'm missing from above is how I use SVN. I use it in a pretty straightforward way from my OSX filesystem (not from the VM). I use Springloops for this which is exceptional for management and deployment, and relatively cheap (eg. $9/month USD). I've been thinking about making the transition to git more and more, and have started pushing out some of my code on there, but that'll be a slow process until I'm as comfortable with it as I am with svn at the command line.
So ya, there's my flow. Might revise it down the line, but we'll see.
Updated (May 1, 2013)
Updated rsync
command to work with terminal-notifier
rsync --delete --archive --quiet --compress --exclude '.svn' --exclude '.DS_Store' --exclude '.' --exclude '..' --exclude '.localized' --exclude 'thumbs.db' --exclude 'apc.php' --exclude '*/tmp/*' --exclude '*/application/webroot/uploads/*' --exclude '*/webroot/modules/*' --exclude '*/wp-content/*' /Users/onassar/Sites/ onassar@[VM-IP]:/var/www/; terminal-notifier -message "Changes Received" -title "rsync"