Deploying a Python API to Azure App Services - azure

I have a client with an existing API built in Python 2.7.6. Currently it's Dockerized (Docker v1.16(?)) on some VMs at another host. I have seen several posts about putting Python natively on azure app services but I am no expert at either Docker or Python so I wanted to know a couple things:
Can we natively push Python (2.7.6) to azure app services? or would
we need something like Docker?
This Docker version is (apparently) quite old - is it easy to update
this?
If I needed to Dockerize this what SKU on Azure would I need to
procure? I suspect this would not be a standard S1 web app running
Linux?

Following link explains creation of app services using docker hub image:
https://learn.microsoft.com/en-us/azure/app-service/containers/quickstart-docker-go
More detailed explanation:
https://learn.microsoft.com/en-us/azure/app-service/containers/tutorial-custom-docker-image
You can also use webapp on linux to deploy your python app directly:
https://learn.microsoft.com/en-us/azure/app-service/containers/quickstart-python
If you are using direct deployment, use Webapp for Linux, rather than Webapp for windows. Windows based webapp are mmore suited for dotnet based applications

Related

Orocrm in Docker in Azure

I would like to deploy Orocrm community edition in Azure in web service or Azure docker container and Azure MySQL. I'm looking for good working documentation
Thank you very much!
The application requires a lot of services. At least database (mysql), web server (nginx), php interpreter (php-fpm), consumer services, websockets, etc.. In the docker paradigm, these should be separate containers. The documentation describes a typical setup, what should be done from the application side. If you want some non-standard installation, you will have to adapt it yourself.
We are currently developing the ability to run in containerized environments. But there are a lot of them and there will not be a single approach. And it's hard to meet all the requirements.

Azure App Service suddenly stopped with PhantomJS error

We have a Restify API running in Azure App Service on Linux for a while now. Suddenly this app (both test and prod, they run as seperate apps) stopped working. Based on the logs the error is related to a package we are using node-highcharts-exporting which is dependent on PhantomJS. App Service is using Node 8.1.
We tried re-deploying the code, upgrading node version to 8.12 (do not want to use latest version with out testing) but still no luck.
Deployment Logs: (This part is successful. This is just for reference)
Container logs: (Startup fails here)
Tried to replicate the same environment on-prem and everything works fine. Created a new App Service which is also running into same issue. Any help is much appreciated.
Update 1:
I think I figured out what is happening. This is related to font libraries on linux https://github.com/ariya/phantomjs/issues/10904
I need to install libfontconfig but this is not supported on Azure App Service.
Yes, it is due to sandbox restriction on a App Service. Just to highlight, the standard/native Azure Web Apps run in a secure environment called a sandbox. Each app runs inside its own sandbox, isolating its execution from other instances on the same machine as well as providing an additional degree of security and privacy which would otherwise not be available.
Not supported scenarios on standard App Service - PhantomJS (/Selenium): tries to connect to local address, and also uses GDI+.Known issue for all PDF generators based on wkhtmltopdf or phantomjs: custom fonts are not rendered (system-installed font is used instead) because of sandbox GDI API limitations.See App Service GitHub sandbox page.
Based on your requirement, however you could use a custom container in App Service (You can use a custom Docker image) that lets you make OS changes that your app needs.
Checkout these document for more details on this topic:
Run a custom Linux container in Azure App Service (You can use a custom Docker image): https://learn.microsoft.com/azure/app-service/containers/quickstart-docker
Run a custom Windows container in Azure (Preview):
https://learn.microsoft.com/azure/app-service/app-service-web-get-started-windows-container

Azure App service with or without docker

I have some experience in using azure app services without docker. I did worked on k8 with docker. Now I am seeing an option to deploy containers in azure app services. As per my understanding app services internally use container and orchestration engine. Now someone can explain why this new docker option in azure app services? How it is going to help? When to use this option? Why I should bundle it as docker(extra effort eventhough it trivial)?
Azure App Service on Linux (Web App with built-in images)
The built-in image option running on Linux is an extension of a current Azure App Service offering, catering to developers who want to use FTP or GIT, deploy .NET Core, Node, PHP or Ruby applications to Azure App Service running on Linux
All of the built-in Docker images are open sourced on GitHub and available on DockerHub
Now someone can explain why this new docker option in the azure app
services?
Web App for Containers is catered more towards developers who want to have more control over, not just the code, but also the different packages, runtime framework, tooling etc. that are installed on their containers.
Customers of this offering prefer to package their code and dependencies into containers using various CI/CD systems like Jenkins, Maven, Travis CI or VSTS, alongside setting up continuous deployment webhooks with App Service.
This way you can easily deploy and run containerized applications that scale with your business.
How it is going to help?
This will make sure that the environment that you use locally, is
exactly the same as the one in the cloud.
Just pull container images from Docker Hub or a private Azure
Container Registry and Web App for Containers will deploy the containerized app with your preferred dependencies to production in seconds.
Automate and simplify your container image deployments through
continuous integration/continuous deployment (CI/CD) capabilities
with Docker Hub, Azure Container Registry, and Visual Studio Team
Services
Automatically scale vertically and horizontally based on application
needs. Granular scaling rules are available to handle peaks in
workload automatically while minimizing costs during off-peak times
When to use this option?
If you are so passionate/familiar with Docker/container then you can
use the Azure App service with the container.
If you are planning to host all your container in ACS(Azure Container
Service)/GitHub Repository then this service might be useful
You can refer to this blog for more details

Any reason to use Azure Web Apps instead of Azure Web Apps for Containers?

I'm pretty new to Azure, so for the sake of learning, I have deployed Node.js applications in Azure both as Docker containers and Azure web apps on Linux. Since Azure web apps are containers anyway, is there any good reason why I should use them instead of my own containers, which I have better control over?
One problem I stumbled upon was that you have to take quite a few things into account with the preconfigured containers in Azure web apps, some of that described here. If I instead use my own Docker containers, I don't have to take the extra steps that are sometimes required to get your Node.js application with its dependencies up and running as an Azure web app.
Am I missing something, or is it as it now seems to me, less work to deploy my apps in Azure as Docker containers?
Sebastian
I am not 100% sure but I think there is a difference in the security updates of application SW (e.g. NodeJs). When you use a custom docker image you might be responsible for keeping the containers up to date.

Hosting existing node.js apps on Windows Azure

Is it possible to port existing node.js applications to Windows Azure platform? I currently develop on my Mac but will need to deploy the application to Windows Azure in a near future.
You may also want to check a video on Channle 9.
node.js on Azure : http://channel9.msdn.com/Events/Patterns-Practices-Symposium-Online/Patterns-Practices-Symposium-Online-2012/node-js-on-Azure
Yes it is very much possible. You may also need to consider to make changes to use Azure Blob storage where your node.js code is using local file system (if required). The deployment is very similar to any other Windows Azure App and one you have Azure SDK for node.js you can use powershell cmdlets to make your job easy.
Download Node.js SDK for Azure
https://www.windowsazure.com/en-us/develop/nodejs/
Here you can learn the basics to deploy node.js app to Azure:
https://www.windowsazure.com/en-us/develop/nodejs/tutorials/getting-started/
Porting node.js apps to Azure is possible but not yet a yes/no answer.
You can run your Node apps in Azure but you need to look at the modules you're using to make sure you aren't depending on a tool or command or other facility that isn't yet available on Azure. For example, are you using a database like redis or couchDB or mysql? These don't exist natively in Azure so you may or may not be able to port that layer -- you'll have to check.
Since you're on a Mac, there isn't yet a native OS X deployment tool. Microsoft and the Cloud9 folks have been showing a way for Macs to deploy from the Cloud9 IDE which works but the Mac story will most assuredly improve over time. I work on a Mac but I keep a Windows VM open (Parallels) and if I deploy from the desktop I've been using the Powershell cmdlets in the Windows Azure SDK for Node.js which makes things fairly turnkey from Windows.
You will want to follow a couple of repos and their contributors: Azure SDK for Node, which allows native access to Azure Storage via npm install azure and iisnode (on Github) which is a component that assists your node app running under IIS (the Windows Web Server) on Azure.
It's been great to see the Node story on Azure evolve; it's still just a little early but they seem to be making great progress quickly.

Resources