Since Ghost 6.0, the recommended (though preview) way to install Ghost is through Docker. As such, this is the way I have mostly tested this adapter. These installation steps are based off of the instructions/setup provided here: Ghost Docker Install Instructions .
- Setup the repo
git clone https://github.com/idivait/ghost-storage-cloudflare-images.git /opt/ghost/cloudflare-images && cd /opt/ghost/cloudflare-imagesnpm install --omit=devnpm run build
- Modify the env file
cp .env.storage.example /opt/ghost/.env.storagenano /opt/ghost/.env.storage- Change the values as indicated in the env file. I've included links to find the values in the comments of the file.
- Write out (^O), enter, and exit (^X)
- Move example override file to root of ghost install
cp compose.example.override.yml /opt/ghost/compose.override.yml && cd /opt/ghost
- Force recreate containers
docker compose down && docker compose up -d --force-recreate
Following an install that used the guide here: Official Ghost Install Guide
- Setup the repo
- Go to the base directory you installed Ghost in (eg. /var/www/ghost)
git clone https://github.com/idivait/ghost-storage-cloudflare-images.git ./cloudflare-images && cd ./cloudflare-imagesnpm install --omit=devnpm run build
- Create a symlink to the storage adapter directory in your content directory
cd .. && mkdir -p ./content/adapters/storage && ln -s ../../../cloudflare-images ./content/adapters/storage/cloudflare-images
- Setup your config (can also be done by modifying the config.production.json file directly)
- Create an api token at Cloudflare API Token Dashboard using the 'Read and write to Cloudflare Stream and Images' template
ghost config storage.cloudflare-images.apiToken YOUR_TOKEN_HERE
- Look up your account id and hash on your Cloudflare dashboard. Select 'Images' in the left hand panel, you should see copyable values in the right hand panel.
- Enable the adapter
ghost config storage.active cloudflare-images
- Create an api token at Cloudflare API Token Dashboard using the 'Read and write to Cloudflare Stream and Images' template
- Restart ghost
ghost restart
- Though the delete function is implemented, currently Ghost never deletes images in their storage. This is an issue on Ghost's end (I'm working on implementing some additional tooling to keep those in sync).
- I created a Docker compose file for local development and testing. I currently run it in Github Codespaces using the .devcontainer in the repo.
