Open jimsihk opened 1 year ago
Is possible that the problem is caused because we are using postgresql instead of mariadb, can you please check if with MariaDB it works?
Tried with mariadb, unfortunately, still the same error, below the docker-compose.yml
fyi:
version: '2'
services:
mariadb:
image: mariadb:latest
restart: unless-stopped
environment:
- MARIADB_RANDOM_ROOT_PASSWORD=yes
- MARIADB_PASSWORD=moodle
- MARIADB_USER=moodle
- MARIADB_DATABASE=moodle
volumes:
- mariadb:/var/lib/mariadb/data
moodle:
image: erseco/alpine-moodle:4.1.1
restart: unless-stopped
environment:
- LANG=en_US.UTF-8
- LANGUAGE=en_US:en
- SITE_URL=http://localhost
- DB_TYPE=mariadb
- DB_HOST=mariadb
- DB_PORT=3306
- DB_NAME=moodle
- DB_USER=moodle
- DB_PASS=moodle
- DB_PREFIX=mdl_
- SSLPROXY=false
- MOODLE_EMAIL=user@example.com
- MOODLE_LANGUAGE=en
- MOODLE_SITENAME=New-Site
- MOODLE_USERNAME=moodleuser
- MOODLE_PASSWORD=PLEASE_CHANGEME
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=587
- SMTP_USER=your_email@gmail.com
- SMTP_PASSWORD=your_password
- SMTP_PROTOCOL=tls
- MOODLE_MAIL_NOREPLY_ADDRESS=noreply@localhost
- MOODLE_MAIL_PREFIX=[moodle]
ports:
- 80:8080
volumes:
- moodledata:/var/www/moodledata
- moodlehtml:/var/www/html
depends_on:
- mariadb
volumes:
mariadb: null
moodledata: null
moodlehtml: null
I think is a moodle error and I am who opened MDL-77369. Please vote, watch or add comment there :smiley:
That is what I doubt actually. I did tried a 4.0 GCP Marketplace stack (not docker) and there is no issue, but the same version on docker faces the issue.
Also, not sure if help, I tried moosh 0.39 and it could create new roles normally from command line (might be a workaround for now?).
@lupa18 have you bypassed the issue?
@jimsihk I'm still waiting :-/
I tried to set PHP max_input_vars
to even higher at 100000 but seems not related.
I was checking if was problem with the PHP version (8.0) and the moodle version but seems is not related
I was debugging and seems the root problem can be in the https://github.com/moodle/moodle/blob/master/admin/roles/classes/define_role_table_basic.php
file or in the https://github.com/moodle/moodle/blob/master/admin/roles/define.php
but no idea on what is happening
By the way I setted up a new upstream version (4.1.2+) and PHP 8.1 but the problem persists, I will continue testing it, any news I will write here
Unfortunately, I tried with PHP8.1 and 4.1.2 still the same.
Please @jimsihk go to moodle issue tracker and comment my issue to see if can we move it.
Thanks!
Added a message to move this!
I managed to test the bitnami docker but it works, so it seems not really related to Moodle code itself?
Would that be related to Nginx that we are using but bitnami is using Apache?
version: '2'
services:
postgres:
image: postgres:alpine
restart: unless-stopped
environment:
- POSTGRES_PASSWORD=moodle
- POSTGRES_USER=moodle
- POSTGRES_DB=moodle
volumes:
- postgres:/var/lib/postgresql/data
moodle:
image: bitnami/moodle
restart: unless-stopped
environment:
- MOODLE_DATABASE_TYPE=pgsql
- MOODLE_DATABASE_HOST=postgres
- MOODLE_DATABASE_PORT_NUMBER=5432
- MOODLE_DATABASE_USER=moodle
- MOODLE_DATABASE_PASSWORD=moodle
- MOODLE_DATABASE_NAME=moodle
ports:
- 80:8080
volumes:
- moodledata:/var/www/moodledata
- moodlehtml:/var/www/html
depends_on:
- postgres
volumes:
postgres: null
moodledata: null
moodlehtml: null
As also mentioned in the Moodle tracker, the issue is caused by the incompatible version of iconv in Alpine (which seems to be a well-known problem) and that's why Bitnami's work because it is using Debian.
The line of code with problem: https://github.com/moodle/moodle/blob/1d863c338ac6ace8e6b945f0e2c49753acfdb837/lib/classes/text.php#L351
Error message: NOTICE: PHP message: PHP Warning: iconv(): Wrong encoding, conversion from "utf-8" to "ASCII//TRANSLIT//IGNORE" is not allowed in /var/www/html/lib/classes/text.php
One of the workaround could be replacing iconv with gnu-libiconv but need pointing to an older version as mentioned in https://github.com/docker-library/php/issues/240#issuecomment-876464325:
RUN apk add gnu-libiconv=1.15-r3 --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so
Another way could be exploring to switch the base image to php:fpm-alpine3.17 which built PHP using the gnu-libiconv as mentioned in https://github.com/docker-library/php/pull/1264
Hi Jim,
Thank you for the detailed research on this issue! It's great that you've identified the cause of the problem and provided potential workarounds. I agree that sticking with the Alpine version is preferable, and I appreciate your suggestion to use gnu-libiconv.
Regarding the version mentioned in the linked messages, it's true that they refer to gnu-libiconv-1.16-r0. However, as you've pointed out, the Alpine 3.17 repository has the 1.17-r0 version, which could potentially contain a fix for this issue. It's worth trying out the newer version and see if it resolves the problem.
I'll implement these changes and test if the updated configuration works as expected. If everything goes well, we should have a functional Alpine-based solution. I'll keep you updated on the progress.
Once again, thanks for your valuable input and suggestions!
Best regards,
I tried gnu-libiconv=1.15-r3 does work, but higher version seems missing something or just not match with PHP8+. Let's see if any other options.
Considering it is a Alpine related issue instead of just Moodle, I tried to apply a quick fix on the base image and tested working, see if any suggestion (May need to cherry pick the commit for PR).
Hi @jimsihk
Thanks for your contribution in resolving the gnu-libiconv
compatibility issue we experienced with Moodle. With the recent release of Alpine 3.19, I wanted to follow up and ask if you're aware of any updates regarding the gnu-libiconv
issue in this new version of Alpine. Your insights would be greatly appreciated as we continue to ensure smooth functionality.
Best regards.
Tried to search around, seems only PHP 8.3 has applied a fix on it. Not sure if the community agreed to apply to PHP 8.2 as well.
Reference: https://gitlab.alpinelinux.org/alpine/aports/-/issues/15114#note_362481
Thanks for the reference! Based on this, I've created a new php83
branch/tag, which has successfully passed the CI pipeline. I'm currently in the process of debugging to ensure everything is working seamlessly. If all goes well, this update will be ready to merge for the upcoming Moodle 4.3.2 release. Fingers crossed! 🤞
That would be good! But Moodle official support on PHP 8.3 would be on Moodle 4.4 onwards, shall we wait?
https://moodledev.io/general/development/policies/php#php-83
Thank you for pointing this out! Given that Moodle's official support for PHP 8.3 is slated to begin with Moodle 4.4, it does seem prudent to wait before implementing these changes. In light of this information, I will close the current issue and note in PR #58 that we should hold off until PHP 8.3 receives official support, hopefully in Moodle 4.4 as indicated.
This approach ensures our alignment with Moodle's official development and support policies, maintaining stability and compatibility for our users. I appreciate your input and look forward to adapting our environment in line with Moodle's future updates.
Thanks for your help!
I just had a try with Moodle 4.4rc1 with PHP 8.3, unfortunately the error still happened. I have read again the alpine issue thread and it seems I have overlooked and the commit is NOT yet merged to the main. Guess we still need to stick to the dirty fix for now.
Hi @jimsihk, thank you for bringing this to our attention! I will keep this issue open and monitor it until the release of Moodle 4.5. Please let us know if there are any updates or changes in the meantime. :)
Hi,
When defining new roles, it will always rejected by "Incorrect role short name". I tried using the docker-compose.yaml with moodle 4.0 version up to the latest are still facing the same problem.
For comparison, I tried picking the bitnami stack from GCP and it works without this issue. Do you think is related to NGINX and MariaDB? I don't have a chance yet to test the bitnami moodle container though.
I also notice that there is an issue logged on official tracker as MDL-77369 and the issue seems related to container only.
Any thought?