Skip to content

Azure hosting

Anders Fredrik KiΓ¦r edited this page Sep 5, 2019 · 2 revisions

Webviz application hosting on Azure

This guide show you step by step how to deploy and host a Webviz application on Azure.

🚧 Content is under construction and not verified for production.

🐳 Create an application (with premade example content)

  1. Go to https://portal.azure.com and log in.

  2. Click on Create a resource.

    image

  3. Select Web and then Web App for Containers.

    image

  4. Fill in the required settings under the Basic tab.

    • Subscription: Select the resource subscription....
    • Resource Group: ...and the subsequent resource group you want the application cost to be allocated to.
    • Name: Choose your wanted application name (which also becomes the first part of the URL-address for the application). A βœ”οΈ appears if the name you type is available.
    • Publish: Choose Docker image
    • Operating system: Choose Linux
    • Region: Choose an appropriate region. You usually want to choose a region physically close to the majority of the end users, but also, ensure that all data owners consent to the content of the application being stored on Azure in the chosen region, if applicable.
    • Linux Plan: Choose an appropriate cost/resource plan. For an overview of app service plans, see https://azure.microsoft.com/en-us/pricing/details/app-service/linux/. Simple applications with low traffic can e.g. choose one of the basic service plans (B1-B3).
  5. Flip over from the Basic tab to the Docker tab. Choose the following settings:

    • Options: Single Container
    • Image Source: Docker Hub
    • Access Type: Public
    • Image and tag: webviz/example_image:latest
  6. Flip over from the Docker tab to the Review and create tab. Review your settings and then click Create. The deployment of your initial example app will now begin (it can take a couple of minutes). When the page says Your deployment is complete click on Go to resource.

πŸŽ‰πŸŽŠ Your application is now deployed. You should be able to see the URL link to the application in the top right area in the resource overview (usually something like https://(YOURAPPNAME).azurewebsites.net). Go there and verify that the example Webviz application is running (it might take a couple of minutes the first time before it appears). πŸŽŠπŸŽ‰

πŸ“– Add logging

It is useful to have a log available in case somethings go wrong. To enable application logging, click on App Service Logs in the left menu of the app resource overview:

image

From there, select

  • Application Logging: File System
  • Quote (MB): Default value or something you select.
  • Rentention Period (Days): Number of days you want the log to be stored.

Click on Save and you have enabled application logging πŸ“–

πŸ”‘ Add authentication

Your application from the previous step is currently completely open. No authentication is necessary to browse the application. However, adding authentication is easy using built-in Azure functionality.

  1. From the app resource page (where you ended the previous task) click on Authentication / Authorization and then select the values shown here:

    image

  2. Then click on Azure Active Directory: Not configured. and choose the values shown below. Note however that the value under Create app should not be someflaskapp, but rather either the default value you were provided, or a unique name of your choise regarding the AD app registration you now are creating.

    image

    Click Ok and then Save.

  3. We need to do some small changes to the default settings. Click on image in the menu to the far left and then on image in the menu that appears. Search for the app registration you just made and click on the resulting row.

  4. Click on image and choose the following values:

    • Enabled for users to sign-in: Yes
    • User assigment required: Yes Then click on Save.

You have now enabled authentication πŸ”‘ You can check this using e.g. incognito or private tabs in your browser, and go to your previously deployed application.

Note that there is a potential bug in Azure, so you might see the message below when logging in, in which case an Omnia administrator must approve the application.

image



🚧🚧 To be changed 🚧🚧

There is an open issue regarding Azure web app containers using Docker compose. When that is resolved, step 5) above can be replaced by this:

  1. Flip over from the Basic tab to the Docker tab. Copy the snippet below into a file and temporarily save it on your computer. You can choose any filename, but the file extension should be .yml:

    version: '3'
    services:
      web:
        image: webviz/example_image:latest
        cap_drop:
         - all
        ports:
         - 80:5000

    Set the options as shown below (under Configuration file you upload the file you saved the snippet to):

    image

    You can now delete the file you temporarily saved locally.