diff --git a/bin/ghe-restore b/bin/ghe-restore index c891793d7..87f3acb18 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -274,28 +274,17 @@ commands=(" echo \"Restoring Redis database ...\" ghe-ssh \"$GHE_HOSTNAME\" -- 'ghe-import-redis' < \"$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb\" 1>&3") -# Unified and enhanced restore method to 2.13.0 and newer -if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.13.0)" ]; then - commands+=(" - echo \"Restoring Git repositories ...\" - ghe-restore-repositories \"$GHE_HOSTNAME\"") - - commands+=(" - echo \"Restoring Gists ...\" - ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") +commands+=(" +echo \"Restoring Git repositories ...\" +ghe-restore-repositories \"$GHE_HOSTNAME\"") - commands+=(" - echo \"Restoring GitHub Pages artifacts ...\" - ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") -else - commands+=(" - echo \"Restoring Git repositories and Gists ...\" - ghe-restore-repositories-rsync \"$GHE_HOSTNAME\" 1>&3") +commands+=(" +echo \"Restoring Gists ...\" +ghe-restore-repositories-gist \"$GHE_HOSTNAME\"") - commands+=(" - echo \"Restoring GitHub Pages ...\" - ghe-restore-pages-rsync \"$GHE_HOSTNAME\" 1>&3") -fi +commands+=(" +echo \"Restoring GitHub Pages artifacts ...\" +ghe-restore-pages \"$GHE_HOSTNAME\" 1>&3") commands+=(" echo \"Restoring SSH authorized keys ...\" diff --git a/share/github-backup-utils/ghe-restore-pages-rsync b/share/github-backup-utils/ghe-restore-pages-rsync deleted file mode 100755 index d1b2b7b82..000000000 --- a/share/github-backup-utils/ghe-restore-pages-rsync +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-restore-pages-rsync -#/ Restore an rsync snapshot of all Pages data to a GitHub instance. -#/ -#/ Note: This script typically isn't called directly. It's invoked by the -#/ ghe-restore command when the rsync strategy is used. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# Show usage and bail with no arguments -[ -z "$*" ] && print_usage - -bm_start "$(basename $0)" - -# Restore all pages data via rsync -ghe-restore-userdata pages "$1" - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-restore-repositories-rsync b/share/github-backup-utils/ghe-restore-repositories-rsync deleted file mode 100755 index b151a6645..000000000 --- a/share/github-backup-utils/ghe-restore-repositories-rsync +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-restore-repositories-rsync -#/ Restore an rsync snapshot of all Git repository data to a GitHub instance. -#/ -#/ Note: This script typically isn't called directly. It's invoked by the -#/ ghe-restore command when the rsync strategy is used. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# Show usage and bail with no arguments -[ -z "$*" ] && print_usage - -bm_start "$(basename $0)" - -# Grab host arg -GHE_HOSTNAME="$1" - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$GHE_HOSTNAME" - -# The snapshot to restore should be set by the ghe-restore command but this lets -# us run this script directly. -: ${GHE_RESTORE_SNAPSHOT:=current} - -cleanup() { - # Enable remote GC operations - ghe-gc-enable $GHE_HOSTNAME -} - -trap 'cleanup' INT TERM EXIT - -# Disable remote GC operations -ghe-gc-disable $GHE_HOSTNAME - -# Transfer all git repository data from the latest snapshot to the GitHub -# instance in a single rsync invocation. -ghe-rsync -av --delete \ - --exclude ".sync_in_progress" \ - -e "ghe-ssh -p $(ssh_port_part "$GHE_HOSTNAME")" \ - --rsync-path="sudo -u git rsync" \ - "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/repositories/" \ - "$(ssh_host_part "$GHE_HOSTNAME"):$GHE_REMOTE_DATA_USER_DIR/repositories" 1>&3 - -bm_end "$(basename $0)" diff --git a/share/github-backup-utils/ghe-restore-userdata b/share/github-backup-utils/ghe-restore-userdata deleted file mode 100755 index cfb8834d3..000000000 --- a/share/github-backup-utils/ghe-restore-userdata +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -#/ Usage: ghe-restore-userdata -#/ Restore a special user data directory via rsync. This is used -#/ for a number of different simple datastores kept under /data/user on the -#/ remote appliance, including: hookshot, alambic_assets, and pages data. -set -e - -# Bring in the backup configuration -# shellcheck source=share/github-backup-utils/ghe-backup-config -. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config" - -# Show usage and bail with no arguments -[ $# -lt 2 ] && print_usage - -bm_start "$(basename $0) - $1" - -# Grab userdata directory name and host args -dirname="$1" -GHE_HOSTNAME="$2" - -# Verify rsync is available. -if ! rsync --version 1>/dev/null 2>&1; then - echo "Error: rsync not found." 1>&2 - exit 1 -fi - -# Perform a host-check and establish GHE_REMOTE_XXX variables. -ghe_remote_version_required "$GHE_HOSTNAME" - -# The snapshot to restore should be set by the ghe-restore command but this lets -# us run this script directly. -: ${GHE_RESTORE_SNAPSHOT:=current} - -# Transfer data from the latest snapshot to the GitHub instance in a single -# rsync invocation. -if [ -d "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/$dirname" ]; then - # Create the remote user data directory - ghe-ssh "$GHE_HOSTNAME" -- "sudo -u git mkdir -p $GHE_REMOTE_DATA_USER_DIR/$dirname" - - ghe-rsync -avz --delete \ - -e "ghe-ssh -p $(ssh_port_part "$GHE_HOSTNAME")" \ - --rsync-path="sudo -u git rsync" \ - "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/$dirname/" \ - "$(ssh_host_part "$GHE_HOSTNAME"):$GHE_REMOTE_DATA_USER_DIR/$dirname" 1>&3 -fi - -bm_end "$(basename $0) - $1"