bitnami / containers

Bitnami container images
https://bitnami.com
Other
3.47k stars 4.93k forks source link

[bitnami/moodle] Async emails sent out with http://127.0.0.1:8080 instead of FQDN #54710

Closed rroblik closed 9 months ago

rroblik commented 10 months ago

Name and Version

bitnami/moodle:4.2

What architecture are you using?

None

What steps will reproduce the bug?

  1. Configure and enable email notification for feedback
  2. As Teacher, let feedback to student
  3. Check the received email code

What is the expected behavior?

See https://mysite.com/* links

What do you see instead?

See http://127.0.0.1:8080/* links

Additional information

Seems that async email (sended out using moodle cron / task, others are good) are not able to "discover automatically" the current FQDN.

Here is a $event_data dump value for such type of email (from native moodle/message/output/email/message_output_email.php::send_message()) ; (in 🇫🇷 ) we can see the wrong FQDN

localhost - 2024-01-11 08:25:02 - 3 - stdClass Object
(
    [courseid] => 5
    [modulename] => assign
    [component] => mod_assign
    [name] => assign_notification
    [userfrom] => stdClass Object
        (
            [id] => 2
            [auth] => manual
            [confirmed] => 1
            [policyagreed] => 0
            [deleted] => 0
            [suspended] => 0
            [mnethostid] => 1
            [username] => xxx
            [password] => xxx
            [idnumber] => 
            [firstname] => xxx
            [lastname] => xxx
            [email] => xxx@xxx.fr
            [emailstop] => 0
            [phone1] => 
            [phone2] => 
            [institution] => 
            [department] => 
            [address] => 
            [city] => xxx
            [country] => xx
            [lang] => fr
            [calendartype] => gregorian
            [theme] => 
            [timezone] => 99
            [firstaccess] => 1670529954
            [lastaccess] => 1704961439
            [lastlogin] => 1704882618
            [currentlogin] => 1704960239
            [lastip] => 192.168.48.4
            [secret] => 
            [picture] => 0
            [description] => 
            [descriptionformat] => 1
            [mailformat] => 1
            [maildigest] => 0
            [maildisplay] => 1
            [autosubscribe] => 1
            [trackforums] => 0
            [timecreated] => 0
            [timemodified] => 1677788985
            [trustbitmask] => 0
            [imagealt] => 
            [lastnamephonetic] => 
            [firstnamephonetic] => 
            [middlename] => 
            [alternatename] => 
            [moodlenetprofile] => 
        )

    [convid] => 
    [conversationtype] => 
    [userto] => stdClass Object
        (
            [id] => 7
            [auth] => oauth2
            [confirmed] => 1
            [policyagreed] => 0
            [deleted] => 0
            [suspended] => 0
            [mnethostid] => 1
            [username] => xxx
            [idnumber] => 
            [firstname] => Roger
            [lastname] => xxx
            [email] => test@example.com
            [emailstop] => 0
            [phone1] => 
            [phone2] => 
            [institution] => xxx
            [department] => 
            [address] => 
            [city] => 
            [country] => 
            [lang] => fr
            [calendartype] => gregorian
            [theme] => 
            [timezone] => 99
            [firstaccess] => 1703949236
            [lastaccess] => 1704961195
            [lastlogin] => 1704836476
            [currentlogin] => 1704960377
            [lastip] => 192.168.48.4
            [secret] => 
            [picture] => 0
            [descriptionformat] => 1
            [mailformat] => 1
            [maildigest] => 0
            [maildisplay] => 0
            [autosubscribe] => 1
            [trackforums] => 0
            [timecreated] => 1703585839
            [timemodified] => 1704960377
            [trustbitmask] => 0
            [imagealt] => 
            [lastnamephonetic] => 
            [firstnamephonetic] => 
            [middlename] => 
            [alternatename] => 
            [moodlenetprofile] => 
            [sesskey] => 9ka4lLAUtE
            [access] => Array
                (
                    [ra] => Array
                        (
                            [/1] => Array
                                (
                                    [7] => 7
                                    [10] => 10
                                )

                            [/1/2] => Array
                                (
                                    [8] => 8
                                )

                            [/1/166/22/24/25] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/24/27] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/24/28] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/24/29] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/34/35] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/34/36] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/39/40] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/42/43] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/42/44] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/45/46] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/45/47] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/45/48] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/49/50] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166/22/49/51] => Array
                                (
                                    [5] => 5
                                )

                            [/1/166] => Array
                                (
                                    [10] => 10
                                )

                            [/1/166/21/252] => Array
                                (
                                    [5] => 5
                                )

                        )

                    [time] => 1704961502
                    [rsw] => Array
                        (
                        )

                )

            [enrol] => Array
                (
                    [enrolled] => Array
                        (
                        )

                    [tempguest] => Array
                        (
                        )

                )

            [preference] => Array
                (
                    [auth_forcepasswordchange] => 0
                    [block_myoverview_user_paging_preference] => 0
                    [block_myoverview_user_sort_preference] => lastaccessed
                    [block_myoverview_user_view_preference] => card
                    [core_message_migrate_data] => 1
                    [core_user_welcome] => 1703949236
                    [drawer-open-block] => 1
                    [drawer-open-index] => 1
                    [email_bounce_count] => 0
                    [email_send_count] => 24
                    [filepicker_recentlicense] => allrightsreserved
                    [filepicker_recentrepository] => 5
                    [login_failed_count_since_success] => 0
                    [tool_usertours_tour_completion_time_1] => 1704400333
                    [tool_usertours_tour_completion_time_4] => 1703949242
                    [tool_usertours_tour_completion_time_5] => 1703949250
                    [_lastloaded] => 1704961502
                )

        )

    [subject] => xxx a donné un feedback pour le devoir Dépose ici ton challenge 3 complété
    [fullmessage] => S3 -> Devoir -> Dépose ici ton challenge 3 complété
---------------------------------------------------------------------
XXX a donné un feedback pour le travail remis pour « Dépose ici ton challenge 3 complété ».

Vous pouvez le consulter en annexe à votre travail : http://127.0.0.1:8080/mod/assign/view.php?id=397

---------------------------------------------------------------------

    [fullmessageformat] => 2
    [fullmessagehtml] => <p><font face="sans-serif"><a href="http://127.0.0.1:8080/course/view.php?id=5">S3</a> -><a href="http://127.0.0.1:8080/mod/assign/index.php?id=5">Devoir</a> -><a href="http://127.0.0.1:8080/mod/assign/view.php?id=397">Dépose ici ton challenge 3 complété</a></font></p><hr /><font face="sans-serif"><p>XXX a donné un feedback pour le travail remis pour « <em>Dépose ici ton challenge 3 complété</em> ».<br /><br />Vous pouvez le consulter en annexe à <a href="http://127.0.0.1:8080/mod/assign/view.php?id=397">votre travail</a>.</p></font><hr />
    [smallmessage] => XXX a donné un feedback pour le devoir Dépose ici ton challenge 3 complété
    [notification] => 1
    [contexturl] => http://127.0.0.1:8080/mod/assign/view.php?id=397
    [contexturlname] => Dépose ici ton challenge 3 complété
    [replyto] => 
    [replytoname] => 
    [savedmessageid] => 181
    [attachment] => 
    [attachname] => 
    [timecreated] => 
    [fullmessagetrust] => 
    [customdata] => {"cmid":"397","instance":"37","messagetype":"feedbackavailable","blindmarking":false,"uniqueidforuser":0,"notificationiconurl":"http:\/\/127.0.0.1:8080\/theme\/image.php\/boost\/core\/1704836738\/u\/f1","courseid":"5"}
    [anonymous] => 

See also : https://moodle.org/mod/forum/discuss.php?d=395414#p1685200

Workaround is to edit config.php file with hardcoded value but.... !

Thanks

andresbono commented 10 months ago

Hi @rroblik, can you explain how are you running the bitnami/moodle container and what environment variables are you using to configure it? Thanks! Please check:

andreagiuseppecolombo commented 10 months ago

Hi @andresbono, I have the same issue. my docker-compose.yml contains: environment:

As mentioned before, async email (sended out using moodle cron / task) contains a wrong URL , others are good. Use Case - OK user creation done manully. Email is sent using the correct URL when I'm using {$a->link} ----> ttps://mylmsname.mydomain.ch Use Case - NOK user creation done with CSV import. Email is sent using the wrong URL when I'm using {$a->link} -----> http://127.0.0.1:8080/login/?lang=it

andresbono commented 10 months ago

Hi @andreagiuseppecolombo, can you confirm that you experience the issue only with cron / task?

I'm asking because in your "NOK" use case, you are describing that the url is wrong when importing users via CSV. Does the CSV import method implies using cron and that is way you observe the issue in that way?

github-actions[bot] commented 9 months ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 9 months ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

rgr commented 3 months ago

I have exactly the same problem using the image on a kubernetes environment. @rroblik, did you find a way to modify the helm chart or something to pass the value to the config.php ?