Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First readme update #18

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/<name of data file>.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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastianbarry this should not be a hardcoded file name, right?
Also, for the record, you don't need to copy the file into this directory. You can load it from anywhere as long as you specify the full file path. That's Unix CLI 101.


## 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
9 changes: 9 additions & 0 deletions docker/load_mongodump.sh
Original file line number Diff line number Diff line change
@@ -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'