Deploying .NET applications with Chef

3a05235ac9d98378afddbaf95c0d1f6f?s=47 Milos Gajdos
September 04, 2014

Deploying .NET applications with Chef

Slides from the London Infracoders meetup on deploying .NET applications with Chef.

Rather than diving too much into technical details, the slides will provide a high overview of the solution we came up with as well as few tips and reflections on various Windows automation topic.

3a05235ac9d98378afddbaf95c0d1f6f?s=128

Milos Gajdos

September 04, 2014
Tweet

Transcript

  1. Deploying .NET applications with Chef Infracoders London, #infracoders 4th September,

    2014
  2. About me… • Ex-Rackspace, couple of startups in UK and

    abroad • Professional (technology) ranter - Ops guy • Programming language tourist, currently in love with Go • I blog about Linux containers http://containerops.org/ • Currently freelancing • Twitter: @milosgajdos • Linkedin: http://uk.linkedin.com/in/milosgajdos
  3. Windows automation • Sucks! Fear not - things are improving!

    Rapidly! • Get ready for the world with almost NO standards • Having even basic Windows administration experience helps massively • You need at least basic knowledge of PowerShell or advanced Google skills, but ideally both!
  4. Very simple deployment pipeline

  5. Provisioning Windows servers tips • Bake your Windows AMIs -

    we used chef-solo (even better - use chef zero) to do the most time consuming stuff like installing IIS, cygwin + OpenSSH, etc. • Avoid installing too much stuff on your servers from scratch during provisioning - unless you have plenty of time or can afford to wait! • Access your servers via SSH - unless you understand RDP/ WinRM and have reliable clients (knife-ec2 --bootstrap-protocol ssh)
  6. Configuring Windows servers with Chef I. • Get familiar with

    the awesome windows, IIS and dsc cookbooks! • We wrote our own wrapper winsvc cookbook which: • installs MS .NET (versions 4 and 4.5) • installs MS Web Deploy • installs SQL Server CE • modifies various Windows registries • sets up Windows tasks (for scheduled jobs) ! • Majority of the above is baked into the AMI, but Chef resources in winsvc cookbook recipes are idempotent - useful to have the above recipes in run_lists of already running servers for upgrades triggered via Chef attributes
  7. Configuring Windows servers with Chef II. • Disable auto updates

    if you can - unless you enjoy some very unpleasant surprises! Find other ways to patch your servers. • Turn off Shutdown Tracker and IE enhanced security for both Administrators and Users - those are incredibly annoying! • Make sure you don’t open Remote Desktop access to the outside world - we controlled the access to RDP via AWS Security Groups
  8. Deploying .NET applications with Chef • chef-client + MS Web

    Deploy https://gist.github.com/milosgajdos83/b953462536dd52dedcdc • Deployments are idempotent - we don’t attempt to redeploy already deployed version to avoid unnecessary restarts: ! already_deployed = "((dir #{node['msapp']['deploy_path']}\\bin\\MsApp.dll).VersionInfo.FileVersion -eq \'#{version}\')" ! windows_batch "Deploy-MsApp" do code <<-EOH "#{node['msapp']['extract_path']}\\MsApp.deploy.cmd" /y EOH guard_interpreter :powershell_script notifies :restart, "iis_site[#{node['msapp']['iis']['site']}]" not_if "#{already_deployed}" end
  9. Useful links • https://github.com/opscode-cookbooks/windows • https://github.com/opscode-cookbooks/iis • https://github.com/opscode-cookbooks/dsc • https://github.com/Webtrends/ms_dotnet4

    • https://github.com/Webtrends/ms_dotnet45 • https://github.com/Novakov/cookbook_msdeploy • https://github.com/joefitzgerald/sqlce • https://github.com/opscode/knife-windows • https://github.com/opscode/knife-ec2 • http://foodfightshow.org/2014/01/were-doing-it-wrong.html