Skip to content

Commit 4485640

Browse files
authored
feat(backup): Support new backup script (#2407)
Closes getsentry/team-ospo#184
1 parent 9eb056f commit 4485640

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

_integration-test/ensure-backup-restore-works.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ echo "Creating backup..."
1111
touch $(pwd)/sentry/backup.json
1212
chmod 666 $(pwd)/sentry/backup.json
1313
# Command here matches exactly what we have in our docs https://develop.sentry.dev/self-hosted/backup/#backup
14-
$dc run -v $(pwd)/sentry:/sentry-data/backup --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export /sentry-data/backup/backup.json
14+
$dc run -v $(pwd)/sentry:/sentry-data/backup --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export global /sentry-data/backup/backup.json
1515
# Check to make sure there is content in the file
1616
if [ ! -s "$(pwd)/sentry/backup.json" ]; then
1717
echo "Backup file is empty"
1818
exit 1
1919
fi
2020

21+
# Print backup.json contents
22+
echo "Backup file contents:\n\n"
23+
cat "$(pwd)/sentry/backup.json"
24+
2125
# Bring postgres down and recreate the docker volume
2226
$dc stop postgres
2327
sleep 5
@@ -29,6 +33,6 @@ source install/set-up-and-migrate-database.sh
2933
$dc up -d
3034

3135
echo "Importing backup..."
32-
$dc run --rm -T web import /etc/sentry/backup.json
36+
$dc run --rm -T web import global /etc/sentry/backup.json
3337

3438
rm $(pwd)/sentry/backup.json

scripts/_lib.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ function reset() {
6262
function backup() {
6363
touch $(pwd)/sentry/backup.json
6464
chmod 666 $(pwd)/sentry/backup.json
65-
$dc run -v $(pwd)/sentry:/sentry-data/backup --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export /sentry-data/backup/backup.json
65+
$dc run -v $(pwd)/sentry:/sentry-data/backup --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export global /sentry-data/backup/backup.json
6666
}
6767

6868
function restore() {
69-
$dc run --rm -T web import /etc/sentry/backup.json
69+
$dc run --rm -T web import global /etc/sentry/backup.json
7070
}
7171

7272
# Needed variables to source error-handling script

0 commit comments

Comments
 (0)