Tag: Linux

ContainersDevelopmentInfrastructure

Deploy Docker Containers to Azure Web Apps on Linux

The PaaS (Platform as a Service) offerings within Microsoft Azure have been getting expanded out pretty impressively lately. The “extreme PaaS” that is the serverless computing of Azure Functions is a really interesting direction for cloud computing. However, one of the of the latest changes is the ability to host Docker Containers on Linux within Azure App Service Web Apps! It seems Microsoft is starting to add Docker support to everything.

App Service Web Apps on Linux

A few weeks ago the initial preview release of Azure App Service Web Apps for Linux was released. This offers a way to host OSS applications (Node.js, Python, PHP, etc) in Azure App Service with the use of a Linux Virtual Machine (VM). This provides a great alternative to hosting all Azure Web Apps with a Windows Server VM and IIS. While IIS works, the option of using Linux is definitely more appealing to Linux and non-Microsoft developers looking to use the Microsoft Azure cloud.

To provision a new Azure App Service Web App on Linux, you can follow these steps:

  1. Within the Azure Portal, search the Marketplace for Web App on Linux.
    azportal_webapponlinux_marketplace
  2. Enter the App nameResource Group, and select an App Service Plan to create the Web App on Linux.
  3. Next a specific Container needs to be selected in order to configure the specific Language / Platform that will be used to deploy a Web App to the Web App on Linux App Service instance.
    azportal_webapponlinux_pickbuiltincontainer
  4. Once provisioned the new Web App on Linux will be deployed out to an Ubuntu Linux VM with the specified platform container deployed and ready to go.

As you can see from the above screenshot of the available Built-in containers to choose from there are a number of Language/Platform versions to choose from. The list of language/platform versions supported by the current Preview release of Azure Web Apps on Linux are:

  • .NET Core v1.0
  • Node.js 6.6.0
  • Node.js 6.2.2
  • Node.js 4.5.0
  • Node.js 4.4.7
  • PHP 5.6.23
  • PHP 7.0.8

There’s also another thing that can be seen within the above screenshot…

Azure Web Apps + Docker

webapplinux-dockercontainerThe platform features of Azure App Service Web Apps on Linux support the deployment and configuration of the hosting environment through the use of Docker Containers. This is a huge departure and powerful feature addition to Azure Web Apps on Linux that differs from how the original Azure Web Apps hosted with Windows Server and IIS is implemented.

The use of Docker Containers to configure and host Web Apps on Linux opens up a huge amount of possibilities that help push Azure Web Apps to a more powerful service than before. The Built-In Containers that can be chosen to host Node.js, PHP, or .NET Core applications are built out as Docker Containers.

With the support for Docker Containers bring along the ability to deploy any Docker container image from Docker Hub (http://hub.docker.com) as the basis for hosting an Azure Web App on Linux. Not just Node.js, PHP, or .NET Core images can be deployed. It actually supports the deployment of any Docker Container Image from Docker Hub. It also supports both Public and Private images in Docker Hub.

azportal_webapponlinux_dockerhubcontainer

In addition to supporting any Docker Container Image from Docker Hub, Web Apps on Linux also supports deploying container images from any Private registry as well. To deploy an image form a private registry, you simply provide a couple additional properties: Server URL, Login username, and Password.

azportal_webapponlinuxprivateregistrycontainer

The Docker Container Images used to deploy out the language / platform to host an app can be used to simply host a Web App as normally with Azure Web Apps. However, the Docker Container Image can also contain the entire application to host within Azure Web Apps on Linux; including the language / platform and the full custom application as well.

Deploy “Hello World” Container to Web App on Linux

As an example of a Docker Container Image that can be deployed to Azure App Service Web App on Linux that contains the language / platform as well as a sample, “hello world” style application, the following Docker Images can be used:

This is just a sample of a couple Docker images that can easily be used, and any Docker Image can be deployed out to an Azure Web App on Linux.

Here’s what the dimkk/ng2-admin Docker Image from Docker Hub looks like once it’s deployed out and hosted within a Web App on Linux instance:

webapponlinux_ng2-admin-running

To deploy out a Docker Image from the Docker Hub, you can use the following steps when provisioning a new Web App on Linux, or when modifying an existing Web App on Linux:

  1. For the Image source property, select Docker Hub.
  2. Specify Public or Private accordingly for the Repository Access field.
  3. Enter the Docker Image Name into the Image and optional tag field.

To use the ng2-admin image you can specify the Docker Image of dimkk/ng2-admin”.

webapponlinux_ng2-admin_container

In this example, once the Web App on Linux initializes the deployment of the Docker Container image “ng2-admin” or another that implements a full application, the app will be running.

There is also the Startup Command field when configuring a Docker Container Image for a Web App on Linux to specify a specific startup command to execute once the Docker Container is deployed.

Infrastructure

Hosting Azure Web App on Linux

Since the introduction of Azure App Service and Azure Web Apps in early 2015, as well as the Azure Websites feature even earlier, the only option has been to use a Windows VM underneath to host Web Apps. That was until recently! Microsoft recently released a new feature into Preview that allows Azure Web Apps to be hosted on a Linux VM under the covers. With the availability of the Azure Web App on Linux Preview it’s now possible to choose either Windows or Linux as the host OS for the underlying VM Web Apps are deployed to.

With the availability of the Azure Web App on Linux Preview it’s now possible to choose either Windows or Linux as the host OS for the underlying VM Web Apps are deployed to.

Provisioning an Azure Web App on Linux

Once logged into the Azure Portal (http://portal.azure.com), the “Web App on Linux” option is available within the Azure Marketplace when choosing what resource(s) to provision in an Azure Subscription.

Clicking on “+NEW” in the portal will reveal Web App on Linux under the “Web + mobile” section of the Marketplace, or by typing in “Web App on Linux” in the marketplace search.

azureportal_new_webapponlinux

azureportal_webapponlinux_provisioningOnce the Web App on Linux resource is chosen, the prompt to choose the settings for creating a new “Web App on Linux” deployment is almost identical to the options when creating a standard “Web App” deployment that uses the Windows OS. The App name, Resource Group, and App Service Plan are still required just the same, as well as the option to turn App Insights On or Off.

However, there is an additional option to specify. The additional option is the Runtime Stack. The Runtime Stack configuration is a required field that specifies the specific version of either Node.js or PHP that is necessary for the chosen deployment.

The available options (at least in the current Preview state of the service) for Node.js version are:

  • Node.js 6.6.0
  • Node.js 6.2.2
  • Node.js 4.5.0
  • Node.js 4.4.7

The available options (at least in the current Preview state of the service) for PHP version are:

  • PHP 7.0.8
  • PHP 5.6.23

It’s worth noting that even though the PHP or Node.js version needs to be specified when creating a new Web App on Linux resource, the version can be changed later on within the Application settings for the Web App. It is also possible to switch the configuration from Node.js to PHP or the other way on an existing Web App on Linux resource as well.

Supported Regions

Since the Web App on Linux service is currently in Preview, it’s not supported to be deployed out to all Azure regions just yet. This is part of the standard way with how Azure Preview services are rolled out and eventually deployed across the Microsoft Azure Platform. First, Preview services are rolled out to only 1 or a few Azure regions / locations. Then, later on, once the service reached General Availability (GA) the service will be rolled out to be supported across the rest of the Microsoft Azure regions / locations.

It the current Preview state of the Web App on Linux support, the service is available in the following 3 regions:

  • West Europe
  • Southeast Asia
  • West US

Pricing Plans

While it’s expected that Web Apps on LInux will eventually receive the same App Service plan Pricing tier support once the service reached General Availability (GA), the current Preview doesn’t support all the same pricing tiers just yet. Currently, it supports a few of the Pricing tiers for the smaller Instance Sizes which still give plenty of options to use this new Preview service.

Here’s the list of the currently supported Pricing tiers for the Web App on Linux Preview service:

  • Standard S1 (1 Core, 1.75 GB RAM)
  • Standard S2 (2 Cores, 3.5 GB RAM)
  • Standard S3 (4 Cores, 7 GB RAM)
  • Basic B1 (1 Core, 1.75 GB RAM)
  • Basic B2 (2 Cores, 3.5 GB RAM)
  • Basic B3 (4 Cores, 7 GB RAM)

webapponlinux_preview_pricingtiers

As can be seen in the above screenshot of the Pricing tier options, there are many standard features of Azure Web Apps supported.

  • Up to 50 GB Storage
  • Custom domains
  • SSL Support
  • Up to 10 instances
  • Daily backup
  • Up to 5 Deployment Slots

Each of the Azure App Service Pricing tiers for the Web App on Linux Preview service also shows a listing of “Preview Pricing” for both the Standard and Basic pricing tiers. This indicates that the pricing of the Web App on Linux service while it’s in Preview is actually charged at a 50% discount of the prices shown. The price displayed for the Standard S2 tier is $89.29 USD, so with the 50% discount, the price you’ll pay to use a Standard S2 instance with the Web App on Linux Preview will actually be $44.65 USD.

Linux App Service Plan

When provisioning a Azure Web App, whether a “standard” Web App or a Web App on Linux, there needs to be an Azure App Service Plan provisioned. The App Service Plan is what determines the Pricing tier and each App Service Plan can be used to host 1 or more Web Apps. There is however a difference between the App Service Plans.

An App Service Plan for a Web App for Linux resource can only be used to host other Linux based Web Apps, and an App Service Plan for a “standard” Web App resource can only be used to host Windows based Web Apps.

While a Web App or a Web App on Linux can be provisioned, the starting point you use (which of these that’s chosen to start provisioning) will determine the NEW App Service Plan that gets created. A Web App, as it’s hosted on a Windows VM underneath, will have a Windows based App Service Plan provisioned. A Web App on Linux, as it’s hosted on a Linux VM underneath, will have a Linux based App Service Place provisioned.

However, there’s one thing to be aware of when provisioning a new Web App if there are already both Windows based and Linux based App Service Plans running on an Azure Subscription. When a new Web App is created, although it will create NEW App Service Plans that support Windows, if an existing Linxed based App Service Plan is chosen as the App Service Plan to use for hosting the Web App, the resulting Web App that gets provisioned, since it’s configured to use a Linux App Service Plan, will in fact be a Web App on Linux instead. This is a seemingly small detail that needs to be kept in mind when provisioning both Web App and Web App on Linux resources within an Azure Subscription.

What distribution of Linux?

Since Azure Web Apps are a Platform as a Service (PaaS) service in the cloud, it does fully abstract away the underlying Virtual Machine (VM) and Operating System (OS) that is hosting the Web App. However, there are times when it’s useful to know what OS and Version is hosting something, and using the Kudu portal (which is available to all Azure Web Apps) it’s possible to gleam into what OS, Web Server, and other System Information of the underlying OS.

The OS that Web App on Linux resources / instances are running on is: Debian GNU/Linux 8 (jessie)

webapponlinux_prev_releaseinfo

Also, the web server running on the Web App on Linux resource / instances is: Apache/2.4.10

Here is some additional Environment / System information about the Linux VM underneath Web App on Linux instances.

System info

  • System up time: 3.17:07:04.9990000
  • OS version: Unix 4.4.0.38
  • 64 bit system: True
  • 64 bit process: True
  • Processor count: 1
  • Machine name: fc53b9b63c6f
  • Instance id: fc53b9b63c6f
  • Short instance id: fc53b9
  • CLR version: 4.0.30319.42000
  • System directory:
  • Current working directory: /
  • IIS command line: /usr/lib/mono/4.5/mod-mono-server4.exe –filename /tmp/mod_mono_server_default –applications /:/opt/Kudu –nonstop

Environment variables

  • APACHE_LOCK_DIR = /var/lock/apache2
  • APACHE_LOG_DIR = /var/log/apache2
  • APACHE_PID_FILE = /var/run/apache2/apache2.pid
  • APACHE_RUN_DIR = /var/run/apache2
  • APACHE_RUN_GROUP = www-data
  • APACHE_RUN_USER = www-data
  • APPDATA = /opt/Kudu/local
  • APPSETTING_SCM_USE_LIBGIT2SHARP_REPOSITORY = 0
  • APPSETTING_ScmType = None
  • APPSETTING_WEBSITE_AUTH_ENABLED = False
  • APPSETTING_WEBSITE_NODE_DEFAULT_VERSION = 4.4.7
  • APPSETTING_WEBSITE_SITE_NAME = linuxwebapp42
  • DEBIAN_FRONTEND = noninteractive
  • DOTNET_SKIP_FIRST_TIME_EXPERIENCE = true
  • HOME = /home
  • HOSTNAME = fc53b9b63c6f
  • HTTP_HOST = linuxwebapp42.scm.azurewebsites.net
  • KUDU_APPPATH = /opt/Kudu
  • KUDU_MSBUILD = /usr/bin/xbuild
  • KUDU_RUN_USER = 31c21a883af01a04cb9bd231
  • LANG = C
  • MONO_IOMAP = all
  • MONO_SHARED_DIR = /tmp
  • NUGET_XMLDOC_MODE = skip
  • PATH = /home/site/deployments/tools;/opt/Kudu/bin/Scripts;/usr/bin;/usr/bin;;;Microsoft SDKs/F#/3.1/Framework/v4.0;/usr/bin;/usr/share/npm;/usr/local/bin;/usr/local/bin;/usr/local/bin;/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/nodejs/4.5.0/bin
  • PWD = /
  • SCM_BIN_PATH = /opt/Kudu/bin
  • ScmType = None
  • SITE_BITNESS = AMD64
  • WEBSITE_AUTH_ENABLED = False
  • WEBSITE_NODE_DEFAULT_VERSION = 4.5.0
  • WEBSITE_SITE_NAME = linuxwebapp42

It’s worth nothing that anywhere the value “linuxwebapp42” is shown in the above settings / information that this is the Name of the Web App on Linux that was created and subsequently used to access all this information.

If you’re curious how the above Environment / System information was obtained, it was retrieved by using the Kudu portal. Kudu is the engine used behind the scenes for git/hg deployments, WebJobs, and various other features of Azure Web Apps. Every instance of Azure Web Apps (both Windows and Linux) have an instance of Kudu running that can be accessed through the Azure Portal or directly via its HTTP endpoint.

Open SourcePowerShell

PowerShell now Open Source AND Cross-Platform! Linux, macOS, Windows

Windows PowerShell the new Shell (first released in 2006) for Windows that provides the ability to implement Task Automation, and Configuration Management via a Command-Line Shell and PowerShell scripting language built on the .NET Framework. PowerShell is an extremely strong tool and has become a staple in managing various Windows systems from the OS to SharePoint to the cloud and Microsoft Azure. Today, Microsoft has officially released PowerShell cross-platform support via an Open Source project that supports Linux, macOS and Windows! Read More

Internet of Things

Microsoft Azure Certified for IoT Starter Kits and Platforms

Having trouble choosing what Arduino or Raspberry Pi hardware to use for getting started building Internet of Things (IoT) devices? There’s a lot of choices to navigate, and not all boards have integrated Wifi or Ethernet either. To help with this process, Microsoft has a few “Azure Certified for IoT” Starter Kits.  These kits provide the perfect platform to get started! Read More

Azure Weekly

Azure Weekly: May 30, 2016

The Azure Weekly series from BuildAzure.com brings a consolidated source for the weeks Azure news, blogs, and service updates. There is an incredible amount of things changing in the Microsoft Azure platform and ecosystem on a regular basis. The goal of this weekly list is to help keep up on all that keeps changing.

Service Updates

This is the list of Azure Service Updates announced by Microsoft for the week:

Read More