Skip to content

backup and restore scripts#83

Merged
theyoyojo merged 9 commits into
masterfrom
backup
Apr 13, 2024
Merged

backup and restore scripts#83
theyoyojo merged 9 commits into
masterfrom
backup

Conversation

@theyoyojo

Copy link
Copy Markdown
Contributor

The backup script gzips the volumes exported from podman and outputs them to stdout. The restore script takes an archive of this same format from stdin and imports the volumes into podman after deleting them and re-creating them afresh.

Sample usage:

$ ./backup.sh > archive.tar.gz
$ ./restore.sh < archive.tar.gz # containers must be down

Fixes #62

@charliemirabile

Copy link
Copy Markdown
Contributor

depends on #54

theyoyojo and others added 8 commits April 12, 2024 17:50
The backup script gzips the volumes exported from podman
and outputs them to stdout. The restore script takes an
archive of this same format from stdin and imports the volumes
into podman after deleting them and re-creating them afresh.

Sample usage:

$ ./backup.sh > archive.tar.gz
$ ./restore.sh < archive.tar.gz # containers must be down

Fixes #62

Signed-off-by: Joel Savitz <jsavitz@redhat.com>
Keep them together in a dedicated place instead of cluttering
the root of the project.
Once source of truth is better for when we inevitability need to
update this list of volumes
like the other scripts we should show what we are doing
and exit if something goes wrong. The trace goes to stderr
so it doesn't interfere with redirecting the output into
the tar file
After running these a few times /tmp was literred with
many folders since neither script deletes their tmpdir
after they are finished.
As suggested by shellcheck, it doesn't hurt to quote the
variable references even though they shouldn't be able
to contain spaces
pushd and popd are not specified by posix for the shell,
so if we use /bin/sh we should avoid them. In this case
we aren't using more than one level of stack anyways
so there is really no need to use them at all.
Now that both pass shellcheck, we should keep them that way
by linting them in the tests.

@charliemirabile charliemirabile left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@theyoyojo

Copy link
Copy Markdown
Contributor Author
./test.sh
+ trap : EXIT
+ DOCKER=podman
+ require curl
+ command -v curl
+ require jq
+ command -v jq
+ require flake8
+ command -v flake8
+ require podman
+ command -v podman
+ ./script-lint.sh
+ shellcheck script-lint.sh
+ shellcheck test.sh
+ shellcheck orbit/test-style.sh
+ shellcheck orbit/warpdrive.sh
+ shellcheck -x backup/backup.sh

In backup/backup.sh line 6:
. ./volumes_list
  ^------------^ SC1091 (info): Not following: ./volumes_list: openBinaryFile: does not exist (No such file or directory)

For more information:
  https://www.shellcheck.net/wiki/SC1091 -- Not following: ./volumes_list: op...
+ :

it's true, the scripts don't work when invoked outside of their directories

Signed-off-by: Joel Savitz <jsavitz@redhat.com>
@theyoyojo theyoyojo merged commit 7b3d5d8 into master Apr 13, 2024
@theyoyojo theyoyojo deleted the backup branch April 13, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data persistence and backup

2 participants