Skip to content

Commit 99dbfe4

Browse files
committed
Adds recover_origin task to Fabric
Whilst we can fail the site to mirrors easily using Fabric, we can't restore as easily - at least, it's not a super-quick Fabric script. This makes it a nice quick fix. The logic is as follows: - Re-enable Puppet on the affected class - Run Puppet, with some degree of verbosity for confidence - This should restore the www.gov.uk Nginx vhost - This should restart Nginx because the configuration has changed - Prints a success message Changes the fail_to_mirror success message to point to using this task in future to recover back to origin from the mirrors.
1 parent 301b034 commit 99dbfe4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

incident.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@ def fail_to_mirror():
1010
nginx.disable_vhost("www.gov.uk")
1111
nginx.force_restart()
1212
print("Disabled Puppet and www.gov.uk vhost, remember to re-enable and re-run puppet to restore previous state")
13+
14+
@task
15+
@roles('class-cache')
16+
def recover_origin():
17+
"""Recovers GOV.UK to serve from origin after incident.fail_to_mirror has been invoked"""
18+
puppet.enable()
19+
puppet.agent("--test")
20+
print("Puppet has been re-enabled, has run and the site should now be serving from origin as normal.")

0 commit comments

Comments
 (0)