-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #474 from Runtee/sql-dump
feat: Implement Database Import and Streamlit Dashboard Setup via Doc…
- Loading branch information
Showing
6 changed files
with
1,086 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
set -e # Exit immediately if any command fails | ||
|
||
# Wait for the database to be ready | ||
# Import data from dump file | ||
if [ -f ./derisk_dump_part_aa.sql ]; then | ||
echo "Importing data from derisk_dump_part_aa.sql..." | ||
PGPASSWORD="$DB_PASSWORD" psql -U "$DB_USER" -d "$DB_NAME" -h "$DB_HOST" -p "$DB_PORT" -f ./derisk_dump_part_aa.sql | ||
echo "Data import complete." | ||
else | ||
echo "No ./derisk_dump_part_aa.sql file found." | ||
while true; do | ||
read -p "Do you want to continue without importing data? (yes/no): " choice | ||
case "$choice" in | ||
yes|YES|y|Y) | ||
echo "Skipping data import and continuing..." | ||
break | ||
;; | ||
no|NO|n|N) | ||
echo "Stopping the process as requested." | ||
exit 1 | ||
;; | ||
*) | ||
echo "Invalid input. Please type 'yes' or 'no'." | ||
;; | ||
esac | ||
done | ||
fi | ||
|
||
## Start Streamlit | ||
#echo "Starting Streamlit application..." | ||
#streamlit run dashboard.py --server.port=8501 --server.address=0.0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# PostgreSQL | ||
DB_USER=postgres | ||
DB_PASSWORD=password | ||
DB_NAME=data_handler | ||
DB_NAME=postgres | ||
DB_HOST=db | ||
DB_PORT=5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
FROM python:3.10 | ||
FROM python:3.12 | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
postgresql-client \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /app | ||
|
||
RUN pip install poetry | ||
COPY legacy_app/pyproject.toml legacy_app/poetry.lock* ./ | ||
COPY pyproject.toml poetry.lock* ./ | ||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-interaction --no-ansi | ||
|
||
COPY legacy_app/src legacy_app/src | ||
COPY legacy_app/app.py . | ||
COPY legacy_app/update_data.py . | ||
|
||
CMD ["streamlit", "run", "dashboard.py"] | ||
&& poetry install --no-interaction --no-ansi --no-root | ||
|
||
COPY . . | ||
ENTRYPOINT ["../.entrypoint.sh"] |
Oops, something went wrong.