by Kiran Jonnalagadda (@jace) on Wednesday, 8 June 2011

+22
Vote on this proposal
Status: Submitted
Section
Deployment

Session type
Discussion

Technical level
Beginner

Objective

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

Description

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.

Comments

  • 1
    [-] Aditya (@netroy) 6 years ago

    This is great way when the code has to be pushed to one or a few servers. Since we are talking about cloud here, we cant ignore the possibility of clusters of servers here. To deal with deployment to a big cluster, twitter pioneered using bit-torrent for deployment. So when you git push on a master server, it starts acting as a seed & notifies other servers & they all sync up P2P.

    Maybe we dont need to discuss this in detail, but it surely deserves a mention.

    A video about the same - http://vimeo.com/11280885 & the github repo for deployment scripts used at twitter (called Murder) - http://github.com/lg/murder

    • 1
      [-] Kiran Jonnalagadda (@jace) Proposer Reviewer 6 years ago

      Aditya, shouldn't that be a separate talk? We're unlikely to have folks with that kind of scale and no existing deployment infrastructure.

      Maybe we dont need to discuss this in detail, but it surely deserves a mention.

      I agree. A mention will suffice.

  • 1
    [-] Sidu Ponnappa (@kaiwren) 6 years ago

    Chef + Capistrano. Or maybe Puppet + Capistrano. Too complicated? Try Vlad the deployer.

    Either way, no SCM on the server. If you're running a Twitter or Facebook scale setup, you can try the bittorent based mass deployment solution, Murder.

    All of these are open source.

    • 1
      [-] Kiran Jonnalagadda (@jace) Proposer Reviewer 6 years ago

      Capistrano looks interesting, but a "getting started for PHP devs" type talk may help demystify it for all non-Ruby devs. Care to take this up, Sidu?

  • 1
    [-] t3rmin4t0r (@t3rmin4t0r) 6 years ago

    For the better part of the decade, every prod system I've worked on has used RCS to maintain configs (co/ci commands on linux).

    Right now, I'm trying to switch all of it over to use git for one simple reason - no new files in each subdir, unlike RCS or svn - I can maintain my git repos in /root/ and symlink out the actual conf dirs into /etc/

  • 1
    [-] vamsiikrishna (@ing33k) 6 years ago

    This will be really useful for beginners. I am currently using git post-update hook ;) btw , I love Capistrano ,but this is php developers event :P

  • 1
    [-] Sandeep Shetty (@sandeepshetty) 6 years ago

    Will you be covering PHP specific issues related to deployments? Some issues related to just copying code to the server are mentioned in the blog post (http://www.wepay.com/dev/2010/11/30/weploy-wepays-deployment-tool/) introducing WePloy (https://github.com/rlerdorf/WePloy) a tool specifically created for PHP deployments by Rasmus (the creator of PHP).

Login with Twitter or Google to leave a comment