-
Notifications
You must be signed in to change notification settings - Fork 624
Use .sync_in_progress file during restores #179
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
Conversation
Updated to include cluster support. |
Also waits for Git GC operations to finish before beginning restore, much like backups already do. |
trap 'cleanup' INT TERM EXIT | ||
|
||
wait_pids="" | ||
for hostname in $hostnames; do |
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.
I believe this will match all the servers in the cluster, not only git servers. Is that the intention?
Running something like:
ghe-cluster-each -r git -p
will return the list of git servers only. Same applies when cleaning up the sync_in_progress_file
.
@rubiojr Thanks for the detailed and valuable feedback. I very much appreciate it! ✨ I have just pushed a couple of new commits that refactor a number of areas as a result of @rubiojr's feedback. As a lot of this code was copy and pastes from existing code in the repository backup scripts, there is some refactoring to be done to those areas too. This is best done as a seperate activity since this PR only deals with the restore side. |
@snh 🤘, I really like how you approached this. Let me 👀 that one more time. |
@@ -0,0 +1,48 @@ | |||
#!/bin/sh |
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.
#!/usr/bin/env bash
here?
@rubiojr Thanks for the latest feedback. I've made a few changes as a result. Does the way I have re-jigged the working directory stuff look OK? My plan would be to do a new PR to update all the other scripts. |
# Bring in the backup configuration | ||
cd $(dirname "$0")/../.. | ||
. share/github-backup-utils/ghe-backup-config | ||
export GHE_BACKUP_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )" |
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.
I would avoid the export
here to prevent potential regression/behaviour change in a patch release.
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.
I mean avoid the export
and don't use the GHE_BACKUP_ROOT
variable name for now. That'd change ghe-backup-config
behaviour I think.
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.
I did try and avoid changing ghe-backup-config behavior but ran in to a
issue with it requiring the working dir be changed to the root backup utils
dir before being called.
In share/github-backup-utils/ghe-gc-disable
#179 (comment):
@@ -9,8 +9,8 @@
set -eBring in the backup configuration
-cd $(dirname "$0")/../..
-. share/github-backup-utils/ghe-backup-config
+export GHE_BACKUP_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
I mean avoid the export and don't use the GHE_BACKUP_ROOT variable name for
now. That'd change ghe-backup-config behaviour I think.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/github/backup-utils/pull/179/files/26feaa1f4392b21b825040e0c268ecf1cb0fd5da..3427dfe7df2867bd54250b37ee7c4ae7e150efef#r57606669
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.
@snh ah, gotcha. Then leaning towards reverting the change, keep using pwd
for now and address this in a future PR.
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.
That is, reverting 3427dfe.
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.
@rubiojr Sounds like a plan. I will revert that commit.
Added some comments to avoid changing behaviour and potential regressions for now but the rest looks great to me.
That'd be great. |
This reverts commit 3427dfe.
Thanks Steven, |
Always restore Actions settings
This PR prevents Git GC operations and some other maintenance jobs from running while repositories are being restored using
ghe-restore-repositories-rsync
,ghe-restore-repositories-dgit
andghe-restore-repositories-gist
.This makes use of the existing
$GHE_REMOTE_DATA_USER_DIR/repositories/.sync_in_progress
file, which is already used byghe-backup-repositories-rsync
andghe-backup-repositories-cluster
, and largely copies the existing code from these.Also waits for Git GC operations to finish before beginning restore, much like backups already do.
/cc @github/backup-utils