linuxserver / docker-dokuwiki

GNU General Public License v3.0
110 stars 24 forks source link

Some Plugins did not find its content #9

Closed Springjunky closed 4 years ago

Springjunky commented 4 years ago

I have installed the snippets plugin and the bootstrap3 / bootstrap-wrapper plugin

https://www.dokuwiki.org/plugin:snippets https://www.dokuwiki.org/template:bootstrap3 https://www.dokuwiki.org/plugin:bootswrapper?s[]=bootstrap&s[]=wrapper

Expected Behavior

The editor buttons opens a pupup.

Current Behavior

Pupup ist blank, debugging shows a http 500 error The follwing ULR is openend in the popup window

http:///lib/plugins/snippets/exe/snippets.php?ns=&edid=wikitext or http:///lib/plugins/bootswrapper/exe/popup.php?ns=&edid=wikitext

Debugging the URL from the popup window shows the http-error

I tried a Docker exec into container and look the nginx-error.log

The nginx shows some more error

2019/12/25 23:08:56 [error] 334#334: *288 FastCGI sent in stderr: "PHP message: PHP Warning:  require_once(/config/dokuwiki/lib/plugins/bootswrapper/exe/../../../../inc/init.php): failed to open stream: No such file or directory in /config/dokuwiki/lib/plugins/bootswrapper/exe/popup.php on line 13PHP message: PHP Fatal error:  require_once(): Failed opening required '/config/dokuwiki/lib/plugins/bootswrapper/exe/../../../../inc/init.php' (include_path='.:/usr/share/php7') in /config/dokuwiki/lib/plugins/bootswrapper/exe/popup.php on line 13" while reading response header from upstream, client: 172.19.0.1, server: _, request: "GET /lib/plugins/bootswrapper/exe/popup.php?ns=&edid=wiki__text HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "raspi", referrer: "http://raspi/gesehen_status_behalten?do=edit"

2019/12/25 23:09:18 [error] 334#334: *288 FastCGI sent in stderr: "PHP message: PHP Warning:  require_once(/config/dokuwiki/lib/plugins/snippets/exe/../../../../inc/init.php): failed to open stream: No such file or directory in /config/dokuwiki/lib/plugins/snippets/exe/snippets.php on line 8PHP message: PHP Fatal error:  require_once(): Failed opening required '/config/dokuwiki/lib/plugins/snippets/exe/../../../../inc/init.php' (include_path='.:/usr/share/php7') in /config/dokuwiki/lib/plugins/snippets/exe/snippets.php on line 8" while reading response header from upstream, client: 172.19.0.1, server: _, request: "GET /lib/plugins/snippets/exe/snippets.php?ns=&edid=wiki__text HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "raspi", referrer: "http://raspi/gesehen_status_behalten?do=edit"

I tried a link

root@7fbaec5bbddb:/config/dokuwiki# ll
total 20
drwxr-xr-x 5 abc  users 4096 Dec 25 23:02 .
drwxr-xr-x 8 abc  users 4096 Dec 19 20:17 ..
drwxrwxr-x 3 abc  users 4096 Dec 25 22:51 conf
drwxr-xr-x 8 abc  users 4096 Dec 19 20:17 data
lrwxrwxrwx 1 root root    17 Dec 25 23:02 inc -> /app/dokuwiki/inc
drwxr-xr-x 4 abc  users 4096 Dec 19 20:17 lib

but this gave me a Cache not accessible error

I guess the inc(lude) directory is at the wrong place in the docker container, plugins with this code

if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../../');
define('DOKU_MEDIAMANAGER',1); // needed to get proper CSS/JS
require_once(DOKU_INC.'inc/init.php');

starting from the code like

/config/dokuwiki/lib/plugins/<pluginName>/exe/plugincode.php

for example

/config/dokuwiki/lib/plugins/snippets/exe/snippets.php

would fail, because the builded path points to

/config/dokuwiki/lib/plugins/snippets/exe/../../../../inc/init.php

Steps to Reproduce

Environment

PI4
*CPU architecture:arm32 How docker service was installed:
with docker-compose up -d

cat docker-compose.yml

'version: "2" services: dokuwiki: image: linuxserver/dokuwiki container_name: dokuwiki environment:


## Docker logs
pi@raspi:~ $ docker logs dokuwiki
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing...
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing...

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

Brought to you by linuxserver.io
We gratefully accept donations at:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing...
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing...
generating self-signed keys in /config/keys, you can replace these with your own keys if required
Generating a RSA private key
..................................................................................+++++
.........................................................................................+++++
writing new private key to '/config/keys/cert.key'
-----
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 50-config: executing...
Go to http://IP-ADDRESS:PORT/install.php to configure your install then restart your container when finished to remove install.php
[cont-init.d] Setting permissions this may take some time
[cont-init.d] 50-config: exited 0.
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing...
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing...
usermod: no changes

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

Brought to you by linuxserver.io
We gratefully accept donations at:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing...
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing...
using keys found in /config/keys
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 50-config: executing...
Existing install found install.php not available
[cont-init.d] Setting permissions this may take some time
[cont-init.d] 50-config: exited 0.
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing...
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing...
usermod: no changes

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

Brought to you by linuxserver.io
We gratefully accept donations at:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing...
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing...
using keys found in /config/keys
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 50-config: executing...
rm: cannot remove '/app/dokuwiki/install.php': No such file or directory
[cont-init.d] Setting permissions this may take some time
[cont-init.d] 50-config: exited 0.
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
s6-svwait: fatal: supervisor died
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing...
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing...

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

Brought to you by linuxserver.io
We gratefully accept donations at:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------
usermod: no changes

User uid:    1000
User gid:    1000
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing...
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing...
using keys found in /config/keys
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 50-config: executing...
rm: cannot remove '/app/dokuwiki/install.php': No such file or directory
[cont-init.d] Setting permissions this may take some time
[cont-init.d] 50-config: exited 0.
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
pi@raspi:~ $
github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

avks commented 4 years ago

Similar problem with searchindex plugin. The plugin gave me a 500. Looking into nginx logs, I found that the error was because dokuwiki could not find init.php. But the plugin has the correct path: https://github.com/splitbrain/dokuwiki-plugin-searchindex/blob/32e56a59996ea3a10b3a70f0239fc13d58f1174b/ajax.php#L17 (I checked it works perfectly from a local php installation).

avks commented 4 years ago

I guess the inc(lude) directory is at the wrong place in the docker container, plugins with this code

This is definitely the case.

avks commented 4 years ago

I noticed that /config (which can be mounted on host system) doesn't contain inc dir, although it contains other dokuwiki dirs.

I went a little backwards and found that lsiobase-alpine on which this image is based doesn't contain anything about /config.

But lsiobase-nginx does expose /config as a volume. Now, this dokuwiki image extracts the dokuwiki tar file into /app. So inc should be inside /app/dokuwiki (which is true since I can verify it from inside the container). I am really missing something here as I can't identify how /app and /config are connected.

avks commented 4 years ago

Okay, I found it here.

So basically, the image is built by copying only certain directories to /config, and /inc remains inside /app. And then, creates symlinks. Could this problem be due to symlinking? Could just create symlinks (and not copy individual dirs)?

avks commented 4 years ago

Okay, spent sometime debugging the issue. Inside the container, I ran:

cd /config/dokuwiki && ln -sf /app/dokuwiki/inc inc

The plugin started working. Now, from inside my host volume, I see that only the symlink is mounted; no access to dokuwiki core files.

aptalca commented 4 years ago

Good find. It is strange that the plugin gets its absolute real path, rather than the symlinked path.