Message storage
Every message's raw file (what mail apps download) is kept apart from the database, named by its account and its SHA-256. The database holds everything else: folders, flags, search, contacts and calendars.
By default the files are on the server's disk, in CORPSUITE_BLOB_DIR (/var/lib/corpsuite/blobs on an installed server). They can be kept in S3-compatible object storage instead: AWS S3, MinIO, Cloudflare R2, Backblaze B2, Wasabi or any service with the S3 API. The panel shows which, on the Mailocity overview (Message files), and so does corpsuite storage.
Using a bucket
Make a bucket and a key that may read, write, list and delete in it, then set these in /etc/corpsuite/corpsuite.env and restart the server:
| Variable | What |
|---|---|
CORPSUITE_S3_ENDPOINT | The service, such as https://s3.eu-west-1.amazonaws.com, https://<account>.r2.cloudflarestorage.com or https://minio.example.com:9000. Must be https:// (http:// only for localhost). |
CORPSUITE_S3_BUCKET | The bucket. |
CORPSUITE_S3_REGION | Its region; us-east-1 by default, auto for R2. |
CORPSUITE_S3_ACCESS_KEY | The key's id. |
CORPSUITE_S3_SECRET_KEY_FILE | A file holding the secret (readable only by the service user), or CORPSUITE_S3_SECRET_KEY for the secret itself. |
CORPSUITE_S3_PREFIX | Optional: a folder in the bucket, for sharing a bucket. |
CORPSUITE_S3_PATH_STYLE | true puts the bucket in the path (most services), false in the host name (AWS). Left out, AWS endpoints use the host name and others the path. |
Files are stored as prefix/account/ab/abcd…. A file read back is checked against its name, so a file changed in the bucket is refused rather than shown. Turn on the bucket's own encryption at rest and versioning or backups as you would for the disk.
Moving an existing server
- Set the variables above.
- Copy the files already on disk:
sudo -u corpsuite corpsuited blobs copy-to-s3(with the service's environment; on an installed serversudo corpsuite blobs copy-to-s3). It can run before or after the restart: the server reads the disk for any file not in the bucket yet. - Restart the server. New mail goes to the bucket.
- Once
copy-to-s3has finished after the restart (run it again to be sure), remove the old files fromCORPSUITE_BLOB_DIR.
Deleting a mailbox removes its files from the bucket too, and the nightly clean-up of files no message uses works the same way there.
Good to know
- The bucket is set in the server's environment, not in the panel: moving storage while the server runs would leave mail it cannot find.
- Each delivery writes one file, and opening a message reads one, so put the bucket near the server: a far one makes mail slower to open.
- The server signs its requests itself (AWS Signature Version 4); no AWS tools need to be installed.