Automated Deployments

I found msdeploy a very helpful and powerful tool. It allows a user to deploy files to a remote server, to execute applications and control IIS. My issue with it is its complexity. I don't use it every day, each time I come back to it I have to Google all the settings and it takes some time to get things right. With that in mind I started to create a console application (Automated Deployments) to wrap up some of the complexities and expose them via the config file.

The application can deploy with either local or remote deployments. This helped developers set up their locally machines and CI servers deploying files to any application server, (be that local or remote). The console application can handle:

  • Give Full permissions to a given folder and its children for the given username.
  • Removing files from a destination location.
  • Setting up App Pools on a destination machine.
  • Setting up web sites on a destination machine.
  • Setting up applications on a destination machine.
  • Removing App Pools from a destination machine.
  • Removing web sites from a destination machine.
  • Removing applications from a destination machine.

Lets give you an example. The below configuration snippet will package an ASPNET website into a deployable zip package. It will next deploy the zipped package file to the destination server.

 <ConfigurationGroup name="deploy-site">
    <ValueItems>          
      <ValueItem key="DestinationComputerName" value="101.8.151.86:8173"/>
      <ValueItem key="DestinationContentPath" value="c:\websites-installer"/>
      <ValueItem key="DestinationUserName" value="administrator"/>
      <ValueItem key="DestinationPassword" value="THIS_IS_MY_PASSWORD"/>
      <ValueItem key="CleanUp" value="true"/>
      <ValueItem key="ForceInstall" value="false"/>
    </ValueItems>
    <Collections>

       <Collection name="PackageSite">
        <ValueItems>
          <ValueItem key="ComponentType" value="CreatePackage"/>
          <ValueItem key="SourceContentPath" value="..\Apps\Web\web.csproj" />
          <ValueItem key="InternalPath" value="C:\websites\dev" />
          <ValueItem key="ConfigurationType" value="DevDeploy" />
          <ValueItem key="OutputLocation" value="output\web.zip" />
          <ValueItem key="ZipFileOnly" value="true" />
        </ValueItems>
      </Collection>

      <Collection name="DeployPackage">
        <ValueItems>
          <ValueItem key="ComponentType" value="DeployPackage"/>
          <ValueItem key="SourceContentPath" value="output\web.zip" />
              <ValueItem key="TakeIisDown" value="true" />
        </ValueItems>
      </Collection>

    </Collections>
  </ConfigurationGroup>

The application can deploy either locally or to a remote server. The only difference would be the destination name. For a local deployment the DestinationComputerName value would be localhost were as remote would be the IP and port. For more detailed information feel free to visit Automated Deployments at Github.

Published: Sunday, 10 May 2015