-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Make a reset button #988
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
Merged
Merged
Make a reset button #988
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b334aac
Make a reset button
chadwhitacre 1c45bf4
sha -> ref
chadwhitacre 387a729
Remove local images as well
chadwhitacre 777ee91
Arbitrary git refs won't work
chadwhitacre 5454714
Always reinstall, even when no version is given
chadwhitacre 5513625
Remove another ref ref in comment
chadwhitacre 2f5c171
Validate version
chadwhitacre e405249
--remove-orphans
chadwhitacre 61b5de2
Validate version early for fast fail
chadwhitacre 50c2ab9
Tighten up volume removal logic
chadwhitacre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,62 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # The purpose of this script is to make it easy to reset a local onpremise | ||
| # install to a clean state, optionally targeting a particular version. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| if [ -n "${DEBUG:-}" ]; then | ||
| set -x | ||
| fi | ||
|
|
||
| cd "$(dirname $0)" | ||
|
|
||
|
|
||
| function confirm () { | ||
| read -p "$1 [y/n] " confirmation | ||
| if [ "$confirmation" != "y" ]; then | ||
| echo "Canceled. 😅" | ||
| exit | ||
| fi | ||
| } | ||
|
|
||
|
|
||
| # If we have a version given, validate it. | ||
| # ---------------------------------------- | ||
| # Note that arbitrary git refs won't work, because the *_IMAGE variables in | ||
| # .env will almost certainly point to :latest. Tagged releases are generally | ||
| # the only refs where these component versions are pinned, so enforce that | ||
| # we're targeting a valid tag here. Do this early in order to fail fast. | ||
|
|
||
| version="${1:-}" | ||
| if [ -n "$version" ]; then | ||
| set +e | ||
| git rev-parse --verify --quiet "refs/tags/$version" > /dev/null | ||
| if [ $? -gt 0 ]; then | ||
| echo "Bad version: $version" | ||
| exit | ||
| fi | ||
| set -e | ||
| fi | ||
|
|
||
| # Make sure they mean it. | ||
| confirm "☠️ Warning! 😳 This is highly destructive! 😱 Are you sure you wish to proceed?" | ||
chadwhitacre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "Okay ... good luck! 😰" | ||
|
|
||
| # Hit the reset button. | ||
| docker compose down --volumes --remove-orphans --rmi local | ||
|
|
||
| # Remove any remaining (likely external) volumes with name matching 'sentry-.*'. | ||
| for volume in $(docker volume list --format '{{ .Name }}' | grep '^sentry-'); do | ||
| docker volume remove $volume > /dev/null \ | ||
| && echo "Removed volume: $volume" \ | ||
| || echo "Skipped volume: $volume" | ||
chadwhitacre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| done | ||
|
|
||
| # If we have a version given, switch to it. | ||
| if [ -n "$version" ]; then | ||
| git checkout "$version" | ||
| fi | ||
|
|
||
| # Install. | ||
| exec ./install.sh | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.