Skip to content

Commit 5e4d89c

Browse files
authored
Merge pull request #743 from github/enterprise-3.11-backport-revert-cluster-changes
Enterprise 3.11 backport revert cluster changes
2 parents 58b2db1 + 6e8cbf4 commit 5e4d89c

File tree

4 files changed

+5
-60
lines changed

4 files changed

+5
-60
lines changed

backup.config-example

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ GHE_NUM_SNAPSHOTS=10
3232
# disk space validation and software version checks on the backup-host will be disabled.
3333
#GHE_SKIP_CHECKS=false
3434

35-
# Cluster filesystem to check if it's writable as part of ghe-host-check
36-
# By default it is /data/user/tmp but can be updated if needed
37-
#GHE_FILE_SYSTEM_WRITE_CHECK="/data/user/tmp"
38-
3935
# The hostname of the GitHub appliance to restore. If you've set up a separate
4036
# GitHub appliance to act as a standby for recovery, specify its IP or hostname
4137
# here. The host to restore to may also be specified directly when running

bin/ghe-backup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ if [ -z "$failures" ]; then
377377
else
378378
log_info "Expired and incomplete snapshots to be pruned separately"
379379
fi
380-
else
380+
else
381381
log_info "Skipping pruning snapshots, since some backups failed..."
382382
fi
383383

bin/ghe-host-check

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,28 @@ if [ $rc -ne 0 ]; then
8585
exit $rc
8686
fi
8787

88-
if [ -z "$CLUSTER" ]; then
89-
CLUSTER=false
90-
fi
88+
CLUSTER=false
9189
if ghe-ssh "$host" -- \
9290
"[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ]"; then
9391
CLUSTER=true
9492
fi
9593

96-
set +e
9794
# ensure all nodes in the cluster are online/reachable and running the same version
9895
if "$CLUSTER"; then
9996
online_status=$(ghe-ssh "$host" ghe-cluster-host-check)
10097
if [ "$online_status" != "Cluster is ready to configure." ]; then
101-
echo "$online_status" 1>&2
102-
log_error "Error: Not all nodes are online! Please ensure cluster is in a healthy state before using backup-utils." 1>&2
98+
echo "Error: Not all nodes are online! Please ensure cluster is in a healthy state before using backup-utils." 1>&2
10399
exit 1
104100
fi
105101

106102
node_version_list=$(ghe-ssh "$host" ghe-cluster-each -- ghe-version)
107103
distinct_versions=$(echo "$node_version_list" | awk '{split($0, a, ":"); print a[2]}' | awk '{print $4}' | uniq | wc -l)
108104
if [ "$distinct_versions" -ne 1 ]; then
109105
echo "Version mismatch: $node_version_list" 1>&2
110-
log_error "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2
106+
echo "Error: Not all nodes are running the same version! Please ensure all nodes are running the same version before using backup-utils." 1>&2
111107
exit 1
112108
fi
113109
fi
114-
set -e
115110

116111
version=$(echo "$output" | grep "GitHub Enterprise" | awk '{print $NF}')
117112

@@ -120,37 +115,6 @@ if [ -z "$version" ]; then
120115
exit 2
121116
fi
122117

123-
NON_WRITABLE=""
124-
# ensure all nodes are writable
125-
if [ "$CLUSTER" == "true" ] ; then
126-
if [ -z "$GHE_FILE_SYSTEM_WRITE_CHECK" ]; then
127-
if [ -d "/data/user/tmp" ]; then
128-
WRITE_CHECK_FILE="/data/user/tmp/test-ro-file.txt"
129-
else
130-
WRITE_CHECK_FILE="/tmp/test-ro-file.txt"
131-
fi
132-
else
133-
WRITE_CHECK_FILE="$GHE_FILE_SYSTEM_CHECK/test-ro-file.txt"
134-
fi
135-
136-
# Iterate through each node in the cluster
137-
nodes=$(ghe-ssh "$host" ghe-cluster-nodes)
138-
for node in $nodes; do
139-
if ! echo "set -o pipefail; ssh $node -- 'touch $WRITE_CHECK_FILE && rm $WRITE_CHECK_FILE'" | ghe-ssh "$host" /bin/bash; then
140-
echo "File system is not writeable or no permission on $node" 1>&2
141-
NON_WRITABLE+="$node "
142-
fi || true
143-
done
144-
# Display the comma-separated list of non-writable nodes
145-
if [ -n "$NON_WRITABLE" ]; then
146-
NON_WRITABLE=$(echo "$NON_WRITABLE" | sed 's/ /, /g; s/, $//')
147-
log_error "Error: Following nodes are non-writable - $NON_WRITABLE. Please make sure the filesystem for all GHES nodes are writable." 1>&2
148-
exit 1
149-
else
150-
log_info "All nodes are writable."
151-
fi
152-
fi
153-
154118
# Block restoring snapshots to older releases of GitHub Enterprise Server
155119
if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then
156120
snapshot_version=$(cat $GHE_RESTORE_SNAPSHOT_PATH/version)
@@ -213,7 +177,7 @@ SKIP_MSG
213177

214178
#Display dir requirements for repositories and mysql
215179
echo -e "\nChecking host for sufficient space for a backup..."
216-
available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}')
180+
available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}')
217181
echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time."
218182

219183
repos_disk_size=$(transfer_size repositories /tmp)

test/test-ghe-host-check.sh

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,3 @@ begin_test "ghe-host-check blocks restore to old release"
122122
! GHE_TEST_REMOTE_VERSION=$bu_version_major.$((bu_version_minor-1)).$bu_version_patch ghe-restore -v
123123
)
124124
end_test
125-
126-
# Check ghe-host-check detects RO file system
127-
begin_test "ghe-host-check fails when encountering RO file-system"
128-
(
129-
set -e
130-
131-
ghe-ssh "$GHE_HOSTNAME" -- 'mkdir -p "~/tmp"'
132-
# Remove write access in ~/tmp
133-
ghe-ssh "$GHE_HOSTNAME" -- 'chmod a-w -R "~/tmp"'
134-
135-
# File creation fails for CLUSTER
136-
! WRITE_CHECK_FILE="$HOME/tmp/test" CLUSTER=true GHE_ALLOW_REPLICA_BACKUP=no ghe-host-check
137-
WRITE_CHECK_FILE="$HOME/tmp/test" CLUSTER=false GHE_ALLOW_REPLICA_BACKUP=no ghe-host-check
138-
)
139-
end_test

0 commit comments

Comments
 (0)