GithubHelp home page GithubHelp logo

ifvictr / ghost-storage-github Goto Github PK

View Code? Open in Web Editor NEW
65.0 65.0 13.0 271 KB

:octocat: GitHub storage adapter for Ghost

Home Page: https://npm.im/ghost-storage-github

License: MIT License

JavaScript 100.00%
adapter blog ghost github storage

ghost-storage-github's People

Contributors

dependabot[bot] avatar ifvictr avatar scottsmith95 avatar snbqt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ghost-storage-github's Issues

Hi ifvictr, just follow the README is enough to install on ghost(v3.2.0) ?

First of all, pretty thanks for your share.
My question: My ghost version is v3.2.0. I just follow the README, but i can't install it correct. So something should be update? Honestly, I am a newbie in programming. Please give me more details for how to install this plugin for ghost~ :D Thanks~

it did not work with Ghost V3.2

Debug Information:
OS: Ubuntu, v18.04
Node Version: v10.17.0
Ghost-CLI Version: 1.12.0
Environment: production
Command: 'ghost restart'
Message: We detected a misuse. Please read the stack trace.
Suggestion: journalctl -u ghost_inote-xyz -n 50
Stack: Error: We detected a misuse. Please read the stack trace.
at Server.server.close (/usr/lib/node_modules/ghost-cli/lib/utils/port-polling.js:38:28)
at Object.onceWrapper (events.js:286:20)
at Server.emit (events.js:198:13)
at emitCloseNT (net.js:1619:8)
at process._tickCallback (internal/process/next_tick.js:63:19)

Allow use of GitHub Pages URLs

Currently, ghost-github serves files from raw.githubusercontent.com. As far as I know, incorrect filetypes are sent in headers (I don't know if this applies to images or not). Files are cached for only a short amount of time, leading to unnecessary requests. Being able to use a GitHub Pages URL (especially if the user has a custom domain) would allow the user to do more things to the image (i.e. perform image optimization via Cloudflare).

PNG image upload encountering error

I am encountering an error when trying to upload PNG images to Github. The files do upload immediately to Github; however, if I download the image from Github, it says it is corrupt for over a minute or so. I think Github takes longer to process PNG images (even small ones ~13kB). After 2 minutes when I refresh the link to the Github PNG it appears just fine.

Using the ghost-github 1.0.2 and Ghost 2.31.0.

It may be related to the 2 other issues that are open #18 and #21.

Error log:

{"message":"is at 71caabd4c09d47a8a4f3124dbcf224c4b348a2c2 but expected 3a2a56b1564c71bd7379e85fc5060bf65436114d","documentation_url":"https://developer.github.com/v3/repos/contents/#create-or-update-a-file"}
Error ID:
    f943fe20-f0f4-11e9-b055-73d3faf0bf5b
Error Code:
    409
----------------------------------------
InternalServerError: {"message":"is at 71caabd4c09d47a8a4f3124dbcf224c4b348a2c2 but expected 3a2a56b1564c71bd7379e85fc5060bf65436114d","documentation_url":"https://developer.github.com/v3/repos/contents/#create-or-update-a-file"}
    at new GhostError (/var/www/ghost/versions/2.31.0/core/server/lib/common/errors.js:10:26)
    at _private.prepareError (/var/www/ghost/versions/2.31.0/core/server/web/shared/middlewares/error-handler.js:51:19)
    at Layer.handle_error (/var/www/ghost/versions/2.31.0/node_modules/express/lib/router/layer.js:71:5)
    at trim_prefix (/var/www/ghost/versions/2.31.0/node_modules/express/lib/router/index.js:315:13)
    at /var/www/ghost/versions/2.31.0/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/var/www/ghost/versions/2.31.0/node_modules/express/lib/router/index.js:335:12)
    at next (/var/www/ghost/versions/2.31.0/node_modules/express/lib/router/index.js:275:10)
    at Layer.handle_error (/var/www/ghost/versions/2.31.0/node_modules/express/lib/router/layer.js:67:12)
    at trim_prefix (/var/www/ghost/versions/2.31.0/node_modules/express/lib/router/index.js:315:13)
    at /var/www/ghost/versions/2.31.0/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/var/www/ghost/versions/2.31.0/node_modules/express/lib/router/index.js:335:12)
    at next (/var/www/ghost/versions/2.31.0/node_modules/express/lib/router/index.js:275:10)
    at /var/www/ghost/versions/2.31.0/node_modules/express/lib/router/index.js:635:15
    at next (/var/www/ghost/versions/2.31.0/node_modules/express/lib/router/index.js:260:14)
    at next (/var/www/ghost/versions/2.31.0/node_modules/express/lib/router/route.js:127:14)
    at apiImpl.then.then.catch (/var/www/ghost/versions/2.31.0/core/server/api/shared/http.js:97:17)

Add filepath format option

Example of what the config might look like:

format: '{YYYY}/{MM}/{DD}/{NAME}-{UUID}-{TIMESTAMP}-{RANDOM}{EXT}'

module path not exits

Error: Cannot find module '/var/www/ghost/versions/1.24.3/core/server/adapters/storage/ghost-github'

Jun 15 20:53:54 ubuntu node[6351]: NAME: IncorrectUsageError
Jun 15 20:53:54 ubuntu node[6351]: CODE: MODULE_NOT_FOUND
Jun 15 20:53:54 ubuntu node[6351]: MESSAGE: We detected a misuse. Please read the stack trace.
Jun 15 20:53:54 ubuntu node[6351]: level:critical
Jun 15 20:53:54 ubuntu node[6351]: We cannot find your adapter in: /var/www/ghost/content/adapters/storage/ or: /var/www/ghost/versions/1.24.3/core/server/adapters/storage/
Jun 15 20:53:54 ubuntu node[6351]: IncorrectUsageError: We detected a misuse. Please read the stack trace.
Jun 15 20:53:54 ubuntu node[6351]: at new IncorrectUsageError (/var/www/ghost/versions/1.24.3/node_modules/ghost-ignition/lib/errors/index.js:79:23)

Another "Unable to find storage adapter ghost-storage-github"

Hello,
I created a Ghost instance under /var/www/ghost directly on Ubuntu OS.
I tried to follow the README guide but when I restarted Ghost, I got the following error :

May 24 14:10:57 ubuntu node[31494]: [2021-05-24 14:10:57] INFO Ghost is running in production...
May 24 14:10:57 ubuntu node[31494]: [2021-05-24 14:10:57] INFO Your site is now available on https://ghost-myblog/
May 24 14:10:57 ubuntu node[31494]: [2021-05-24 14:10:57] INFO Ctrl+C to shut down
May 24 14:10:57 ubuntu node[31494]: [2021-05-24 14:10:57] INFO Ghost server started in 3.84s
May 24 14:10:58 ubuntu node[31494]: [2021-05-24 14:10:58] INFO Bootstrap client was closed.
May 24 14:10:59 ubuntu node[31494]: [2021-05-24 14:10:59] INFO Database is in a ready state.
May 24 14:10:59 ubuntu node[31494]: [2021-05-24 14:10:59] INFO Ghost database ready in 5.32s
May 24 14:11:10 ubuntu node[31494]: [2021-05-24 14:11:10] ERROR Unable to find storage adapter ghost-storage-github in ,/var/www/ghost/content/adapters/,/var/www/ghost/versions/4.4.0/core/server/adapters/.
May 24 14:11:10 ubuntu node[31494]:
May 24 14:11:10 ubuntu node[31494]: Unable to find storage adapter ghost-storage-github in ,/var/www/ghost/content/adapters/,/var/www/ghost/versions/4.4.0/core/server/adapters/.
May 24 14:11:10 ubuntu node[31494]: Error ID:
May 24 14:11:10 ubuntu node[31494]:     e4274890-bc99-11eb-9aff-038fa33ea23d
May 24 14:11:10 ubuntu node[31494]: ----------------------------------------
May 24 14:11:10 ubuntu node[31494]: IncorrectUsageError: Unable to find storage adapter ghost-storage-github in ,/var/www/ghost/content/adapters/,/var/www/ghost/versions/4.4.0/core/server/adapters/.
May 24 14:11:10 ubuntu node[31494]:     at new IncorrectUsageError (/var/www/ghost/versions/4.4.0/node_modules/ghost-ignition/lib/errors/index.js:98:23)
May 24 14:11:10 ubuntu node[31494]:     at AdapterManager.getAdapter (/var/www/ghost/versions/4.4.0/node_modules/@tryghost/adapter-manager/lib/AdapterManager.js:110:19)
May 24 14:11:10 ubuntu node[31494]:     at Object.getAdapter (/var/www/ghost/versions/4.4.0/core/server/services/adapter-manager/index.js:26:31)
May 24 14:11:10 ubuntu node[31494]:     at Object.getStorage (/var/www/ghost/versions/4.4.0/core/server/adapters/storage/index.js:4:27)
May 24 14:11:10 ubuntu node[31494]:     at setupSiteApp (/var/www/ghost/versions/4.4.0/core/server/web/site/app.js:112:71)
May 24 14:11:10 ubuntu node[31494]:     at setupParentApp (/var/www/ghost/versions/4.4.0/core/server/web/parent/app.js:66:44)
May 24 14:11:10 ubuntu node[31494]:     at initExpressApps (/var/www/ghost/versions/4.4.0/core/boot.js:124:57)
May 24 14:11:10 ubuntu node[31494]:     at bootGhost (/var/www/ghost/versions/4.4.0/core/boot.js:286:32)
May 24 14:11:10 ubuntu node[31494]:
May 24 14:11:10 ubuntu node[31494]: [2021-05-24 14:11:10] WARN Ghost is shutting down
May 24 14:11:10 ubuntu node[31494]: [2021-05-24 14:11:10] WARN Ghost has shut down
May 24 14:11:10 ubuntu node[31494]: [2021-05-24 14:11:10] WARN Your site is now offline
May 24 14:11:10 ubuntu node[31494]: [2021-05-24 14:11:10] WARN Ghost was running for a few seconds
May 24 14:11:10 ubuntu node[31494]: [2021-05-24 14:11:10] INFO Bootstrap client was closed.
May 24 14:11:11 ubuntu systemd[1]: Stopping Ghost systemd service for blog: ghost-myblog...
May 24 14:11:11 ubuntu node[31494]: [2021-05-24 14:11:11] WARN Ghost is shutting down
May 24 14:11:11 ubuntu node[31494]: [2021-05-24 14:11:11] WARN Ghost has shut down
May 24 14:11:11 ubuntu node[31494]: [2021-05-24 14:11:11] WARN Your site is now offline
May 24 14:11:11 ubuntu node[31494]: [2021-05-24 14:11:11] WARN Ghost was running for a few seconds
May 24 14:11:11 ubuntu node[31465]: /usr/lib/node_modules/ghost-cli/lib/process-manager.js:46
May 24 14:11:11 ubuntu node[31465]:         throw error;
May 24 14:11:11 ubuntu node[31465]:         ^
May 24 14:11:11 ubuntu node[31465]: {
May 24 14:11:11 ubuntu node[31465]:   message: 'Ghost was able to start, but errored during boot with: Unable to find storage adapter ghost-storage-github in ,/var/www/ghost/content/adapters/,/var/www/ghost/versions/4.4.0/core/server/adapters/.'
May 24 14:11:11 ubuntu node[31465]: }
May 24 14:11:11 ubuntu systemd[1]: ghost_ghost-myblog.service: Main process exited, code=exited, status=1/FAILURE
May 24 14:11:11 ubuntu systemd[1]: ghost_ghost-myblog.service: Failed with result 'exit-code'.
May 24 14:11:11 ubuntu systemd[1]: Stopped Ghost systemd service for blog: ghost-myblog.

However, the adapter exists under the specified folder (specified folder on README) :

user@ubuntu:~/ghost/current$ tree content/adapters/
content/adapters/
├── README.md
└── storage
    └── ghost-storage-github
        ├── LICENSE.txt
        ├── README.md
        ├── build
        │   ├── index.js
        │   └── utils.js
        └── package.json

Plus, I tried to copy the adapter under /var/www/ghost/content/adapters/ :

user@ubuntu:~/ghost$ tree content/adapters/ -L 2
content/adapters/
├── ghost-storage-github
│   ├── LICENSE.txt
│   ├── README.md
│   ├── build
│   ├── package.json
└── storage

None of both solutions work and I am a bit clueless 😭

Thanks in advance for your help.

ERROR: Unable to find storage adapter ghost-storage-github

  • OS: ubuntu 20.04
  • Docker: 19.03.14

Hi, I am using ghost with docker, and after I installed this adapter following the README, it given me the following error:

[2020-12-04 04:29:05] ERROR Unable to find storage adapter ghost-storage-github in ,/var/lib/ghost/content/adapters/,/var/lib/ghost/versions/3.38.3/core/server/adapters/.

Unable to find storage adapter ghost-storage-github in ,/var/lib/ghost/content/adapters/,/var/lib/ghost/versions/3.38.3/core/server/adapters/.

Error ID:
    3e172b50-35e9-11eb-9036-3d0bb8ad1017

----------------------------------------

IncorrectUsageError: Unable to find storage adapter ghost-storage-github in ,/var/lib/ghost/content/adapters/,/var/lib/ghost/versions/3.38.3/core/server/adapters/.
    at new IncorrectUsageError (/var/lib/ghost/versions/3.38.3/node_modules/ghost-ignition/lib/errors/index.js:98:23)
    at AdapterManager.getAdapter (/var/lib/ghost/versions/3.38.3/node_modules/@tryghost/adapter-manager/lib/AdapterManager.js:110:19)
    at Object.getAdapter (/var/lib/ghost/versions/3.38.3/core/server/services/adapter-manager/index.js:26:31)
    at Object.getStorage (/var/lib/ghost/versions/3.38.3/core/server/adapters/storage/index.js:4:27)
    at setupSiteApp (/var/lib/ghost/versions/3.38.3/core/server/web/site/app.js:111:71)
    at setupParentApp (/var/lib/ghost/versions/3.38.3/core/server/web/parent/app.js:65:44)
    at /var/lib/ghost/versions/3.38.3/core/server/index.js:109:52

I examined the directory /var/lib/ghost/content/adapters/ and there did has storage/ghost-storage-github/,then according to the official document https://ghost.org/docs/concepts/storage-adapters/

Inside of content/adapters/storage create a file or a folder: content/adapters/storage/my-module.js or content/adapters/storage/my-module - if using a folder, create a file called index.js inside it

I moved the index.js and utils.js outside from build folder, but it didn't work either.

adapters/
└── storage
    └── ghost-storage-github
        ├── build
        │   ├── index.js
        │   └── utils.js
        ├── index.js
        ├── LICENSE.txt
        ├── package.json
        ├── README.md
        └── utils.js

My ghost configuration is:

{
  "url": "http://localhost:2368",
  "server": {
    "port": 2368,
    "host": "0.0.0.0"
  },
  "database": {
    "client": "mysql",
    "connection": {
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/lib/ghost/content"
  },
  "storage": {
    "active": "ghost-storage-github",
    "ghost-storage-github": {
        "token": "TOKEN",
        "owner": "OWNER",
        "repo": "ghost-assets",
        "branch": "master",
        "useRelativeUrls": false
    }
  }
}

and my docker-compse file is:

version: '3'
services:
	
# other services ...

  ghost:
    image: ghost
    volumes:
    - ./ghost/content/:/var/lib/ghost/content
    - ./ghost/config.json:/var/lib/ghost/config.production.json
    expose:
    - "2368"
    depends_on:
    - caddy
    - mariadb

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.