Skip to content

Commit 0e42379

Browse files
authored
Add redis restart mechanism (#583)
1 parent eebe329 commit 0e42379

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

bin/ghe-restore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,25 @@ echo "sudo restart -q memcached 2>/dev/null || true" |
636636
ghe-ssh "$GHE_HOSTNAME" -- /bin/sh
637637
bm_end "$(basename $0) - Restarting memcached"
638638

639+
# Restart redis before updating keys
640+
# It's possible that redis hcl is not rendered on an unconfigured system
641+
# so check first
642+
if $instance_configured; then
643+
log_info "Getting redis status before restart..." 1>&3
644+
echo "nomad status redis" |
645+
ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3
646+
log_info "Restarting redis" 1>&3
647+
echo "nomad stop redis" |
648+
ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3 2>&3
649+
ghe-ssh "$GHE_HOSTNAME" -- "/usr/local/share/enterprise/ghe-nomad-jobs queue /etc/nomad-jobs/redis/redis.hcl" 1>&3 2>&3
650+
if $? -gt 0; then
651+
log_error "Unable to restart redis"
652+
fi
653+
log_info "Getting redis status after restart..." 1>&3
654+
echo "nomad status redis" |
655+
ghe-ssh "$GHE_HOSTNAME" -- /bin/sh 1>&3
656+
fi
657+
639658
# Prevent GitHub Connect jobs running before we've had a chance to reset
640659
# the configuration by setting the last run date to now.
641660
if ! $RESTORE_SETTINGS; then

test/bin/ghe-nomad-jobs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
# Usage: ghe-nomad-jobs
3+
# Emulates the remote GitHub ghe-nomad-jobs command. Tests use this
4+
# to assert that the command was executed.
5+
set -e
6+
echo "$(basename $0)" "'$(cat)'" "OK"
7+

0 commit comments

Comments
 (0)