dropkick – an idea for deployments

Still very rough, but I have the DSL compiling and looking at making file copy work. This is more than anything an exercise in building a framework that uses the same structure as the MassTransit Sagas.

public class TestDeployment :
        Deployment<TestDeployment>
    {
        public static Part Web { get; set; }
        public static Part Db { get; set; }
        public static Part Service { get; set; }

        //dropkick r:role(web,db,service | full)
        static TestDeployment()
        {
            Define(() =>
                {
                    During(Web, (p) =>
                        {
                            p.OnServer("WebServer")
                                .IisSite("Apps")
                                .VirtualDirectory("dashboard")
                                .Verify()
                                .CreateIfItDoesntExist();

                            p.OnServer("SrvTopeka19")
                                .Msmq()
                                .PrivateQueueNamed("mt_subscriptions")
                                .CreateIfItDoesntExist();

                            p.CopyFrom(@".\code_drop\dashboard\**\*.*").To(@"\\webserver\apps\dashboard\")
                                .And((f) =>
                                    {
                                        f.WebConfig
                                            .ReplaceIdentityTokensWithPrompt()
                                            .EncryptIdentity();
                                    });
                        });

                    During(Db, (p) =>
                        {
                            p.OnServer("sql")
                                .SqlInstance(".")
                                .Database("dashboard")
                                .Verify()
                                .BackupWithLightspeedTo(@"\\sql\\backsups\")
                                .RunTarantinoOn(@".\code_drop\dashboard\sql");
                        });

                    During(Service, (p) =>
                        {
                            p.OnServer("WebServer")
                                .WinService("dashboard service")
                                .Verify()
                                .Do(() =>   //auto-stop
                                    {
                                        p.CopyFrom(@".\code_drop\dashboard").To(@"\\webserver\apps\dashboard-service")
                                            .And((f) =>
                                                {
                                                    f.AppConfig
                                                        .ReplaceIdentityTokensWithPrompt()
                                                        .EncryptIdentity();
                                                });
                                    });        //auto-start
                        });

                });
        }
    }

About Dru Sellers

Sr. Software Engineer at Dovetail Software.
This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://codebetter.com/members/drusellers/default.aspx drusellers
  • http://bradygaster.com brady gaster

    I’d like to see an approach like this on top of (serving as a public API for) the MHS code that exists for hosters. That’d be a dream. Any chance you’d release the interfaces for this DDD spec so that developers could write their own implementations?

  • http://n/a Pavel Nikolov

    Awesome! I can’t wait to play with the API. This is the best article in my RSS reader for the last month : )

  • http://www.anydiem.com Sean Scally

    I dig the API. I’ve never found any decent deployment automation tools for the .NET ecosystem. I was hoping maybe someone would port Capistrano from Ruby to C#, but this might be just as good.

  • http://codebetter.com/members/drusellers/default.aspx drusellers

    yeah, I have the intent to add configuration. It just would have made the example alot more obtuse (i thought anyway) but yeah, I would assume either a structuremap style or a configuration object of some sort. :) good idea!!!

  • Jeremy Wiebe

    I might not have caught the full intent of the DSL, but in order for it to be re-usable, it might be handy to be able to pull values from the deployment’s app.config a la StructureMap.