Sunday, July 12, 2009

Begin with the End in Mind: Deploy Early

In many projects I've worked on the task of developing a deployment process is deferred until close to the release date. This is a bad idea. Deferring deployment-related decisions adds risk to a project as deployment to a target environment exposes development time assumptions and operational requirements that may need to be addressed by the engineering team before an application is released.

I suggest that a project develop (and use) a process to deploy the software to the target platform in the first iteration. Starting on deployment early gets you closer to the agile goal of shippable code at the end of each iteration.

Deployment is important, and something for which there should be a story in your process early on because:
  • Deployment is the first thing a customer sees, but it's only an enabler, it doesn't directly deliver value, so you'd like for the process to be efficient. Incremental improvement of the process is a great way to make it work well.
  • Design decisions can have an impact on the deployment and configuration process, and deployment models may suggest a different design
  • Thinking about deployment early means that you'll have an identifiable, repeatable process. this will make your testing process more valuable.
By a deployment process I mean the mechanism for delivering your software to, and making it usable by a customer (or intially to a QA Team), including any required configuration steps. This process can be as manual or as automated as you like, ranging from a zip file and a README, to a fully automated installer. You can start simple and automate more as you get feedback.

Developing a deployment process early can look like Big Design Up Front if you start out with too detailed of a process that involve guesses about things you just don't know at the beginning of a project. But remember: you can change the process as you learn. Start with a simple process and change and refactor the process as you go to make it more suitable to the target user's needs. You may discover that a manual process works well enough, or you may find that adding some automation make the process simpler and lower risk with little added cost. If you have a test team that is using the deployed artifact, you may find that you can leverage automation developed to support test related deployments and use it in your customer process.

Deploying early and often can also improve your architecture too, as deployment exposes issues about the system architecture that are easy to overlook in an development environment. How the application is designed affects how it can (and should) be packaged (and the reverse is also true). While another groups may be responsible for the operational aspects of deployment, the engineering team is responsible for making the process work in a real environment. Consider configuration as just one example. Using a build tool like Maven or Ant, it's a simple matter to keep a number of configuration files in synch by using filtering, and passing a property in to the build. Once you deploy a package that needs to be configured at a customer site, the fact that there are now many configuration files that need to be edited in the same way becomes an obvious source of wasted effort and possible error.

Even seemingly trivial issues such as how to configure logging in production to debug a problem can influence, the choice of logging framework. The sooner you see the problem, the easier it is to fix with less risk. Michael Nygard 's book Release It, covers some of these issues and is an excellent resource for information about how to build software that can be deployed into production effectively.

Like all things agile, you can start small, and take small steps towards the end result. They key things to consider are:
  • Packaging: have the build generate a deploy-able package. This can be used for Integration Testing, demo environments, and the like.
  • Configuration: understand what parameters need to configured and how to configure them. The first pass could be build properties that are filtered into configuration files. Move towards understanding what needs to be configured at deploy time at a customer site.
  • Requirements of the target platform and operations teams: How automated does the process need to be?
Even if you don't know all of the details of the production deployment, frequent early developments help you to understand what issues you need to decide, and which you can defer. And if you really do understand what you need to do, you may as well give it a try sooner rather than later. At best you'll be validated. At worst, you'll have lots of time to address issues.

2 comments:

Julian said...

Hi there,

Great post. Like the reference to the 7 Habits.

I think the point that most miss is that deployment and configuration concerns can and do change the way you write the code. I worked on a very complicated codebase that had loads of configuration strategies.

It was only when we started deploying the app constantly and trying to tune different parameters that we realised just how broken the application was.

This app was developed and tested on standalone pc's for much of it's life and we only surfaced the issues long after some mistakes were made.

Steve Berczuk said...

Julian, Thanks for your feedback. I think there are many reasons that teams don't realize the relationship between deployment and the architecture. A big one is that many "release engineering" tasks are thought of as a separate discipline from designing and building software. Even one believes that different people should be doing the deployment work (I don't; the agile idea of generalizing specialists makes a lot of sense to me!) working on deployment early will expose the problems so that we can fix them. We'll get there. Agile methods have raised awareness of the value of everyone testing early. Everyone deploying should follow soon.

Lessons in Change from the Classroom

This is adapted from a story I shared at the Fearless Change Campfire on 22 Sep 2023 I’ve always been someone to ask questions about id...