Skip to content

Commit

Permalink
Parameterize backup restore script (#2412)
Browse files Browse the repository at this point in the history
* parameterize backup restore script
  • Loading branch information
hubertdeng123 committed Jan 16, 2024
1 parent b71d147 commit 168330c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions scripts/_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ function reset() {
}

function backup() {
type=${1:-"global"}
touch $(pwd)/sentry/backup.json
chmod 666 $(pwd)/sentry/backup.json
$dc run -v $(pwd)/sentry:/sentry-data/backup --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export global /sentry-data/backup/backup.json
$dc run -v $(pwd)/sentry:/sentry-data/backup --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export $type /sentry-data/backup/backup.json
}

function restore() {
$dc run --rm -T web import global /etc/sentry/backup.json
type=${1:-"global"}
$dc run --rm -T web import $type /etc/sentry/backup.json
}

# Needed variables to source error-handling script
Expand Down
2 changes: 1 addition & 1 deletion scripts/backup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
cmd=backup
cmd="backup $1"
source scripts/_lib.sh
$cmd
2 changes: 1 addition & 1 deletion scripts/restore.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
cmd=restore
cmd="restore $1"
source scripts/_lib.sh
$cmd

0 comments on commit 168330c

Please sign in to comment.