简体   繁体   中英

backup database using gem “backup” in rails

I had a problem to backup database by using backup gem in rails.

this is my daily_db_backup.rb

Model.new(:daily_db_backup, 'Description for daily_db_backup') do
  database SQLite do |db|
     db.path               = "home/ec2-user/project/db/production.sqlite3"
     db.sqlitedump_utility = "/usr/bin/sqlite3"
  end

  compress_with Gzip

  store_with S3 do |s3|
     s3.access_key_id     = "my_key_id"
     s3.secret_access_key = "my_access_key"
     s3.region             = 'ap-northeast-2'
     s3.bucket             = 'project'
     s3.path               = 'home/ec2-user/project/db/production.sqlite3'
  end

  notify_by Mail do |mail|
     mail.on_success           = true
     mail.on_warning           = true
     mail.on_failure           = true
     mail.delivery_method      = :sendmail
     mail.from                 = "backup_check@email.com"
     mail.to                   = "myemail@email.com"
  end
end

and these are error messages

[error] Model::Error: Backup for Description for daily_db_backup (daily_db_backup) Failed!
[error] --- Wrapped Exception ---
[error] Database::SQLite::Error: Database::SQLite Dump Failed!
[error]   Pipeline STDERR Messages:
[error]   (Note: may be interleaved if multiple commands returned error messages)
[error]   
[error]   Error: unable to open database "home/ec2-user/project/db/production.sqlite3": unable to open database file
[error]   The following system errors were returned:
[error]   Errno::EPERM: Operation not permitted - 'echo' returned exit code: 1

then, how can i solve this problem?

The error logs said unable to open database

"home/ec2-user/project/db/production.sqlite3": unable to open database file

Please check your production.sqlite3 path .

I think it should be "/home/ec2-user..."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM