mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Records package: README explains viewing the data locally, links the source; includes viewer/docker-compose.yml
The viewer compose uses the published image (from docker-compose.image.yml) and a throwaway secret key, plain HTTP on localhost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f390f3366
commit
afaa1ca191
4 files changed
+64
-4
No files matched your search
@@ -135,7 +135,7 @@ To back up or move a single aircraft with all its files, use **Access & Sharing
|
|||||||
| Logbook | Maintenance entries with search and a link to a scanned document page. Records the signer's certificate kind and number and an inspection's result, and flags what 43.9 / 43.11 needs that's missing. Entries transcribed by Claude stay "unverified" until someone checks them against the scan. Entry templates (built-in pilot preventive maintenance per 43.3(g) and Part 43 Appendix A(c); admins add and edit their own under Admin → Logbook templates). Engine and propeller entries link the component and record its total time and time since overhaul (SMOH/SFOH/SNEW) at the entry, worked out from the entry's airframe total time; sub-components (an oil filter on the engine…) can be included with their own times. Print entries as a PDF on Avery 5163/8163 or 5164/8164 labels or half-letter/letter pages (boxed) to sign and put in the paper logbook. |
|
| Logbook | Maintenance entries with search and a link to a scanned document page. Records the signer's certificate kind and number and an inspection's result, and flags what 43.9 / 43.11 needs that's missing. Entries transcribed by Claude stay "unverified" until someone checks them against the scan. Entry templates (built-in pilot preventive maintenance per 43.3(g) and Part 43 Appendix A(c); admins add and edit their own under Admin → Logbook templates). Engine and propeller entries link the component and record its total time and time since overhaul (SMOH/SFOH/SNEW) at the entry, worked out from the entry's airframe total time; sub-components (an oil filter on the engine…) can be included with their own times. Print entries as a PDF on Avery 5163/8163 or 5164/8164 labels or half-letter/letter pages (boxed) to sign and put in the paper logbook. |
|
||||||
| Documents | Collections, multi-file documents with a page viewer, per-document share visibility, bulk upload, and expiration dates (registration, insurance…). |
|
| Documents | Collections, multi-file documents with a page viewer, per-document share visibility, bulk upload, and expiration dates (registration, insurance…). |
|
||||||
| Electronic signatures | Logbook entries can be signed electronically along the lines of AC 120-78B chapter 2: the signer reviews the entry, picks their certificate, re-enters their password (or signs in again with SSO) and confirms a "Certified by" statement. The signature records who, which certificate, the statement, the time and a SHA-256 fingerprint of the entry, sealed by the server; the signer gets an email. Signed entries are locked: a correction is a new signed entry that supersedes the original. Owners can invite an outside mechanic to sign one entry with their own account. Disabled accounts can't sign; their past signatures stay. |
|
| Electronic signatures | Logbook entries can be signed electronically along the lines of AC 120-78B chapter 2: the signer reviews the entry, picks their certificate, re-enters their password (or signs in again with SSO) and confirms a "Certified by" statement. The signature records who, which certificate, the statement, the time and a SHA-256 fingerprint of the entry, sealed by the server; the signer gets an email. Signed entries are locked: a correction is a new signed entry that supersedes the original. Owners can invite an outside mechanic to sign one entry with their own account. Disabled accounts can't sign; their past signatures stay. |
|
||||||
| Records integrity | Every change to maintenance records is kept (who, when, field by field) in a hash chain per aircraft (Activity → Record history). Nightly: a verified SQLite backup in `storage/backups` (how many are kept: Admin → Settings), then a check of the history chains and every signature; admins are emailed on a problem (Admin → About). Software versions are recorded. A records package (Access & Sharing) bundles every entry as a PDF with signatures, a signature register, the history, the status report and the `.sam.zip` for the FAA or a buyer. Scans of paper logbooks can be marked as legacy records, with an "electronic records since" date per aircraft. |
|
| Records integrity | Every change to maintenance records is kept (who, when, field by field) in a hash chain per aircraft (Activity → Record history). Nightly: a verified SQLite backup in `storage/backups` (how many are kept: Admin → Settings), then a check of the history chains and every signature; admins are emailed on a problem (Admin → About). Software versions are recorded. A records package (Access & Sharing) bundles every entry as a PDF with signatures, a signature register, the history, the status report and the `.sam.zip` for the FAA or a buyer, with a README (and a ready-to-run `viewer/docker-compose.yml`) so the recipient can browse the data in their own local copy of the app. Scans of paper logbooks can be marked as legacy records, with an "electronic records since" date per aircraft. |
|
||||||
| Off-site backup | Nightly copy of the verified database snapshot (newest 30 kept) and every new uploaded file to Google Drive, using your own Google OAuth client and the `drive.file` scope (the app sees only its own files). Restore test from the admin page; failures emailed to admins; `bin/rails offsite:restore_files` brings files back after a restore. |
|
| Off-site backup | Nightly copy of the verified database snapshot (newest 30 kept) and every new uploaded file to Google Drive, using your own Google OAuth client and the `drive.file` scope (the app sees only its own files). Restore test from the admin page; failures emailed to admins; `bin/rails offsite:restore_files` brings files back after a restore. |
|
||||||
| Recordkeeping procedures and audits | Admin → Recordkeeping Procedures generates the procedures document AC 120-78B asks for (who is responsible, who may sign, signing, corrections, backups, access, audits, transfer, legacy records) from the system setup plus a few details you fill in (with suggested text built from the installation's settings; a revision can't be adopted while a [bracketed] blank is left); adopt it as numbered, unchangeable revisions, included in the records package. Admin → Records Audits is a periodic QC checklist (app checks plus a restore test, a sample of entries against source documents and a user review); admins get the due date in the weekly reminder. The users' instructions are the guide's [Electronic records and signing](docs/guide/records.md) page. |
|
| Recordkeeping procedures and audits | Admin → Recordkeeping Procedures generates the procedures document AC 120-78B asks for (who is responsible, who may sign, signing, corrections, backups, access, audits, transfer, legacy records) from the system setup plus a few details you fill in (with suggested text built from the installation's settings; a revision can't be adopted while a [bracketed] blank is left); adopt it as numbered, unchangeable revisions, included in the records package. Admin → Records Audits is a periodic QC checklist (app checks plus a restore test, a sample of entries against source documents and a user review); admins get the due date in the weekly reminder. The users' instructions are the guide's [Electronic records and signing](docs/guide/records.md) page. |
|
||||||
| Major repairs and alterations | Form 337, STC, and ICA tracking; an STC's ICA can become a tracked recurring inspection. |
|
| Major repairs and alterations | Form 337, STC, and ICA tracking; an STC's ICA can become a tracked recurring inspection. |
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class RecordsPackage
|
|||||||
if (revision = ProceduresRevision.current)
|
if (revision = ProceduresRevision.current)
|
||||||
add(zip, "recordkeeping-procedures.html", standalone_html(revision.content, "Recordkeeping procedures, revision #{revision.number}"))
|
add(zip, "recordkeeping-procedures.html", standalone_html(revision.content, "Recordkeeping procedures, revision #{revision.number}"))
|
||||||
end
|
end
|
||||||
|
add(zip, "viewer/docker-compose.yml", viewer_compose)
|
||||||
archive = Tempfile.new([ "archive", ".sam.zip" ])
|
archive = Tempfile.new([ "archive", ".sam.zip" ])
|
||||||
AircraftArchive::Exporter.new(@aircraft, source: @source).write_to(archive.path)
|
AircraftArchive::Exporter.new(@aircraft, source: @source).write_to(archive.path)
|
||||||
zip.put_next_entry("#{@aircraft.tail_number.downcase}.sam.zip")
|
zip.put_next_entry("#{@aircraft.tail_number.downcase}.sam.zip")
|
||||||
@@ -62,6 +63,7 @@ class RecordsPackage
|
|||||||
- status-report.html Maintenance status per 14 CFR 91.417(a)(2): times, life-limited parts, inspections, ADs, alterations.
|
- status-report.html Maintenance status per 14 CFR 91.417(a)(2): times, life-limited parts, inspections, ADs, alterations.
|
||||||
- #{@aircraft.tail_number.downcase}.sam.zip All records and files as data, to load into another system.
|
- #{@aircraft.tail_number.downcase}.sam.zip All records and files as data, to load into another system.
|
||||||
- recordkeeping-procedures.html How these electronic records and signatures are kept (AC 120-78B), current adopted revision.
|
- recordkeeping-procedures.html How these electronic records and signatures are kept (AC 120-78B), current adopted revision.
|
||||||
|
- viewer/docker-compose.yml Runs Simple Aircraft Manager on your own computer to browse the archive (below).
|
||||||
|
|
||||||
Signatures
|
Signatures
|
||||||
Each electronic signature records who signed, with which certificate, what they certified, when, and a SHA-256
|
Each electronic signature records who signed, with which certificate, what they certified, when, and a SHA-256
|
||||||
@@ -70,9 +72,59 @@ class RecordsPackage
|
|||||||
signing; "Superseded" means a later signed correction replaces it.
|
signing; "Superseded" means a later signed correction replaces it.
|
||||||
|
|
||||||
Last records integrity check: #{check ? "#{check.created_at.utc.strftime('%Y-%m-%d %H:%M UTC')}, #{check.ok ? 'no problems found' : "#{check.problems.size} problem(s) found"}" : 'not run yet'}.
|
Last records integrity check: #{check ? "#{check.created_at.utc.strftime('%Y-%m-%d %H:%M UTC')}, #{check.ok ? 'no problems found' : "#{check.problems.size} problem(s) found"}" : 'not run yet'}.
|
||||||
|
|
||||||
|
Viewing the data in Simple Aircraft Manager
|
||||||
|
The PDF, CSV and HTML files above open on their own. To browse everything (components, logbook, ADs,
|
||||||
|
inspections, documents, flights, oil and fuel) the way the owner sees it, run the app on your own computer:
|
||||||
|
|
||||||
|
1. Install Docker Desktop (https://www.docker.com/products/docker-desktop/).
|
||||||
|
2. In a terminal, go to the "viewer" folder of this package and run: docker compose up -d
|
||||||
|
3. Open http://localhost:3000 and create the first (admin) account.
|
||||||
|
4. Choose Fleet -> Import and select #{@aircraft.tail_number.downcase}.sam.zip from this package (or this whole zip file).
|
||||||
|
|
||||||
|
The copy runs only on your computer and stays separate from the owner's system. Electronic signatures are
|
||||||
|
shown as imported: compare their fingerprints with signatures.csv and logbook-entries.pdf. To stop it:
|
||||||
|
docker compose down (add -v to delete the local copy).
|
||||||
|
#{"\nSimple Aircraft Manager is open source: #{repository}" if repository}
|
||||||
TXT
|
TXT
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def repository = SystemInfo.new.repository_url
|
||||||
|
|
||||||
|
# The published image, as named in the project's docker-compose.image.yml
|
||||||
|
# (APP_IMAGE overrides it, e.g. for a fork's own image).
|
||||||
|
def viewer_image
|
||||||
|
ENV["APP_IMAGE"].presence ||
|
||||||
|
Rails.root.join("docker-compose.image.yml").then { _1.exist? ? _1.read[/^\s*image:\s*(\S+)/, 1] : nil }
|
||||||
|
end
|
||||||
|
|
||||||
|
# A ready-to-run local viewer, with its own throwaway secret key (never this
|
||||||
|
# installation's), plain HTTP on localhost.
|
||||||
|
def viewer_compose
|
||||||
|
image = viewer_image
|
||||||
|
<<~YAML
|
||||||
|
# Simple Aircraft Manager on your own computer, to browse #{@aircraft.tail_number.downcase}.sam.zip.
|
||||||
|
# docker compose up -d then open http://localhost:3000, create an account,
|
||||||
|
# and import #{@aircraft.tail_number.downcase}.sam.zip (Fleet -> Import). Stop: docker compose down
|
||||||
|
# Prepared with software version #{SystemInfo.new.revision}.#{" Source: #{repository}" if repository}
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
#{image ? "image: #{image}" : "build: . # no published image known: build from the source code"}
|
||||||
|
restart: "no"
|
||||||
|
ports:
|
||||||
|
- "3000:80"
|
||||||
|
environment:
|
||||||
|
SECRET_KEY_BASE: #{SecureRandom.hex(64)} # for this local copy only
|
||||||
|
APP_HOST: localhost:3000
|
||||||
|
FORCE_SSL: "false"
|
||||||
|
SOLID_QUEUE_IN_PUMA: "true"
|
||||||
|
volumes:
|
||||||
|
- viewer_storage:/rails/storage
|
||||||
|
volumes:
|
||||||
|
viewer_storage:
|
||||||
|
YAML
|
||||||
|
end
|
||||||
|
|
||||||
def signatures_csv(entries)
|
def signatures_csv(entries)
|
||||||
CSV.generate do |csv|
|
CSV.generate do |csv|
|
||||||
csv << %w[entry_date log entry_type signer certificate_kind certificate_number signed_at_utc status fingerprint statement corrects_entry_dated]
|
csv << %w[entry_date log entry_type signer certificate_kind certificate_number signed_at_utc status fingerprint statement corrects_entry_dated]
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Give it a label and optionally an expiry. Documents only appear if their visibil
|
|||||||
|
|
||||||
## Records package
|
## Records package
|
||||||
|
|
||||||
**Download records package** builds a zip for the FAA, a buyer or a new maintainer: every logbook entry as a PDF with its signatures, a signature register, the change history, the status report, the current recordkeeping procedures, and the data archive.
|
**Download records package** builds a zip for the FAA, a buyer or a new maintainer: every logbook entry as a PDF with its signatures, a signature register, the change history, the status report, the current recordkeeping procedures, and the data archive. Its README explains each file, links to the source code, and includes a ready-to-run `viewer/docker-compose.yml`: with Docker Desktop, the recipient can run the app on their own computer and import the archive to browse everything.
|
||||||
|
|
||||||
## Backup and transfer
|
## Backup and transfer
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class RecordsIntegrityTest < ActionDispatch::IntegrationTest
|
|||||||
File.binwrite(path, response.body)
|
File.binwrite(path, response.body)
|
||||||
Zip::File.open(path) do |zip|
|
Zip::File.open(path) do |zip|
|
||||||
def zip.text(name) = read(name).force_encoding("UTF-8")
|
def zip.text(name) = read(name).force_encoding("UTF-8")
|
||||||
assert_equal %w[README.txt logbook-entries.pdf n12345.sam.zip record-history.csv signatures.csv status-report.html], zip.entries.map(&:name).sort
|
assert_equal %w[README.txt logbook-entries.pdf n12345.sam.zip record-history.csv signatures.csv status-report.html viewer/docker-compose.yml], zip.entries.map(&:name).sort
|
||||||
readme = zip.text("README.txt")
|
readme = zip.text("README.txt")
|
||||||
assert_includes readme, "All 2 logbook entries, oldest first. 1 are signed electronically"
|
assert_includes readme, "All 2 logbook entries, oldest first. 1 are signed electronically"
|
||||||
assert_includes readme, "Electronic records since: 2026-01-01"
|
assert_includes readme, "Electronic records since: 2026-01-01"
|
||||||
@@ -117,8 +117,16 @@ class RecordsIntegrityTest < ActionDispatch::IntegrationTest
|
|||||||
engine = create_component(@a, tbo_hours: 2000, hours_since_overhaul: 126, on_condition: true)
|
engine = create_component(@a, tbo_hours: 2000, hours_since_overhaul: 126, on_condition: true)
|
||||||
path = Rails.root.join("tmp", "pkg-#{SecureRandom.hex(4)}.zip")
|
path = Rails.root.join("tmp", "pkg-#{SecureRandom.hex(4)}.zip")
|
||||||
RecordsPackage.new(@a, source: "test").write_to(path)
|
RecordsPackage.new(@a, source: "test").write_to(path)
|
||||||
html, csv = Zip::File.open(path) { |z| [ z.read("status-report.html").force_encoding("UTF-8"), z.read("signatures.csv").force_encoding("UTF-8") ] }
|
html, csv, readme, compose = Zip::File.open(path) { |z| %w[status-report.html signatures.csv README.txt viewer/docker-compose.yml].map { z.read(_1).force_encoding("UTF-8") } }
|
||||||
assert csv.start_with?("\uFEFF"), "CSV has a byte order mark for Excel"
|
assert csv.start_with?("\uFEFF"), "CSV has a byte order mark for Excel"
|
||||||
|
assert_includes readme, "Viewing the data in Simple Aircraft Manager"
|
||||||
|
assert_includes readme, SystemInfo.new.repository_url
|
||||||
|
viewer = YAML.safe_load(compose)
|
||||||
|
web = viewer.dig("services", "web")
|
||||||
|
assert_equal File.read(Rails.root.join("docker-compose.image.yml"))[/image:\s*(\S+)/, 1], web["image"]
|
||||||
|
assert_equal "false", web.dig("environment", "FORCE_SSL")
|
||||||
|
assert_equal 128, web.dig("environment", "SECRET_KEY_BASE").size
|
||||||
|
refute_equal Rails.application.secret_key_base, web.dig("environment", "SECRET_KEY_BASE")
|
||||||
File.delete(path)
|
File.delete(path)
|
||||||
assert_includes html, "<style>"
|
assert_includes html, "<style>"
|
||||||
refute_includes html, "\\[</head>" # escaped "&" in CSS selectors left intact
|
refute_includes html, "\\[</head>" # escaped "&" in CSS selectors left intact
|
||||||
|
|||||||
Reference in new issue
Block a user