Streamlit apps for battery researchers
st-apps/
Dockerfile
README.md
requirements.txt
src/
Home.py
pages/
1_my_app.py
2_second_app.py
3_another_app.py/usr/local/apps/st-apps
- update repository by adding another app as a .py file in the
st-apps/src/pagesdirectory (e.g.4_the_best_app.py) - go to st-apps location in odin and pull changes
- re-build and run docker
First clone (or pull recent changes from) the github repository (ife-bat/st-apps). Create a python environment and install requirements if you don't already have one.
Assume your app is called my_eq_solv_v1.py. Put the app in the pages folder and change the name follwing this convention:
<number>_<name>.py
The <number> is used to order / position the short-cut to the app in the side-bar with the label <name>. For example,
if you call the file 000_Solve_equations.py, the link Solve equations will most likely be put on top of the
list of apps in the side-bar (first one below Home).
You can check if it works as intended by running the multipage app locally:
# in the top directory
streamlit run src/Home.pyIf you want to check only your own app, point streamlit to your apps python-file.
# in the top directory
streamlit run src/pages/000_Solve_equations.pyLog in to odin using ssh (either through a terminal or using the remote coding option in VSCode). Then go to / open the directory and pull changes from the github repository (ife-bat/st-apps).
cd /usr/local/apps/st-apps
git pull # (otional) stop the current docker container
docker ps # to get the container_id
docker stop <container_id>
# (re-) build the docker image:
docker build -t streamlit-apps .
# run the docker container using the image:
docker run -d -p 8501:8501 streamlit-apps
- Split requirements into two files - one that contains the packages we believe will (almost) never change, and one for the others. This will speed up building the Docker container.
- Use docker compose (create
docker-compose.yml) - Put it into systemctl.