This template-project includes the basic building blocks needed to deploy a streamlit application in ODP using Agent Ocean.
The components of this template:
- Example application
- Python streamlit-application
- Dockerfile
- Azure DevOps pipeline definition
In order to use this template, you must first install cookiecutter. This is simply done with pip
$ pip install cookiecutter
Windows users may need to do some extra steps. Please refer to the cookiecutter documentation.
Simply run cookiecutter to generate your project:
$ cookiecutter git+https://github.com/C4IROcean/template-streamlit-app.git
Cookiecutter will prompt your to input some options, then finally generate a new
directory containing the full project and named by cookiecutter based on the
project_name
you specified.
First clone this project template:
$ git clone https://github.com/C4IROcean/template-streamlit-app.git <MY_DIR>/template-streamlit-app
You can then generate your own project using cookiecutter:
$ cookiecutter <MY_DIR>/template-streamlit-app
Cookiecutter will prompt your to input some options, then finally generate a new
directory containing the full project and named by cookiecutter based on the
project_name
you specified.
This application serves as a placeholder for your application. It also includes some packages to serve as inspiration for app-developers:
- Poetry Package manager - A modern Python package manager
- Streamlit Web App framework - Turn data scripts into beatiful and sharable apps
The Dockerfile holds the definition of the containerized environment your application will run in.
If your project is a simple Python {{cookiecutter.python_version}} app that uses Poetry as its package manager, you will likely not have to make any changes to this file. If your uses different ports or needs custom assets such as images, then you may have to update this file.
The Azure DevOps pipeline definition, located at
.azure-devops/pipelines/azure-pipeline.yml
, holds instructions on how to build
and deploy your application. It has to be manually deployed from Azure DevOps in
order to use it.
The pipeline consists of two jobs - Build
and Deploy
. Build
will build the
Dockerfile and save the resulting image to our Azure Container Registry.
Deploy
will deploy the application using the definition in
deployment_config.yml
.
This template is built in such a way that you should not need make any changes
to the azure-pipeline.yml
-file. However, if you have more than one Dockerfile
or your app requires specialized build-steps, then you will need to update this
file.
deployment_config.yml
is processed by the
app-deployer
,
and holds all the information necessary to deploy your app. Here you can add
supporting services, configure the deployment URL and add environment variables.