erseco / alpine-moodle

Moodle docker image based on Alpine Linux
https://hub.docker.com/r/erseco/alpine-moodle
MIT License
42 stars 33 forks source link

exit status 127 on running cron.php #18

Closed jimsihk closed 2 years ago

jimsihk commented 2 years ago

I am trying the latest docker image on M1 Macbook with Docker Desktop and found that the cron is failed to run due to missing file:

Starting startup scripts in /docker-entrypoint-init.d ...
Linux b74b9970b55c 5.10.104-linuxkit #1 SMP PREEMPT Thu Mar 17 17:05:54 UTC 2022 aarch64 Linux
Waiting for : to be ready
 is ready
Upgrading moodle...
== Maintenance mode (http://localhost) ==
Your site is currently in CLI maintenance mode, no web access is allowed.
== Maintenance mode (http://localhost) ==
*** Running: /docker-entrypoint-init.d/01-uname.sh
*** Running: /docker-entrypoint-init.d/02-configure-moodle.sh
No upgrade needed for the installed version 4.0.2 (Build: 20220711) (2022041902). Thanks for coming anyway!

Maintenance mode has been disabled and the site is running normally again
Finished startup scripts in /docker-entrypoint-init.d
Starting runit...
Started runsvdir, PID is 18
wait for processes to start....
/usr/sbin/crond 4.5 dillon's cron daemon, started with loglevel notice
[09-Aug-2022 18:02:39] NOTICE: fpm is running, pid 23
[09-Aug-2022 18:02:39] NOTICE: ready to handle connections
run: cron: (pid 24) 5s
run: nginx: (pid 25) 5s
run: php: (pid 23) 5s
exit status 127 from user nobody /usr/bin/php  /var/www/html/admin/cli/cron.php > /dev/null

Checked in the /usr/bin folder, there is only php8 but no php which seems to be the root cause:

/usr/bin $ ls -l | grep php
-rwxr-xr-x    1 root     root       5302216 Nov 18  2021 php8
/usr/bin $ 

This is my docker-compose.yml FYR:

version: '2'
services:

  moodle:
    image: erseco/alpine-moodle
    build: .
    restart: unless-stopped
    environment:
      - LANG=en_US.UTF-8
      - LANGUAGE=en_US:en
      - SITE_URL=http://localhost
      - DB_TYPE=pgsql
      - DB_HOST=host.docker.internal
      - DB_PORT=55000
      - DB_NAME=moodle
      - DB_USER=<masked>
      - DB_PASS=<masked>
      - 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

volumes:
  moodledata: null
  moodlehtml: null
erseco commented 2 years ago

You are right, was a mistake on the php8 migration, should be fixed now

jimsihk commented 2 years ago

Thanks for the quick fix and it works!

Wondering would it be better for future maintenance if creating a soft link php to point to php8 in alpine-php-webserver? Then even for php upgrade in the future, there is no need to change the alpine-moodle project.

erseco commented 2 years ago

Yes, good idea, the new php8.1 binary is named php81 so it can be easier to maintain, I will change it in the next version, thanks!

jimsihk commented 2 years ago

I found that alpine 3.16 will by default create the soft link if installing php8 instead of php81, seems like upgrading would also be a good option.

/usr/bin $ ls -l | grep php
lrwxrwxrwx    1 root     root             4 Aug 11 12:13 php -> php8
-rwxr-xr-x    1 root     root       5302048 Aug  5 23:54 php8
/usr/bin $