Skip to content
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 Snapshot Restore command #947

Merged
merged 4 commits into from
Mar 7, 2023
Merged

Add Snapshot Restore command #947

merged 4 commits into from
Mar 7, 2023

Conversation

jac
Copy link
Member

@jac jac commented Mar 2, 2023

Snapshot Restore generates commands to restore dumped snapshots to a Sourcegraph instance

Usage:
After generating a dump the restore commands can be generated with

src snapshot restore <docker|kubectlpg_dump>

The --run command can be used to attempt to automatically run these commands. Useful e.g. in the AMIs e.g.

src snapshot restore --run <docker|kubectlpg_dump>
  • Changed snapshot args ordering
    • To get the --run flag to work it was necessary to change arg ordering as Go's flag package requires all flags come before non flag args
src snapshot databases docker --run
# changes to
src snapshot databases --run docker
  • Removed the -t flags from <docker|kubectl> exec
    • afaik only -i should be necessary for input/output redirection. Without -t we get better compatibility (prevents device is not a TTY error)

Test plan

  • Generated snapshots using the snapshot tool and then restored them to another instance (running the same Sourcegraph version)

@jac jac requested review from jdpleiness and bobheadxi March 2, 2023 20:27
Copy link
Contributor

@jdpleiness jdpleiness left a comment

Choose a reason for hiding this comment

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

Looks good! 🚀

internal/pgdump/pgdump.go Outdated Show resolved Hide resolved
cmd/src/snapshot_restore.go Outdated Show resolved Hide resolved
Copy link
Member

@bobheadxi bobheadxi left a comment

Choose a reason for hiding this comment

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

nice work! a few comments

internal/pgdump/pgdump.go Outdated Show resolved Hide resolved
cmd/src/snapshot_databases.go Outdated Show resolved Hide resolved
jac added 4 commits March 7, 2023 19:56
Snapshot Restore generates commands to restore dumped snapshots to a Sourcegraph instance
@jac jac merged commit 37ff66f into main Mar 7, 2023
@jac jac deleted the jac/restore branch March 7, 2023 22:09
scjohns pushed a commit that referenced this pull request Apr 24, 2023
Snapshot Restore generates commands to restore dumped snapshots to a Sourcegraph instance
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.

3 participants