colinmeinke/ghost-storage-adapter-s3

Installation instructions did not work in docker container

johnbarney opened this issue · 1 comments

Example of my Dockerfile:

FROM ghost:alpine

RUN cd current;                                   \
    npm install ghost-storage-adapter-s3;         \
    mkdir -p ./content/adapters/storage;          \
    cp -r ./node_modules/ghost-storage-adapter-s3 \
          ./content/adapters/storage/s3;          \
    rm -f /var/lib/ghost/content/data/ghost.db;   \
    rm -f /var/lib/ghost/configuration.production.json

ENV server__host 0.0.0.0

This Dockerfile works as long as I do not try to activate the s3 storage module.

Stacktrace when I do invoke the s3 storage module:

NAME: IncorrectUsageError
CODE: MODULE_NOT_FOUND
MESSAGE: We detected a misuse. Please read the stack trace.

level:critical

We cannot find your adapter in: /var/lib/ghost/content/adapters/storage/ or: /var/lib/ghost/versions/1.12.1/core/server/adapters/stor
age/
IncorrectUsageError: We detected a misuse. Please read the stack trace.
    at new IncorrectUsageError (/var/lib/ghost/versions/1.12.1/node_modules/ghost-ignition/lib/errors/index.js:79:23)
    at Object.getStorage (/var/lib/ghost/versions/1.12.1/core/server/adapters/storage/index.js:62:19)
    at setupBlogApp (/var/lib/ghost/versions/1.12.1/core/server/blog/app.js:64:66)
    at setupParentApp (/var/lib/ghost/versions/1.12.1/core/server/app.js:54:36)
    at /var/lib/ghost/versions/1.12.1/core/server/index.js:70:37

    at tryCatcher (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:638:18)
    at PromiseArray._resolve (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise_array.js:126:19)
    at PromiseArray._promiseFulfilled (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise_array.js:144:14)
    at Promise._settlePromise (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:574:26)
    at Promise._settlePromise0 (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

Error: Cannot find module '/var/lib/ghost/versions/1.12.1/core/server/adapters/storage/s3'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.getStorage (/var/lib/ghost/versions/1.12.1/core/server/adapters/storage/index.js:59:42)
    at setupBlogApp (/var/lib/ghost/versions/1.12.1/core/server/blog/app.js:64:66)
    at setupParentApp (/var/lib/ghost/versions/1.12.1/core/server/app.js:54:36)

    at /var/lib/ghost/versions/1.12.1/core/server/index.js:70:37
    at tryCatcher (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:638:18)
    at PromiseArray._resolve (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise_array.js:126:19)
    at PromiseArray._promiseFulfilled (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise_array.js:144:14)
    at Promise._settlePromise (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:574:26)
    at Promise._settlePromise0 (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/var/lib/ghost/versions/1.12.1/node_modules/bluebird/js/release/async.js:17:14)

Example Dockerfile that I created that works using S3 storage adapter:

FROM ghost:alpine

RUN cd current;                                   \
    npm install ghost-storage-adapter-s3;         \
    mkdir -p ./content/adapters/storage;          \
    cp -r ./node_modules/ghost-storage-adapter-s3 \
          ./core/server/adapters/storage/s3;          \
    rm -f /var/lib/ghost/content/data/ghost.db;   \
    rm -f /var/lib/ghost/configuration.production.json

ENV server__host 0.0.0.0

I'm positive this is something I am doing wrong so I'd like to get some feedback. I'm not blocked as I got it working.

Thanks

It was indeed an issue on my end. The Docker container does some interesting things with the content folder. Using my workaround seems to be the only sane thing to do for the moment. Closing thread.