Reasoning

ephemeral meaning: transitory, transient, fleeting, passing, short-lived, momentary, brief, short, cursory, temporary, impermanent, short-term; fading, evanescent, fugitive, fly-by-night; literary fugacious. ANTONYMS long-lived, permanent.

The ephemeral datastore is a SQLite3 database stored in the Docker container at a default location /opt/PasswordPusher/db/db.sqlite3.

Because it is stored in the Docker container, it is lost on container restart (unless it is persisted by a mounted volume). Hence the name ephemeral.

The ephemeral database offers users:

  1. Simplicity in setup
  2. Security in lack of data persistence

Still, there are cases where you may prefer to persist this database across container restarts.

One such reason is the use of the Public Gateway container which requires access to the same datastore as the full pglombardo/pwpush Docker container.

Warning: SQLite3 has historically not been designed for high concurrency applications. It is possible if you share the database file with high traffic sites, you may get transient database lock errors. For low traffic sites, this is usually not a problem.

SQLite3 Database Files

These are the types of files you will find in the filesystem that belong to the SQLite3 database:

  • .sqlite3 file: The core SQLite3 database file. Can sometimes be named .sqlite or .db but this generally isn’t the case with Password Pusher
  • .wal files: These files are used for write-ahead logging, which helps ensure database consistency and recoverability.
  • .shm files: These files are used for shared memory, which allows multiple processes to access the same database simultaneously.

Selecting a Location & setting DATABASE_URL

Given that there are multiple database files, it is suggested that you use a dedicated directory such as /opt/PasswordPusher/database/.

To mount a volume at this location, you could use a command such as:

docker run -v /local_fs/pwpush_db:/opt/PasswordPusher/database pglombardo/pwpush

Warning: It is not suggested to overload the default /opt/PasswordPusher/db directory with a Docker volume as it contains other required files not related to the SQLite3 database.

With the database volume mounted, you can then set the DATABASE_URL environment variable to:

DATABASE_URL=sqlite3:///opt/PasswordPusher/database/db.sqlite3

See Also

Updated: