Skip to content

Commit

Permalink
Fixed minor bug where uuids loaded infinitely due to misuse of interv…
Browse files Browse the repository at this point in the history
…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
TeachMeTW committed Oct 30, 2024
1 parent daee228 commit efcf905
Show file tree
Hide file tree
Showing 5 changed files with 336 additions and 193 deletions.
3 changes: 1 addition & 2 deletions app_sidebar_collapsible.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,11 @@ def make_controls():
'flex-direction': 'column'}
)


page_content = dcc.Loading(
id='global-loading',
type='default',
fullscreen=True,
overlay_style={"visibility": "visible", "filter": "blur(2px)"},
overlay_style={"visibility": "visible", "filter": "opacity(0.5)"},
style={"background-color": "transparent"},
children=html.Div(dash.page_container, style={
"margin-left": "5rem",
Expand Down
51 changes: 51 additions & 0 deletions docker-compose-dev.yml.bak
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:
70 changes: 70 additions & 0 deletions docker/new_mongo.sh
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."
Loading

0 comments on commit efcf905

Please sign in to comment.