Class: Meroku::Backup

Inherits:
Object
  • Object
show all
Includes:
Sshable
Defined in:
lib/meroku/backup.rb

Overview

Logic related to backup of production server

Instance Attribute Summary

Attributes included from Sshable

#connection

Instance Method Summary collapse

Methods included from Sshable

#close_ssh, #execute, #execute_script, #sshopts

Constructor Details

#initializeBackup

Returns a new instance of Backup.



8
9
10
11
12
13
14
15
16
17
# File 'lib/meroku/backup.rb', line 8

def initialize
  @connection = Net::SSH.start('34.239.241.218', 'ubuntu', sshopts)
  execute_script <<~HEREDOC
    SECRET=#{Meroku::Shared.secrets.meroku_secret} ~/backend_api/script/backup_db
    SECRET=#{Meroku::Shared.secrets.meroku_secret} ~/backend_api/script/backup_etc
    SECRET=#{Meroku::Shared.secrets.meroku_secret} ~/backend_api/script/backup_nginxconfs
    SECRET=#{Meroku::Shared.secrets.meroku_secret} ~/backend_api/script/backup_homedirs
  HEREDOC
  puts 'OK'
end