Skip to content

Commit 38d587d

Browse files
authored
Update formatting on ghe-host-check
Added: - Recommended Disk requirement - Updated formatting of checks
1 parent 5f40dc1 commit 38d587d

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

bin/ghe-host-check

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,10 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then
157157
. "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size"
158158

159159
#Display dir requirements for repositories and mysql
160+
echo "" 1>&2
160161
echo "Checking host for sufficient space for a backup..." 1>&2
161162
available_space=$(df -B 1k $GHE_DATA_DIR | awk 'END{printf "%.0f", $4 * 1024}')
162-
echo "We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." 1>&2
163+
echo " We recommend allocating at least 5x the amount of storage allocated to the primary GitHub appliance for historical snapshots and growth over time." 1>&2
163164

164165
repos_disk_size=$(transfer_size repositories /tmp)
165166
pages_disk_size=$(transfer_size pages /tmp)
@@ -171,20 +172,24 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then
171172
mssql_disk_size=$(transfer_size mssql /tmp)
172173

173174
min_disk_req=$((repos_disk_size + pages_disk_size + es_disk_size + stor_disk_size + minio_disk_size + mysql_disk_size + actions_disk_size + mssql_disk_size))
174-
echo "Available space: $((available_space / (1024 ** 2))) MB" 1>&2
175-
echo -e "Min Disk required for this backup is at least $min_disk_req MB\n" 1>&2
175+
recommended_disk_req=$((min_disk_req * 5))
176+
echo " - Available space: $((available_space / (1024 ** 2))) MB" 1>&2
177+
echo " - Min Disk required for this backup is at least $min_disk_req MB" 1>&2
178+
echo " - Recommended Disk requirement is $recommended_disk_req MB" 1>&2
179+
echo "" 1>&2
176180

177-
cat <<DATA_TRANSFER_SIZE 1>&2
181+
cat <<DATA_TRANSFER_SIZE 1>&2
178182
### Data Transfer Sizes
179-
repositories: $repos_disk_size MB
180-
pages: $pages_disk_size MB
181-
elasticsearch: $es_disk_size MB
182-
storage: $stor_disk_size MB
183-
minio: $minio_disk_size MB
184-
mysql: $mysql_disk_size MB
185-
actions: $actions_disk_size MB
186-
mssql: $mssql_disk_size MB
183+
- repositories: $repos_disk_size MB
184+
- pages: $pages_disk_size MB
185+
- elasticsearch: $es_disk_size MB
186+
- storage: $stor_disk_size MB
187+
- minio: $minio_disk_size MB
188+
- mysql: $mysql_disk_size MB
189+
- actions: $actions_disk_size MB
190+
- mssql: $mssql_disk_size MB
187191
DATA_TRANSFER_SIZE
192+
echo "" 1>&2
188193

189194
if [[ $((available_space / (1024 * 1024))) -lt $min_disk_req ]]; then
190195
echo "There is not enough disk space for the backup. Please allocate more space and continue." 1>&2
@@ -223,15 +228,15 @@ You can disable this warning by changing RSYNC_WARNING to 'no' in your backup.co
223228
224229
WARN_MSG
225230
fi
226-
echo "rsync ${rsync_version} >= required ($min_rsync)" 1>&2
231+
echo " - rsync ${rsync_version} >= required ($min_rsync)" 1>&2
227232

228233
ssh_version=$(ssh -V 2>&1 | awk '{print $1}'|grep -oPm 1 '[\d\.]+' |head -1 | tr -cd '[:digit:].\n')
229234
if awk "BEGIN {exit !($ssh_version < $min_openssh)}" &> /dev/null; then
230235
echo "openSSH version $ssh_version in backup-host does not meet minimum requirements." 1>&2
231236
echo "Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2
232237
exit 1
233238
else
234-
echo "openSSH ${ssh_version} >= required ($min_openssh)" 1>&2
239+
echo " - openSSH ${ssh_version} >= required ($min_openssh)" 1>&2
235240
fi
236241

237242
jq_version=$(jq --version |awk -F\- '{print $2}' | tr -cd '[:digit:].\n')
@@ -240,8 +245,8 @@ WARN_MSG
240245
echo "Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2
241246
exit 1
242247
else
243-
echo "jq ${jq_version} >= required ($min_jq)" 1>&2
248+
echo " - jq ${jq_version} >= required ($min_jq)" 1>&2
244249
fi
245250
fi
246-
251+
echo "" 1>&2
247252
echo "Connect $hostname:$port OK (v$version)"

0 commit comments

Comments
 (0)