Files Storage

Upload files

Used to store uploaded files.

File System

The file system object store is the easiest to get started with. This is also the default implementation to store uploaded files.

It uses a file system (local or a mounted share) to store files. It can be configured using the following property:

# Storage path for uploaded files
data.upload.dir = {user.home}/.axelor/attachments

S3 Object Storage

Simple storage service (S3) is a cloud-based storage solution that can be used to store files.

It can be configured using the following properties:

data.object-storage.enabled = true
data.object-storage.endpoint = 127.0.0.1:9000
data.object-storage.path-style = true
data.object-storage.secure = true
data.object-storage.access-key = my-access-key
data.object-storage.secret-key = my-secret-key
data.object-storage.bucket = files
data.object-storage.region =
data.object-storage.encryption =
data.object-storage.encryption-kms-key-id =
data.object-storage.storage-class =

data.object-storage.cache.enabled =
data.object-storage.cache.max-entries =
data.object-storage.cache.time-to-live =
data.object-storage.cache.clean-frequency =
Setting Description Default value

enabled

Enable or disable object storage

false

endpoint

URL of the S3 service such as 127.0.0.1:9000

path-style

Set to true to use host/bucket/object style paths instead of bucket.host/object

false

secure

Set to true to use secure connection (https)

true

access-key

Access key (aka user ID) of an account in the S3 service

secret-key

Secret key (aka password) of an account in the S3 service

bucket

The bucket name; should follow these rules

region

S3 region

encryption

Encryption mode: SSE-S3 or SSE-KMS

encryption-kms-key-id

KMS key ID. Only needed when SSE-KMS in encryption

cache.enabled

Enable or disable S3 cache

true

cache.max-entries

Maximum number of entries in cache, -1 means unlimited

2000

cache.time-to-live

Time-to-live of a cache entry, in seconds, -1 means unlimited

600

cache.clean-frequency

Number of hits from which the cache is cleaned, -1 means disabled

1000

This is a generic implementation that supports S3 compatible object storage service only. It is built on top of the MinIO Java Client, which implements the standard S3 API. As a result, it should work seamlessly with most object storage providers that expose an S3-compatible interface. It is not tied to any specific cloud provider and does not rely on proprietary extensions. It focuses on portability and standard S3 functionality such as object upload, download, deletion. See Custom Store bellow create your own implementation of the Store interface to integrate non–S3-compatible storage service.

Credentials provider chain

When access-key and secret-key are not specified, an AWS credentials provider chain will be used instead. The following credentials will be tried in this order:

  1. IAM roles for Amazon EC2 (data.object-storage.iam-aws.custom-endpoint)

  2. Amazon AWS credentials file (data.object-storage.aws-config.filename and data.object-storage.aws-config.profile)

  3. Amazon AWS environment variables

Here are the AWS-specific configuration properties:

// Optional custom endpoint to fetch IAM role credentials
data.object-storage.iam-aws.custom-endpoint =

// Optional Amazon AWS credentials file
data.object-storage.aws-config.filename =
// Optional Amazon AWS credentials profile
data.object-storage.aws-config.profile =
Setting Description

iam-aws.custom-endpoint

Custom endpoint to fetch IAM role credentials

aws-config.filename

AWS credentials file

aws-config.profile

AWS credentials profile

All the AWS-specific properties are usually left empty, unless you have special requirements.

Custom Store

data.store.provider property allows setting FQN of a Store implementation so that a custom storage system can be used. The class should implement com.axelor.file.store.Store and has a no-arg constructor.

Temp files

To deal with temporary files, the following property can be configured as a dedicated directory:

# Storage path for temp files (defaults to `{java.io.tmpdir}/.axelor`)
data.upload.temp-dir = {user.home}/.axelor-temp

Then use com.axelor.file.temp.TempFile to deal with temporary files and directories:

// Create a temporary file
Path tempFile = TempFiles.createTempFile();

// Create a temporary directory
Path tempFile = TempFiles.createTempDir();

Files will be created under subdirectory tmp_files of data.upload.temp-dir.