What this is about
CDMS does not store the content of files in the database, but in a file storage. Which one that is, is called the storage backend. You choose it in the hub on the system, field Storage:
FILESYSTEM: the contents live in a directory of the server, in a container on a mounted volume.NONE: the application has no file storage.
A separate module brings the file storage into the application: cdms-localfs-storage. With NONE this module is missing.
The variants
When: The application has file models.
-
1Buildadds the module
cdms-localfs-storageto the application -
2Buildthe project scaffold writes
codamai.cdms.persistence.file.basePathinto the configuration, default/files/ -
3CDMSchecks the base directory at startup
-
4CDMS→File storagestores contents under
<basePath>/…/<fileId>
Result: See Storage layout and tenant isolation in storage.
When: The application needs no files.
-
1Buildno file storage module, no base directory
-
2CDMSa request wants to write or read content
-
3CDMS→Clientrejected,
file-storage-not-configured
Result: File models make no sense here. They need the system to have a file storage.
See also The project scaffold.
Configuring the base directory
codamai:
cdms:
persistence:
file:
basePath: ${CODAMAI_CDMS_PERSISTENCE_FILE_BASE_PATH:/files/}env:
- name: CODAMAI_CDMS_PERSISTENCE_FILE_BASE_PATH
value: /data/files/
volumeMounts:
- name: cdms-files
mountPath: /data/filesYou set the operating mode (SINGLE or MULTI) for the whole installation. It applies to database and file storage alike and decides whether tenants get directories of their own. See SINGLE and MULTI across both modules.
The check at startup
-
CDMSConfiguredIs
basePathset?↳ no the application does not start -
CDMSPresentDoes the directory exist, and is it a directory?↳ no the application does not start, the log names the path
-
CDMSWritableMay the application write there?↳ no the application does not start, the log names the path
- Storage ready
CDMS deliberately does not create the base directory itself. If the volume were not mounted, the application would otherwise write into the container’s own file system and lose all files at the next restart, while the records stay in the database.
During operation
If the Actuator is included, the health check reports an entry storageRoot: writable as long as the base directory is writable, otherwise DOWN with the reason. That way a lost volume is noticed before users notice it.
Pitfalls
What comes next
- How the files lie in the storage: Storage layout and tenant isolation in storage
- What a file model is: What a file model is
- How large files may be: Size limits