CanastaWiki / Canasta

MediaWiki Docker image for Canasta, an all-in-one MediaWiki stack for easy deployment and management of enterprise-ready MediaWiki on production environments.
https://www.canasta.wiki
MIT License
36 stars 27 forks source link

The create-symlinks.sh script does not remove existing links in extensions folder #321

Closed pastakhov closed 1 month ago

pastakhov commented 10 months ago

How to reproduce: restart a web docker container without recreating one. You will see the error messages like:

Symlinking bundled extensions...
ln: failed to create symbolic link '/var/www/mediawiki/w/extensions/AJAXPoll/AJAXPoll': File exists
...

For each extension.

Most likely, it is the reason for #300

When you remove an extension from a folder mounted to the user-extensions folder and restart the container you expect that the symlink in the extension folder will be changed to use the Canasta bundled extension. However because the script does not delete existing symbolic links, the symlink to the removed extension from the user-extensions folder will not be replaced.

yaronkoren commented 10 months ago

@pastakhov - thank you for uncovering this problem. It seems to me that the problem is actually with the monitor-directories.sh script - no?

https://github.com/CanastaWiki/Canasta/blob/master/_sources/scripts/monitor-directories.sh

This is the script that is supposed to constantly check (via inotifywait) whether any directories get removed from user-extensions/ or user-skins/, and then remove the corresponding symlink from extensions/ or skins/ if so. Somehow this script is not working - would you agree?

pastakhov commented 10 months ago

I agree, the script is not working, but I didn't test/check the monitor-directories.sh script. I thought it was removed or disabled. It can be related to this issue (or be similar), but it is another one. This issue describes a mistake in the create-symlinks.sh script. In other words, the monitor-directories.sh does not affect this issue but can have similar mistake in the code (and yes, it does not work).

yaronkoren commented 10 months ago

That's true - the problem needs to be fixed in create-symlinks.sh. I still think fixing monitor-directories.sh (or maybe just getting it to always run) will fix this problem 99% of the time, but there will still be cases when a "bad" symlink is there when Canasta is started, and for that, create-symlinks.sh needs to take action.

yaronkoren commented 1 month ago

I believe this was fixed by PR #366 ... I'm closing this now.