All help articles

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:

VariableWhat
CORPSUITE_S3_ENDPOINTThe 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_BUCKETThe bucket.
CORPSUITE_S3_REGIONIts region; us-east-1 by default, auto for R2.
CORPSUITE_S3_ACCESS_KEYThe key's id.
CORPSUITE_S3_SECRET_KEY_FILEA file holding the secret (readable only by the service user), or CORPSUITE_S3_SECRET_KEY for the secret itself.
CORPSUITE_S3_PREFIXOptional: a folder in the bucket, for sharing a bucket.
CORPSUITE_S3_PATH_STYLEtrue 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

  1. Set the variables above.
  2. Copy the files already on disk: sudo -u corpsuite corpsuited blobs copy-to-s3 (with the service's environment; on an installed server sudo 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.
  3. Restart the server. New mail goes to the bucket.
  4. Once copy-to-s3 has finished after the restart (run it again to be sure), remove the old files from CORPSUITE_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