Difference between revisions of "Cloud Storage"

From SocialStack
(Created page with "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 rout...")
 
Line 9: Line 9:
</syntaxhighlight>
</syntaxhighlight>


This will create a new configuration entry called "CloudHosts" 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.
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 ==
 
<syntaxhighlight lang="json">
{
  "DigitalOcean": {
      "SpaceOriginUrl": "https://your-space.ams3.digitaloceanspaces.com",
      "SpaceKey": "DO...",
      "SpaceSecret": "..space secret.."
  }
}
</syntaxhighlight>
 
* CDN: It'll use the spaces CDN by default. Turn it off by adding:
 
<syntaxhighlight lang="json">
{
  "DigitalOcean": {
      ...
      "DisableCDN": true
  }
}
</syntaxhighlight>
 
 
* 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:
 
<syntaxhighlight lang="json">
{
  "DigitalOcean": {
      ...
      "DisplayPdfInline": true
  }
}
</syntaxhighlight>
 
== AWS Config ==
 
<syntaxhighlight lang="json">
{
  "AWS": {
      "S3ServiceUrl": "s3.eu-west-2.amazonaws.com",
      "S3AccessKey": "..access key..",
      "S3AccessSecret": "..access secret..",
      "S3BucketName": "bucket-name",
      "LockedDownAccess": false
  }
}
</syntaxhighlight>
 
* 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:
 
<syntaxhighlight lang="json">
{
  "DigitalOcean": {
      ...
      "DisplayPdfInline": true
  }
}
</syntaxhighlight>

Revision as of 22:40, 10 February 2023

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

{
  "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
  }
}