Skip to content

Commit

Permalink
Merge branch 'master' into lildude/clean-old-nodes-on-restore
Browse files Browse the repository at this point in the history
  • Loading branch information
lildude committed May 10, 2018
2 parents 786af0f + bec81d3 commit 374ff58
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions bin/ghe-backup
Expand Up @@ -139,6 +139,10 @@ echo "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION
ghe_remote_version_required
echo "$GHE_REMOTE_VERSION" > version

if [ -n "$GHE_ALLOW_REPLICA_BACKUP" ]; then
echo "Warning: backing up a high availability replica may result in inconsistent or unreliable backups."
fi

# Log backup start message in /var/log/syslog on remote instance
ghe_remote_logger "Starting backup from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION in snapshot $GHE_SNAPSHOT_TIMESTAMP ..."

Expand Down
9 changes: 9 additions & 0 deletions bin/ghe-host-check
Expand Up @@ -91,6 +91,15 @@ if [ -z "$version" ]; then
exit 2
fi

if [ -z "$GHE_ALLOW_REPLICA_BACKUP" ]; then
if [ "$(ghe-ssh $host -- cat $GHE_REMOTE_ROOT_DIR/etc/github/repl-state 2>/dev/null || true)" = "replica" ]; then
echo "Error: high availability replica detected." 1>&2
echo "Backup Utilities should be used to backup from the primary node in" 1>&2
echo "high availability environments to ensure consistent and repliable backups." 1>&2
exit 1
fi
fi

# backup-utils 2.13 onwards limits support to the current and previous two releases
# of GitHub Enterprise.
supported_minimum_version="2.11.0"
Expand Down
13 changes: 13 additions & 0 deletions debian/changelog
@@ -1,3 +1,16 @@
github-backup-utils (2.13.1) UNRELEASED; urgency=medium

* Retry with the admin ssh port on network unreachable too. #377
* Output backup utils version on backup and restore #384
* Check filesystem supports hardlinks #388
* Switch back to optimised restore route calculation #389
* Optionally log verbose output to a file instead of stdout #391
* Switch back to optimised backup route calculation #392
* Remove check for git from ghe-ssh #393
* Use remote's mktemp to create temp dir on remote host #395

-- Colin Seymour <colin@github.com> Wed, 09 May 2018 10:16:18 +0000

github-backup-utils (2.13.0) UNRELEASED; urgency=medium

* Unify the backup & restore process #375
Expand Down
2 changes: 1 addition & 1 deletion share/github-backup-utils/version
@@ -1 +1 @@
2.13.0
2.13.1
12 changes: 12 additions & 0 deletions test/test-ghe-host-check.sh
Expand Up @@ -62,3 +62,15 @@ begin_test "ghe-host-check detects unsupported GitHub Enterprise versions"
GHE_TEST_REMOTE_VERSION=3.0.0 ghe-host-check
)
end_test

begin_test "ghe-host-check detects high availability replica"
(
set -e
echo "primary" > "$GHE_REMOTE_ROOT_DIR/etc/github/repl-state"
ghe-host-check

echo "replica" > "$GHE_REMOTE_ROOT_DIR/etc/github/repl-state"
! ghe-host-check
GHE_ALLOW_REPLICA_BACKUP=yes ghe-host-check
)
end_test

0 comments on commit 374ff58

Please sign in to comment.