Best way to deploy/update web production code
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
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:
- A video on continuous delivery
- A book on continuous delivery
Both of these resources should give you enough ideas to create your own process.