@@ -85,33 +85,13 @@ echo "Starting backup of $GHE_HOSTNAME in snapshot $GHE_SNAPSHOT_TIMESTAMP"
8585ghe_remote_version_required
8686echo " $GHE_REMOTE_VERSION " > version
8787
88- # Figure out if we're restoring into cluster
89- cluster=false
90- if ghe-ssh " $GHE_HOSTNAME " -- \
91- " [ -f '$GHE_REMOTE_ROOT_DIR /etc/github/cluster' ]" ; then
92- cluster=true
93- fi
94-
9588# Log backup start message in /var/log/syslog on remote instance
9689ghe_remote_logger " Starting backup from $( hostname) in snapshot $GHE_SNAPSHOT_TIMESTAMP ..."
9790
98- # Determine whether to use the rsync or tarball backup strategy based on the
99- # remote appliance version. The tarball strategy must be used with GitHub
100- # Enterprise versions prior to 11.10.340 since rsync is not available.
101- # The tarball strategy may be forced for newer versions by setting
102- # GHE_BACKUP_STRATEGY=tarball in backup.config but this is not recommended.
103- : ${GHE_BACKUP_STRATEGY:= rsync}
104- if [ $GHE_VERSION_MAJOR -eq 1 -a $GHE_VERSION_PATCH -lt 340 ]; then
105- GHE_BACKUP_STRATEGY=" tarball"
106- fi
107-
108- if $cluster ; then
109- GHE_BACKUP_STRATEGY=" cluster"
110- fi
91+ export GHE_BACKUP_STRATEGY=${GHE_BACKUP_STRATEGY:- $(ghe-backup-strategy)}
11192
11293# Record the strategy with the snapshot so we will know how to restore.
11394echo " $GHE_BACKUP_STRATEGY " > strategy
114- export GHE_BACKUP_STRATEGY
11595
11696# If we're using the tarball backup strategy, put the appliance in maintenance
11797# mode and wait for all writing processes to bleed out.
@@ -150,7 +130,7 @@ failures="$failures mysql"
150130bm_end " ghe-export-mysql"
151131
152132echo " Backing up Redis database ..."
153- if $ cluster; then
133+ if [ " $GHE_BACKUP_STRATEGY " = " cluster" ] ; then
154134 ghe-backup-redis-cluster > redis.rdb ||
155135 failures=" $failures redis"
156136else
@@ -187,7 +167,7 @@ ghe-backup-pages-${GHE_BACKUP_STRATEGY} ||
187167failures=" $failures pages"
188168
189169if [ " $GHE_VERSION_MAJOR " -ge 2 ]; then
190- if $ cluster; then
170+ if [ " $GHE_BACKUP_STRATEGY " = " cluster" ] ; then
191171 echo " Backing up asset attachments ..."
192172 ghe-backup-alambic-cluster ||
193173 failures=" $failures alambic_assets"
@@ -216,7 +196,7 @@ if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
216196 fi
217197fi
218198
219- if ! $ cluster; then
199+ if [ " $GHE_BACKUP_STRATEGY " != " cluster" ] ; then
220200 echo " Backing up Elasticsearch indices ..."
221201 ghe-backup-es-${GHE_BACKUP_STRATEGY} ||
222202 failures=" $failures elasticsearch"
0 commit comments