Oslo based solution for deploying BizTalk applications
Since PDC I’ve been working on and off on an “Oslo” based solution for deploying a BizTalk application; unfortunately I couldn’t get a good chunk of time to play with this, so it’s been dragging a bit, but I’m getting close, so here are some details -
I’m a big advocate of automated builds; it’s a topic that probably deserves a post of its own, so I won’t get started on this here, but the idea is that one must have a way to be confident that, when its time to [re-]deploy the app, it will get deployed successfully time after time, without a hitch;
From my experience, deploying a BizTalk application of a decent size is often not trivial, and often it does not go smoothly if done manually (things are being missed, done out of order, wrong versions being picked up, etc), which does not help to boost the confidence in the solution (or BizTalk as a whole) in the organisation; automating the process can save a lot of time (can be done unattended, while in a meeting, out for lunch or overnight), save a lot of head scratching, boost the confidence in the solution and set the ground for proper automated builds, auto testing etc.
To that extent, I have previously built an MSBuild based framework for deploying BizTalk applications.
While I’m sure it does not suit all purposes as it was developed to support those scenarios I had, I think it’s quite comprehensive and had served me well over the past couple of years.
It allows one to provide an MSBuild-formatted file with some parameters and lists and, using the pre-created framework, would do things like remove the existing application (after terminating current instances and un-enlisting services), build the new solution(s), deploy assemblies to BizTalk, add/import binding files, start ports etc.
This is working great for us, and we’ve been using it extensively for quite a while now, but there’s one major downside – it requires one to maintain those MSBuild scripts.
Now - MSBuild is cool, I do like it very much, but as it’s generic – it does not speak in BizTalk terms, and as it’s XML – it’s quite verbose, and I wanted an easier format for all of us to work with.
So – inspired after seeing Oslo and even more driven after visiting PDC - I’ve decided to come up with an MGrammar based language for describing a BizTalk application to be deployed.
So far I’ve come up with “version 1.0” of my grammar that allows to describe the major artifacts in a BizTalk application and a basic runtime to process source files written in this language, the language allows you to describe things like -
- References to other applications
- Solutions and projects to build
- BizTalk assemblies to deploy
- Orchestrations contained in those (these can then be terminated before attempting to remove the application prior to deployment)
- .net assemblies to deploy
- Binding file to import
- Binding files to add (and the name of the environment to attach to those)
As Oslo hasn’t RTM-ed yet, I can’t quite rely on it yet, and so I cannot use it in production in any shape or form, or can I?
I found a good middle ground for us which allows us to gain from the benefits I’m hoping to get by using my language, while not exposing ourselves too much to the risks of using early technology –
At the moment the runtime I’ve built for this is used to generate the MSBuild scripts we’re already using out of the source files; in this way - if Oslo disappears tomorrow, or significantly changes (not that I think that’s going to be the case), we’re safe – we still have the MSBuild scripts as “checked-in artifacts” and so we have lost nothing.
So – how does an instance of my language looks like? here’s an example:
//add references to other applications
add reference SomeOtherApp;
add reference AndAnother,andAThird;
//build the solution
//add required biztalk assemblies
add biztalk assembly "SomeFolder\SomeOtherFolder\bin\deployment\Schemas.dll"
add biztalk assembly "SomeFolder\SomeOtherFolder\bin\deployment\Maps.dll"
add biztalk assembly "SomeFolder\SomeOtherFolder\bin\deployment\Orchestrations.dll"
//and .net helpers assembly
add assembly "SomeFolder\SomeOtherFolder\bin\release\HRG.FareWatch.Hotel.Helpers.dll"
//import dev bindings
import binding "SomeFolder\SomeOtherFolder\Bindings.xml";
//add various environment's bindings.
add binding "SomeFolder\SomeOtherFolder\Bindings.Dev.xml" "development";
add binding "SomeFolder\SomeOtherFolder\Bindings.Stage.xml" "stage";
add binding "SomeFolder\SomeOtherFolder\Bindings.Prod.xml" "production";
as I’ve said – I already have a runtime that generates the MSBuild scripts required to deploy these - the runtime outputs several files to the temp folder -
- The “framework” MSBuild script that contains all the targets I’m using
- The Microsoft.Sdc.Tasks.BizTalk.dll and the Microsoft.Sdc.Tasks.dll which contains many useful custom tasks.
- The relevant import file for the SDC tasks
- The generated MSBuild file that contains all the various artifacts based on the source code
That latter file, which is the equivalent of my source code, and what we had to maintain so far, looks like -
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="DeployAll">
<Import Project="Deploy.Framework" />
<MyApp Include="SomeOtherApp" />
<MyApp Include="AndAnother" />
<MyApp Include="andAThird" />
<!-- Set for a remote deployment -->
<!-- Deploying BizTalk Server name - leave blank if local-->
<!-- not currently supported by runtime-->
<!-- Deploying BizTalk Server database - leave blank if BizTalkMsgBoxDb-->
<!-- Deploying BizTalk Server SQL user name - leave blank if local-->
<!-- Deploying BizTalk Server SQL password - leave blank if local-->
Would you agree that the former source code is easier to maintain?
note: one thing you would notice is that none of the paths contains a root; I assume that this would be used by different developers/IT pros which may have the code in a different path; however, as the assumption is that the code will come from source control, my framework script expects you to provide the root path to your source code and assumes the specified paths start there.
So – what’s next?
From a coding perspective - I plan to add support in my runtime to perform the actual deployment; this is I would like it to do once Oslo is in production so I’ll add it as an option through a command line switch.
This option would tell the runtime to deploy the artifacts to a specified BizTalk server using BTSTask or the Object model instead of generated the MSBuild script.
I also want to make some modification to my language definition to make the MGraph produced cleaner (and better geared towards using the repository and Quadrant at a later stage) as well as, obviously, add support for more features, after which I plan to publish both my language and the runtime somewhere (here, codeplex, DevCente..we’ll see)
I’ll post some more notes on all of these here in the near future hopefully…