discord-tickets / bot

The most popular open-source and self-hosted ticket management bot for Discord - a free alternative to the premium and white-label plans of other popular ticketing bots.
https://discordtickets.app
GNU General Public License v3.0
956 stars 478 forks source link

[BUG] Error: EACCES: permission denied, mkdir 'user/uploads' on docker swarm #521

Open alf1e opened 9 months ago

alf1e commented 9 months ago

Is there an existing issue for this?

Current Behavior

Experiencing error when starting for first time.

Error: EACCES: permission denied, mkdir 'user/uploads'
    at mkdirSync (node:fs:1391:3)
    at mkDirAndCopy (node:internal/fs/cp/cp-sync:268:3)
    at onDir (node:internal/fs/cp/cp-sync:263:25)
    at getStats (node:internal/fs/cp/cp-sync:167:12)
    at copyDir (node:internal/fs/cp/cp-sync:284:21)
    at onDir (node:internal/fs/cp/cp-sync:264:10)
    at cpSyncFn (node:internal/fs/cp/cp-sync:61:10)
    at checkParentDir (node:internal/fs/cp/cp-sync:159:10)
    at Object.cpSync (node:fs:3020:3) {
  errno: -13,
  syscall: 'mkdir',
  path: 'user/uploads'
  code: 'EACCES',
}

Expected Behavior

Shoudl start and create config

Steps To Reproduce

  1. Install bot through portainer stack on latest version
  2. Experience Error

Environment

Docker (swarm) Latest

Anything else?

No response

eartharoid commented 9 months ago

@alf1e as a temporary workaround, you can remove (or comment out) the volume that is mounted at ./user. Currently, no data is stored in the folder, only configuration files that are generated when the container is first created.

https://github.com/discord-tickets/bot/blob/b8972ba825191d375a18c9e3b8f97ecf384fee57/docker-compose.yml#L28-L29

korneliuszw commented 1 month ago

I solved this by mounting a directory and changing it's owner to 1001:1001

chown 1001:1001 ./tickets-bot

However the problem exists, at least on 4.2 image. I'm not sure why exactly because Dockerfile already has USER directive.