-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add base URL for deployment #1820
Comments
I don't have a any experience running Shiny apps in Kubernetes clusters, so I asked around internally at Posit and got some advice. One immediate thing that came up is that we've also run into the same confusion/issue with uvicorn's Another option could be to use starlette to mount the entire Shiny app at the base URL. That might look something like this: from starlette.applications import Starlette
from starlette.routing import Mount
routes = [
Mount("/shiny", app=my_shiny_app),
]
app = Starlette(routes=routes)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0") Hopefully that helps get you through this road block. If you find a solution, please let us know what you do and we'll see how we could use that to improve Shiny. |
From @amol-, if you're using nginx your proxy config might look like this
And you'd launch the app with this (or something close to it)
|
@gadenbuie @amol_, thanks a lot for your suggestions. Actually, before you responded we tried out your mounting suggestion using Starlette, because we saw that is how it could be solved for |
This is slightly off-topic @gadenbuie and @amol-, but I had a similar use case where I wanted to make the |
We currently have many
Streamlit
applications deployed on our Kubernetes cluster. The Kubernetes Ingress routes the requests to the corresponding deployment in Kubernetes with a base URL path. This means that when we try to accesshttps://demo.com/baseurl
in our browsers, the request gets routed to the specific Kubernetes deployment where the Streamlit app is running.This can easily be configured instreamlit using for example the
config
baseUrlPath
(See here for more information). For example, we deploy our Streamlit app under https://demo.com/app1 by launching streamlit in the Deployment:We wanted to replace many of those
Streamlit
apps withPython Shiny
apps. However, as of today, this seems not possible for us. A similar issue was posted on StackOverflow. The problem is that the Shiny doesn't provide the a equivalent parameter tobaseUrlPath
.We have already unsuccessfully tried the following approaches:
1. Use
--root-path
flag inuvicorn
We tried to deploy the app using
uvicorn shiny_demo.shiny.run:app --host 0.0.0.0 --port 5000 --root-path/shiny_demo
. However, this parameter does not solve our issue. Rather, it appends the root path to every incoming request.Shiny doesn't recognize such a path and returns a
404
error.2. Modify the ingress to remove the base URL when it reaches the deployment
This didn't work either because Shiny tries to access several
.js
and.css
files that do not have the base url prefix.Any suggestion or help is highly appreciated!
The text was updated successfully, but these errors were encountered: