From b9989c4e9764cd7aed0a0bb2997d1e50789df29c Mon Sep 17 00:00:00 2001 From: Caine Jette Date: Tue, 31 Mar 2020 11:51:37 -0700 Subject: [PATCH 1/6] Introduce configuration to skip restoring of audit logs --- backup.config-example | 3 +++ bin/ghe-restore | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backup.config-example b/backup.config-example index 1ea7fb61f..1fc3571c8 100644 --- a/backup.config-example +++ b/backup.config-example @@ -43,6 +43,9 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_CREATE_DATA_DIR=yes +# If set to 'no', skip restoring audit logs to speed up restore time +RESTORE_AUDIT_LOGS=no + # If set to 'yes', git fsck will run on the repositories # and print some additional info. # diff --git a/bin/ghe-restore b/bin/ghe-restore index 386eacdae..4e2c60168 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -301,8 +301,12 @@ fi # Restore exported audit and hookshot logs to 2.12.9 and newer single nodes and # all releases of cluster if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then - echo "Restoring Audit logs ..." - ghe-restore-audit-log "$GHE_HOSTNAME" 1>&3 + if [[ "$RESTORE_AUDIT_LOGS" = "yes" ]]; then + echo "Restoring Audit logs ..." + ghe-restore-audit-log "$GHE_HOSTNAME" 1>&3 + else + echo "Skipping restore of audit logs." + fi echo "Restoring hookshot logs ..." ghe-restore-es-hookshot "$GHE_HOSTNAME" 1>&3 From 407f772b98d7c2c2052ebc067843629022da6c8e Mon Sep 17 00:00:00 2001 From: Caine Jette Date: Tue, 31 Mar 2020 11:55:01 -0700 Subject: [PATCH 2/6] Move configuration higher in the file --- backup.config-example | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backup.config-example b/backup.config-example index 1fc3571c8..2a81bb8e6 100644 --- a/backup.config-example +++ b/backup.config-example @@ -23,6 +23,9 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_RESTORE_HOST="github-standby.example.com" +# If set to 'no', skip restoring audit logs to speed up restore time +RESTORE_AUDIT_LOGS=yes + # When verbose output is enabled with `-v`, it's written to stdout by default. If # you'd prefer it to be written to a separate file, set this option. # @@ -43,9 +46,6 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_CREATE_DATA_DIR=yes -# If set to 'no', skip restoring audit logs to speed up restore time -RESTORE_AUDIT_LOGS=no - # If set to 'yes', git fsck will run on the repositories # and print some additional info. # From f8d966d7dacbd3c5b20ad7d0f0341928881c6a4a Mon Sep 17 00:00:00 2001 From: Caine Jette Date: Tue, 31 Mar 2020 11:56:38 -0700 Subject: [PATCH 3/6] Prefix configuration with GHE_ for consistency --- backup.config-example | 2 +- bin/ghe-restore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backup.config-example b/backup.config-example index 2a81bb8e6..26bf2f1c7 100644 --- a/backup.config-example +++ b/backup.config-example @@ -24,7 +24,7 @@ GHE_NUM_SNAPSHOTS=10 #GHE_RESTORE_HOST="github-standby.example.com" # If set to 'no', skip restoring audit logs to speed up restore time -RESTORE_AUDIT_LOGS=yes +GHE_RESTORE_AUDIT_LOGS=yes # When verbose output is enabled with `-v`, it's written to stdout by default. If # you'd prefer it to be written to a separate file, set this option. diff --git a/bin/ghe-restore b/bin/ghe-restore index 4e2c60168..a36b104f3 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -301,7 +301,7 @@ fi # Restore exported audit and hookshot logs to 2.12.9 and newer single nodes and # all releases of cluster if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then - if [[ "$RESTORE_AUDIT_LOGS" = "yes" ]]; then + if [[ "$GHE_RESTORE_AUDIT_LOGS" = "yes" ]]; then echo "Restoring Audit logs ..." ghe-restore-audit-log "$GHE_HOSTNAME" 1>&3 else From 9585b3b12dcbed8e11ab4308ce9c6644197b7b2a Mon Sep 17 00:00:00 2001 From: Caine Jette Date: Tue, 31 Mar 2020 12:26:24 -0700 Subject: [PATCH 4/6] Switch flag default --- backup.config-example | 4 ++-- bin/ghe-restore | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backup.config-example b/backup.config-example index 26bf2f1c7..8b43cc5a1 100644 --- a/backup.config-example +++ b/backup.config-example @@ -23,8 +23,8 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_RESTORE_HOST="github-standby.example.com" -# If set to 'no', skip restoring audit logs to speed up restore time -GHE_RESTORE_AUDIT_LOGS=yes +# If set to 'yes', skip restoring audit logs to speed up restore time. +#GHE_RESTORE_SKIP_AUDIT_LOGS=no # When verbose output is enabled with `-v`, it's written to stdout by default. If # you'd prefer it to be written to a separate file, set this option. diff --git a/bin/ghe-restore b/bin/ghe-restore index a36b104f3..b7448eebf 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -301,11 +301,11 @@ fi # Restore exported audit and hookshot logs to 2.12.9 and newer single nodes and # all releases of cluster if $CLUSTER || [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.12.9)" ]; then - if [[ "$GHE_RESTORE_AUDIT_LOGS" = "yes" ]]; then + if [[ "$GHE_RESTORE_SKIP_AUDIT_LOGS" = "yes" ]]; then + echo "Skipping restore of audit logs." + else echo "Restoring Audit logs ..." ghe-restore-audit-log "$GHE_HOSTNAME" 1>&3 - else - echo "Skipping restore of audit logs." fi echo "Restoring hookshot logs ..." From 9089ab2c3aa4253227454507a651cb73a7b622bd Mon Sep 17 00:00:00 2001 From: Caine Jette Date: Tue, 31 Mar 2020 12:28:02 -0700 Subject: [PATCH 5/6] Add newline comment for consistency --- backup.config-example | 1 + 1 file changed, 1 insertion(+) diff --git a/backup.config-example b/backup.config-example index 8b43cc5a1..9451a57f2 100644 --- a/backup.config-example +++ b/backup.config-example @@ -24,6 +24,7 @@ GHE_NUM_SNAPSHOTS=10 #GHE_RESTORE_HOST="github-standby.example.com" # If set to 'yes', skip restoring audit logs to speed up restore time. +# #GHE_RESTORE_SKIP_AUDIT_LOGS=no # When verbose output is enabled with `-v`, it's written to stdout by default. If From 5a4b69ad5dd26e9a4be576866aea2aeb071c9966 Mon Sep 17 00:00:00 2001 From: Caine Jette Date: Tue, 31 Mar 2020 12:32:10 -0700 Subject: [PATCH 6/6] Change wording to match pages PR --- backup.config-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backup.config-example b/backup.config-example index 9451a57f2..4a339dd29 100644 --- a/backup.config-example +++ b/backup.config-example @@ -23,7 +23,7 @@ GHE_NUM_SNAPSHOTS=10 # #GHE_RESTORE_HOST="github-standby.example.com" -# If set to 'yes', skip restoring audit logs to speed up restore time. +# If set to 'yes', ghe-restore will omit the restore of audit logs. # #GHE_RESTORE_SKIP_AUDIT_LOGS=no