Skip to content

Commit 4b6d5f4

Browse files
committed
Merge pull request #173 from github/cluster-fixes
Clustering: ghe-restore fixes
2 parents 0c2cb37 + 011bdd8 commit 4b6d5f4

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

share/github-backup-utils/ghe-restore-alambic-cluster

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ hostnames=$(ghe-ssh "$GHE_HOSTNAME" ghe-config --get-regexp cluster.*.hostname |
4747
for hostname in $hostnames; do
4848
config="$config
4949
Host $hostname
50+
ServerAliveInterval 60
5051
ProxyCommand ssh -q $GHE_EXTRA_SSH_OPTS -p $port $user@$host nc.openbsd %h %p"
5152
done
5253

@@ -59,22 +60,21 @@ cleanup() {
5960
for pid in $(jobs -p); do
6061
kill -KILL $pid > /dev/null 1>&2 || true
6162
done
62-
rm -rf $config_file ssh_routes_in ssh_routes_out ssh_finalize_in ssh_finalize_out
63+
rm -rf $config_file ssh_routes_in ssh_routes_out ssh_finalize_out
6364
}
6465

6566
trap 'cleanup' INT TERM EXIT
6667

67-
rm -rf ssh_routes_in ssh_routes_out ssh_finalize_in ssh_finalize_out
68+
rm -rf ssh_routes_in ssh_routes_out ssh_finalize_out
6869
mkfifo ssh_routes_in
6970
mkfifo ssh_routes_out
70-
mkfifo ssh_finalize_in
7171
mkfifo ssh_finalize_out
7272

7373
echo "Setting up storage processes"
7474

7575
ghe-ssh "$GHE_HOSTNAME" github-env ./bin/storage-cluster-import-routes - < ssh_routes_out > ssh_routes_in &
7676
ssh_routes_pid=$!
77-
ghe-ssh "$GHE_HOSTNAME" github-env ./bin/storage-cluster-import-finalize - < ssh_finalize_out > ssh_finalize_in &
77+
ghe-ssh "$GHE_HOSTNAME" github-env ./bin/storage-cluster-import-finalize - < ssh_finalize_out &
7878
ssh_finalize_pid=$!
7979

8080
echo "Set up storage processes"
@@ -114,8 +114,7 @@ exec 4>&-
114114
exec 5>&-
115115

116116
# Ensure to flush these and close the pipes
117-
cat ssh_routes_in > /dev/null
118-
cat ssh_finalize_in > /dev/null
117+
cat ssh_routes_in > /dev/null &
119118

120-
wait $ssh_routes_pid > /dev/null 1>&2 || true
121-
wait $ssh_finalize_pid > /dev/null 1>&2 || true
119+
wait $ssh_routes_pid > /dev/null 2>&1 || true
120+
wait $ssh_finalize_pid > /dev/null 2>&1 || true

share/github-backup-utils/ghe-restore-pages-dpages

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ for pages_path in $pages_paths; do
8585
echo "$page_id" >&4
8686
read routes < ssh_routes_in
8787

88+
if [ "$routes" = 'page-id-not-found' ]; then
89+
echo " Warning: page ID $page_id not found in the database, ignoring."
90+
continue
91+
fi
92+
8893
for route in $routes; do
8994
ghe-rsync -aHR --delete \
9095
-e "ssh -q $opts -p $port -F $config_file -l $user" \

share/github-backup-utils/ghe-restore-repositories-gist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ for gist_path in $gist_paths; do
8585
echo "$gist_id" >&4
8686
read routes < ssh_routes_in
8787

88+
if [ "$routes" = 'gist-not-found' ]; then
89+
echo " Warning: gist ID $gist_id not found in the database, ignoring."
90+
continue
91+
fi
92+
8893
for route in $routes; do
8994
ghe-rsync -aHR --delete \
9095
-e "ssh -q $opts -p $port -F $config_file -l $user" \

0 commit comments

Comments
 (0)