I am relatively new to servers and networks, so any guidance would be highly appreciated.
I just made a streamlit application for my team, and want to deploy it so that anyone can use it. My team member has a server available, and I can access it via ssh. I was told that I can “host the app locally and then ssh tunnel to the web port.” Knowing very little about servers, hosting applications, etc, I am quite confused on what I am supposed to do. I vaguely understand ssh tunneling, port forwarding, etc, but I am not sure how the task of deploying the application will be accomplished by “hosting the app locally and then ssh tunneling to the web port.” Where do I start? What should be my steps? How can I host an application locally and ssh tunnel to the web port?
You should be able to run a streamlit sever on your local machine, then ngrok will give u a public url.
But to host the app itself on a sever, you need to put your code on it and run the app itself on the server, which isn’t straightforward, as you need to install streamlit, any libs etc etc.
@khalido
Ngrok will give a public URL as you said, so it may not be an appropriate solution in case he doesn’t want to share his app publicly (if I’m not mistaken). And It’s an opportunity to learn about SSH Tunneling, it can be useful to understand how to setup something like this!
@mali13
The first thing you have to do is to “host your app locally on the server”. That means you have to install your app in the server and run it on 127.0.0.1:8501. Once this is done, you won’t be able to access it directly as the app only listens to requests coming from your server only.
To access to your app, you can use an SSH Tunnel. The idea is to bind a port of your choice on your computer (let’s take 8000 for instance) which will redirect all the traffic from this port directly to the server.
You can do so by running the following command: ssh -L 8000:127.0.0.1:8501 server_user@server_name.
Now in your browser, if you go to the address 127.0.0.1:8000, your HTTP request will be forwarded to 127.0.0.1:8501 onto your server, and you’ll be able to access your app.
This method is good as you benefit from SSH security when communicating with the server from your computer.
Try googling SSH Tunnel or SSH Port Forwardingto get more information on those subjects. I’m sure you’ll find some blogs which will explain clearly what’s the concept behind it if my post isn’t good enough
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.