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!