Databases
Two stores are used: one for records and one for file keys. Each has its own address, so they can be the same database server, different ones, or one of each kind.
Choices
| Kind | Address | Notes |
|---|---|---|
| SQLite | sqlite:/path/to/file.db | Built in; nothing to install. The file must be on the server's own machine. The default. |
| PostgreSQL | postgres://user:password@host:5432/name?sslmode=verify-full | Can be on another machine. |
GOVERNATE_DB='postgres://governate:[email protected]:5432/governate?sslmode=verify-full'
GOVERNATE_KEYS_DB='postgres://keys:[email protected]:5432/keys?sslmode=verify-full'
With no setting, both are SQLite files in the data folder: governate.db and keys.db.
Encrypted connections
A PostgreSQL server on another machine must be reached over an encrypted connection: the address needs sslmode=verify-full, verify-ca or require. The server refuses to start otherwise. A database on the same machine is exempt.
Tables
The server creates and updates its own tables at start-up. Give its database user the right to create tables in its own database, and nothing more.
What is in each
- Records: accounts with password hashes, files (name, owner, size, permissions), shares, sessions, licences, activity, settings.
- File keys: one sealed key per file. Each is encrypted under the installation's key and bound to its file, so a key copied onto another file's row will not open.
Neither database holds a readable file key or any file content.
Backups
Back up both databases, the protected files, and the root key (see Keys). All four are needed to restore. The records and keys databases should be backed up at the same moment as each other.