1.0.2 • Published 3 months ago

ghost-gstorage-plugin v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Status License


📝 Table of Contents

🧐 About

The ghost-gstorage-plugin is a storage adapter for Ghost CMS that allows you to store your media files on Google Cloud Storage. This plugin provides a seamless way to manage and serve your media files directly from Google Cloud, ensuring high availability and scalability.

🏁 Getting Started

These instructions will help you set up the ghost-gstorage-plugin on your Ghost blog.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have a Google Cloud account.
  • You have created a Google Cloud Storage bucket.
  • You have a service account key JSON file for authentication.

Installing

  1. Navigate to your Ghost installation directory:

    cd /var/www/ghost
  2. Install the plugin:

    npm install --save ghost-gstorage-plugin
  3. Create the storage module:

    export GHOST_ENVIRONMENT=production
    export CONTENT_PATH=$(jq -r '.paths.contentPath // "."' config.${GHOST_ENVIRONMENT}.json)
    mkdir -p ${CONTENT_PATH}/adapters/storage/gcloud
    cat > ${CONTENT_PATH}/adapters/storage/gcloud/index.js << EOL
    'use strict';
    module.exports = require('ghost-gstorage-plugin');
    EOL

⚙️ Configuration

  1. Create a bucket in your Google Cloud project. Note your project ID and create a service account key in JSON format.

  2. Add the key to your Ghost root directory or any preferred location.

  3. Update your config.production.json with the following configuration:

    "storage": {
      "active": "gcloud",
      "gcloud": {
        "projectId": "<your-project-id>",
        "bucket": "<your-bucket-name>",
        "key": "<path-to-your-service-account-key.json>",
        "assetDomain": "<your-asset-domain>",
        "uploadFolderPath": "<your-upload-folder-path>",
        "insecure": <true-or-false>,
        "maxAge": "<cache-control-max-age-in-seconds>"
      }
    }
    • projectId: Your Google Cloud project ID.
    • key: Path to your service account key JSON file. If it's in the Ghost root directory, just use the file name; otherwise, use an absolute path.
    • bucket: Your Google Cloud Storage bucket name.
    • assetDomain: Optional custom domain for your bucket. This is only required if you want to use a custom domain for your cloud storage bucket. Note that these instructions only allow for HTTP, not HTTPS, as the storage servers do not present a custom certificate for your domain.
    • uploadFolderPath: The path within your bucket where files will be uploaded.
    • insecure: Set to true if using a custom domain without HTTPS. This config is optional and defaults to false.
    • maxAge: Cache control max-age in seconds. This is optional and defaults to 31 days (in seconds). It is desirable if you will not be deleting and re-uploading the same file multiple times, and will reduce your bandwidth usage when paired with a CDN.
  4. Verify your Ghost configuration:

    ghost stop
    ghost run

    You will see some logs or an error if the install was not successful. Fix any errors and rerun until successful.

  5. Restart Ghost:

    ghost start

⛏️ Built Using

✍️ Authors

🎉 Acknowledgements

  • Thanks to the Ghost community for their support and contributions.
1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago