Introduction
Azure App Service is a product offered by Microsoft Azure that offers the deployment of web applications in a Docker container on an Azure Virtual Machine. In its current configuration, the product comes in two flavors:
- Deployment from code
- Deployment from a Dockerfile
In the case of "Deployment from code", the material inside of the folder to be deployed is zipped and automatically packaged into a Dockerfile.
For more information: Quickstart: Create a Python app - Azure App Service | Microsoft Docs
Using the Web Licensing Service with Azure App Service
Since machine-based licensing is not available in a dockerized environment, the Docker container has to receive a token that authorizes it to run Gurobi. The Web Licensing Service (WLS) provides such a token that is renewed in fixed intervals.
In case of deployment from a Dockerfile, it is quite straightforward to either put the gurobi.lic file in the default location or to choose an alternative location and set the GRB_LICENSE_FILE environment variable (see here).
However, if you deploy directly from code, then you do not have access to the underlying configuration options used in the Dockerfile. Therefore, you should set the license parameters via the API. For Python, this may look as follows:
import gurobipy as gp options = { "WLSACCESSID": "access-id", "WLSSECRET": "secret", "LICENSEID": "license-id", } with gp.Env(params=options) as env, gp.Model(env=env) as model: # Formulate problem model.optimize()
Comments
0 comments
Article is closed for comments.