How ConDep came to life

imageSome people have asked me how ConDep came to life. Here’s the short story…

ConDep had several incarnations before it ending up as a DSL as today. The first version I created at Frende (where I work and where ConDep also came to life) was a set of PowerShell scripts and WebDeploy executing from a build server (TFS back then) (there’s a Hanselminutes interview where I talk about that experience). 2nd version was a web application using PowerShell Remoting and WebDeploy Packages to push applications on demand (one click deployent). That worked for a while, but didn’t scale and was not flexible. 3rd attempt was creating a set of custom providers for WebDeploy which didn’t work at all. And finally, the 4th attempt, about 3 years after the 1st, ConDep started to come to life. The breakthrough was when I found a decent way of using the WebDeploy API in .NET to automate deployment and execution.

When I figured out how to do PowerShell over WebDeploy’s runCmd (remote cmd.exe) I had solved the 4 most pressing issues:

  1. Remote DOS (cmd.exe) execution over HTTP/HTTPS
  2. Remote PowerShell executing (without PS Remoting) over HTTP/HTTPS
  3. Decent deployment for files, directories and web applications that was not XCopy and also over HTTP/HTTPS
  4. Built-in intelligence of how to work the load balancer during deployment.

Some have also been surprised that an open source framework like this come out of a Norwegian insurance company. For me and for my coworkers (I hope) this is not surprising at all. First of all we use a number of open source frameworks and tools on a day-to-day basis and value them greatly, but most importantly solving deployment issues and technical time to market is not my company’s main focus area. So it made perfect sense to push this out to the community, get feedback and hopefully get help and input shaping it to become much better than we could ever figure out on our own. And in all fairness, I’ve created the majority of ConDep on my own private time, but couldn’t have done that without the challenges and experience I’ve got from where I work, and not to forget feedback and challenges from co-workers.

Have you tried or are using ConDep? Let me know what you think!

Introducing ConDep

What’s ConDep?

ConDep is an open source, highly extendable Domain Specific Language for Continuous Deployment, Continuous Delivery and Infrastructure as Code on Windows.

What would I typically use ConDep for?

To effectively deploy web and other server type applications to Windows servers, together with it’s required infrastructure (like IIS, WebSites, AppPools etc).

Where can I get it?

Latest NuGet package: https://nuget.org/packages/ConDep/

Source: https://github.com/torresdal/ConDep

Who created it?

I did :-)

How do I get started?

There’s a Getting Started section over at http://con-dep.net that should help you get up to speed and there’s some sample projects on GitHub (https://github.com/torresdal/ConDep.Samples), but here’s a quick intro:

  1. Create a Class Library in Visual Studio (name it Deployment)
  2. Get ConDep from NuGet (ConDep not ConDep.Dsl)
  3. Create an ApplicationArtifact:
    using ConDep.Dsl;

    using ConDep.Dsl.Config;

     

    namespace ConDepSamples.DotNetWebAppWithInfrastructure

    {

        public class DotNetWebApplication : ApplicationArtifact, IDependOnInfrastructure<WebServerInfrastructure>

        {

            public override void Configure(IOfferLocalOperations onLocalMachine, ConDepConfig config)

            {

                //Deploy a Web Application to remote server(s)

                onLocalMachine.ToEachServer

                (

                    server => server.Deploy.IisWebApplication

                    (

                        sourceDir:      @"..\..\..\SampleApps\AspNetWebFormApp", 

                        webAppName:     "AspNetWebFormApp", 

                        webSiteName:    "ConDepSamples"

                    )

                );

     

                //Test that the Web Application works by executing a HTTP GET (failes if not HTTP Code 200 is returned)

                onLocalMachine.HttpGet

                (

                     url: string.Format("http://{0}:8082/AspNetWebFormApp/", config.Servers[0].Name)

                );

            }

        }

    }

  4. Create an InfrastructureArtifact

    using ConDep.Dsl;

    using ConDep.Dsl.Config;

     

    namespace ConDepSamples.DotNetWebAppWithInfrastructure

    {

        public class WebServerInfrastructure : InfrastructureArtifact

        {

            public override void Configure(IOfferInfrastructure require, ConDepConfig config)

            {

                require

                    //Install IIS with Asp.net if not present

                    .IIS(iis => iis.Include.AspNet())

     

                    //Add an Application Pool running .NET Framework 4.0 (.NET 4.0 must be installed and registered with IIS)

                    .IISAppPool("ConDepSamplesAppPool", appPool => appPool.NetFrameworkVersion(NetFrameworkVersion.Net4_0))

     

                    //Create a Web Site (id 34) on port 8082 and asociate with application pool.

                    .IISWebSite("ConDepSamples", 34, opt => opt

                        .AddHttpBinding(binding => binding.Port(8082))

                        .ApplicationPool("ConDepSamplesAppPool"));

            }

        }

    }

  5. Create a config file (dev.env.json) and point to one or more servers you want to deploy to:

    {

        "Servers" :

        [

            {

                "Name" : "jat-web03"

            }

        ],

        "DeploymentUser": 

        {

            "UserName": "torresdal\\condeptest",

            "Password": "ReallySecureP@ssw0rd :)"

        }

    }

  6. Build
  7. Open cmd.exe and navigate to your bin/debug folder
  8. Execute: ConDep.exe Deployment.dll dev DotNetWebApplication

Feedback is welcome :-)

Enjoy!

Lightning Talk: Why you shouldn’t track bugs

I did a lightning talk at the Roots conference back in April titled “The simplest solution to bug tracking: don’t!”. The 6 minute talk is now online at Vimeo.com together with the other lighting talks at Roots.

How Do We Track Bugs? Check In a Failing Test!

I’ve always tried to avoid bug tracking tools and have several times deleted the entire content in such tools (reported bugs) to great success. However, that’s not what I want to talk about here, but if this sounds weird to you go check out Gojko’s post on the subject.

What I want to talk about here is one issue that came up during my team’s retrospective meeting on Friday. One of the improvement points that came up was bugs. Not that there where too many or that we should find more, but that some bugs where fixed and then reappeared as bugs again on a later stage. The suggested solution was: Instead of having the tester pull the buggy story from test and back into dev, he would write a test (integration or unit) that would replicate the bug and check it into source control.

Since we’re doing Kanban, what would the effect of the above action be? It will effectively stop the “assembly line”. In practice CI will report a failing test and the team will stop what they are doing to fix the failing test.

This is of course something we’ll adopt for all bugs, not just bugs that gets reported twice. I’ll leave it up to you to figure out all the benefits (and drawbacks if any) as well as why this solves our problem at hand. I’m looking forward to see how this will work out in practice.

Stepping Down from NNUG Bergen, Still Chairman of NNUG National

I’ve been chapter lead of NNUG Bergen for 4,5 years now, together with a great group of people. I think we have accomplished a great deal. We’ve managed to attract some great developers in the local community to attend and participate in our meetings and discussions, as well as local, national and international speakers doing presentations and being social. When I now step down, it does not mean things are slow and boring. On the contrary, I’m confident NNUG Bergen will still progress towards an even greater community. For me personally I have too much going on and something needs to be sacrificed – and I believe NNUG Bergen will benefit from a change of “leadership”.

For your information the current NNUG Bergen board consist of: John St. Clair, Torbjørn Marø, Øyvind Fanebust and Thomas Pedersen – a great representation of the .NET community in Bergen!

We have yet to announce who’s taking over after me, but we have many possible candidates, and I’m sure that person will continue the success of NNUG Bergen.

I will still be involved in the community though, attend meetings, present (if they allow me) and I will still keep the chairman role of NNUG National. Hopefully now get some more time to focus on tasks related to some of the National activities. Did anyone say a new website would be in order? Smile That’s one of the things we’re going to sort out going forward.

If you know somebody that you think should be part of the board in NNUG Bergen or a candidate for chapter lead, drop me an email and I’ll make sure to forward it to the others.

See you at NNUG!