Scaling PHP in the Cloud

HasGeek’s seventh event, focusing on the challenges of scaling from single to multi-server deployments for PHP-based websites.

Up next

Git-powered deployments

Submitted Jun 8, 2011

On the benefits of using Git or other version control software to deploy software, instead of traditional rsync, scp or ftp.


This is a brief discussion (~15 minutes) on using Git, Mercurial or other distributed version control software to deploy software to servers. It works when you have one or two servers and rapid iterations.

Traditionally, software is deployed by simply copying it to the server over FTP or SFTP. More clued-in developers use rsync for its ability to update only changed files. There are two problems with this approach:

  1. No version control for deployments. You may have versioning in your development environment, but you’re missing it in your deployment. It’s not easy to roll back if something breaks.

  2. You have to separate your development configuration files from your production configuration files. You could accidentally overwrite production config with development config, breaking the site.

Distributed version control systems provide a better way to manage deployments. They already understand how to ignore certain files (specified in .gitignore or .hgignore) an allow committing a change and pushing it to a remote location that isn’t necessarily the central repository. You can commit a change and push it to a test server. On the production server, you can pull changes from the repository and Git/Mercurial will automatically ensure that config files are not clobbered.

This approach is trivial to setup and makes for much peace of mind when deploying rapid iterations.

During the session I’ll present on how I manage my deployments and then we’ll discuss how you do yours.