jgeusebroek / docker-spotweb

A docker image running ubuntu/20.04 Linux and Spotweb
47 stars 27 forks source link

dbsettings.inc.php has wrong owner #23

Closed klara31 closed 3 years ago

klara31 commented 3 years ago

Just pulled this image to replace my locally running spotweb instance with a dockerized version. When starting, spotweb keeps complaining it cannot connect to the database.

Figured out that the dbsettings.inc.php file is linked from entrypoint.sh and has an owner root:root, in stead of www-data:www-data. When removing the symlink, copying the file from /config and change the owner, everything works perfect! For some reason, the chown in the entrypoint.sh does not touch the symlink.

I am running Docker on an Ubuntu server 20.04 LTS

jgeusebroek commented 3 years ago

That's strange. It should chmod every time the container starts. It does so in my test environment.

https://github.com/jgeusebroek/docker-spotweb/blob/a44992dbc1cf1883b7540f544eb9d4cfee0b4127/entrypoint.sh#L28

jgeusebroek commented 3 years ago

I think you might be referring to the symlink itself. But this should have no consequences. You cannot change the permission and ownership of a symlink AFAIK.

# cd /config
# ls -la
total 12
drwxr-xr-x 2     4000     4000 4096 Jan 19  2016 .
drwxr-xr-x 1 root     root     4096 Nov 22 01:54 ..
-rw-r--r-- 1 www-data www-data  185 Nov 22 01:54 dbsettings.inc.php
-rw-r--r-- 1 www-data www-data    0 Nov 22 01:54 ownsettings.php
# cd /var/www/spotweb
# ls -l dbsett*
lrwxrwxrwx 1 root root 26 Nov 22 01:54 dbsettings.inc.php -> /config/dbsettings.inc.php
klara31 commented 3 years ago

I figured it out. I am using a volume (path) for persistent configuration. The directory that was created by docker-compose has permissions root:users. Changed this folder permissions to www-data:www-data and now it works.

jgeusebroek commented 3 years ago

OK, thanks. But still it should have changed it at startup.

rikharink commented 3 years ago

I'm also having this issue using docker-compose on my synology nas. If i delete the dbsettings.inc.php in /var/www/spotweb inside the container and copy it from /config and chmod it it works. But with the symlink setup it doesn't. Btw you can change the permissions of a symlink with the -h flag for example: chown -h www-data:www-data dbsettings.inc.php but that doesn't seem to fix my connection issue.

Northguy commented 3 years ago

@rikharink, Running into the same issue with a mapped volume via docker-compose. I suppose this is because the host system does not recognize the www-data user. That's why a lot of images use PUID / PGID setup I guess. The manual copy and chmod indeed does the trick.

What connection issue are you referring to?

rikharink commented 3 years ago

I was just referring to the fact that spotweb still couldn't connect to the database (because the dbsettings.inc.php isn't correct) even if I use the -h flag to change the symlink permissions.

proddy commented 3 years ago

I had the same problem, chown -h didn't help so I just copied and removed the file

today at 2:45:33 PM  Creating database configuration
today at 2:45:33 PM  rm: cannot remove '/var/www/spotweb/dbsettings.inc.php': No such file or directory
today at 2:45:33 PM  Setting (PHP) time zone to Europe/Amsterdam