@@ -68,3 +68,50 @@ def reindex_app(app):
68
68
sudo ('govuk_setenv default bundle exec rake -v "%s" --trace' % rake_task , user = 'deploy' )
69
69
else :
70
70
util .rake (app , rake_task )
71
+
72
+
73
+ @task
74
+ def find_latest_snapshot ():
75
+ """Find the latest rummager snapshot"""
76
+ util .rake ('rummager' , 'rummager:snapshot:latest' )
77
+
78
+
79
+ @task
80
+ def find_snapshot_for_date (date ):
81
+ """Find the latest rummager snapshot before a date (YYYY-mm-dd HH:MM:SS)"""
82
+ util .rake ('rummager' , 'rummager:snapshot:latest' , date )
83
+
84
+
85
+ @task
86
+ def list_snapshots ():
87
+ """List rummager snapshots"""
88
+ util .rake ('rummager' , 'rummager:snapshot:list' )
89
+
90
+
91
+ @task
92
+ def restore_snapshot (snapshot , groups_to_restore ):
93
+ """Restore snapshots to new indices.
94
+
95
+ `groups_to_restore` is either 'all' or a comma separated list of aliases.
96
+ """
97
+ util .rake (
98
+ 'rummager' ,
99
+ 'rummager:snapshot:restore' ,
100
+ snapshot ,
101
+ RUMMAGER_INDEX = groups_to_restore
102
+ )
103
+
104
+ puts (
105
+ "After the recovery is complete, switch to the new indexes with rummager.switch_group_to_index"
106
+ )
107
+
108
+
109
+ @task
110
+ def switch_group_to_index (group , index_name ):
111
+ """Point a rummager index alias to a new index"""
112
+ util .rake (
113
+ 'rummager' ,
114
+ 'rummager:switch_to_named_index' ,
115
+ index_name ,
116
+ RUMMAGER_INDEX = group
117
+ )
0 commit comments