MDeLuise / plant-it

🪴 Self-hosted, open source gardening companion app
https://plant-it.org
GNU General Public License v3.0
455 stars 17 forks source link

Error: cannot read image #167

Open CodingEmil opened 1 month ago

CodingEmil commented 1 month ago

Avoid duplicated bug reports

Description

After creating a custom Plant and adding an image everything works like it's supposed to, I can even see the image. If I want to edit the entry of this plant I'll get an error message: server-1 | 2024-05-23T22:14:17.979Z ERROR 23 --- [io-8080-exec-10] .g.m.p.i.s.FileSystemImageStorageService : Error while reading image fee1ef14-2ded-45de-b78c-dbc139521870 permission deny The image isn't shown anymore and I cant edit/delete the entry.

Local environment

No response

MDeLuise commented 1 month ago

Hi @CodingEmil, This seems to be a problem of permissions for the upload-dir folder you're using.

Do you use a docer-compose.yml like this?

  server:
    image: msdeluise/plant-it-server:latest
    env_file: server.env
    depends_on:
      - db
      - cache
    restart: unless-stopped
    volumes:
      - "./upload-dir:/upload-dir"
      - "./certs:/certificates"
    ports:
      - "8080:8080"
      - "3000:3000"

  db:
    image: mysql:8.0
    restart: always
    env_file: server.env
    volumes:
      - "./db:/var/lib/mysql"

  cache:
    image: redis:7.2.1
    restart: always

Specifically the line - "./upload-dir:/upload-dir". If so, do you have read and write access to the ./upload-dir repository?

CodingEmil commented 1 month ago

Hi @MDeLuise, yes, I am using the default docker-compose.yml file. It seems more like a Linux/docker problem... Not quite sure what/whom to give permission, I haven't adjusted any permissions. My setup: Running docker on a container inside Proxmox. Did not create any other users. Could you tell me your setup? Did you setup any other users?

CodingEmil commented 1 month ago

I created a new container doing all those steps: mkdir plantit && cd plantit nano docker-compose.yml

version: "3"
name: plant-it
services:
  server:
    image: msdeluise/plant-it-server:latest
    env_file: server.env
    depends_on:
      - db
      - cache
    restart: unless-stopped
    volumes:
      - "./upload-dir:/upload-dir"
      - "./certs:/certificates"
    ports:
      - "8080:8080"
      - "3000:3000"

  db:
    image: mysql:8.0
    restart: always
    env_file: server.env
    volumes:
      - "./db:/var/lib/mysql"

  cache:
    image: redis:7.2.1
    restart: always

nano server.env

#
# DB
#
MYSQL_HOST=db
MYSQL_PORT=3306
MYSQL_USERNAME=root
MYSQL_PSW=root
MYSQL_DATABASE=bootdb
MYSQL_ROOT_PASSWORD=root

#
# JWT
#
JWT_SECRET=putTheSecretHere
JWT_EXP=1

#
# Server config
#
USERS_LIMIT=2 ##ONLY LINE CHANGED
UPLOAD_DIR=/upload-dir
API_PORT=8080
TREFLE_KEY=
LOG_LEVEL=DEBUG
ALLOWED_ORIGINS=*

#
# Cache
#
CACHE_TTL=86400
CACHE_HOST=cache
CACHE_PORT=6379

#
# SSL
#
SSL_ENABLED=false
CERTIFICATE_PATH=/certificates/

docker compose up -d

Then I am creating a new Plant, adding a picture, everything works so far. If I edit the plant (change title for example) I'll get the same error message. I am talking about the picture of the species, not a single plant. Any advice?