go-vikunja / vikunja

Mirror of vikunja from https://code.vikunja.io/api
GNU Affero General Public License v3.0
758 stars 55 forks source link

permissions vikunja.db #242

Closed jhoogeboom closed 3 months ago

jhoogeboom commented 3 months ago

Description

Using this docker-compose:

version: '3'

services:
  vikunja:
    image: vikunja/vikunja
    environment:
      VIKUNJA_SERVICE_JWTSECRET: pjicf9Cs8KjNjV
      VIKUNJA_SERVICE_PUBLICURL: http://localhost:3456/
      # Note the default path is /app/vikunja/vikunja.db.
      # This config variable moves it to a different folder so you can use a volume and 
      # store the database file outside the container so state is persisted even if the container is destroyed.
      VIKUNJA_DATABASE_PATH: /db/vikunja.db
    ports:
      - 3456:3456
    volumes:
      - ./files:/app/vikunja/files
      - ./db:/db

I also chown the folders first before starting the docker with:

mkdir $PWD/files $PWD/db
chown 1000 $PWD/files $PWD/db

but I get this error:

vikunja-vikunja-1  | info: creating the new user vikunja with 1000:1000
vikunja-vikunja-1  | usermod: no changes
vikunja-vikunja-1  | 2024-03-20T12:05:51.412579305Z: INFO       ▶ config/InitConfig 001 No config file found, using default or config from environment variables.
vikunja-vikunja-1  | 2024-03-20T12:05:51.413096055Z: CRITICAL   ▶ migration/initMigration 002 Could not connect to db: could not open database file [uid=1000, gid=1000]: open /db/vikunja.db: per

Turns out that the user 1000 does own the folder and the files, but the permission on vikunja.db is zero, I did chmod u+rw db/vikunja.db which fixes it. Perhaps it can be fixed so that the user does not have to do this.

Vikunja Version

latest docker vikunja/vikunja

Browser and version

No response

Can you reproduce the bug on the Vikunja demo site?

Please select

Screenshots

No response

kolaente commented 3 months ago

Can you check if this is still a problem with the unstable build? (do not use your main setup for this)

jhoogeboom commented 3 months ago

Just did a fresh docker compose pull on the vikunja/vikunja:unstable image, deleted the db/files, recreated them with right owner. But the vikunja.db is created without any permissions still:

16777233 20779664 ---------- 1 (1000) (1000) 0 0 "Mar 29 09:44:52 2024" "Mar 29 09:44:52 2024" "Mar 29 09:52:25 2024" "Mar 29 09:44:52 2024" 4096 0 0 db/vikunja.db
kolaente commented 3 months ago

I was unable to reproduce this with your docker compose file and the latest unstable build.

Maybe this is a filesystem issue? Which OS are you running on? Which FS are you using?

Does it work if you touch and chown the db file manually?

jhoogeboom commented 3 months ago

Oh it seems a OS issue, I cannot reproduce this on my ubuntu box where my normal setup runs, there the database is created with the right permissions. I thought I'd try out the new container version locally on my laptop which is macOS.