-
-
Notifications
You must be signed in to change notification settings - Fork 498
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4798 from rubyforgood/reminder-deadline
Add reminder deadline job and backup RDS
- Loading branch information
Showing
5 changed files
with
59 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# to be called from Clock | ||
module BackupDbRds | ||
def run | ||
logger = Logger.new($stdout) | ||
logger.info("Performing dump of the database.") | ||
|
||
current_time = Time.current.strftime("%Y%m%d%H%M%S") | ||
|
||
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}") | ||
|
||
account_name = ENV["AZURE_STORAGE_ACCOUNT_NAME"] | ||
account_key = ENV["AZURE_STORAGE_ACCESS_KEY"] | ||
|
||
blob_client = Azure::Storage::Blob::BlobService.create( | ||
storage_account_name: account_name, | ||
storage_access_key: account_key | ||
) | ||
|
||
logger.info("Uploading #{backup_filename}") | ||
blob_client.create_block_blob("backups", backup_filename, File.read(backup_filename)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.