Giter VIP home page Giter VIP logo

ghost-v3-google-cloud-storage's Introduction

Ghost v3 Google Cloud Storage Adapter

This custom storage adapter for Ghost v3 allows you to send your publication's images to Google Cloud Storage (in short, GCS).

Read more about Ghost's storage adapters in the official documentation.

Installation

cd [your/ghost/root/directory]

# Create the GCS storage adapter directory
mkdir -p content/adapters/storage/gcs

# No need for --save as we will move the content to a different folder
npm install ghost-v3-google-cloud-storage

# Move the GCS storage adapter to the correct location so Ghost can find it
mv node_modules/ghost-v3-google-cloud-storage/* content/adapters/storage/gcs/

Note: We named the storage adapter gcs; it's simpler to work with.

Configuration

Create a Google Cloud Storage bucket

Please refer to the official documentation.

Ghost config file

Open your config.[env].json in the Ghost root directory and add a storage section.

"storage": {
  "active": "gcs",
  "gcs": {
    "bucket": "your-gcs-bucket-name",
    "keyFilename": "path-to-your-service-account.json",
    "cdn": "optional-cdn-domain"
  }
}

bucket: Required.

keyFilename: Optional if Ghost is hosted on GCP.

cdn: Optional. If you use a CDN, this is the CDN base URL.

ghost-v3-google-cloud-storage's People

Contributors

cheungpat avatar

Stargazers

Robin Smorenburg avatar Todd Birchard avatar  avatar Justin Ip avatar Abel Moremi avatar Gaurav Singh avatar Javier Gómez Rodríguez avatar Mike Sirs avatar Quang Hà avatar Raffy Alcoriza avatar dejen-sharew-wcar avatar Dodi Sabaruddin avatar Mark Massoud avatar

Watchers

James Cloos avatar Javier Gómez Rodríguez avatar  avatar

ghost-v3-google-cloud-storage's Issues

Delete images when post gets deleted (add post id to images path)

When a post is deleted the images are not removed from google storage.
I am not sure if ghost triggers some kind of event when a post gets removed but for even removing the images manually is good enough. But in order to do that I need to add the post id to the images path because currently one cant tell which posts owns which pictures by looking at the images path.

Appending `assetDomain` to beginning of URL when fetching favicon

Hey Mike! Hope you find this since the repo is blank :)

First off, thanks for making this adapter! It saved me when trying to set up Ghost on Google App Engine. Everything works great, except that trying to load the favicon.png file on article pages throws a 500. It looks like the location URL has the original assetDomain string appended to the beginning, so that it's trying to get the icon from a URL like this:

ASSET_DOMAIN/https://ASSET_DOMAIN.storage.googleapis.com/2019/11/logo.png

Instead of what it should be:

https://ASSET_DOMAIN.storage.googleapis.com/2019/11/logo.png

Any thoughts on how to fix this? I'd be happy to submit a PR if you can steer me in the right direction (and if the repo gets populated, obviously).

Request: randomise filenames

Hi Mike,

Coming from Wordpress earlier this year, I had a GCS addon that would randomise filenames to ensure filenames are not the same. Renaming filenames exist, but it will amend a 1 on the end of the filename, and I don't want to see the original filenames in each request.

I understand that I could randomise the filenames myself, but I would end up losing track of each file.

FYI - great addon :)

Thanks.

[bug] Cannot get it run with Docker

Hi Mike,

After I install this package with the docker image ghost:alpine, I get the error Cannot find module 'ghost-ignition' when boosting ghost.

The strange thing is as soon as this package is installed, the ghost-ignition in node_modules/ becomes empty.

Add an ability to set object prefix for uploaded files

Hi, what do you think about adding a new optional parameter (let's say objectPrefix) that will allow to prefix uploaded files? It will be useful for cases when one bucket is shared between content and other files, for example files of custom frontend like Gatsby.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.