My new workflow: Git, Beanstalk, and local development

For the longest time I've developed the way that everyone tells you not to -- over FTP on a live server. Over the years I've found that I've been doing a lot of things differently (usually incorrectly) because I was never actually taught how to do any of this. Now that I'm out of school and have time to really focus on my work, I'm looking to correct this.

The first step is correcting my workflow, which has ingrained some very bad habits. For the past week or so I've been working to reverse those bad habits, and while it hasn't been easy, I can already tell it will be very rewarding. So, instead of simply firing up the old FTP machine and hammering away on a live server, I know go through a slightly more involved process, but it comes with some great benefits.

New Workflow

Local Development

The first step was to move my development off of the live server and onto my own computer. Luckily for me, OS X comes pre-installed with PHP and Apache, the majority of which I need to do this kind of development (this article was helpful in tweaking the settings). Doing development locally cuts out the need to upload files continuously; which, depending on your connection speed, can save some time I suppose.

The real benefit comes in the quality assurance department, which has been sorely missing from all of GoldFire Studios projects. Instead of making changes and uploading them to the live server without testing them (I think PokerRPG and BC Wars players will know the perils of the "fatal error" screen of death), I can make the changes locally, test them out to make sure it is all working correctly, and then upload the changes to the server.

Git

Local development solved one major problem, but what if I messed something up (which lets face it, happens quite often), and I need to quickly switch back to the previous version Well, too bad, I'll have to go wading through the thousands of lines of code trying to find and remember what change I made that broke the feature or even the site. This is where version control comes in, and I believe I may be one of the few serious programmers that has yet to adopt this age-old technology. The truth of it is that I've been well aware of version control for years, but I didn't know about it when I first started, and its been hard to get out of the flow that has worked.

I looked at a lot of different version control systems like SVN and Mercurial, but ultimately I decided the distributed environment of Git was best for me. Git is extremely fast, extremely versatile, and even allows for offline development without the need to hook into a central repository. What is cool about version control is that it saves a complete history of the changes made to my code, so I can experiment on a change, and if it doesn't work out, I can easily discard that change without having to make a bunch of messy files like: {file}2.php, {file}3.php, etc.

Beanstalk

So now I'm developing locally, and I'm using version control on that code to keep it all organized and secure. I still need a way to collaborate efficiently with other programmers (remember, I'm hiring, so if you are interested, hit up that contact button in the top right), and to actually deploy the freshest code release to the live server. This is where Beanstalk comes in (get 10% off your first month with that link). Beanstalk is a hosted repository and deployment platform that not only looks gorgeous, but has some really useful features as well. I can collaborate on code easily and efficiently with other team members. I can browse through the changes in the code, and even edit the code on the fly if I'm in a hurry.

I looked at a lot of different hosted git solutions (including the ever popular GitHub), but ultimately I decided on Beanstalk because of the powerful deployment platform that makes it extremely easy to get that locally developed code in front of all of you. And lets be honest, using a web app that just looks great makes it just that much more enjoyable.

While I didn't choose to get a paid plan with GitHub, I am using their newly released GitHub for Mac. GitHub for Mac is another superbly designed tool, and luckily for me it hooks into Beanstalk just fine. This native application allows me to quickly and easily manage my local versioning without having to dip into the command line too much. Don't get me wrong, I have nothing against using the command line, and there are still areas where it is useful, but take a look at GitHub for Mac and you'll see why it is a no-brainer.

How does this affect you?

I've had the chance to do all of this workflow tweaking because I was able to integrate it from the ground up into my new project, Leet Media. It is much easier to start a new workflow with a new project than on ones you've been used to for so long. This makes Leet Media a sort of testing ground, and once I'm used to the new workflow it will find its way into PokerRPG, BC Wars, MG Poll, etc. In the end this means more quality control, and less glaring bugs (everyone at PokerRPG say it together: hallelujah!).

Sorry this post took so long, but if there's anything left unsaid and you have questions, or you'd like to elaborate on your own workflow, please leave a note in the comments.

Update (12/09/2013): Over 2.5 years since I first wrote this, we are still employing many of the same strategies that I put in place here. Git remains a vital aspect of our development workflow, and it has actually gained an increased role as a major component of our completely revamped deployment systems. The main component that has changed is that we are now completely on GitHub. We loved using Beanstalk, but we've increased our interactions with the open source community (see howler.js) and have found it much easier to have everything in one place. In addition, our switch to everything Node.js has lessened the need for Beanstalk's deployment systems.