0 %
!
Programmer
SEO-optimizer
English
German
Russian
HTML
CSS
WordPress
Python
C#
  • Bootstrap, Materialize
  • GIT knowledge
0

No products in the cart.

Deploying Streamlit Applications

06.06.2024

Streamlit is an open source python toolkit which makes the building of Data Visualization applications and Interactive Web Application very easy. However, when you have created this Streamlit app, the process is to host it to allow other people to access it and use it as intended. This short tutorial will guide you through the process of deploying your Streamlit applications so that they are easily accessible and usable by others.

Cloud Deployment Options

The installation of Streamlit apps is typically possible using cloud solutions, and this is one of the main challenges. These platforms ranging from hosting, scaling, even managing the infrastructure makes it easier for developers to focus on their applications instead of hosting infrastructure.

Streamlit Sharing

Streamlit Sharing is an offering from the Streamlit open-source team who offer a free service to host your applications in a jiffy. For this reason, it is useful when youíre dealing with small tasks or pilot projects, since no further installation is necessary.

To deploy your app using Streamlit Sharing, simply run the following command in your terminal:To deploy your app using Streamlit Sharing, simply run the following command in your terminal:


streamlit run app.py --server.share=true

It will produce a URL that is unique to your Streamlit app and can only be accessed by people you decide to share it with.

Cloud Platforms

For broader usage or if you are using web scales then you can use some clouds like Heroku, AWS, or Google Cloud Platform (GCP). These platforms supply the viable architecture, smooth delivery pipelines and provided monitoring and logging features in SOC.

Heroku

Py, However, for the purpose of this work, I will be developing my project on Heroku, a well-known cloud platform that supports Python and many more languages. IF you want to host your Streamlit app on Heroku, you have to follow the below steps: you have to create a Heroku account and Heroku CLI and follow the Heroku deployment policies.

AWS

AWS provides several services for application deployment and hosting such as the Elastic Beanstalk services, AWS Lambda service and EC2 service. Depending on the result you wish to achieve, you can decide to follow the appropriate service of AWS and the documentation provided on the internet.

Google Cloud Platform (GCP)

There are a few different ways we can deploy Streamlit apps, Ssome of the common ways are Google cloud app engine Google cloud run or else using the Google cloud compute instances. Another beneficial feature of GCP is its solutions for scaling and monitoring which are well appropriate for implementing at the enterprise level.

On-Premises Deployment

If you wish to keep your application at Streamlit to be hosted in your organizationís internal environment, then yes, you can deploy it on-premise. This approach may be ideal for applications dealing with personal data or other more sensitive information, or those that have particular security or regulatory standards it has to meet.

To deploy Streamlit app in-premise, youíd have to host it on a web server of your own or use a Containerization tool like the Docker or Kubernetes. This is slightly more complex and requires configuration additional to the base installation and also takes more effort in ongoing management however it does provide far more control over the deployment environment.

Continuous Integration and Deployment (CI/CD)

CI/CD pipeline helps to deploy system and make it more efficient as well as to provide the confident that Streamlit app always deploys properly in different environments. Most of the recent CI/CD tools like Jenkins, Circle CI, GitHub action etc. are integrated with your code repository which helps in automating the build, testing and deployment phase.

Monitoring and Scaling

Even if your Streamlit application is a small app, as it grows and is used more frequently, you may notice issues related to its performance and scalability. Some monitoring tools may come with cloud platforms while others are added features which may not be available in cloud platforms; auto-scaling is complex and may be provided in cloud platforms but not in on-premises deployments.

Thanks to tools like top and iostat, you can see how your systemís resources are being utilized; is the CPU saturated or are the swap files under heavy pressure, or is the network loaded up?. Also, the auto-scaling approach guarantees your app can accommodate more consumer traffic and avoid issues of the site slowing down.

Security and Access Control

It is important to note that given the type of your Streamlit application and the data it deals with, you may have the need for dedicated security measures and access rights management. Virtual environments inevitably come with different levels of security measures including Firewall, SSL/TLS encryption, user authentication and authorization.

For on-premises instance sevices, such as Nginx or Apache can be used to manage SSL/TLS encryption while for authentication and authorization, frameworks which include Flask, Django, or FastAPI may be incorporated.

Conclusion

In this method, Streamlit applications need to be deployed in order to make your data visualization and web apps accessible to users, as required for this task. Therefore, it is advisable to understand the most important differentials when choosing between cloud-based solutions and on-premises-deployment, which include scalability, security, and monitoring. Below, we present best practices for Streamlit applicationsí deployment and detailed instructions for setting up your applications using the best-of-breed tools and services.

Posted in Python, StreamlitTags:
Write a comment
© 2024... All Rights Reserved.

You cannot copy content of this page