laosb / ghos3

A modernized AWS S3 storage adapter for Ghost.
Other
27 stars 10 forks source link

DigitalOcean Spaces Installation (+ Problem with installation) #16

Open mciszczon opened 3 months ago

mciszczon commented 3 months ago

Hi there! Thanks for forking the original adapter and maintaining it.

I have a Ghost blog on DigitalOcean and wanted to connect it with its Spaces for storage. After some tinkering I finally adapted the installation instructions and wanted to share it for anyone (myself included) in the future. If you're interested in adding it to the README file, I can make a quick PR for that.

Here's what worked for me:

{
  "storage": {
    "active": "s3",
    "media": {
      "adapter": "s3"
    },
    "files": {
      "adapter": "s3"
    },
    "s3": {
      "accessKeyId": "...",
      "secretAccessKey": "...",
      "region": "<REGION_NAME like fra1>",
      "bucket": "<BUCKET_NAME>",
      "assetHost": "<CDN_ENDPOINT>",
      "pathPrefix": "<ANYTHING_YOU_LIKE>",
      "endpoint": "https://<REGION>.digitaloceanspaces.com"
    }
  }
}

Not sure if the region param is required though, so I added it for the sake of explicitness. One tricky part is that the endpoint param has to have the bucket name omited, as it is added automatically from the bucket param. I did not check if it would work by adding the bucket name straight into the endpoint URL and just removing the bucket param from the config.

Also, when I tried to install the adapter into the /content/adapters/storage/s3 as instructed, it wouldn't get picked up by Ghost on startup. It worked, hovewer, when I installed it into /current/core/server/adapters/storage/s3—not sure why.

Node: v18.19.0 Ghost-CLI: 1.25.3 Ghost: 5.76.0 (at /var/www/ghost)

laosb commented 3 months ago

region is only supposed to be present when using AWS endpoint I think.

Also, when I tried to install the adapter into the /content/adapters/storage/s3 as instructed, it wouldn't get picked up by Ghost on startup. It worked, hovewer, when I installed it into /current/core/server/adapters/storage/s3—not sure why.

I don't recognize /current/core/server/ part of the path though. Where did you get the idea of this?

mciszczon commented 3 months ago

I don't recognize /current/core/server/ part of the path though. Where did you get the idea of this?

current is just a symlink to the currently installed version of Ghost.