Closed mtompkins closed 1 year ago
Hi,
It is happy to know someone found it useful!
For persistent storage, due to the nature of nobody
, we will need to change the owners of all the files of that existing storage to nobody
, e.g. chown -R nobody:nobody /var/www/moodledata
. For directories and files created by this image, it could be used properly.
But beware that the /bitnami/moodle
may contains the moodle code which are not required to be mounted for this image.
Another workaround is to perform a file migration instead of mounting the existing disk to the container, this is actually what I used and found even easier if additional storage is allowed. For example,
/var/www/moodledata
In this way, the moodledata directories and files are all created under nobody
FYI if you are using k8s, this is what I added as an initContainer when mounting volumes managed externally like longhorn or openebs:
initContainers:
- name: set-folder-permission
image: alpine
command: ["chown"]
args: ["nobody:nobody", "/var/www/moodledata"]
volumeMounts:
- mountPath: /var/www/moodledata
name: moodle-data
subPath: moodledata
Thank you for taking the time to respond. Also thank you for the migration suggestion. Unfortunately the Bitnami container is no longer functional (and one of the reasons I've looked for an alternative). I'm hoping they will resolve the PHP issue I have posted to their repo.
What you have provided generally, however, does not work in my testing with docker compose
. Specifically, if you take your image and try to create persistent storage the container will fail to launch. To confirm please disregard any context I provided about migration and just try a standard persistent volume mount with nobody
as I indicated earlier. You should be able to see it will not launch.
Essentially I had the same expectation as you have described, that paths with proper nobody
ownership would suffice. It does not.
It is super interesting the k8s
manages to work as expected.
Below is a simplified docker-compose
that can be used to replicate what I am referencing:
Note the data
folder is owned by nobody:nobody
[root@dpw1 test]# ls -lha
total 4.0K
drwxr-xr-x 1 root root 44 May 24 19:58 .
drwx------ 1 root root 414 May 24 19:40 ..
drwxr-xr-x 1 nobody nobody 40 May 24 19:55 data
-rw-r--r-- 1 root root 1.3K May 24 19:58 docker-compose.yml
[root@dpw1 test]# id nobody
uid=65534(nobody) gid=65534(nobody) groups=65534(nobody)
docker-compose.yml
version: '3'
services:
postgres-moodle:
container_name: postres-moodle
image: postgres:alpine
restart: unless-stopped
environment:
- POSTGRES_PASSWORD=moodle
- POSTGRES_USER=moodle
- POSTGRES_DB=moodle
volumes:
- postgres:/var/lib/postgresql/data
moodle:
container_name: "moodle"
image: jimsihk/alpine-moodle
# command: tail -F anything
restart: "unless-stopped"
security_opt:
- no-new-privileges:true
ports:
- 80:8080
depends_on:
- postgres-moodle
volumes:
- ./data/moodledata:/var/www/moodledata
- ./data/moodlehtml:/var/www/html
environment:
- LANG=en_US.UTF-8
- LANGUAGE=en_US:en
- SITE_URL=http://localhost
- DB_TYPE=pgsql
- DB_HOST=postgres-moodle
- DB_PORT=5432
- DB_NAME=moodle
- DB_USER=moodle
- DB_PASS=moodle
- SSLPROXY=false
- MOODLE_EMAIL=user@example.com
- MOODLE_LANGUAGE=en
- MOODLE_SITENAME=Moodle
- MOODLE_USERNAME=moodleuser
- MOODLE_PASSWORD=randomPassword
- MOODLE_MAIL_NOREPLY_ADDRESS=noreply@localhost
- MOODLE_MAIL_PREFIX=[moodle]
- AUTO_UPDATE_MOODLE=true
volumes:
postgres: null
Which produces the following failure as indicated:
postres-moodle | 2023-05-24 23:57:03.005 UTC [24] LOG: database system was shut down at 2023-05-24 23:56:29 UTC
postres-moodle | 2023-05-24 23:57:03.007 UTC [1] LOG: database system is ready to accept connections
moodle | Starting startup scripts in /docker-entrypoint-init.d ...
moodle | *** Running: /docker-entrypoint-init.d/01-uname.sh
moodle | Linux 05ef646fe511 6.1.29-1-lts #1 SMP PREEMPT_DYNAMIC Wed, 17 May 2023 11:35:20 +0000 x86_64 Linux
moodle | *** Running: /docker-entrypoint-init.d/02-configure-moodle.sh
moodle | Waiting for postgres-moodle:5432 to be ready
moodle | postgres-moodle is ready
moodle | Generating config.php file...
moodle | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
moodle | Could not open input file: /var/www/html/admin/cli/install.php
moodle | *** Failed with return value: 0
moodle | Finished startup scripts in /docker-entrypoint-init.d
moodle | Starting runit...
moodle | Started runsvdir, PID is 14
moodle | wait for processes to start....
moodle | /usr/sbin/crond 4.5 dillon's cron daemon, started with loglevel notice
moodle | [24-May-2023 23:57:06] NOTICE: fpm is running, pid 20
moodle | [24-May-2023 23:57:06] NOTICE: ready to handle connections
moodle | run: cron: (pid 19) 5s
moodle | run: nginx: (pid 18) 5s
moodle | run: php: (pid 20) 5s
moodle | initgroups failed: nobody Operation not permitted
moodle | unable to ChangeUser (user nobody /usr/bin/php /var/www/html/admin/cli/cron.php > /dev/null)
moodle | exit status 1 from user nobody /usr/bin/php /var/www/html/admin/cli/cron.php > /dev/null
I may have found a cause. If I look inside your container:
54a45f27263f:/var$ ls -lha
total 4K
drwxr-xr-x 1 nobody nobody 6 May 21 21:12 .
drwxr-xr-x 1 root root 24 May 25 00:22 ..
drwxr-xr-x 1 root root 14 May 9 18:39 cache
dr-xr-xr-x 1 root root 0 May 9 18:39 empty
drwxr-xr-x 1 root root 0 May 21 21:12 git
drwxr-xr-x 1 root root 10 May 20 17:10 lib
drwxr-xr-x 1 root root 0 May 9 18:39 local
drwxr-xr-x 1 root root 12 May 9 18:39 lock
drwxr-xr-x 1 root root 10 May 20 17:10 log
drwxr-xr-x 1 root root 0 May 9 18:39 mail
drwxr-xr-x 1 root root 0 May 9 18:39 opt
lrwxrwxrwx 1 root root 4 May 9 18:39 run -> /run
drwxr-xr-x 1 root root 8 May 9 18:39 spool
drwxrwxrwt 1 root root 0 May 9 18:39 tmp
drwxr-xr-x 1 nobody nobody 8 May 21 21:11 www
54a45f27263f:/var$ cd www
54a45f27263f:/var/www$ ls -lha
total 0
drwxr-xr-x 1 nobody nobody 8 May 21 21:11 .
drwxr-xr-x 1 nobody nobody 6 May 21 21:12 ..
drwxr-xr-x 1 root root 0 May 25 00:19 html
drwxr-xr-x 1 root root 12 May 20 17:10 localhost
drwxr-xr-x 1 root root 0 May 25 00:19 moodledata
54a45f27263f:/var/www$
It looks like permissions on the two key directories html
and moodledata
are root
and not nobody
owned?
Update: I chown
those two folders and there is no improvement.
I will give a try later on Docker Desktop. So far I remember it is working if create from scratch.
May I suggest to try not mount /var/www/html? The image will check a file inside to determine if database has been installed before (this is slightly different from the bitnami version). The log showing it is complaining about unable to locate that file:
Could not open input file: /var/www/html/admin/cli/install.php
A quick try with the docker-compose.yaml, the first launch from scratch is working and then I tried to launch again with the container removed while keeping the volumns, it could still startup on Docker Desktop.
The folder permissions are indeed nobody
....
FYI Logs below:
First launch:
% docker compose up
[+] Running 9/9
⠿ moodle Pulled 27.9s
⠿ 08409d417260 Already exists 0.0s
⠿ e5963ed11111 Pull complete 5.4s
⠿ 711d6c6a6437 Pull complete 5.4s
⠿ 1d669d71b85e Pull complete 5.5s
⠿ 4f4fb700ef54 Pull complete 5.5s
⠿ 08ecd1af9675 Pull complete 5.9s
⠿ d229c178bad4 Pull complete 6.9s
⠿ e25cce5cecbc Pull complete 22.1s
[+] Running 6/6
⠿ Network alpine-moodle_default Created 0.1s
⠿ Volume "alpine-moodle_moodledata" Created 0.0s
⠿ Volume "alpine-moodle_moodlehtml" Created 0.0s
⠿ Volume "alpine-moodle_postgres" Created 0.0s
⠿ Container alpine-moodle-postgres-1 Created 0.6s
⠿ Container alpine-moodle-moodle-1 Created 3.8s
Attaching to alpine-moodle-moodle-1, alpine-moodle-postgres-1
alpine-moodle-postgres-1 | The files belonging to this database system will be owned by user "postgres".
alpine-moodle-postgres-1 | This user must also own the server process.
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | The database cluster will be initialized with locale "en_US.utf8".
alpine-moodle-postgres-1 | The default database encoding has accordingly been set to "UTF8".
alpine-moodle-postgres-1 | The default text search configuration will be set to "english".
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | Data page checksums are disabled.
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
alpine-moodle-postgres-1 | creating subdirectories ... ok
alpine-moodle-postgres-1 | selecting dynamic shared memory implementation ... posix
alpine-moodle-postgres-1 | selecting default max_connections ... 100
alpine-moodle-postgres-1 | selecting default shared_buffers ... 128MB
alpine-moodle-postgres-1 | selecting default time zone ... UTC
alpine-moodle-postgres-1 | creating configuration files ... ok
alpine-moodle-postgres-1 | running bootstrap script ... ok
alpine-moodle-moodle-1 | Starting startup scripts in /docker-entrypoint-init.d ...
alpine-moodle-moodle-1 | *** Running: /docker-entrypoint-init.d/01-uname.sh
alpine-moodle-moodle-1 | Linux bda1ce52af0a 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 Linux
alpine-moodle-moodle-1 | *** Running: /docker-entrypoint-init.d/02-configure-moodle.sh
alpine-moodle-moodle-1 | Waiting for postgres:5432 to be ready
alpine-moodle-postgres-1 | sh: locale: not found
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.197 UTC [30] WARNING: no usable system locales were found
alpine-moodle-postgres-1 | performing post-bootstrap initialization ... ok
alpine-moodle-postgres-1 | initdb: warning: enabling "trust" authentication for local connections
alpine-moodle-postgres-1 | initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
alpine-moodle-postgres-1 | syncing data to disk ... ok
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | Success. You can now start the database server using:
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | waiting for server to start....2023-05-25 01:46:39.597 UTC [36] LOG: starting PostgreSQL 15.3 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924, 64-bit
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.598 UTC [36] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.601 UTC [39] LOG: database system was shut down at 2023-05-25 01:46:39 UTC
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.605 UTC [36] LOG: database system is ready to accept connections
alpine-moodle-postgres-1 | done
alpine-moodle-postgres-1 | server started
alpine-moodle-postgres-1 | CREATE DATABASE
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | waiting for server to shut down....2023-05-25 01:46:39.747 UTC [36] LOG: received fast shutdown request
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.748 UTC [36] LOG: aborting any active transactions
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.751 UTC [36] LOG: background worker "logical replication launcher" (PID 42) exited with exit code 1
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.752 UTC [37] LOG: shutting down
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.753 UTC [37] LOG: checkpoint starting: shutdown immediate
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.783 UTC [37] LOG: checkpoint complete: wrote 918 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.015 s, sync=0.013 s, total=0.031 s; sync files=250, longest=0.004 s, average=0.001 s; distance=4222 kB, estimate=4222 kB
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.792 UTC [36] LOG: database system is shut down
alpine-moodle-postgres-1 | done
alpine-moodle-postgres-1 | server stopped
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | PostgreSQL init process complete; ready for start up.
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.872 UTC [1] LOG: starting PostgreSQL 15.3 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924, 64-bit
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.873 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.873 UTC [1] LOG: listening on IPv6 address "::", port 5432
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.875 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.879 UTC [52] LOG: database system was shut down at 2023-05-25 01:46:39 UTC
alpine-moodle-postgres-1 | 2023-05-25 01:46:39.882 UTC [1] LOG: database system is ready to accept connections
alpine-moodle-moodle-1 | .postgres is ready
alpine-moodle-moodle-1 | Generating config.php file...
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | .-..-.
alpine-moodle-moodle-1 | _____ | || |
alpine-moodle-moodle-1 | /____/-.---_ .---. .---. .-.| || | .---.
alpine-moodle-moodle-1 | | | _ _ |/ _ \/ _ \/ _ || |/ __ \
alpine-moodle-moodle-1 | * | | | | | || |_| || |_| || |_| || || |___/
alpine-moodle-moodle-1 | |_| |_| |_|\_____/\_____/\_____||_|\_____)
alpine-moodle-moodle-1 |
alpine-moodle-moodle-1 | Moodle 4.2+ (Build: 20230519) command line installation program
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.399 UTC [58] ERROR: relation "mdl_config" does not exist at character 19
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.399 UTC [58] STATEMENT: SELECT value FROM mdl_config WHERE name = $1
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.401 UTC [58] ERROR: relation "mdl_context" does not exist at character 15
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.401 UTC [58] STATEMENT: SELECT * FROM mdl_context WHERE contextlevel = $1
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.402 UTC [58] ERROR: relation "mdl_context" does not exist at character 24
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.402 UTC [58] STATEMENT: SELECT COUNT('x') FROM mdl_context
alpine-moodle-moodle-1 | Skipping database installation.
alpine-moodle-moodle-1 | Installation completed successfully.
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.669 UTC [59] ERROR: relation "mdl_config" does not exist at character 19
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.669 UTC [59] STATEMENT: SELECT value FROM mdl_config WHERE name = $1
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.672 UTC [59] ERROR: relation "mdl_context" does not exist at character 15
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.672 UTC [59] STATEMENT: SELECT * FROM mdl_context WHERE contextlevel = $1
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.672 UTC [59] ERROR: relation "mdl_context" does not exist at character 24
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.672 UTC [59] STATEMENT: SELECT COUNT('x') FROM mdl_context
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.673 UTC [59] ERROR: relation "mdl_course" does not exist at character 15
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.673 UTC [59] STATEMENT: SELECT * FROM mdl_course WHERE category = $1
alpine-moodle-moodle-1 | Installing database...
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.787 UTC [60] ERROR: relation "mdl_config" does not exist at character 19
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.787 UTC [60] STATEMENT: SELECT value FROM mdl_config WHERE name = $1
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.789 UTC [60] ERROR: relation "mdl_context" does not exist at character 15
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.789 UTC [60] STATEMENT: SELECT * FROM mdl_context WHERE contextlevel = $1
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.790 UTC [60] ERROR: relation "mdl_context" does not exist at character 24
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.790 UTC [60] STATEMENT: SELECT COUNT('x') FROM mdl_context
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.791 UTC [60] ERROR: relation "mdl_course" does not exist at character 15
alpine-moodle-postgres-1 | 2023-05-25 01:46:43.791 UTC [60] STATEMENT: SELECT * FROM mdl_course WHERE category = $1
alpine-moodle-moodle-1 | -------------------------------------------------------------------------------
alpine-moodle-moodle-1 | == Setting up database ==
alpine-moodle-moodle-1 | -->System
.........(skipped)
alpine-moodle-moodle-1 | Installation completed successfully.
alpine-moodle-moodle-1 | Configuring settings...
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | Using default file session store
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | Skipped auto update of Moodle
alpine-moodle-moodle-1 | Finished startup scripts in /docker-entrypoint-init.d
alpine-moodle-moodle-1 | Starting runit...
alpine-moodle-moodle-1 | Started runsvdir, PID is 35
alpine-moodle-moodle-1 | wait for processes to start....
alpine-moodle-moodle-1 | /usr/sbin/crond 4.5 dillon's cron daemon, started with loglevel notice
alpine-moodle-moodle-1 | [25-May-2023 01:47:20] NOTICE: fpm is running, pid 40
alpine-moodle-moodle-1 | [25-May-2023 01:47:20] NOTICE: ready to handle connections
alpine-moodle-moodle-1 | run: cron: (pid 39) 5s
alpine-moodle-moodle-1 | run: nginx: (pid 41) 5s
alpine-moodle-moodle-1 | run: php: (pid 40) 5s
Relaunch:
% docker compose up
[+] Running 3/3
⠿ Network alpine-moodle_default Created 0.1s
⠿ Container alpine-moodle-postgres-1 Created 0.1s
⠿ Container alpine-moodle-moodle-1 Created 0.1s
Attaching to alpine-moodle-moodle-1, alpine-moodle-postgres-1
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
alpine-moodle-postgres-1 |
alpine-moodle-postgres-1 | 2023-05-25 01:47:54.005 UTC [1] LOG: starting PostgreSQL 15.3 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924, 64-bit
alpine-moodle-postgres-1 | 2023-05-25 01:47:54.005 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
alpine-moodle-postgres-1 | 2023-05-25 01:47:54.005 UTC [1] LOG: listening on IPv6 address "::", port 5432
alpine-moodle-postgres-1 | 2023-05-25 01:47:54.007 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
alpine-moodle-postgres-1 | 2023-05-25 01:47:54.014 UTC [24] LOG: database system was shut down at 2023-05-25 01:47:37 UTC
alpine-moodle-postgres-1 | 2023-05-25 01:47:54.020 UTC [1] LOG: database system is ready to accept connections
alpine-moodle-moodle-1 | Starting startup scripts in /docker-entrypoint-init.d ...
alpine-moodle-moodle-1 | *** Running: /docker-entrypoint-init.d/01-uname.sh
alpine-moodle-moodle-1 | Linux 34f846234872 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 Linux
alpine-moodle-moodle-1 | *** Running: /docker-entrypoint-init.d/02-configure-moodle.sh
alpine-moodle-moodle-1 | Waiting for postgres:5432 to be ready
alpine-moodle-moodle-1 | postgres is ready
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | Using default file session store
alpine-moodle-moodle-1 | PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
alpine-moodle-moodle-1 | Skipped auto update of Moodle
alpine-moodle-moodle-1 | Finished startup scripts in /docker-entrypoint-init.d
alpine-moodle-moodle-1 | Starting runit...
alpine-moodle-moodle-1 | Started runsvdir, PID is 17
alpine-moodle-moodle-1 | wait for processes to start....
alpine-moodle-moodle-1 | /usr/sbin/crond 4.5 dillon's cron daemon, started with loglevel notice
alpine-moodle-moodle-1 | [25-May-2023 01:47:57] NOTICE: fpm is running, pid 22
alpine-moodle-moodle-1 | [25-May-2023 01:47:57] NOTICE: ready to handle connections
alpine-moodle-moodle-1 | run: cron: (pid 21) 5s
alpine-moodle-moodle-1 | run: nginx: (pid 23) 5s
alpine-moodle-moodle-1 | run: php: (pid 22) 5s
Thank you once again for taking time out of your day to try and help.
I confirm that I can start the container if I do not explicitly mount the html
path as you suggested.
I like to be able to easily inspect what containers are doing from a security perspective so I do not use named mounts. I'll see if I can rework your check to be a bit more robust without precluding explicit mounts.
I greatly appreciate your work on this and your effort in helping.
It's good to hear that!
For the html code folder, suggest to have a check on the arrangement of Moodle plugins as this image by default doesn't have any. You may want to install plugins at build (with your own DockerFile) or manually install them later at web after start up (but may need some tricks to preserve the files inside html
after the initial start).
One thought for the mount concern might be always mount a separated volume (e.g. /code
) which contains the moodle code, then the container will always copy/rsync from and paste to the mounted /var/www/html
directory at start up, e.g. adding an extra script to copy the files under rootfs/docker-entrypoint-init.d/
before 02-configure-moodle.sh
is executed.
I'm having additional problems with the container unfortunately. It sits behind traefik and it is returning 303's (likely based on your implementation of nginx). There are also cron errors generated by the nobody user in the logs.
It seems this has become too heavy a lift to use in its current form. Thank you so much for your thoughts and efforts. I'll close this ticket and search for something a bit more aligned with my needs.
For HTTP 303, I came across the same thing running behind a Nginx ingress controller. It just caused an infinity redirection. It takes me a long time to figure out the solution, especially I run it behind a CDN which make it even worse to troubleshoot...
My way to solve it is to set SSLPROXY
to true
with SITE_URL
as https://example.com.
I hope you are not also exposing the URL with a port as it may not properly supported yet (https://github.com/jimsihk/alpine-moodle/issues/38).
If you are running this behind a CDN proxy (e.g. Cloudflare), remember to set the connection as HTTPS enforced, assuming your Traefik supported HTTPS. Otherwise, the Moodle container will also still keep redirecting.
For cron errors, I suggest to ssh into the container and run the cron command directly to see what is the error shown. The stdout right now does not log it...
Not sure if you are having the same setup, maybe you could check https://github.com/jimsihk/alpine-moodle/issues/9 which related to running the image behind Traefik.
Thank you for these additional comments. I actually reviewed all your issues including the ones you referenced, as well as those from the original repo you forked. I tried all that variants and none of them worked - which is why in the end it is looking like I'll have to roll my own solution.
The original repo also provides a method to prestage the persistent volumes. I really don't like this requirement as it makes the setup very fragile and prone to difficulties.
Agree that docker bind mount is one of the use cases, let me also see what I could do.
@mtompkins just in case if you are still finding for solutions, I have updated the image in https://github.com/jimsihk/alpine-moodle/pull/152 to also support mounting directories, it will be available since release v402.102.1.
Thanks for reaching out @jimsihk
Thanks for this image / work.
I'm trying to migrate to this project from Bitnami and have a question about your use of
nobody
and volumes. Specifically, Bitnami uses the convention of explicit mounts for volume persistence.- /path/to/moodle-persistence:/bitnami/moodle
As I am trying to preserve the existing data, I'm attempting to map to your structure, however your use of implicit storage is making that a challenge. I have tried to adjust your
docker-compose
such that I do something like:with ownership of those folders as
nobody
(65534
). When doing so, the container fails to startup.I'd appreciate any insight you may be able to provide. I've tried a couple things:
user
indocker-compose
PUID
&GUID
env variablesrw
to the volume mapschmod 777
on the voume folders as a debug effortbut none of them allow the container to write to the mapped volume.
Once I know I can get the container launched I can (hopefully) align the data movement.
Many thanks!