Enable AppOffline rule

Hi,

I’m using the new azure web app deployment step but I’m missing the use AppOffline rule (and path to the app_offline.htm) option. This is a great out-of-the-box feature from msdeploy http://www.iis.net/learn/publish/deploying-application-packages/taking-an-application-offline-before-publishing

Is there a different way to accomplish this? Will this option be available in a future release?

Hi Jeroen,

Thanks for getting in touch! You’re right, it should be reasonably easy for us to add support for app_offline.htm. I’ve added a GitHub Issue for this.

Hope that helps!
Mike

Hi Michael,

Cool, thanks!

Hi Jeroen,
I have just added support for app_offline.htm in the latest build of Calamari. It should go out with the next Octopus Deploy build 3.2.11 in the next few days.
To enable this feature you will be able to simply add the variable Octopus.Action.Azure.AppOffline and set it to "True". This will get passed along to Calamari and used in the deployment process.
Keep an eye on our releases page to see when you can start using this feature!
Thanks for dropping a line with this suggestion.
Cheers,
Rob

Hi Robert,

Good to hear! Is it also possible to specify the (relative) path to the app_offline.htm?

Hi Jeroen,

We haven’t added support for specifying the relative path to the app_offline.htm, we just enable the AppOffline rule when calling WebDeploy. At this point your app_offline.htm file will need to be in the site root.

After a quick bit of research through the WebDeploy world I haven’t found any reference mentioning you can specify a relative path to app_offline.htm. Do you have a reference for this feature of WebDeploy?

Hope that helps.
Mike

Hi Michael,

Sorry, you are right there is no option for that! Thanks for the quick response!

Hi Jeroen,

I was just talking to Rob, who worked on this feature, and he clarified for me the default behaviour of the AppOffline rule:

The way it works is if Web Deploy detects that a change needs to be made on the destination server, it will automatically drop a blank App_Offline.htm file into the root of the application folder. When ASP.Net detects that a file by the name of “App_Offline.htm” exists, it will automatically bring down the app domain hosting the application. When the publish process is completed, the App_Offline.htm file will be removed and the site will be online again. Taking an Application Offline before Publishing | Microsoft Learn

If you’ve got App_Offline.htm in the site root, web deploy will likely sync your custom file up and overwrite the blank one it created, thus using your custom page - but to be honest I haven’t tested the theory!

Happy Deployments!
Mike

It must be noted that it HAS to be a .htm and not a .html for the app to go offline

Hi Gavin,

Thanks for posting the clarification - I’ve updated all of the erroneous comments with app_offline.htm.

Thanks!
Mike

Wanted to contribute to this as I get a blank file in my deploys and it’s rather ugly. In my current version of Octopus () it shows “Safely bring down app domain by with blank app_offline.html in root”.

The offline feature is triggered by the presence of an app_offline.htm file and a note from Scott Guthrie said any changes to that file will trigger the reset.

So will Octopus use app_offline.html in the root of the nuget package and rename it app_offline.htm then back again during the deploy? Am I understanding this correctly?

Thanks

Hi Bil

Octopus does not natively support this (AFAIK), it’s an IIS feature for taking ASP.NET applications offline just by the presence of the app_offline.htm file in the root directory. There are is an Octopus Deploy Library template here https://library.octopusdeploy.com/step-template/actiontemplate-iis-change-app-offline if that’s what you’re referring to?

Or else you could use custom powershell to do this (which is how I do it), by deploying an app_offline.htm to the current IIS directory, then Octopus deploys to the new directory and switches IIS over then your app comes back online.

Gavin