Hi there,
I am attempting to create a stable and reusable huggingface docker space for hosting streamlit and fastapi through nginx.
I want to expose streamlit at the root (/) and fastapi endpoint at (/api/)
I have the docker container running locally and working as expected.
The problem is that on Huggingface, the streamlit landing page (/) displays ok, but an attempt to land on fastapi (/api/) yields a 404 error.
I have tried to enable logs with no luck.
Any help appreciated.
The (public) project is located at:
Update:
ok. I am at the end of my tether with this.
I have added logging for nginx, and for fastapi in an attempt to trace online what is going on. No change. The docker container is running fine locally, but nginx is not reverse proxying properly in huggingface.
I was able to select the ‘Run in Docker’ option. This provided me the ref link required to pull my huggingface image locally and run on docker desktop.
It ran just fine locally. This tells me that it is not a rebuild issue. Something is different from an env config between the docker container host locally versus in huggingface.
Any assistance appreciated.
Solved.
The root problem is that documentation is weak.
All samples/examples are illustrated through code or through the hub UI.
None explicitly state that in order to see your docker container run in ‘prod’, you need to access your endpoints through a different domain.
https://{username}-{space name with hyphens instead of spaces or underscores}.hf.space/{endpoint}/
In my case, for my streamlit endpoint
https://kidcoconut-dkr-nginx-templ.hf.space/web/