Storage Service
Please refer to Kubernetes docs for a complete automated setup.
OpenMRS 2.8.x adds and makes use of Storage Service. It is an abstraction layer that can be used to store data, which does not fit well in DB (e.g. images, pdfs, reports, etc.). The backend for Storage Service is easily switchable at runtime and currently allows to store data in local file system or S3 compatible storage (e.g. MinIO).
Implementers can provide their own storage backend e.g. Azure Files through a module by creating a bean implementing StorageService or extending BaseStorageService.
The default storage backend is a local file system, which can be configured with:
storage.type: "local"
storage.local.dir: "openmrs_application_data_dir/storage"You don’t have to specify these variables if you are okay with the defaults.
Please note that if you modify the storage.local.dir, the existing data will not be automatically migrated over to a new location. You need to do it manually.
The S3 storage backend can be enabled with:
storage.type: "s3"
storage.s3.region: "us-east-1"
storage.s3.bucketName: "openmrs"
storage.s3.accessKeyId: "replaceWithAccessKeyId"
storage.s3.secretAccessKey: "replaceWithSecretAccessKey"
storage.s3.endpoint: "minio-headless"
storage.s3.forcePathStyle: "true"
storage.s3.multipartEnabled: "true"storage.s3.endpoint and storage.s3.forcePathStyle are specific for MinIO connection.
The S3 storage backend implementation uses a high performance async S3 client with multipart upload/download enabled by default. It allows to upload and download files in multiple threads and resume parts if connection breaks. Please see https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/examples-s3.html for details.
Please note that if you change the storage type the existing data will not be migrated over to a new location. It is also very likely that the new backend stores data in a different structure so you may need to adjust your data as well.