Skip to content

Commit

Permalink
Use standard out logger instead of system echo (#4787)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorner authored Nov 17, 2024
1 parent 11541b1 commit 64c75a6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/tasks/backup_db_rds.rake
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
desc "Update the development db to what is being used in prod"
task :backup_db_rds => :environment do
system("echo Performing dump of the database.")
logger = Logger.new(STDOUT)
logger.info("Performing dump of the database.")

current_time = Time.current.strftime("%Y%m%d%H%M%S")

system("echo Copying of the database...")
logger.info("Copying the database...")
backup_filename = "#{current_time}.rds.dump"
system("PGPASSWORD='#{ENV["DIAPER_DB_PASSWORD"]}' pg_dump -Fc -v --host=#{ENV["DIAPER_DB_HOST"]} --username=#{ENV["DIAPER_DB_USERNAME"]} --dbname=#{ENV["DIAPER_DB_DATABASE"]} -f #{backup_filename}")

Expand All @@ -16,6 +17,6 @@ task :backup_db_rds => :environment do
storage_access_key: account_key
)

system("echo Uploading #{backup_filename}")
logger.info("Uploading #{backup_filename}")
blob_client.create_block_blob("backups", backup_filename, File.read(backup_filename))
end

0 comments on commit 64c75a6

Please sign in to comment.