mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
SAM_VIEWER=true (set only by the records package's viewer/docker-compose.yml) makes the app a read-only copy of an archive, for whoever receives the records: `docker compose up`, then open http://localhost:3000. - At start (bin/docker-entrypoint → sam:viewer:prepare) the package's .sam.zip, mounted read-only, is imported once. - No sign-in: everyone browses as a built-in account. Nothing can be changed: any request but GET/HEAD is refused, no role permission applies (so no edit buttons), and there's no sign-out or profile. A banner names the archive and when it was exported. - It refuses to start, and every page answers 503, when the database has any other account, so turning it on for a real installation stops the app instead of exposing its records. - The viewer listens on 127.0.0.1 only, and skips scheduled jobs (reminders, backups, AD searches). - Docs: the package README (three steps now), Access & sharing, README settings and features, the suggested recordkeeping procedures. Checked end to end with a built image and a real records package: the archive imported at start, pages browsed without an account, a change refused, and the container refusing to start once an account existed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
547 B
Bash
Executable File
19 lines
547 B
Bash
Executable File
#!/bin/bash -e
|
|
|
|
# Enable jemalloc for reduced memory usage and latency.
|
|
if [ -z "${LD_PRELOAD+x}" ]; then
|
|
LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
|
|
export LD_PRELOAD
|
|
fi
|
|
|
|
# If running the rails server then create or migrate existing database
|
|
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
|
|
./bin/rails db:prepare
|
|
# Viewer mode (records package): refuse a real database, import the archive.
|
|
if [ "${SAM_VIEWER}" == "true" ]; then
|
|
./bin/rails sam:viewer:prepare
|
|
fi
|
|
fi
|
|
|
|
exec "${@}"
|