“Run-From-Zip” with Cake Kudu Client

A new way to deploy your Azure Web Apps and Function Apps

Mattias Karlsson
Feb 20, 2018 · 3 min read
Image for post
Image for post

Update! Since this post was written, there’s been some breaking changes to Azure App Services Run-From-Zip feature, this was fixed in Cake.Kudu.Client version 0.6.0 you can read more about that at the post below

A couple of days ago Azure announced that they in preview added a new way to do app services deployments called Run-From-Zip, which lets you deploy using a zip file.

Deploying using a zip file as been possible before, the difference with this new method is that the file isn’t extracted into the “wwwroot” directory, but instead the zip file mounted read only as “wwwroot”.

The zip file can either be hosted externally from the site or in a special folder on the app service itself, and the latter is now what the “Kudu Client” Cake addin now supports — enabling you to use this new method of deployment in your Cake build scripts.

Prerequisites

Image for post
Image for post

To enable Run-From-Zip deployments you’ll first need to set an application setting called WEBSITE_USE_ZIP, you either set this to an url when deploying from an external source, or in this case just set it to 1.

ZipRunFromDirectory

Naming things is hard, but the addin now has a method called ZipRunFromDirectory, which will do all the “heavy lifting” and deploy a local directory.

Example usage

So deploying a site using this new method just becomes a couple of lines of code

The file path returned, is the zip file deployed to the app service.

Behind the curtain

So what does actually happen here?
In a nutshell the method will:

  1. In memory zip source directory
  2. Push that zip to d:\home\data\SitePackages to a unique date stamped file name
  3. Push the filename of the zip to d:\home\data\SitePackages\siteversion.txt
  4. Via Kudu API call the site to ensure it’s up and right version deployed (a file called KuduClientZipRunFromDirectoryVersion.txt is included in deployed zip for this purpose)
  5. Return the remote path of the deployed zip
Image for post
Image for post

Closing thoughts

I’ve tried this for a couple of days now, and have found deployments to be very stable and quick. But really need some more testing to see what the implications of running this in production, how existing apps behave in a read only mode, etc.

This is a shiny new feature still in preview, general guidance and tooling support isn’t quite there yet, but as you seen with this post the primitives are in place to build upon and refine the experience in the future!

HackerNoon.com

#BlackLivesMatter

Sign up for Get Better Tech Emails via HackerNoon.com

By HackerNoon.com

how hackers start their afternoons. the real shit is on hackernoon.com. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Mattias Karlsson

Written by

Partner & Technical fellow at WCOM AB. Microsoft Azure & Developer Technologies MVP. Been coding since I 80’s (C128 & Amiga). Father of 2, husband of 1.

HackerNoon.com

Elijah McClain, George Floyd, Eric Garner, Breonna Taylor, Ahmaud Arbery, Michael Brown, Oscar Grant, Atatiana Jefferson, Tamir Rice, Bettie Jones, Botham Jean

Mattias Karlsson

Written by

Partner & Technical fellow at WCOM AB. Microsoft Azure & Developer Technologies MVP. Been coding since I 80’s (C128 & Amiga). Father of 2, husband of 1.

HackerNoon.com

Elijah McClain, George Floyd, Eric Garner, Breonna Taylor, Ahmaud Arbery, Michael Brown, Oscar Grant, Atatiana Jefferson, Tamir Rice, Bettie Jones, Botham Jean

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store