Render Logo.

Deploying a Streamlit Application to Render (as an alternative to Heroku)

Rosario0g3nio
5 min readNov 7, 2022

The announcement of the discontinuation of the Free Tier plans on Heroku (starting November 28th) shacked the dev community.

Heroku is a PaaS (Platform as a Service) and as a PaaS, it allows it’s developers to focus more on the coding process and less on infrastructure.

It’s free tier (along with it’s simplicity) was one of the main reason that made this service very popular among the dev community and was a very good way to deploy an application for testing purpose in production, practically for free.

After this announcement, I started looking for alternative solutions and I came across this blog post by Ossman Rauf (currently offline,unfortunately 😔) presenting other options and among them was Render which, according to him, is “one of the most popular ‘Heroku alternatives’ ”. That statement got my attention and I had to check it out.

According to it’s website, Render is a “unified cloud to build, and run all your apps and websites with free TLS certificates, a global CDN, DDoS protection, private networks, and auto deploys from Git.”

You can deploy services such as Web servers, static sites, background work (RabbitMQ, Celery), Cron Jobs, Dockerfiles, Redis, PostgreSQL and private services and some of the stack supported are Python, Rust, Go, Rudy, JavaScript and and more.

In this post, we are going to see how to deploy on Render, and for this example, I’m going to use a (still in development) Streamlit application for that end.

First, we have to create a Render account. We can do that by clicking on the “GET STARTED FOR FREE” blue button.

Render homepage with a short description of the service.
Render Homepage with the “GET STARTED BUTTON” on the top right corner of the site

Then, we choose the method we want to use to sign in. It can be our Github, Gitlab, Google account or you can login using your email, if you wish so, in case you already have a Render account.

After that, you’ll be redirected to the dashboard page, in the top right corner of the page , you’ll see a “New” blue button.

Render Dashboard with the type of services you can pick to create a new project.
Rander Dashboard

you can click on it to choose the type of service you want to deploy (or by clicking the “New [name of the service]” button on the services name with the description of the type of service on the body of the page if its your first time doing this). For this example we’re going to choose the “Web Server” option because the Streamlit application we are about to deploy is a Web Server.

Next, you have to choose the Git service in which you code is hosted. In case you don’t have you code hosted online, you can check the Github documentaion on how to create a repository.

Then, we choose the name of the repo we want to use for our project. In the search bar bellow “Connect a repository”, we enter the name of the repository on our github account that has the code for the project we want to deploy.

Option to search and chose the github/gitlab repository we are going to use for our project.
Choosing the github/gitlab repo.

In the next step, we define the name of project (the name is going to be the domain), for this example, we are going to choose “streamlitapp” as the project name (and as consequence, the domain is going to be streamlitapp.onrender.com). For Root Directory, region and Environment we can leave as default but, if Render for some reason does not pick the correct Environment, you’ll have to define it.

For Branch we can leave as main, for Build Command we have to make sure we have the requirements.txt file on the right place, the root dir in this case beacuse, it is the file that contains the list of all the libraries (to be installed) our app relies on. And finally, we have the “Start Command” which is the command that is executed to run the application, considering that this is a Streamlit application, the command we are going to use is:

streamlit run 1_Home.py

being “1_Home.py” the main app file.

And finally, at the bottom of the page we have the “Create Web Server”, clicking this button, we make the deployment of our application.

After that all we have to do is to wait for the deployment process to finish,in might take a few minutes to conclude the whole process of installation of all dependencies and building the application.

When the process is over, the prompt will show a message telling us that we can now deploy our app and right above is the IP address we can use to run our app. In the top left corner of the page, bellow the “streamlitapp” (in your case will be the name of your app) we have a link we can also use to open up our app. Just be patient because the first launch of the app can take a while.

On the left side of the page, we have some tabs like “Events” for example and when clicking on it, we’ll have the deployments history and a message telling if the a given deployment failed or succeeded.

That’s it for now, hope you enjoy this story and if possible, give me a feedback in the comment section, thank you so much for reading and I hope this story was insightful.

--

--

Rosario0g3nio

Just exploring the world of ML and Deep Learning and sharing my journey! Might also write about startups, SaaS and SE in general.