Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-83391

Remove hard-coded "support" for webservers

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 5.0
    • 5.0
    • Installation
    • MOODLE_500_STABLE
    • MOODLE_500_STABLE
    • MDL-83391-main
    • Hide

      Caddy

      (Assumption: Using a docker environment for dev/testing)

      1. Install a php-fpm container and configure it to serve your site
        1. Example Dockerfile: https://github.com/cwarwicker/quick-dev/blob/prime/.docker/images/php/Dockerfile
        2.  (Assumption: /var/www/site is mounted codebase)
      2. Install a caddy container and configure it to serve as your reverse proxy
        1. Docs: https://caddyserver.com/docs/
        2. Image: `caddy:latest`
        3. Example Caddyfile to mount: https://github.com/cwarwicker/quick-dev/blob/prime/.docker/caddy/moodle.caddy 
        4. Make sure the php_fastcgi is pointing to your valid php-fpm container name, e.g. `moodle-app`
      3. Setup docker-compose file to manage the containers
        1. Example:

      services:
        caddy:
              container_name: caddy
              image: caddy:latest
              restart: always
              ports:
                  - "80:80"
                  - "443:443"
              volumes:
                  - ./path/to/your/codebase/:/srv/www
                  - ./path/to/your/Caddyfile:/etc/caddy/Caddyfile
              networks:
                  - my-network
       
        app:
              container_name: moodle-app
              image: moodle
              build:
                  context: /path/to/my/php-fpm/Dockerfile
              volumes:
                  - ./path/to/your/codebase/:/var/www/site/
              networks:
                  - my-=network
              pull_policy: always    
        db:
              container_name: moodle-db
              stdin_open: true
              image: mariadb:11.2.4
              ports:
                  - 3336:3306
              command: >
                  --character-set-server=utf8mb4
                  --collation-server=utf8mb4_bin
                  --innodb_file_per_table=On
                  --wait-timeout=28800
              environment:
                  MYSQL_ROOT_PASSWORD: "password"
                  MYSQL_USER: user
                  MYSQL_PASSWORD: password
                  MYSQL_DATABASE: main
              networks:
                  - my-network

                4. Bring the containers up and install Moodle

       

      Pre-Patch:

      5. Access the site in the browser - You should see "Web server software (Caddy/v2.8.4) is not supported, sorry."

       

      Post-Patch:

      5. Access the site in the browser - Should work fine

       

       

      The same general idea should follow for other webservers as well, not just Caddy.

      Show
      Caddy (Assumption: Using a docker environment for dev/testing) Install a php-fpm container and configure it to serve your site Example Dockerfile: https://github.com/cwarwicker/quick-dev/blob/prime/.docker/images/php/Dockerfile  (Assumption: /var/www/site is mounted codebase) Install a caddy container and configure it to serve as your reverse proxy Docs: https://caddyserver.com/docs/ Image: `caddy:latest` Example Caddyfile to mount: https://github.com/cwarwicker/quick-dev/blob/prime/.docker/caddy/moodle.caddy   Make sure the php_fastcgi is pointing to your valid php-fpm container name, e.g. `moodle-app` Setup docker-compose file to manage the containers Example: services: caddy:         container_name: caddy         image: caddy:latest         restart: always         ports:             - "80:80"             - "443:443"         volumes:             - ./path/to/your/codebase/:/srv/www             - ./path/to/your/Caddyfile:/etc/caddy/Caddyfile         networks:             - my-network   app:         container_name: moodle-app         image: moodle         build:             context: /path/to/my/php-fpm/Dockerfile         volumes:             - ./path/to/your/codebase/:/var/www/site/         networks:             - my-=network         pull_policy: always    db:         container_name: moodle-db         stdin_open: true         image: mariadb: 11.2 . 4         ports:             - 3336 : 3306         command: >             --character-set-server=utf8mb4             --collation-server=utf8mb4_bin             --innodb_file_per_table=On             --wait-timeout= 28800         environment:             MYSQL_ROOT_PASSWORD: "password"             MYSQL_USER: user             MYSQL_PASSWORD: password             MYSQL_DATABASE: main         networks:             - my-network           4. Bring the containers up and install Moodle   Pre-Patch: 5. Access the site in the browser - You should see " Web server software (Caddy/v2.8.4) is not supported, sorry. "   Post-Patch: 5. Access the site in the browser - Should work fine   —   The same general idea should follow for other webservers as well, not just Caddy.
    • Hide

      Code verified against automated checks.

      Checked MDL-83391 using repository: https://github.com/cwarwicker/moodle/

      More information about this report

      Built on: Mon 21 Oct 2024 05:03:07 AM UTC

      Show
      Code verified against automated checks. Checked MDL-83391 using repository: https://github.com/cwarwicker/moodle/ main (0 errors / 0 warnings) [branch: MDL-83391-main | CI Job ] More information about this report Built on: Mon 21 Oct 2024 05:03:07 AM UTC
    • Show
      Launching automatic jobs for branch MDL-83391 -main https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/16981/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/57850/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/57851/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/57852/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/57853/ App tests (stable app version) Built on: Mon Oct 14 10:25:19 AM UTC 2024

      When using a webserver not in the hard-coded list in setuplib.php, we get a fatal error of:

      `Web server software (<name>) is not supported, sorry.`

      The list is hard-coded in 

      setuplib.php:setup_get_remote_url()

      which lists various web servers, with else if clauses, which are supported (and some which the comments say aren't, and yet they are supported in the code).

      It looks like this was some very old code decision years ago which never got changed.

       

      There is no need for all these else if clauses for various web server software, all to do the samr thing and just the REQUEST_URI. We can put all of that in a single `else` at the very least, and re-consider how much of this function we actually need, at all.

       

      Patches will be attached shortly.

            cwarwicker CMR
            cwarwicker CMR
            Brendan Heywood Brendan Heywood
            Andrew Lyons Andrew Lyons
            Andrew Lyons Andrew Lyons
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 1 hour, 59 minutes
                1d 1h 59m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.