Pre and post Traefik reboot hooks
Provide pre and post reboot hooks for Traefik, that can be used to remove/add to an external load balancer to prevent requests from being sent during the reboot. Works best with the --rolling setting, where each hook is called once per host.
This commit is contained in:
3
test/integration/docker/deployer/app/.kamal/hooks/post-traefik-reboot
Executable file
3
test/integration/docker/deployer/app/.kamal/hooks/post-traefik-reboot
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
echo "Rebooted Traefik on ${KAMAL_HOSTS}"
|
||||
mkdir -p /tmp/${TEST_ID} && touch /tmp/${TEST_ID}/post-traefik-reboot
|
||||
3
test/integration/docker/deployer/app/.kamal/hooks/pre-traefik-reboot
Executable file
3
test/integration/docker/deployer/app/.kamal/hooks/pre-traefik-reboot
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
echo "Rebooting Traefik on ${KAMAL_HOSTS}..."
|
||||
mkdir -p /tmp/${TEST_ID} && touch /tmp/${TEST_ID}/pre-traefik-reboot
|
||||
@@ -7,8 +7,19 @@ class TraefikTest < IntegrationTest
|
||||
kamal :traefik, :boot
|
||||
assert_traefik_running
|
||||
|
||||
kamal :traefik, :reboot
|
||||
output = kamal :traefik, :reboot, capture: true
|
||||
assert_traefik_running
|
||||
assert_hooks_ran "pre-traefik-reboot", "post-traefik-reboot"
|
||||
assert_match /Rebooting Traefik on vm1,vm2.../, output
|
||||
assert_match /Rebooted Traefik on vm1,vm2/, output
|
||||
|
||||
output = kamal :traefik, :reboot, :"--rolling", capture: true
|
||||
assert_traefik_running
|
||||
assert_hooks_ran "pre-traefik-reboot", "post-traefik-reboot"
|
||||
assert_match /Rebooting Traefik on vm1.../, output
|
||||
assert_match /Rebooted Traefik on vm1/, output
|
||||
assert_match /Rebooting Traefik on vm2.../, output
|
||||
assert_match /Rebooted Traefik on vm2/, output
|
||||
|
||||
kamal :traefik, :boot
|
||||
assert_traefik_running
|
||||
|
||||
Reference in New Issue
Block a user