Streamlit on Azure

Hi Experts

I have made a docker container with pandas and streamlit. My streamlit container runs like a dream on my local laptop. But when I try to run it under Azure App services it hangs:

Do you have any ideas?

I think this could be very cool if we could understand what the issue is docker, Azure or Streamlit…

Hi @sojohan, I am not an Azure expert, but can you double check you don’t need any special configuration to enable Websockets? Is it supposed to work out of the box on Azure? Can you share the content of the network tab? Chrome tools -> Network

Thanks,
Matteo

I am also having this same problem. I have implemented all the suggestions on this forum to no avail. If anyone has been successful in deploying to Azure, a written guide will be much appreciated.

Hi @Kerelu and @sojohan

I have successfully deployed awesome-streamlit.org via Docker and Azure. It’s actually running at https://awesome-streamlit.azurewebsites.net/.

I had a lot of problems before eventually getting it working.

The most important to solve was to discover that you need to switch “Always on in the configuraiton settings”. Otherwise your docker container will be closed down after X minutes of inactivity. Leading it to have very, very long response times.

I also set folderWatchBlacklist = [''] in the config.toml file.

I also setup a script to ping my web site every 5 minutes to keep it being responsive. It’s running inside the docker container. I’m actually not sure this is needed. But I still do it.

Then I did a lot of other things to solve this. But some where because I did some very special things with streamlit. So these where changes to the code and should not be relevant to you.

I would really like there to be a guide and could maybe also find the motivation to write one the next time i deploy a streamlit app to Azure via Docker. But I don’t know when that will be unfortunately.

See my docker files and the ping script here

For a lengthy discussion see

For other discussions see

1 Like

@Marc, thank you for your response. I will incorporate your suggestions and hopefully it will work. Should I get it work, I will report back here.
By the way, your awesome-streamlit site is awesome and I reference it from time to time. Thank you!

2 Likes

So I have been able to successfully deploy to Azure, thanks to @Marc’s suggestions and his ‘awesome-streamlit’ site. Basically, I created a .streamlit folder in my project folder which then holds my configurations and changed the port to 80. After pushing my docker image to Azure web app service, I added a new setting named 'WEBSITES_PORT" with value 80. Hope it helps @sojohan.

1 Like

Thanks will try this….

Thanks Marc will continue to experiment. Soren.

I am able to deploy the docker locally without any issue. Deployment to Azure web App also looks good but the site is not working.

Can you share your folder?

I was able to “deploy” using this reference but got this error: No credential was provided to access Azure Container Registry. Trying to look up…

Then, expectedly, this error when I navigate to the site: :frowning: Application Error
If you are the application administrator, you can access the diagnostic resources.

I just copied the config.prod.toml and credentials.prod.toml files to my folder (deleted the “prod” from the file names), updated the docker file to reflect my app name.

Could you please help?

Reference: Deploy a Streamlit Web App with Azure App Service | by Richard Peterson | Towards Data Science

1 Like