Could anyone please tell me the steps to deploy streamlit app on Microsoft Azure
Hi @temp_cmd
The steps depends. Do you wan’t the fastest way to get on Azure with a hoppy project or something you can use robustly for your work over a longer period of time?
I’ve deployed awesome-streamlit.org via Azure and I’ve chosen something robust and automated.
- Azure DevOps Repo
- Docker (expose your Streamlit App on port 80). Dockerfiles
- Docker Hub as my container registry. Registry
- Azure DevOps Pipelines for CI/ CD yaml files, My CI/ CD Setup
- Azure Web App for containers (configure “Always on” to True). Overview
- set
folderWatchBlacklist = ['']
in the config.toml file
This takes some time to setup. When it’s done it’s amazing. When I merge into MASTER everything is automatically built, tested and deployed. And I can replicate everything and debug locally in an identical Docker container.
An easier way would (I think) be with an Azure Web App. But I’ve never tried that. For small hobby projects I’ve used Heroku before with success.
Hi Marc
I have the same problem. The solution is to embed the ping part in your python code?
Sojohan
Hi @temp_cmd,
thanks for posting on the forum. I haven’t personally tried on Azure, but @Marc’s answer is excellent. I do deploy Streamlit on Google Cloud routinely and the only caveat I have is making sure that Websocket does not need a special configuration. For the rest it should work fine. I know people have had lot of success deploying on Heroku as well and I have seen several Streamlit apps on Heroku.
Best,
Matteo
Hi @sojohan, thanks for posting. Can you elaborate a little bit more on your specific problem? On top of my head, I don’t think you need anything special with the ping.
Best,
Matteo
Marc’s answer is excellent, thx!
If your deployed Azure web app still hangs on “Connecting…”, like mine was, make sure you have no Cors enabled, not even “*”
To add another source of information about Azure:
Richard Peterson over at Towards Data Science just published a how-to on deploying Streamlit to Azure.
Thanks for sharing Heroku. It is simpler.
I managed to deploy via AWS EC2 and Heroku via docker. How difficult it is to port the same thing to Azure? It’s a simple ML prediction app that uses sklearn, panda and numpy.
Would it be ok if I follow this tutorial ?
Hi @Andrew_Ng
I have not tried following the tutorial, so I would not know. My guess though is that it would be ok.
You can see my Docker container and azure pipelines files here.
They might be of use.
Hi,
i am tried to deploy an app on azure, similar to the above.
My streamlit app on my local computer works great.
My container works now.
However, deployment app on azure fails.
Any help would be appreciated.
Thanks!
Ankur
Has anyone had any success deploying their streamlit app to Azure? I tried several of the tutorials and they came back with the "Please wait … " problem.
I tried using the config.toml file that @Marc supplied in his example but it still didn’t work.
I could make my app work by changing the config.toml.
logLevel = “debug” in the [global] section was deprecated, so I had to use the following instead:
[logger]
level = “debug”
I also set the WEBSITES_PORT to 80 (matching my Dockerfile) and selected the Always on option in general settings, as suggested in previous comments.
The pricing tier I am using for the appservice plan is B1.
Hope this helps you.
Best
@roentgen11 I was able to successfully deploy streamlit app to Azure App Service. As @Domenjp points out, via the Azure portal > App Service, add configuration for keypair WEBSITES_PORT to match the port you expose in your Dockerfile. I also added keypar PORT=3000 (as looking at the container log it was having issues health pinging the container via HTTP). Further, I extended the wait time with WEBSITES_CONTAINER_START_TIME_LIMIT=400. See here:
Two useful examples with streamlit, dockerfiles, and Azure.
https://towardsdatascience.com/deploying-a-streamlit-web-app-with-azure-app-service-1f09a2159743
https://saitracychen.medium.com/deploy-a-streamlit-app-to-azure-126452e7df6d
Hi Marc,
Awesome work with awesome streamlit.
Would you be willing to do a tutorial on deploying to Azure in better way you described?
Hi all,
I’ve been having issues with deploying on Azure as well, but based on Marc’s work I was able to get it running (cheers Marc!!).
I’ve created a simplified guide to deploy Streamlit on Azure, hope people will find it helpful.
I took the long way around and found this at another source. I was going to post here, but then I saw @Domenjp found this earlier this year. I can confirm as of 10/19/2021 this is the correct answer to getting @Marc’s and this tutorial’s instructions to work.
comment out this line in the config.toml file:
#logLevel = “debug”
and add this just below
[logger]
level = “debug”