mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Off-site backup to Google Drive
- Admin → Off-site Backup: connect a Google account with your own OAuth client (drive.file scope; refresh token and secret encrypted) - Nightly after the verified database backup: upload the gzipped snapshot (newest N kept, Settings) and every uploaded file not yet copied - Restore test downloads the newest copy, opens and checks it, and checks sampled files against their checksums; failures emailed to admins - About, procedures document, policy completeness and audits use it - offsite:restore_files rake task; restore steps in the admin guide Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fe3fba1736
commit
7694719582
31 files changed
+853
-20
No files matched your search
@@ -0,0 +1,37 @@
|
||||
class CreateOffsiteBackups < ActiveRecord::Migration[8.1]
|
||||
def change
|
||||
# One row: the Google Drive account the off-site copies go to.
|
||||
create_table :offsite_connections do |t|
|
||||
t.string :provider, null: false, default: "google_drive"
|
||||
t.string :client_id
|
||||
t.text :client_secret
|
||||
t.text :refresh_token
|
||||
t.string :account_email
|
||||
t.string :folder_id
|
||||
t.string :database_folder_id
|
||||
t.string :files_folder_id
|
||||
t.references :connected_by, foreign_key: { to_table: :users }
|
||||
t.datetime :connected_at
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :offsite_runs do |t|
|
||||
t.string :kind, null: false # backup | restore_test
|
||||
t.boolean :ok, null: false
|
||||
t.text :message
|
||||
t.bigint :bytes
|
||||
t.integer :files_uploaded, null: false, default: 0
|
||||
t.json :details
|
||||
t.timestamps
|
||||
end
|
||||
add_index :offsite_runs, [ :kind, :created_at ]
|
||||
|
||||
# Uploaded files already copied off-site (by blob), so each goes once.
|
||||
create_table :offsite_files do |t|
|
||||
t.references :blob, null: false, index: { unique: true }
|
||||
t.string :drive_file_id, null: false
|
||||
t.bigint :bytes
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user