From e3b3b602b1233015e00495a668c377a5c16033f2 Mon Sep 17 00:00:00 2001 From: Sebastian Barry Date: Fri, 10 Mar 2023 13:40:03 -0700 Subject: [PATCH] First readme update docker/load_mongodump.sh - Added the load_mongodump.sh file from e-mission/em-public-dashboard README.md - Reordered the Docker method to go at the top of the How to run this app section - Added a "How to load data into the app" section --- README.md | 32 ++++++++++++++++++++++++-------- docker/load_mongodump.sh | 9 +++++++++ 2 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 docker/load_mongodump.sh diff --git a/README.md b/README.md index 89d7c6f..10086be 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,24 @@ This app uses the NREL Branding component, which is included as a .tgz and is in ## How to run this app +## Docker Compose method (recommended) + +`docker compose -f docker-compose-dash-app.yml build` + +`docker compose -f docker-compose-dash-app.yml up` + + +## Docker method + +`docker build -t dash-app .` + +`docker run dash-app` + + + + +## Windows Command line method + (The following instructions apply to Windows command line.) Create and activate a new virtual environment (recommended) by running @@ -56,14 +74,12 @@ You can run the app on your browser at http://127.0.0.1:8050 To learn more about Dash, please visit [documentation](https://plot.ly/dash). -## Docker - -`docker build -t dash-app .` +## How to load data into the app -`docker run dash-app` +1. Run the app (steps shown above) +2. Copy your `.tar.gz` data file into this directory (`/op-admin-dashboard/.tar.gz`). If you do not have this file, speak with @shankari to get access to these files +3. Run the following shell script: `bash viz_scripts/docker/load_mongodump.sh vail_2023-01-01.tar-2.gz`. This will load the data into the admin dashboard -## Docker Compose (recommended) +_**Note from Sebastian Barry, 3/10/2023**: This file does not exist on the `Dev` branch currently, so you will need to use the version of this file either from `sebastianbarry/op-admin-dashboard` branch named `readme-update`, or from the public dashboard: https://github.com/e-mission/em-public-dashboard/blob/main/viz_scripts/docker/load_mongodump.sh_ -`docker compose -f docker-compose-dash-app.yml build` - -`docker compose -f docker-compose-dash-app.yml up` +4. Open up the admin dashboard using your browser at http://127.0.0.1:8050 and you will be able to see the admin dashboard with loaded data \ No newline at end of file diff --git a/docker/load_mongodump.sh b/docker/load_mongodump.sh new file mode 100644 index 0000000..8c61f19 --- /dev/null +++ b/docker/load_mongodump.sh @@ -0,0 +1,9 @@ +MONGODUMP_FILE=$1 + +echo "Copying file to docker container" +docker cp $MONGODUMP_FILE em-public-dashboard_db_1:/tmp + +FILE_NAME=`basename $MONGODUMP_FILE` + +echo "Restoring the dump from $FILE_NAME" +docker exec -e MONGODUMP_FILE=$FILE_NAME em-public-dashboard_db_1 bash -c 'cd /tmp && tar xvf $MONGODUMP_FILE && mongorestore && rm $MONGODUMP_FILE'