kd2org / karadav

Lightweight NextCloud compatible WebDAV server
https://fossil.kd2.org/karadav/
GNU Affero General Public License v3.0
155 stars 14 forks source link

Docker fails to create the database #30

Closed MassiveBox closed 1 year ago

MassiveBox commented 1 year ago

Hello again, Thanks for responding to #29 so quickly and efficiently, however I'm still having some other problems with KaraDAV that prevent me from using it. It looks like when using Docker KaraDAV fails to create the database and user. I've set the following in my config.local.php: const DB_FILE = __DIR__ . '/data/karadav.sqlite';, and I've mounted a volume in my docker-compose.yml as follows: /media/hdd/filebrowser:/var/karadav/data I expected to get a file /media/hdd/filebrowser:/var/karadav/data/karadav.sqlite, but that didn't come up. When I started the container, I got errors like Exception Unable to open database: unable to open database file, so I created it as a regular SQLite file using the schema. I tried starting it like that, but I saw it didn't work so I added my user manually, hashing the password manually with PHP's password_hash(), but while I don't get any error now, it's telling me that the username of password are incorrect. As before, please tell me if I need to provide any additional information. Thank you for your help!

bohwaz commented 1 year ago

I'm not using Docker sorry.

If the directory is mounted it should work though, there's probably something wrong on the docker side. Maybe do a die(DB_FILE) in the config.local.php to find out if you are mapping the directory correctly.

MassiveBox commented 1 year ago

So, I've done some testing today, and it turns out it's a permissions issue. I've implemented a small change to warn the users about permission problems (and other instances in which the database file can't be created), and I've also changed the Dockerfile to fix the problem at its root. I've noticed that by removing the nobody user from the Dockerfile, it seems to be fixed, however I want to ask you before opening the pull request with the upgraded Dockerfile - why is it there in the first place? If it's been implemented for a specific reason I can't simply get rid of it, and I'll have to look for another solution. It seems to work fine to me though.

bohwaz commented 1 year ago

What are the changes you have made? I'll need to see to understand if it's fine or not :)