matrix-dimension icon indicating copy to clipboard operation
matrix-dimension copied to clipboard

Docker install permissions

Open MasterJubei opened this issue 3 years ago • 2 comments

I am having problems with the default instructions, they are not very comprehensive for someone new to docker. On the matrix server: I am running as root Made /etc/dimension as root docker pull turt2live/matrix-dimension Then created /etc/dimension/config.yaml as root I put the default configuration there, but which parameters must be changed for it to not just exit immediately?

The only thing I changed first was to replace the old database with:

database:
    file: "/data/dimension.db"
    botData: "/data/bot.json"

However when I run docker run -d --name dimension -p 127.0.0.1:8184:8184 -v /etc/dimension:/data turt2live/matrix-dimension When I check the logs with: docker logs dimension I get:

root@matrix:/etc/dimension# docker logs dimension
internal/fs/utils.js:230
    throw err;
    ^

Error: EACCES: permission denied, open '/data/bot.json'
    at Object.openSync (fs.js:457:3)
    at writeFileSync (fs.js:1282:35)
    at FileSync.read (/home/node/matrix-dimension/node_modules/lowdb/adapters/FileSync.js:46:9)
    at LodashWrapper.db.read (/home/node/matrix-dimension/node_modules/lowdb/lib/main.js:32:21)
    at module.exports (/home/node/matrix-dimension/node_modules/lowdb/lib/main.js:51:13)
    at new SimpleFsStorageProvider (/home/node/matrix-dimension/node_modules/matrix-bot-sdk/lib/storage/SimpleFsStorageProvider.js:9:19)
    at new _MatrixStickerBot (/home/node/matrix-dimension/build/app/matrix/MatrixStickerBot.js:22:143)
    at Object.<anonymous> (/home/node/matrix-dimension/build/app/matrix/MatrixStickerBot.js:165:28)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/home/node/matrix-dimension/build/app/db/ScalarStore.js:15:28)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/home/node/matrix-dimension/build/app/api/controllers/AccountController.js:25:23)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18) {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/data/bot.json'
}

What should I change? I tried asking on matrix:matrix.org but nobody replied. Thanks

MasterJubei avatar Mar 27 '21 02:03 MasterJubei

The problems you're having might be related to using /etc/dimension, since that directory probably requires root access. I think it would be best to just use a directory under your checkout of dimension, for example ./data.

The docker command then becomes:

cd /path/to/matrix-dimension
docker run -d --name dimension -p 127.0.0.1:8184:8184 -v ./data:/data turt2live/matrix-dimension

I too thought it was confusing to use /etc/dimension, specially considering that directory is specific to UNIX systems, Windows hosts won't have it. Probably the docs could be updated to use something like ./data instead.

psrpinto avatar Jun 14 '21 15:06 psrpinto

For future reference: it seems UID & GID 1000 are used (inherited from docker.io/node images).

mibmo avatar Oct 27 '21 17:10 mibmo