Ghost adapter to store images into Google Cloud Storage.
- Create a project from Google Cloud Console
- Be sure that
Google Cloud Storage API
is enable inAPIs & Services > Library
- Create a new Service Account in
IAM & Admin > Service Accounts
- Create new credentials for your service account in
IAM & Admin > Service Accounts > <Your Service Account> > Actions > Manage Keys > Add Key
- Download your credentials as a JSON file and renamed it to
credentials.json
- Create a bucket to store your files (use Fine-grained access control)
- Go to your Ghost instalation folder (the folder where you have the files
config.production.json
orconfig.development.json
):
cd /your/ghost/instalation/folder
- Create the
adapters/storage
folder inside thecontent
folder:
mkdir -p content/adapters/storage
- Install this package via NPM:
npm i ghost-gcp-storage-adapter
- Copy the installed package into
content/adapters/storage
:
cp -r node_modules/ghost-gcp-storage-adapter content/adapters/storage/ghost-gcp-storage-adapter
-
Copy your
credentials.json
file intocontent/adapters/storage/ghost-gcp-storage-adapter
-
Add the next configuration to your
config.production.json
file:
"storage": {
"active": "ghost-gcp-storage-adapter",
"ghost-gcp-storage-adapter": {
"projectId": "<your_google_cloud_project_id>",
"keyFilename": "<your_ghost_instalation_folder>/content/adapters/storage/ghost-gcp-storage-adapter/credentials.json",
"bucketName": "<your_bucket_name>"
}
}
- Restart Ghost
If you want to contribute or test this adapter, you can use it locally by following the next instructions:
- Follow the same steps to configure Google Cloud Storage
- Fork this repo
- Clone your fork in your computer
- Install Ghost locally (Instructions)
- In the folder where you installed Ghost, install the adapter locally
cd ghost_folder/
npm install /path/to/your/forked/repo
- Create the
adapters/storage
folder inside thecontent
folder:
mkdir -p content/adapters/storage
- Copy the installed package into
content/adapters/storage
:
cp -r node_modules/ghost-gcp-storage-adapter content/adapters/storage/ghost-gcp-storage-adapter
- Copy your
credentials.json
file intocontent/adapters/storage/ghost-gcp-storage-adapter
- Stop Ghost and running it in
development
mode by using:
NODE_ENV=development ghost run
With this you'be able to see the logs in real time and test and debug this package.