code deployment with lftp and md5deep

After a long time of developing on a live server, the startup that I work for now has a development server as a result of getting funded. This is great but also necessitated the creation of a process to deploy code from test -> live.

I tackled this deployment issue by creating a few scripts which make special use of a couple nifty tools – lftp and md5deep.

lftp
Lftp is FTP on steroids. This tool, among it’s features, allows scripting and mirroring which proved very valuable here.

md5deep
This tool is md5sum on steroids. The built in md5sum is great for verifying file integrity which is a great thing to do after moving code from one server to another. However, I just couldn’t figure out how to make it recursive and automaitcally do sub-directories. This is when I found md5deep. md5deep CAN work recursively and it does so quite well.

The process goes a little something like the following:
The test server runs a script which . . .

  • backs up the code (tar + gzip) and slaps that backup into a backup directory
  • runs md5deep on the directory and produces a file
  • uses lftp to mirror that directory (including md5deep’s file) to a deployment directory on the live site

The live server has a script which . . .

  • does a similar backup but of the live directory
  • moves code from the deployment directory to the live directory
  • runs md5deep to verify the integrity of all the files using the file created on the development server

If md5deep gives the okay, we’re good to go. Otherwise we investigate any files that seem to vary from development to live.

For more information on these two tools:
lftp
md5deep


Leave a Comment