Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webserver exits on M1 #248

Closed
mackensen opened this issue Jan 25, 2023 · 11 comments
Closed

Webserver exits on M1 #248

mackensen opened this issue Jan 25, 2023 · 11 comments

Comments

@mackensen
Copy link

The webserver container exits immediately on an M1 laptop running Ventura 13.0.1:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.6. Set the 'ServerName' directive globally to suppress this message
[Wed Jan 25 21:36:38.675378 2023] [core:emerg] [pid 1] (95)Operation not supported: AH00023: Couldn't create the proxy mutex
[Wed Jan 25 21:36:38.679179 2023] [proxy:crit] [pid 1] (95)Operation not supported: AH02478: failed to create proxy mutex
AH00016: Configuration Failed

May be related to https://stackoverflow.com/questions/73294020/docker-couldnt-create-the-mpm-accept-mutex

@mackensen mackensen changed the title Webserver exists on M1 Webserver exits on M1 Jan 25, 2023
@scara
Copy link
Contributor

scara commented Jan 29, 2023

Hi @mackensen,
unfortunately I do not have an M1 and in my Raspberry Pi 4 Model B (aarch64) the HQ image works fine e.g. 8.0:

Status: Downloaded newer image for moodlehq/moodle-php-apache:8.0
...
[Sun Jan 29 10:47:03.371432 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.0.27 configured -- resuming normal operations
[Sun Jan 29 10:47:03.371588 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

Would you mind to give the quick&dirty patch below a test run in your M1?

Clone the repo

$ git clone https://github.com/moodlehq/moodle-php-apache

Patch the Dockerfile

$ git diff
diff --git a/Dockerfile b/Dockerfile
index ad3d20a..e3e2191 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -34,6 +34,10 @@ RUN /tmp/setup/php-extensions.sh
 RUN /tmp/setup/oci8-extension.sh
 ENV LD_LIBRARY_PATH /usr/local/instantclient

+# Setup the required configurations.
+# TODO Use a setup script and let the following sed run only when "${TARGETPLATFORM}" == "linux/arm64".
+RUN sed -i '/^#Mutex.*/a Mutex posixsem' /etc/apache2/apache2.conf
+
 RUN mkdir /var/www/moodledata && chown www-data /var/www/moodledata && \
     mkdir /var/www/phpunitdata && chown www-data /var/www/phpunitdata && \
     mkdir /var/www/behatdata && chown www-data /var/www/behatdata && \

Build the arm64 target platform and load it in your Docker Engine

$ docker buildx create --use
$ docker buildx build --platform=linux/arm64 --load -t moodlehq/moodle-php-apache:8.2-test-posix .

Test the new local image and check that the new conf is there

$ docker run --name moodle-web-82-test-posix -p 8888:80 moodlehq/moodle-php-apache:8.2-test-posix
...
[Sun Jan 29 19:24:57.838261 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

$ docker rm -v moodle-web-82-test-posix
$ docker run --rm --name moodle-web-82-test-posix -it moodlehq/moodle-php-apache:8.2-test-posix grep -i mutex /etc/apache2/apache2.conf
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
#Mutex file:${APACHE_LOCK_DIR} default
Mutex posixsem

Remove the test env

$  docker buildx rm
$  docker rmi moodle-web-82-test-posix

HTH,
Matteo

@mackensen
Copy link
Author

@scara Thanks, I can confirm it built and ran fine on my M1.

@stronk7
Copy link
Member

stronk7 commented Mar 18, 2023

So maybe we can just try adding this to the Dockerfile (disclaimer, not tested):

...
RUN if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
    sed -i '/^#Mutex.*/a Mutex posixsem' /etc/apache2/apache2.conf; \
    fi

And done?

@scara
Copy link
Contributor

scara commented Mar 19, 2023

Hi @stronk7,

And done?

Yes: I guess we need the help of @mackensen to perform the end test or just look at the /etc/apache2/apache2.conf file in the resulting arm64 image (an automated test?).

Not sure why @andrewnicols didn't mention this issue when hardly working on https://github.com/moodlehq/moodle-php-apache in these days. Does he run Docker Engine on M1 too?

HTH,
Matteo

@andrewnicols
Copy link
Contributor

Yes, both @stronk7 and I use M1 machines. I've not had any issues in the times that I use the docker image.

@stronk7
Copy link
Member

stronk7 commented Mar 21, 2023

Yes, while I still use an old x64 laptop as main one... I've a 2020 Mini M1 and I use to run stuff there here and there. I've just tried and it's working ok (nothing in logs apart from the requests) and apache serving perfectly ok:

$ bin/moodle-docker-compose exec -u www-data webserver php admin/tool/behat/cli/run.php --tags=@auth_manual
Running single behat site:
Moodle 4.2dev+ (Build: 20230318), f3bf17cdfbee0377f5a09fcbbcce7c0367bbe58b
Php: 8.0.28, pgsql: 13.10 (Debian 13.10-1.pgdg110+1), OS: Linux 5.15.49-linuxkit aarch64
Run optional tests:
- Accessibility: No
Server OS "Linux", Browser: "firefox"
Started at 21-03-2023, 15:02
...............

2 scenarios (2 passed)
15 steps (15 passed)
0m24.00s (51.45Mb)

I'm using latest Docker Desktop 4.17.0 (Engine 20.10.23), with "Use Virtualization framework" and "VirtioFS" enabled.

Ciao :-)

@scara
Copy link
Contributor

scara commented Mar 21, 2023

Hi @mackensen,

I'm using latest Docker Desktop 4.17.0 (Engine 20.10.23), with "Use Virtualization framework" and "VirtioFS" enabled.

could you share here your configuration to compare it with the others?

TIA,
Matteo

@mackensen
Copy link
Author

mackensen commented Apr 6, 2023

Hi @mackensen,

I'm using latest Docker Desktop 4.17.0 (Engine 20.10.23), with "Use Virtualization framework" and "VirtioFS" enabled.

could you share here your configuration to compare it with the others?

TIA, Matteo

I updated to that version and changed my setting to VirtioFS I'm still seeing the error. The manual compilation workaround is still effective.

@stronk7
Copy link
Member

stronk7 commented Apr 8, 2023

Hi,

we are really running out of possibilities (and ideas), at very least here. One last thing that may be happening... are you using the very latest moodle-php-apache images? Can you try pulling them manually, for example:

docker pull moodlehq/moodle-php-apache:8.0

(or the version you are using)

If you don't see a message saying "Status: Image is up to date for moodlehq/moodle-php-apache:8.0" it means that you weren't using the latest. If so, just restart all the moodle-docker machinery and try again, please.

Apart from that... I cannot imagine many other causes for the behaviour of your M1, let's see.

Ciao :-)

@mackensen
Copy link
Author

@stronk7 that was it, I pulled the latest and the container comes up cleanly now. Thanks!

@stronk7
Copy link
Member

stronk7 commented Apr 24, 2023

Yay, so we can finally close this one?

@stronk7 stronk7 closed this as completed May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants