Storage
Hearth keeps files in one primary store, either a folder on the server or an S3 bucket. The database holds only what Hearth knows about each file (its id, size, versions, shares); the bytes stay in the store. Folders from other systems can be mounted beside it as external storage.
The primary store
Choose the kind when you install. Moving an existing Hearth from one kind to the other is not supported by Hearth itself.
A folder on the server
STORAGE: local
STORAGE_DIR: /data/files
The folder must belong to the user the container runs as (65532). Files are kept as plain files and folders under it:
users/<id>/files/... a person's files
teamfolders/<id>/files/... a library that was a team folder
sites/libraries/<id>/files/ a space's document library
versions/<file id>/<version> older contents
trash/<trash id> deleted items
uploads/<id>/... uploads in progress
previews/<file id>/... thumbnails
Hearth compares the files with what it knows every
FILES_SCAN_MINUTES (15 by default), so a file placed or changed under a
person's folder by other means shows up within that time. Prefer
uploading through Hearth: changes made on disk skip the virus scan and
the activity feed.
An S3 bucket
STORAGE: s3
S3_ENDPOINT: s3.example.org
S3_BUCKET: hearth
S3_ACCESS_KEY: hearth
S3_SECRET_KEY_FILE: /run/hearth/s3-secret
# optional
S3_REGION: eu-central-1
S3_PREFIX: production
S3_USE_SSL: "true"
S3_PATH_STYLE: "true"
Any S3-compatible service works (MinIO, Ceph, Backblaze B2, Scaleway,
AWS). S3_PATH_STYLE is on by default; turn it off for services that
only accept bucket names in the host name. Use S3 when you run several
Hearth servers behind a load balancer, as on Kubernetes, since every
server must see the same files.
Hearth's own backup and hearth backup restore-server restore the file
store into STORAGE_DIR only, so with S3 back the bucket up with the
tools of your storage provider (Backups).
Quotas
A quota limits how much a person's files may take. Set it in Administration, Users: open the person and type the number of GB next to Quota, then select Save. Leave the field empty for no limit. The line shows how much the person uses now.
When a person reaches the quota, uploads and saves are refused with "Not enough storage space" until they make room.
Libraries of spaces have quotas of their own, set in Administration, Spaces.
Trash and versions
Two settings apply to everyone:
| Setting | Default | Meaning |
|---|---|---|
TRASH_DAYS |
30 | Deleted items are kept this many days, then removed for good |
MAX_VERSIONS |
50 | Versions kept per file, after thinning |
Versions saved close together are thinned, as Nextcloud does: one a
minute for the last hour, one an hour for the last day, one a day for
the last month and one a week after that, up to MAX_VERSIONS. A version
someone has named is never thinned.
A retention policy or a legal hold can keep trash and versions longer than these settings for some people (Retention and legal hold).
External storage
External storage shows a folder from another system inside Hearth's Files, next to a person's own files. The files stay where they are; Hearth reads and writes them on each request.
There are two places to add it:
- Administration, External storage: for everyone, or only for chosen groups (Only for groups).
- Settings, External storage: each person adds their own. People cannot add a server folder.
To add a mount:
- Select Add storage.
- Type the Folder name it will have in Files.
- Choose the Kind and fill in its fields.
- Turn on Read-only if people should not change anything there.
- Select Save. For Google Drive, OneDrive and Dropbox, select Save and connect and sign in to the account at the provider.
- Select Check to test the connection.
Passwords, keys and tokens are stored sealed with the master key.
The kinds and what they need
| Kind | Fields |
|---|---|
| Server folder | Folder on the server: an absolute path inside one of EXTERNAL_LOCAL_ROOTS (admins only) |
| Amazon S3 or compatible | Endpoint, Bucket, Access key, Secret key; Region, Folder in the bucket, HTTPS and Path-style addresses as needed |
| SMB / Windows share | Host, Share, Username; Port, Folder in the share, Domain and Password as needed |
| SFTP | Host, Username, a Password or a Private key (with its Key passphrase), and the Host key fingerprint (SHA256) |
| FTP / FTPS | Host, Username, Password; TLS (FTPS) for an encrypted connection |
| WebDAV | Address; Username and Password if the server asks |
| Nextcloud or Hearth | Server address, Username, App password; Folder for a part of the account |
| Google Drive, OneDrive, Dropbox | Client ID and Client secret of an OAuth client you register with the provider, then the connection |
For the OAuth providers, register a client in the provider's developer console with this redirect address:
https://hearth.example.org/api/v1/mounts/oauth/callback
Accept any host key (SFTP) and Accept any certificate (FTP, WebDAV, Nextcloud) turn off the checks that protect the connection. Use them only for a test server on your own network.
Names that SMB and OneDrive refuse (with : * ? " < > |) are stored
the way macOS stores them and shown as typed.
Server folders
An admin can mount a folder that is on the Hearth server itself, for example a share of old project files. List the folders that may be mounted:
EXTERNAL_LOCAL_ROOTS: /srv/archive,/srv/media
Mount them into the container at the same paths, and give the container user read access (and write access unless the mount is read-only). An admin can then mount those folders or any folder inside them. Nothing outside the listed roots can be mounted.
What does not apply to external storage
- Files on external storage are not encrypted by Hearth and are not in Hearth's backup.
- Personal backups leave them out.
- Changes made on the other system appear when someone opens the folder, or at the next scan.