Records package viewer: setup code, release image

The viewer/docker-compose.yml in the records package (and the package's
README) said to just create an account, but first-run setup asks for a
one-time code from the log since 2026.11.5; both now say how to get it,
and the right menu for importing. The viewer runs the published image at
the release that made the package (each release is published under its
version), so whoever opens it later gets that version, not whatever
:latest is then. APP_IMAGE, for a fork, is used as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-15 19:40:01 -05:00
1 parent 3ad6b9493a
commit 34e3232350
4 files changed
+25 -9

No files matched your search

+1 -1
View File
@@ -73,5 +73,5 @@ FORCE_SSL=true
# --- Other ---------------------------------------------------------------
# APP_LOCALE=en # language, e.g. es for config/locales/es.yml
# APP_REPOSITORY_URL= # source link on Admin → About (for a fork)
# APP_IMAGE= # Docker image named in the records package README (for a fork)
# APP_IMAGE= # image for the records package's viewer, used as is (for a fork); default: the published one at this release
# RAILS_LOG_LEVEL=info
+14 -6
View File
@@ -64,11 +64,16 @@ class RecordsPackage
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).
# The published image, as named in the project's docker-compose.image.yml,
# at this release (each release is also published under its version, so
# whoever opens the package years later gets the version that made it).
# APP_IMAGE, e.g. a fork's own image, is used as it is.
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 }
return ENV["APP_IMAGE"] if ENV["APP_IMAGE"].present?
image = Rails.root.join("docker-compose.image.yml").then { _1.exist? ? _1.read[/^\s*image:\s*(\S+)/, 1] : nil } or return
version = SystemInfo.new.version
return image unless version.match?(/\A\d{4}\.\d{1,2}\.\d+\z/)
"#{image.sub(/:[^:\/]+\z/, '')}:#{version}"
end
# A ready-to-run local viewer, with its own throwaway secret key (never this
@@ -77,8 +82,11 @@ class RecordsPackage
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
# 1. docker compose up -d
# 2. Open http://localhost:3000 and create the first (admin) account. It asks
# for a one-time setup code: docker compose logs web | grep "Setup code"
# 3. Fleet -> More -> Import from a .sam.zip archive: choose #{@aircraft.tail_number.downcase}.sam.zip
# Stop: docker compose down (add -v to delete this local copy)
# Prepared with software version #{SystemInfo.new.version_label}.#{" Source: #{repository}" if repository}
services:
web:
+2 -1
View File
@@ -4209,7 +4209,8 @@ en:
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.
3. Open http://localhost:3000 and create the first (admin) account. It asks for a one-time setup code,
which this shows (in the same folder): docker compose logs web | grep "Setup code"
4. Choose Fleet -> More -> Import from a .sam.zip archive and select %{archive} 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
+8 -1
View File
@@ -82,6 +82,12 @@ class RecordsIntegrityTest < ActionDispatch::IntegrationTest
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 viewer/docker-compose.yml], zip.entries.map(&:name).sort
readme = zip.text("README.txt")
assert_includes readme, 'docker compose logs web | grep "Setup code"'
viewer = YAML.safe_load(zip.text("viewer/docker-compose.yml"))
version = SystemInfo.new.version
assert_equal "barrettefab/simple-aircraft-manager-rails:#{version}", viewer.dig("services", "web", "image") # the release that made it
assert_equal "false", viewer.dig("services", "web", "environment", "FORCE_SSL")
assert_includes zip.text("viewer/docker-compose.yml"), 'grep "Setup code"'
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, "scans marked \"legacy record\""
@@ -123,7 +129,8 @@ class RecordsIntegrityTest < ActionDispatch::IntegrationTest
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"]
published = File.read(Rails.root.join("docker-compose.image.yml"))[/image:\s*(\S+)/, 1]
assert_equal published.sub(/:[^:\/]+\z/, ":#{SystemInfo.new.version}"), web["image"] # that image, at this release
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")