forked from e-mission/op-admin-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed minor bug where uuids loaded infinitely due to misuse of interv…
…al disabling, fixed by modifying with statement positioning and return ordering. Revert whitespace changes Revert whitespace changes Bug Fix featuring the uuids misuse from prior commits Caught bug in the form of trips_data table being improperly named and not existing, fixed by renaming trips_data table. Fixed issues brought up and unnecessary changes Unformatted render Reverted more unnecessary changes unfix typo Reverted to old name Whitespace changes revert Whitespace changes revert Whitespace changes revert Whitespace changes revert Added e-mission#121 added timings Added e-mission#121
- Loading branch information
Showing
5 changed files
with
336 additions
and
193 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
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,51 @@ | ||
# docker-compose.yml | ||
version: "3" | ||
services: | ||
dashboard: | ||
build: | ||
context: . | ||
dockerfile: docker/Dockerfile | ||
args: | ||
SERVER_IMAGE_TAG: ${SERVER_IMAGE_TAG} | ||
image: e-mission/opdash:0.0.1 | ||
ports: | ||
- "8050:8050" | ||
environment: | ||
DASH_DEBUG_MODE: "True" | ||
DASH_SILENCE_ROUTES_LOGGING: "False" | ||
DASH_SERVER_PORT: 8050 | ||
DB_HOST: mongodb://db/openpath_stage | ||
WEB_SERVER_HOST: 0.0.0.0 | ||
SERVER_BRANCH: master | ||
CONFIG_PATH: "https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/" | ||
STUDY_CONFIG: "stage-program" | ||
AUTH_TYPE: "basic" # the other option is cognito | ||
REACT_VERSION: "18.2.0" | ||
networks: | ||
- emission | ||
volumes: | ||
- ./pages:/usr/src/app/pages | ||
- ./utils:/usr/src/app/utils | ||
- ./app.py:/usr/src/app/app.py | ||
- ./app_sidebar_collapsible.py:/usr/src/app/app_sidebar_collapsible.py | ||
deploy: | ||
restart_policy: | ||
condition: on-failure | ||
db: | ||
image: mongo:4.4.0 | ||
deploy: | ||
replicas: 1 | ||
restart_policy: | ||
condition: on-failure | ||
volumes: | ||
- mongo-data:/data/db | ||
networks: | ||
- emission | ||
ports: | ||
- "27017:27017" | ||
|
||
networks: | ||
emission: | ||
|
||
volumes: | ||
mongo-data: |
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,70 @@ | ||
#!/bin/bash | ||
|
||
# Directory of the script | ||
SCRIPT_DIR="$(dirname "$0")" | ||
|
||
# Path to the configuration file (one level up) | ||
CONFIG_FILE="$SCRIPT_DIR/../docker-compose-dev.yml" | ||
|
||
# Check if the correct number of arguments is provided | ||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <mongodump-file>" | ||
echo " <mongodump-file> : The path to the MongoDB dump file to be restored." | ||
exit 1 | ||
fi | ||
|
||
MONGODUMP_FILE=$1 | ||
|
||
# Print debug information | ||
echo "Script Directory: $SCRIPT_DIR" | ||
echo "Configuration File Path: $CONFIG_FILE" | ||
echo "MongoDump File Path: $MONGODUMP_FILE" | ||
|
||
# Check if the provided file exists | ||
if [ ! -f "$MONGODUMP_FILE" ]; then | ||
echo "Error: File '$MONGODUMP_FILE' does not exist." | ||
exit 1 | ||
fi | ||
|
||
# Check if the configuration file exists | ||
if [ ! -f "$CONFIG_FILE" ]; then | ||
echo "Error: Configuration file '$CONFIG_FILE' does not exist." | ||
exit 1 | ||
fi | ||
|
||
# Print details about the configuration file | ||
echo "Configuration file details:" | ||
ls -l "$CONFIG_FILE" | ||
|
||
# Extract the database name from the mongodump file | ||
DB_NAME=$(tar -tf "$MONGODUMP_FILE" | grep '^dump/' | sed 's|^dump/||' | awk -F'/' '{if (NF > 0) {print $1; exit}}') | ||
|
||
# Output the database name | ||
echo "$DB_NAME" | ||
|
||
if [ -z "$DB_NAME" ]; then | ||
echo "Error: Failed to extract database name from mongodump." | ||
exit 1 | ||
fi | ||
|
||
echo "Database Name: $DB_NAME" | ||
|
||
# Update the docker-compose configuration file with the actual DB_HOST | ||
DB_HOST="mongodb://db/$DB_NAME" | ||
sed -i.bak "s|DB_HOST:.*|DB_HOST: $DB_HOST|" "$CONFIG_FILE" | ||
|
||
echo "Updated docker-compose file:" | ||
cat "$CONFIG_FILE" | ||
|
||
echo "Copying file to Docker container" | ||
docker cp "$MONGODUMP_FILE" op-admin-dashboard-db-1:/tmp | ||
|
||
FILE_NAME=$(basename "$MONGODUMP_FILE") | ||
|
||
echo "Clearing existing database" | ||
docker exec op-admin-dashboard-db-1 bash -c "mongo $DB_NAME --eval 'db.dropDatabase()'" | ||
|
||
echo "Restoring the dump from $FILE_NAME to database $DB_NAME" | ||
docker exec -e MONGODUMP_FILE=$FILE_NAME op-admin-dashboard-db-1 bash -c "cd /tmp && tar xvf $FILE_NAME && mongorestore -d $DB_NAME dump/$DB_NAME" | ||
|
||
echo "Database restore complete." |
Oops, something went wrong.