ifvictr / ghost-storage-github

:octocat: GitHub storage adapter for Ghost
https://npm.im/ghost-storage-github
MIT License
65 stars 12 forks source link

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

Closed lecoan closed 3 years ago

lecoan commented 3 years ago

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
ifvictr commented 3 years ago

Hi, @lecoan! Just saw this issue and noticed that you've closed it. How did you manage to solve the problem you were having?

lecoan commented 3 years ago

@ifvictr I downloaded the module by npm outside the docker, but the node_modules didn't mount within docker container, as shown in my docker-compse.yaml file, thus the adapter can not find its dependencies.

ifvictr commented 3 years ago

I see. Glad you were able to resolve this! :)

quyleanh commented 2 years ago

@lecoan could you tell me how did you update your docker-compose.yml file? Thank you.

lecoan commented 2 years ago

@quyleanh I lost the config and don't use ghost for posting blogs now. But the configuration is easy.

After cp -r node_modules/ghost-storage-github content/adapters/storage/ghost-storage-github, you need mount the other node_modules inside your container so that ghost-storage-github can find its deps :)

    volumes:
    - ./ghost/content/:/var/lib/ghost/content
    - ./ghost/config.json:/var/lib/ghost/config.production.json
    - ./ghost/node_modules:/var/lib/ghost/node_modules # new
quyleanh commented 2 years ago

@lecoan thank you very much. I've manage to run it successfully. Actually, my error is mistaken config.