Skip to content

Commit

Permalink
run.sh to cover e2e setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanknights committed Jan 15, 2024
1 parent 4014dab commit 113e1f6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/bash
# Purpose: Run streamlit application, ensuring that the `src` sub-modules are in the path
# (This emulates PyCharm's run configuration button parameter: `add content roots to PYTHONPATH`)
# Purpose: Run local development environment including API server, PostgreSQL container, and Streamlit application

# Find the absolute path to the project root
PROJECT_ROOT=$(realpath "$(dirname "$0")/..")

# Set up the API server
uvicorn src.fastAPI_app.app:app --reload &

# Start a local PostgreSQL container
docker compose up -d

# Wait for a moment to ensure that the API server and PostgreSQL container are up
sleep 5

# Set PYTHONPATH to the project root, ensuring it's not added multiple times
export PYTHONPATH=$(echo $PYTHONPATH | tr ":" "\n" | grep -v "$PROJECT_ROOT" | tr "\n" ":")$PROJECT_ROOT

# Run the Streamlit application
venv/bin/streamlit run src/streamlit_app/app.py

0 comments on commit 113e1f6

Please sign in to comment.