From c3c1cd3cf3645cc15d4c80fad5a136ac5f44a8d1 Mon Sep 17 00:00:00 2001 From: Sean-Stilwell Date: Mon, 3 Jun 2024 16:49:15 -0400 Subject: [PATCH 1/3] switching to ghcr --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 06dd7e8..955f0b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ version: '3.8' services: web: build: . - image: seanstilwell/dash-fsdh-sample:latest + image: ghcr.io/ssc-sp/fsdh-dash-sample:latest container_name: dash-app ports: - "80:80" \ No newline at end of file From 892618780a1b81ca9c41b71e81b72c06e49bc718 Mon Sep 17 00:00:00 2001 From: Sean-Stilwell Date: Sat, 8 Jun 2024 16:38:47 -0400 Subject: [PATCH 2/3] Updating --- app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 9bf4acb..fa29865 100644 --- a/app.py +++ b/app.py @@ -17,7 +17,9 @@ DB_PASS = secret_client.get_secret("datahub-psql-password").value # Initialize the Dash app -app = dash.Dash(__name__) +app = dash.Dash(__name__, + requests_pathname_prefix="/webapp-DIE3/", + routes_pathname_prefix="/webapp-DIE3/") # Define the layout of the app app.layout = html.Div([ From 872f7a6b801b8cffd3f67626a6c19f0c33847cbf Mon Sep 17 00:00:00 2001 From: Sean-Stilwell Date: Sun, 9 Jun 2024 15:38:58 -0400 Subject: [PATCH 3/3] adding error handling so we don't need azure --- app.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/app.py b/app.py index fa29865..86782db 100644 --- a/app.py +++ b/app.py @@ -6,21 +6,28 @@ import psycopg2 import pandas as pd -KEY_VAULT_URL = "https://fsdh-proj-dw1-poc-kv.vault.azure.net/" -credential = DefaultAzureCredential() -secret_client = SecretClient(vault_url=KEY_VAULT_URL, credential=credential) - -# Retrieve the secrets containing DB connection details -DB_NAME = "fsdh" -DB_HOST = secret_client.get_secret("datahub-psql-server").value -DB_USER = secret_client.get_secret("datahub-psql-admin").value -DB_PASS = secret_client.get_secret("datahub-psql-password").value - # Initialize the Dash app app = dash.Dash(__name__, requests_pathname_prefix="/webapp-DIE3/", routes_pathname_prefix="/webapp-DIE3/") +KEY_VAULT_URL = "https://fsdh-proj-dw1-poc-kv.vault.azure.net/" +error_occur = False + +try: + # Retrieve the secrets containing DB connection details + credential = DefaultAzureCredential() + secret_client = SecretClient(vault_url=KEY_VAULT_URL, credential=credential) + + # Retrieve the secrets containing DB connection details + DB_NAME = "fsdh" + DB_HOST = secret_client.get_secret("datahub-psql-server").value + DB_USER = secret_client.get_secret("datahub-psql-admin").value + DB_PASS = secret_client.get_secret("datahub-psql-password").value +except Exception as e: + error_occur = True + print(f"An error occurred: {e}") + # Define the layout of the app app.layout = html.Div([ # Form 1 - Query database