linuxserver / docker-dokuwiki

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

Search index only "updates" on page edit #27

Closed clockwinder closed 3 years ago

clockwinder commented 4 years ago

Behavior

Currently if I search for a page I know exists, there will be no search result. The only way to get a page to show up in searches is to edit that page. This info is also relevant to tags, tag indexs only update after page editing as well.

To reproduce

  1. Manually add a file to my "recipes" namespace folder called "taco.txt" containing the word "taco", or update the docker image to a new version
  2. Search for "taco" in dokuwiki yields no results, that makes sense
  3. Manually rebuild search index using the plugin and I can see it read taco.txt, which responds with "Finished indexing", if I navigate to data/index/ I can see updated timestamps on those files
  4. Search for "taco" in dokuwiki yields no results
  5. Edit taco.txt from the dokuwiki editing page, changing something and saving
  6. Search for "taco" and the search does yields results

Another option is to backup your server via the backup plugin, start a new docker instance, and restore your backup to this new instance, even after manual indexing, there will be no search results.

I have tested this in other images by restoring my full wiki backup to dokuwiki-on-a-stick as well as 2 other dokuwiki docker images, and the behavior there has proper search indexing.

Environment

OS:Debian (OMV) CPU architecture: x86_64 How docker service was installed: official docker repo

Command used to create docker container (run/create/compose/screenshot)

NgzMZyr0Vd mhK1egLDbp

Docker logs

Docker Log

:~# docker logs -f dokuwikirecipes
[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

To support LSIO projects visit:
https://www.linuxserver.io/donate/
GID/UID

User uid:    1010
User gid:    100

[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.

Recent error log entries look like 2020/10/03 16:06:18 [error] 352#352: *1108 FastCGI sent in stderr: "PHP message: PHP Warning: DOMDocument not found, unable to use sanitizer in /app/dokuwiki/vendor/simplepie/simplepie/library/SimplePie/Sanitize.php on line 271PHP message: PHP Warning: DOMDocument not found, unable to use sanitizer in /app/dokuwiki/vendor/simplepie/simplepie/library/SimplePie/Sanitize.php on line 271" while reading upstream, client: 172.17.0.3, server: _, request: "GET /doku.php?id=wiki:syntax HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "wiki.myserver.org:443", referrer: "https://wiki.myserver.org/"

Recent debug log entries look like: 12:29:35 172.17.0.3: require_once() is deprecated. It was called from require() in /app/dokuwiki/inc/load.php:147 Autoloading. Do not require() files yourself. should be used instead! 12:29:35 172.17.0.3: INFO_DEPRECATION_LOG:AFTER event triggered before event system was initialized

github-actions[bot] commented 4 years ago

Thanks for opening your first issue here! Be sure to follow the issue template!

clockwinder commented 4 years ago

To add more info, I started a new instance of linuxserver/dokuwiki following the instructions laid out in the "Application Setup" portion on the hub.docker page. At which point the wiki appears to be functional. Then I go to test the indexing, by installing the "SearchIndex Manager" plugin which gives me a result that looks like this: q38puDfNyD

So if we navigate to /mycontainer/dokuwiki/data we only see explorer_opRv63XZBv

Where I would expect to see more directories, including cache, index, and locks.

aptalca commented 4 years ago

Those are just symlinked folders. The real data folder is inside the container at /app/dokuwiki/data, which should contain the cache folder https://github.com/linuxserver/docker-dokuwiki/blob/master/root/etc/cont-init.d/50-config#L3-L32

clockwinder commented 4 years ago

@aptalca Is /mycontainer/dokuwiki/data different than /app/dokuwiki/data?

The link you posted does note creation of a cache folder, or is that elsewhere?

aptalca commented 4 years ago

The linked code doesn't create the folders, it only symlinks them to the config folder for persistence. The cache folder should be created by dokuwiki or the plugin in the main app folder

grillbaer commented 3 years ago

I'm also having problems with incomplete searches (and connected to this, failing page renaming with the 'Move' plug-in and 'Searchindex Manager' failing to rebuild the search index).

I think that the search index stored in /app/dokuwiki/data/index is currently not persistent because it is only a container-local directory. It should be in the USER_DIRECTORY list of the script to create a symlink to /config/dokuwiki/data/index. The index must be preserved across container creations.

See DokuWiki Directory Layout.

github-actions[bot] commented 3 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.

clockwinder commented 3 years ago

Thanks for making some notes on this issue @grillbaer . Sadly it's been over two months and there hasn't been any response, and I'm not knowledgeable enough to make any progress on fixing this problem.

Do you have any ideas on how we could resolve this issue?

Norrodar commented 3 years ago

I've the same issue. Just stopping the container and restart it (Synology Docker) causes the index to loose all its data. My workaround is to create an additional volume to the index folder: -v /path/to/index_workaround:/app/dokuwiki/data/index

jardleex commented 3 years ago

Hi @coldshouldermedia thanks for sharing this. I also just stumbled over this issue. I initially created the folders cache, lock, index, and tmp below /config/dokuwiki/data/ in order to make the Searchindex Manager plugin happy. Sadly this did not fix the search as I assume dokuwiki inside the container uses /app/dokuwiki/data/index/ which is not updated by the plugin.

@Norrodar how do you update your index? Untl this is fixed in the image, wouldn't a symlink from /config/dokuwiki/data/index/ to /app/dokuwiki/data/index/ (and the other folders named) be the way to fix the search function AND the Searchindex Manager?

Norrodar commented 3 years ago

Yep, I created that link like I discribed 2 posts up. Than it just worked for me. But I'm sorry: I was looking for a good container-solutions because I started docker as a completly new project. I found a well maintained and working container from crazymax. His FirefoxSyncServer is another container I'm using from crazymax. So overall.. I'm staying away from lsio/dokuwiki for now.

bh1428 commented 3 years ago

There are two issues here (as mentioned by the other contributors):

  1. Search index gets broken: the search index (directory 'data/index') is created inside the container. If the container is upgraded the index is destroyed and search will be broken.
  2. "SearchIndex Manager" does not work: Dokuwiki (and the plugins) use the 'savedir' configuration setting for checking paths (in 'inc/init.php'). The default for 'savedir' is a relative path ('./data') which leads to problems when you install plugins in a linked path (as we do).

Issue 1 can be fixed by storing the search index in persistent storage. Issue 2 by replacing the relative 'savedir' path with an absolute path.

I will create a pull request for both issues.

bh1428 commented 3 years ago

Please note (after/if the PR is merged and a new version is released): the fix for Searchindex Manager only works when you have not modified the savedir setting manually (Admin -> Configuration Manager -> Basic -> Directory for saving data). In that case: ./data (the default) will be changed to /app/dokuwiki/data (absolute path for the default directory).

If you have changed savedir manually you have to figure out what the new setting has to be (the fix will not overwrite your change).

salvari commented 3 years ago

Hmm. I've got the same problem with a new install. It seems that /app/dokuwiki/data/index is not persistent because it's not symlinked to /config

This commands have been executed in a fresh install with no configuration at all:

docker exec -it dokuwiki bash

root@8a9f38f628db:/root# ls -lha /app/dokuwiki/data/
total 104K
drwxrwxr-x 1 abc users 4.0K Mar 28 11:47 .
drwxr-xr-x 1 abc users 4.0K Mar 28 11:47 ..
-rw-rw-r-- 1 abc users  143 Jul 29  2020 .htaccess
-rw-rw-r-- 1 abc users   32 Jul 29  2020 _dummy
lrwxrwxrwx 1 abc users   27 Mar 28 11:47 attic -> /config/dokuwiki/data/attic
drwxrwxr-x 1 abc users 4.0K Jul 29  2020 cache
-rw-rw-r-- 1 abc users  25K Jul 29  2020 deleted.files
-rw-rw-r-- 1 abc users 6.4K Jul 29  2020 dont-panic-if-you-see-this-in-your-logs-it-means-your-directory-permissions-are-correct.png
-rw-rw-r-- 1 abc users  12K Jul 29  2020 dont-panic-if-you-see-this-in-your-logs-it-means-your-directory-permissions-are-correct.xcf
drwxrwxr-x 1 abc users 4.0K Jul 29  2020 index
drwxrwxr-x 1 abc users 4.0K Jul 29  2020 locks
lrwxrwxrwx 1 abc users   27 Mar 28 11:47 media -> /config/dokuwiki/data/media
lrwxrwxrwx 1 abc users   33 Mar 28 11:47 media_attic -> /config/dokuwiki/data/media_attic
lrwxrwxrwx 1 abc users   32 Mar 28 11:47 media_meta -> /config/dokuwiki/data/media_meta
lrwxrwxrwx 1 abc users   26 Mar 28 11:47 meta -> /config/dokuwiki/data/meta
lrwxrwxrwx 1 abc users   27 Mar 28 11:47 pages -> /config/dokuwiki/data/pages
drwxrwxr-x 1 abc users 4.0K Jul 29  2020 tmp

You can move index directory to /config/dokuwiki/data and then symlink it:

mv /app/dokuwiki/data/index /config/dokuwiki/data
ln -s /config/dokuwiki/data/index /app/dokuwiki/data/index

This will solve the search problems, but every time you rebuild the container you'll have to REMOVE the empty index rmdir /app/config/data/index and then symlink again the persisted one: ln -s /config/dokuwiki/data/index /app/dokuwiki/data/index