Class: KamalBackup::CLI::DrillCLI
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Helpers
#accessory_name, #bridge, #command_env, #confirm!, #deploy_snippet, #deployment_mode?, #direct_app, #exec_remote, #init_config_root, #local_app, #local_command_config, #local_preferences, #prompt_required, #redactor, #shared_config_path, #shared_config_template, #write_init_file
Class Method Details
.basename ⇒ Object
177
178
179
|
# File 'lib/kamal_backup/cli.rb', line 177
def self.basename
CLI.basename
end
|
Instance Method Details
#local(snapshot = "latest") ⇒ Object
183
184
185
186
187
188
|
# File 'lib/kamal_backup/cli.rb', line 183
def local(snapshot = "latest")
confirm!("Run a local restore drill for #{snapshot}? This will overwrite local data.")
result = local_app.drill_on_local_machine(snapshot, check_command: options[:check])
puts(JSON.pretty_generate(result))
exit(1) if local_app.drill_failed?(result)
end
|
#production(snapshot = "latest") ⇒ Object
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
# File 'lib/kamal_backup/cli.rb', line 195
def production(snapshot = "latest")
confirm!("Run a production-side restore drill for #{snapshot}? This will restore into scratch targets on production infrastructure.")
if deployment_mode?
argv = ["kamal-backup", "drill", "production", snapshot, "--files", options[:files], "--yes"]
argv.concat(["--database", production_database_name]) if production_database_name
argv.concat(["--sqlite-path", options[:"sqlite-path"]]) if options[:"sqlite-path"]
argv.concat(["--check", options[:check]]) if options[:check]
exec_remote(argv)
else
result = direct_app.drill_on_production(
snapshot,
database_name: production_database_name,
sqlite_path: options[:"sqlite-path"],
file_target: options[:files],
check_command: options[:check]
)
puts(JSON.pretty_generate(result))
exit(1) if direct_app.drill_failed?(result)
end
end
|