crazy-max / docker-dokuwiki

DokuWiki Docker image
MIT License
43 stars 19 forks source link

Confusion between `/data` & `/var/www` #6

Closed lgnap closed 4 years ago

lgnap commented 4 years ago

Behaviour

It's difficult to understand how this image plays with data. As Dockerfile (and documentation) tells there is a /data where to store data. But the nginx seems configured to use /var/www as root. And the data seems be copied at the both place but with different owners.

Steps to reproduce this issue

  1. Fresh install with a empty binded volume on /data
  2. Specify PUID/PGID (for my case it's 1007) through env
  3. Start image

Expected behaviour

We should see data only in /data and not in /var/www

Actual behaviour

The data are copied at the two places. In /data folder it's chowned as expected with right PUID/PGID but in /var/www it's an other uid/gid and nginx reads data into this folder. As nginx is started through 1007:1007 it fails to write into these folder as /install.php tells us

{DOCUMENT_ROOT}/data is not writable by DokuWiki. You need to fix the permission settings of this directory!
{DOCUMENT_ROOT}/data/pages is not writable by DokuWiki. You need to fix the permission settings of this directory!
{DOCUMENT_ROOT}/data/attic is not writable by DokuWiki. You need to fix the permission settings of this directory!
{DOCUMENT_ROOT}/data/media is not writable by DokuWiki. You need to fix the permission settings of this directory!
{DOCUMENT_ROOT}/data/media_attic is not writable by DokuWiki. You need to fix the permission settings of this directory!
{DOCUMENT_ROOT}/data/media_meta is not writable by DokuWiki. You need to fix the permission settings of this directory!
{DOCUMENT_ROOT}/data/meta is not writable by DokuWiki. You need to fix the permission settings of this directory!
{DOCUMENT_ROOT}/data/cache is not writable by DokuWiki. You need to fix the permission settings of this directory!
{DOCUMENT_ROOT}/data/locks is not writable by DokuWiki. You need to fix the permission settings of this directory!
{DOCUMENT_ROOT}/data/index is not writable by DokuWiki. You need to fix the permission settings of this directory!
{DOCUMENT_ROOT}/data/tmp is not writable by DokuWiki. You need to fix the permission settings of this directory!

Configuration

services: dokuwiki: image: crazymax/dokuwiki:latest volumes:

networks: web: external: true


### Logs

Container logs (set LOG_LEVEL to debug if applicable) dokuwiki_1 | [s6-init] making user provided files available at /var/run/s6/etc...exited 0. dokuwiki_1 | [s6-init] ensuring user provided files have correct perms...exited 0. dokuwiki_1 | [fix-attrs.d] applying ownership & permissions fixes... dokuwiki_1 | [fix-attrs.d] done. dokuwiki_1 | [cont-init.d] executing container initialization scripts... dokuwiki_1 | [cont-init.d] 00-fix-logs.sh: executing... dokuwiki_1 | [cont-init.d] 00-fix-logs.sh: exited 0. dokuwiki_1 | [cont-init.d] 01-fix-uidgid.sh: executing... dokuwiki_1 | [cont-init.d] 01-fix-uidgid.sh: exited 0. dokuwiki_1 | [cont-init.d] 02-fix-perms.sh: executing... dokuwiki_1 | Fixing perms... dokuwiki_1 | [cont-init.d] 02-fix-perms.sh: exited 0. dokuwiki_1 | [cont-init.d] 03-config.sh: executing... dokuwiki_1 | Setting timezone to UTC... dokuwiki_1 | Setting PHP-FPM configuration... dokuwiki_1 | Setting PHP INI configuration... dokuwiki_1 | Setting OpCache configuration... dokuwiki_1 | Setting Nginx configuration... dokuwiki_1 | Initializing DokuWiki files / folders... dokuwiki_1 | Adding preload.php... dokuwiki_1 | Copying global config... dokuwiki_1 | First install detected... dokuwiki_1 | Creating initial data folder... dokuwiki_1 | Bootstrapping configuration... dokuwiki_1 | Saving bundled plugins list... 30 found dokuwiki_1 | Saving bundled templates list... 2 found dokuwiki_1 | Checking user plugins in /data/plugins... dokuwiki_1 | Checking user templates in /data/tpl... dokuwiki_1 | >> dokuwiki_1 | >> Open your browser to install DokuWiki through the wizard (/install.php) dokuwiki_1 | >> dokuwiki_1 | [cont-init.d] 03-config.sh: exited 0. dokuwiki_1 | [cont-init.d] 04-create-services.sh: executing... dokuwiki_1 | [cont-init.d] 04-create-services.sh: exited 0. dokuwiki_1 | [cont-init.d] done. dokuwiki_1 | [services.d] starting services dokuwiki_1 | [services.d] done. dokuwiki_1 | Setting up watches. dokuwiki_1 | Watches established. dokuwiki_1 | 2020/04/14 13:04:03 [notice] 305#305: using the "epoll" event method dokuwiki_1 | 2020/04/14 13:04:03 [notice] 305#305: nginx/1.16.1 dokuwiki_1 | 2020/04/14 13:04:03 [notice] 305#305: OS: Linux 4.9.185-xxxx-std-ipv6-64 dokuwiki_1 | 2020/04/14 13:04:03 [notice] 305#305: getrlimit(RLIMIT_NOFILE): 1048576:1048576 dokuwiki_1 | 2020/04/14 13:04:03 [notice] 305#305: start worker processes dokuwiki_1 | 2020/04/14 13:04:03 [notice] 305#305: start worker process 327 dokuwiki_1 | 2020/04/14 13:04:03 [notice] 305#305: start worker process 328 dokuwiki_1 | 2020/04/14 13:04:03 [notice] 305#305: start worker process 329 dokuwiki_1 | 2020/04/14 13:04:03 [notice] 305#305: start worker process 330 dokuwiki_1 | [14-Apr-2020 13:04:03] NOTICE: fpm is running, pid 307 dokuwiki_1 | [14-Apr-2020 13:04:03] NOTICE: ready to handle connections

Maybe I just don't understand where is my mistake, but don't see where is it

lgnap commented 4 years ago

I succeed to import my backup in /data folder/mountpoint and can modify pages without any error. But can't upgrade/make change in plugins folder due to right issues but into /data all is fine. Seems that using /var/www to tell that :disappointed:

crazy-max commented 4 years ago

@lgnap

As Dockerfile (and documentation) tells there is a /data where to store data. But the nginx seems configured to use /var/www as root. ... in /var/www it's an other uid/gid and nginx reads data into this folder.

Like the README says, data are stored in /data, that's all you need to know. /var/www/ is the location of the application and don't need to have the same perms as your /data. Nginx can read them.

As nginx is started through 1007:1007 it fails to write into these folder as /install.php tells us

I cannot reproduce your issue. Everything works fine with your compose file. Also you don't give me the following information:

Configuration

  • Docker version (type docker --version) :
  • Docker compose version if applicable (type docker-compose --version) :
  • Platform (Debian 9, Ubuntu 18.04, ...) :
  • System info (type uname -a) :
  • Include all necessary configuration files : docker-compose.yml, .env, ...

Docker info

> Output of command `docker info`
lgnap commented 4 years ago

The plugin manager notifies that it doesn't have write access on plugins folder to update/delete these due to this architecture. Another way to do that is to have a cli (like wp-cli for wordpress) to make update at hand, but can't find it.

To reproduce, you can download extension (extension manager) and install a outdated version of a plugin and you'll have something similar to this screenshot ;-)

2020-04-16_09-30

crazy-max commented 4 years ago

@lgnap Ok I was able to reproduce your issue

crazy-max commented 4 years ago

@lgnap Should be ok now.

lgnap commented 4 years ago

Indeed, works well, thanks !