New Component: Streamlit-CDN allows you to deploy multiple instances in K8S and host all Streamlit dependencies on your own CDN

Hi everyone, as a part of a series on sharing components, I will share a solution for :slight_smile:

  • Preload all Streamlit components in advance to ensure that static files are displayed properly in multiple instances.
  • Support rewriting all Streamlit components and Streamlit’s own static files to CDN in container environments.

:metal: Please note that this component cannot be used painlessly, it requires strong system development capabilities to understand and adapt to your own scenarios.

3 Likes

Nice work. I am looking for a similar solution and find yours. I think you don’t need to reconfigure streamlit to use publicPath: auto. webpack support setting publicPath in the runtime by setting a global variable window.__WEBPACK_PUBLIC_PATH_OVERRIDE. So all it needs is to modify the href url in the index.html file and add a tag and set window.__WEBPACK_PUBLIC_PATH_OVERRIDE to the target site.

That sounds awesome! However, I can’t find
window.__WEBPACK_PUBLIC_PATH_OVERRIDE on Google or the Webpack site. Could you please provide some links for it?

It’s in the streamlit codebase: streamlit/frontend/app/src/setWebpackPublicPath.ts at develop · streamlit/streamlit (github.com)

BTW, I have build a command line tool to hotfix streamlit to make it easier to make use of it. link89/streamlit-hotfix: A command line tool to provide advanced features (CDN, etc) for streamlit by apply patch to the installed packages. (github.com)

1 Like

Excellent !!