npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ghost-storage

v1.0.6

Published

Storage plugin for Ghost blog

Downloads

7

Readme

ghost-storage

Description

ghost-storage is a Ghost Blog plugin used to store static files in other cloud storage services like Amazon S3 instead of local file system storage.

Supported storage services

  • Amazon S3 Storage
  • Google Cloud Storage

Amazon S3 Storage

Configuration on AWS S3 console

  • Generate Security Credentials in AWS console with Access Key ID and Secret Access Key, credentials should be keep safe, otherwise can be used to access all AWS services by other users.
  • Create a bucket with a unique name and assign permission to yourself in order to upload, delete and view assets in bucket.
  • Enable static site hosting and add policy below, so your bucket can be served as static site with read access to all users. For example, you can access your static files in browser with URL example-bucket.s3-website-us-east-1.amazonaws.com
{
  "Version":"2012-10-17",
  "Statement":[{
  "Sid":"PublicReadForGetBucketObjects",
        "Effect":"Allow",
    "Principal": "*",
      "Action":["s3:GetObject"],
      "Resource":["arn:aws:s3:::example-bucket/*"
      ]
    }
  ]
}

Setting up in Ghost Blog

In order to replace the storage module, the basic requirements are:

  • Create a new folder inside /content called /storage
  • Inside of /storage you need to create your new module
  • Your config.js file will need to be updated to provide config for your new storage module and set it as active.
  • Get the name of bucket, subdomains of aws host path from AWS S3 console to update config file.
  • In your config.js file, you'll need to add a new storage block to whichever environment you want to change:
production: {
  "others": {},
  "storage": {
      "active": "ghost-storage",
      "ghost-storage": {
          "accessKeyId": "",
        "secretAccessKey": "",
        "bucket": "example_bucket",
        "awsPath": "s3-website-us-east-1.amazonaws.com"
      }
  },
}
development: {

}
  • Create index.js file with folder path content/storage/ghost-storage/index.js (manually create folder if not exist) and fill this file with content below
'use strict';
module.exports = require('ghost-storage').S3;

Google Cloud Storage

Configuration on Google API console

  • Generate Security Credentials in Google API console with Project ID and download JSON key file, credentials should be keep safe.
  • Create a new bucket with domain unique name and make it public to be readable to all visitors. Write down bucket name to be used later.

Setting up in Ghost blog

  • Repeat most steps as the same in Amazon S3 Storage configuration.
  • Put key.json file under the same directory as config.js to be imported in Ghost configuration.
  • Update your config.js file, you'll need to add a new storage block to whichever environment you want to change:
production: {
  "others": {},
  "storage": {
      "active": "ghost-storage",
      "ghost-storage": {
        projectId: '',
            keyFilename: path.join(__dirname, './key.json'),
            bucket: 'bucket name',
            gcloudPath: 'storage.googleapis.com'
      }
  },
}
development: {

}
  • Create index.js file with folder path content/storage/ghost-storage/index.js (manually create folder if not exist) and fill this file with content below.
'use strict';
module.exports = require('ghost-storage').Google;

Collaboration

If you are interested in this project and want to be collaborators to implement other cloud storage plugins, please send pull requests or shoot me a email.