Method: Backup::Model#perform!

Defined in:
lib/backup/model.rb

#perform!Object

Performs the backup process

Databases

Runs all (if any) database objects to dump the databases

Archives

Runs all (if any) archive objects to package all their paths in to a single tar file and places it in the backup folder

Package

After all the database dumps and archives are placed inside the folder, it’ll make a single .tar package (archive) out of it

Encryption

Optionally encrypts the packaged file with one or more encryptors

Compression

Optionally compresses the packaged file with one or more compressors

Storages

Runs all (if any) storage objects to store the backups to remote locations and (if configured) it’ll cycle the files on the remote location to limit the amount of backups stored on each individual location

Syncers

Runs all (if any) sync objects to store the backups to remote locations. A Syncer does not go through the process of packaging, compressing, encrypting backups. A Syncer directly transfers data from the filesystem to the remote location

Notifiers

Runs all (if any) notifier objects when a backup proces finished with or without any errors.

Cleaning

After the whole backup process finishes, it’ll go ahead and remove any temporary file that it produced. If an exception(error) is raised during this process which breaks the process, it’ll always ensure it removes the temporary files regardless to avoid mass consumption of storage space on the machine



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/backup/model.rb', line 214

def perform!
  begin
    if databases.any? or archives.any?
      databases.each   { |d| d.perform! }
      archives.each    { |a| a.perform! }
      package!
      compressors.each { |c| c.perform! }
      encryptors.each  { |e| e.perform! }
      storages.each    { |s| s.perform! }
      clean!
    end

    syncers.each   { |s| s.perform!       }
    notifiers.each { |n| n.perform!(self) }
  rescue Exception => exception
    clean!
    notifiers.each   { |n| n.perform!(self, exception) }
    show_exception!(exception)
  end
end