Skip to content

Commit

Permalink
scripts: make all scripts that need it use realpath
Browse files Browse the repository at this point in the history
Signed-off-by: Younes Khoudli <[email protected]>
  • Loading branch information
Khoyo committed Nov 7, 2024
1 parent bfa5205 commit aef57ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion scripts/cleanup-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if [ "$#" -ne 0 ]; then
exit 1
fi

root_path="$(realpath $(dirname "$0")/..)"

# These variables are necessary to load the infra on the correct instance (the pr-infra or the dev one)
OSRD_POSTGRES="osrd-postgres"
OSRD_EDITOAST="osrd-editoast"
Expand Down Expand Up @@ -77,4 +79,4 @@ docker exec "$OSRD_VALKEY" valkey-cli -p "$OSRD_VALKEY_PORT" FLUSHALL > /dev/nul

echo "Cleanup done!\n"
echo "You may want to apply migrations if you don't load a backup:"
echo "'diesel migration run --migration-dir $(dirname $0)/../editoast/migrations' # 'docker compose up editoast' does it automatically"
echo "'diesel migration run --migration-dir \"$root_path/editoast/migrations\"' # 'docker compose up editoast' does it automatically"
4 changes: 3 additions & 1 deletion scripts/load-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if [ "$#" -ne 1 ]; then
exit 1
fi

root_path="$(realpath $(dirname "$0")/..)"

# Check sha1 is matching
echo "Checking backup integrity..."
BACKUP_PATH="$1"
Expand Down Expand Up @@ -44,7 +46,7 @@ if [ "$PR_TEST" -eq 1 ]; then
OSRD_POSTGRES_PORT=5433
fi

$(dirname "$0")/cleanup-db.sh # Cleanup and init db (no migration)
"$root_path"/scripts/cleanup-db.sh # Cleanup and init db (no migration)

# Copy needed files to the container
docker cp "$BACKUP_PATH" "$OSRD_POSTGRES:tmp/backup-osrd"
Expand Down

0 comments on commit aef57ea

Please sign in to comment.