-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1779 from cardstack/realm/full-reset-cs-7500
Add error-handling to full reset script
- Loading branch information
Showing
4 changed files
with
48 additions
and
31 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
This file was deleted.
Oops, something went wrong.
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,46 @@ | ||
#! /bin/sh | ||
CURRENT_DIR="$(pwd)" | ||
SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
|
||
errors=() | ||
|
||
run_command() { | ||
"$@" | ||
if [ $? -ne 0 ]; then | ||
errors+=("Failed: $*") | ||
fi | ||
} | ||
|
||
cd ${SCRIPTS_DIR}/../packages/postgres || errors+=("Failed: changing to postgres directory") | ||
run_command pnpm run drop-db boxel | ||
run_command pnpm run drop-db boxel_test | ||
run_command pnpm run drop-db boxel_base | ||
|
||
if ! rm -rf "${SCRIPTS_DIR}/../packages/realm-server/realms"; then | ||
errors+=("Failed: removing realms directory") | ||
fi | ||
|
||
cd "${SCRIPTS_DIR}/../packages/matrix" || errors+=("Failed: changing to matrix directory") | ||
|
||
run_command pnpm stop:synapse | ||
|
||
if ! rm -rf ./synapse-data; then | ||
errors+=("Failed: removing synapse-data") | ||
fi | ||
|
||
run_command pnpm start:synapse | ||
run_command pnpm register-all | ||
|
||
echo " | ||
WARNING: Any matrix server authorization tokens cached in the browser's localstorage are now invalid. Make sure to clear browser localstorage. Also make sure to execute the following in the browser after logging in as 'user' to add the experiments realm: | ||
window['@cardstack/host'].lookup('service:matrix-service')._client.setAccountData('com.cardstack.boxel.realms', {realms: ['http://localhost:4201/experiments/']}) | ||
" | ||
|
||
if [ ${#errors[@]} -ne 0 ]; then | ||
echo "\n\033[1;31mThe following errors occurred during execution:\033[0m" | ||
printf '\033[1;31m%s\033[0m\n' "${errors[@]}" | ||
exit 1 | ||
else | ||
echo "\nAll operations completed successfully." | ||
fi |