Closed tjprescott closed 1 year ago
Hi @tjprescott, sorry you are having issues with your flask deployment.
Have you provided any custom configurations for the Oryx build or app service deployment? One thing that I've noticed is the -userStartupCommand 'src/app.py'
flag in the logs you provided. Have you tried allowing app service to run the flask app with gunicorn, as documented in https://learn.microsoft.com/en-us/azure/app-service/configure-language-python#flask-app? Have you tried specifying python in the custom startup command, instead of just src/app.py
?
You mentioned that you cannot SSH in the webapp for the file system. I assume that this prevents you from accessing the KUDU service as well? https://github.com/projectkudu/kudu/wiki/Accessing-the-kudu-service#overview
If there was some way for us to reproduce the issue, that would be immensely helpful. We have some sample flask apps (e.g. https://github.com/microsoft/Oryx/tree/main/tests/SampleApps/python/flask-app) that appear to be working.
As it turned out, the issue was that I had code like
app = Dash(___name__)
which needed to be converted to:
dash_app = Dash(___name__)
app = dash_app.server
Due to Azure WebApps looking very specifically for a Flask variable named "app".
@tjprescott - Thanks for posting the fix here as well!
Bug Report
At what date and time did you most recently experience the problem? 4/24/2023
Where did you experience the problem? E.g. Azure Web Apps, Azure Functions, Azure Container Registry, or offline use. Azure Web Apps
If your repo is publicly available please share its URL: Repo is not public
What happened? Attempting to deploy a Dash (Flask) app via Github actions, which uses Oryx. I had to restructure my app to move requirements.txt to the root of the repo, but finally got to the point where the build and deploy stages are both successful. The Oryx logs also show that everything was successful. However, when I go to the app's main page, I get this lovely page:
The application startup logs show that the pip packages are clearly not being found despite being successfully installed by Oryx.
What did you expect or want to happen? I expect the website to load. The app works fine when I do the following:
pip install -r requirements.txt
(at the root of the repo)python src/app.py
How can we reproduce it? You probably can't since my repo isn't public.
Do you have log output? Please include between the backticks:
Yes! You can see here that the build and deploy stages of Github actions are successful:
Oryx Logs These are also successful as far as I can tell. The pip packages are clearly installed.
But then it all crashes. The diagnostic resource provides logs:
But this doesn't make any sense because the dependencies were clearly installed in the Oryx build logs. I can't SSH into the webapp to examine the file system because it fails to start up.
Any advice would be greatly appreciated.