6

What is the best method to deploy or update code from a development environment to a live production one?

I am used to using the good old filezila to first; delete then upload the new code to the production server, but this brings up various problems, downtime being the primary one.

I have also been thinking about using a VCS such as Mercurial or git. Is this the best method for pushing live code?

Thanks for any insight.

3 Answers 3

2

Using distributed VCS like mercurial, git or bzr is a good idea.

You can have separate branch for production (or even a branch for particular client in case of customizations).

Benefits I see:

  • easy to push a fix
  • easy to revert if needed
  • history of changes
  • if someone did a fix production environment you will see that
3

Regardless of your development ecosystem (Rails, Java) or VCS (GIT, SVN), the most critical aspect of deploying your code to any environment is continuous integration.

Here are some things to consider:

  • Maintain a source repository. Pretty obvious. I work in a Java shop and we use SVN. Regardless of what VCS you use, it's important to be able to tag/version your code to make sure you deploy the right code across environments. Keep in mind that you aren't deploying from development to production, but rather pulling code from source control to a build machine and building a specific package for each of your environments.
  • Automate the build process. We deploy our applications as WAR files and use Ant to create our deployment packages.
  • Execute unit tests during the build. It's important to abort the deployment in the event of failing unit tests.
  • Use a continuous integration server. We use Hudson and have had great success with it. This allows us to not only deploy to all environments (DEV, SIT, UAT, PROD) with a single click, but also schedule builds and deployments throughout the day to ensure the entire delivery process is healthy.

Depending on your production environment implementing this can be fairly trivial or fairly complex. Here are a few more resources to get you started:

Both of these resources should give you enough ideas to create your own process.

1

We use a Git repository coupled with Webistrano.

Git allows for the developpers to manage their code in a decentralized fashion and with all the advantages of a VCS.

Webistrano allows the developpers or appropriate managers to push the code onto a developpement platform then onto the production platform by just clicking into a web interface. It is a tool designed for RoR environments but it will work with a little customization in just about any environment. Another advantage of Webistrano is that it allows for easy rollbacks in case of deployment failures which is a very nice feature.

As a sysadmin, I can't live without webistrano any more. It allows me to stop worrying about developpers (or sysadmins !) doing stupid things to production servers during the deploy. It is automated and straight forward. One other big advantage is that developpers don't need a sysadmin to push code in a clean way, they just click along.

More info on Webistrano : here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .