-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add backup/restore integration tests #2012
Merged
hubertdeng123
merged 9 commits into
master
from
hubertdeng123/add-backup-restore-integration-test
Mar 7, 2023
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c5fdd9c
add backup/restore tests
hubertdeng123 016acdc
create docker volumes
hubertdeng123 bac94f6
resolve precommit errors
hubertdeng123 280bf73
add working backup/restore integration test
hubertdeng123 239d815
resolve pre commit error
hubertdeng123 c730f19
finish unfinished comment about permissioning issues in github ci
hubertdeng123 755653e
use exact commands specified in backup/restore docs
hubertdeng123 163d895
fix removing backup file
hubertdeng123 c347e18
add comment about matching backup/restore command in docs for integra…
hubertdeng123 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 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,34 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
source install/_lib.sh | ||
source install/dc-detect-version.sh | ||
|
||
echo "${_group}Test that backup/restore works..." | ||
echo "Creating backup..." | ||
# Docker was giving me permissioning issues when trying to create this file and write to it even after giving read + write access | ||
# to group and owner. Instead, try creating the empty file and then give everyone write access to the backup file | ||
touch $(pwd)/sentry/backup.json | ||
chmod 666 $(pwd)/sentry/backup.json | ||
# Command here matches exactly what we have in our docs https://develop.sentry.dev/self-hosted/backup/#backup | ||
docker-compose run -v $(pwd)/sentry:/sentry-data/backup --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export /sentry-data/backup/backup.json | ||
# Check to make sure there is content in the file | ||
if [ ! -s "$(pwd)/sentry/backup.json" ]; then | ||
echo "Backup file is empty" | ||
exit 1 | ||
fi | ||
|
||
# Bring postgres down and recreate the docker volume | ||
docker-compose stop postgres | ||
sleep 5 | ||
docker-compose rm -f -v postgres | ||
docker volume rm sentry-postgres | ||
export SKIP_USER_CREATION=1 | ||
source install/create-docker-volumes.sh | ||
source install/set-up-and-migrate-database.sh | ||
docker-compose up -d | ||
|
||
echo "Importing backup..." | ||
docker-compose run --rm -T web import /etc/sentry/backup.json | ||
|
||
rm $(pwd)/sentry/backup.json |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little goofy that we have to call this twice, but I guess that's where we're at and we clean up the test suite under getsentry/team-ospo#91.