google / mesop

Rapidly build AI apps in Python
https://google.github.io/mesop/
Apache License 2.0
5.23k stars 247 forks source link

local vs deployed - issue with base URL #611

Open elx42 opened 1 month ago

elx42 commented 1 month ago

Hi, Thank you very much for this wonderful project.

I was playing around with mesop in the last days and locally everything I did worked flawlessly. Now, I wanted to deploy my application on our clusters and do face an issue with paths. On my local machine, I can access the application via

http://localhost:9000/<page_path>

On our cluster, the deployment is accessible via https://<CLUSTERNAME>/webapps/mesop/testing/<page_path>

In the latter case, I can see 404 issues in the console, as files can not be accessed on https://<CLUSTERNAME>/.

We tried to hack this by applying a fix in our Dockerfile RUN sed -i 's|<base href="/".*/>|<base href="/webapps/mesop/testing/" />|' /opt/conda/lib/python3.11/site-packages/mesop/web/src/app/prod/web_package/index.html

Which solved some of the issues, but other requests also refer to the base URL and subsequently fail.

Does mesop support environment-specific configuration files that I could provide to set the base URL dynamically based on the environment the application is running? Or is there a different way I could solve this issue?

Many thanks!

wwwillchen commented 1 month ago

This isn't something that we support right now, but would be good to support - I'll mark this as a feature request

elx42 commented 1 month ago

Thank you for the feedback, and considering this as a feature!

We were trying to play around with the gunicorn SCRIPT_NAME variable, but this was also not successful as it then led to issues in other parts of the deployment. We'll hold this one for the moment, but I will update this issue here, in case we do find something in the meantime before this feature is added.