External File Storage
By default, linqi stores file contents inside the database. This means you have no additional overhead regarding backups or similar tasks.
However, there may be cases where you want to store file contents outside of the linqi database, for example to reduce the size of the database.
For this purpose, linqi offers various options to connect external storage locations. You can configure external storage locations via the appsettings.json.
File System
With this configuration, linqi stores file contents in the file system. For example, you can connect a network drive across different servers.
It is important that in the case of load balancing, all servers access the same storage location.
To store file contents in the file system, you must perform the following steps:
- Open the file appsettings.json (default path on Windows: C:\inetpub\wwwroot\linqi\appsettings.json) within the linqi installation directory using a text editor.
- In the Misc section, insert or modify the following value:
- FileStoragePath:
Specify the path where the files should be stored. This can, for example, be a UNC path.
- FileStoragePath:
This could look like the following, for example:
{
"Misc": {
"FileStoragePath": "\\share\linqistorage"
}
}
S3 Storage
With this configuration, linqi stores file contents in an S3-compatible storage.
To store file contents in an S3 storage, you must perform the following steps:
- Open the file appsettings.json (default path on Windows: C:\inetpub\wwwroot\linqi\appsettings.json) within the linqi installation directory using a text editor.
- In the Misc section, add a new FileStorageS3 block with the following values:
- ServiceUrl:
Specify the URL of the S3 service here. - Region:
Here you can define the region of the S3 service. - AccessKeyId:
Specify the ID of the access key here. - AccessKeySecret:
Specify the encrypted secret of the access key here. - BucketName:
This value determines the name of the bucket in which the files are stored. - TargetFolder:
If you want to store the files in a subfolder, you can specify the folder name here. - EncryptionKey:
You can specify an encrypted 64-character value here. If this value is provided, the contents will be stored encrypted.
It is important that every server uses the same value in order to be able to decrypt the files again. - UseGzip:
If you set this value to true, the files will be GZIP compressed.
- ServiceUrl:
This could look like the following, for example:
{
"Misc": {
"FileStorageS3": {
"ServiceUrl": "https://s3.linqi.local",
"Region": "linqi",
"AccessKeyId": "ABC",
"AccessKeySecret": "UjrxXzD",
"BucketName": "linqi",
"TargetFolder": "linqi",
"EncryptionKey": "UjrxXzD",
"UseGzip": true
}
}
}
Migration from Database to External Storage
You can always start with the database as the file storage location. If you define an external storage location at a later point in time, linqi will automatically move the file contents to this storage location.
To keep the server load low, this process is performed at night and not immediately.