Cloud Storage
If you'd like to use cloud storage such as DigitalOcean spaces, AWS S3 or Azure blob storage, Socialstack has a mechanism which allows all uploaded files to automatically route and be served from a remote storage system called Cloud hosts.
Getting Started
Install the cloud hosts module, then restart your API:
socialstack i Api/CloudHosts
This will create a new configuration entry called "CloudHost" where you can then drop in the configuration for the particular host you would like to use. By default the CloudHosts config will be created with a list of the directly supported hosts, along with a null next to each one. You can also use more than one simultaneously.
DigitalOcean Spaces Config
The space should have a folder called "content" and "content-private" at its root. From there, its contents are the same as what would otherwise be in the Content folder.
In the CloudHost config in the admin panel:
{
"DigitalOcean": {
"SpaceOriginUrl": "https://your-space.ams3.digitaloceanspaces.com",
"SpaceKey": "DO...",
"SpaceSecret": "..space secret.."
}
}
- CDN: It'll use the spaces CDN by default. Turn it off by adding:
{
"DigitalOcean": {
...
"DisableCDN": true
}
}
- PDFs: By default uploaded PDFs are served from DigitalOcean spaces as bytes which means displaying them inline inside e.g. an iframe on your page doesn't work in Chrome. If you'd like them to be displayable:
{
"DigitalOcean": {
...
"DisplayPdfInline": true
}
}
AWS Config
{
"AWS": {
"S3ServiceUrl": "s3.eu-west-2.amazonaws.com",
"S3AccessKey": "..access key..",
"S3AccessSecret": "..access secret..",
"S3BucketName": "bucket-name",
"LockedDownAccess": false
}
}
- LockedDownAccess: Set it to true if the bucket is locked down from public access and needs to use "S3CannedACL.BucketOwnerFullControl"
- PDFs: By default uploaded PDFs are served from DigitalOcean spaces as bytes which means displaying them inline inside e.g. an iframe on your page doesn't work in Chrome. If you'd like them to be displayable:
{
"DigitalOcean": {
...
"DisplayPdfInline": true
}
}
