By Goavega StaffOn 24 August 2017

This is continuation of last post around hosting Linux web apps on Azure using Docker containers.

Our current front-end deployment pipeline on the VMs has been:

  1. $ npm update on wp-content/themes/our-theme

  2. $ bower install

  3. $ gulp build –production

Since we were now on Web Apps instead of VMs, we had to get these deployment steps into Web App. Based on (not-so-extensive) Web Apps continuous deployment guide on Azure, if there’s a need to customize the deployment process we need to make use of custom kudu deployment script. The deployment script should be part of the source repository and there should be a .deployment file which links to this deployment script. During deployment, kudu will invoke this custom script instead of the built-in kudu script (which pretty much just does a xcopy). Below is a sample .deployment file: [config] command = bash

Another important aspect to remember is that kudu scripts are executed in “kudu container” which is not same as the custom docker container that is running the application, this means that all deployment tools should be installed in kudu container via the deployment script and not the actual container running the app. In our case, it meant we needed bower and gulp installed installed on kudu container. kudu does a smart copy between different git versions, which means – it only copies the delta (and deletes the files which are deleted from git). kudu also has its own ignore pattern (which required us to read through their code to figure out) to ignore files while copying. kudu also exposes environment variables which can be used in the custom deployment script. Some of the important ones are:

  • $ARTIFACTS – where the kudu pulls the files from git

  • $NEXT_MANIFEST_PATH – this is the file that kudu creates which has list of all files downloaded via git

  • $PREVIOUS_MANIFEST_PATH – contains list of all files downloaded via git in previous deployment, this and NEXT_MANIFEST_PATH allows kudu to do a delta copy

  • $DEPLOYMENT_TARGET – where the files need to be deployed

Below is the custom deployment script which installs bower, gulp, and deploys the files to the deployment folder:

[gist httpss://][/gist]

We had quite a few trouble in getting kudu deployment to work initially –

  • We did the initial deployment for testing without using custom scripts, this caused kudu to create the default deployment script. After we included our custom deployment script, kudu refused to use that instead. We had to manually delete the auto-generated kudu scripts first using kudu console

  • It would randomly timeout, generally re-queuing the deployment solved it

Overall, kudu is a good CD choice if you don’t have a complex build steps (for which Visual Studio Builds are perhaps better choice) given that it is supports Web Apps (once you work your way around its idiosyncrasies).

#azure #webapps #projectkudu #continuousdeployment #linux

Redefine customer journey and user experiences through Goavega's Cloud solutions-driven digital transformation.