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:
rickyandClaude Opus 5.5 committed 2026-11-07 13:51:45 -05:00
1 parent fe3fba1736
commit 7694719582
31 files changed
+853 -20

No files matched your search

+3 -2
View File
@@ -13,7 +13,8 @@
</div>
<%= f.field :hosting_description, as: :textarea, rows: 2, label: "Hosting and network",
placeholder: "Self-hosted on a server at the owner's home, behind a firewall and an authenticating proxy." %>
<%= f.field :offsite_backup_description, as: :textarea, rows: 2, label: "Off-site backup",
<%= f.field :offsite_backup_description, as: :textarea, rows: 2, label: (OffsiteConnection.connected? ? "Off-site backup (optional: Google Drive is connected)" : "Off-site backup"),
hint: (OffsiteConnection.connected? ? "The Google Drive backup is described automatically; add anything else here." : "Or set up the built-in Google Drive backup under Admin → Off-site Backup."),
placeholder: "The storage volume is backed up nightly with restic to an encrypted off-site repository; retention 30 days." %>
<div class="grid gap-4 sm:grid-cols-2">
<%= f.field :audit_interval_months, as: :number, min: 1, max: 24, label: "Audit every (months)" %>
@@ -36,7 +37,7 @@
<%= form_with url: adopt_admin_procedures_path, class: "flex flex-wrap items-end gap-2" do %>
<div class="min-w-0 flex-1"><%= label_tag :summary, "What changed", class: "label" %><%= text_field_tag :summary, nil, class: "input", placeholder: current ? "e.g. new mechanic added" : "Initial issue" %></div>
<%= submit_tag "Adopt as revision #{(current&.number || 0) + 1}", class: "btn-primary", disabled: !@policy.complete?,
title: (@policy.complete? ? nil : "Fill in the operator, responsible person, hosting and off-site backup first") %>
title: (@policy.complete? ? nil : "Fill in the operator, responsible person, hosting and off-site backup (or connect Google Drive) first") %>
<% end %>
</section>
<section class="card">