serversideup / docker-php

🐳 Production-ready Docker images for PHP. Optimized for Laravel, WordPress, and more!
https://serversideup.net/open-source/docker-php/
GNU General Public License v3.0
1.75k stars 121 forks source link

Disabling welcome message prevents unit startup #410

Closed lukevear closed 1 month ago

lukevear commented 3 months ago

Steps To Reproduce

  1. Run echo "<?php phpinfo();" > index.php
  2. Run docker run --rm -v $(pwd):/var/www/html/public -p 80:8080 --env SHOW_WELCOME_MESSAGE=false serversideup/php:8.2-unit-v3.3.0

Outcome

What did you expect?

Expected to see php info outlet when navigating to http://localhost.

What happened instead?

Connection is rejected.

Affected Docker Images

serversideup/php:8.2-unit-v3.3.0

Anything else?

Docker Run Output (with SHOW_WELCOME_MESSAGE=false)

2024/08/01 05:02:54 [warn] 1#1 Unit is running unprivileged, then it cannot use arbitrary user and group.
2024/08/01 05:02:54 [info] 1#1 unit 1.32.1 started
2024/08/01 05:02:54 [info] 10#10 discovery started
2024/08/01 05:02:54 [notice] 10#10 module: php 8.2.21 "/usr/lib/unit/modules/php.unit.so"
2024/08/01 05:02:54 [info] 1#1 controller started
2024/08/01 05:02:54 [notice] 1#1 process 10 exited with code 0
2024/08/01 05:02:54 [info] 12#12 router started
2024/08/01 05:02:54 [info] 12#12 OpenSSL 3.0.13 30 Jan 2024, 300000d0

Docker Run Output (with SHOW_WELCOME_MESSAGE=true or omitted)


--------------------------------------------------------------------
 ____                             ____  _     _        _   _
/ ___|  ___ _ ____   _____ _ __  / ___|(_) __| | ___  | | | |_ __
\___ \ / _ \  __\ \ / / _ \  __| \___ \| |/ _` |/ _ \ | | | |  _ \
 ___) |  __/ |   \ V /  __/ |     ___) | | (_| |  __/ | |_| | |_) |
|____/ \___|_|    \_/ \___|_|    |____/|_|\__,_|\___|  \___/| .__/
                                                            |_|

Brought to you by serversideup.net
--------------------------------------------------------------------

🙌 To support Server Side Up projects visit:
https://serversideup.net/sponsor

-------------------------------------
ℹ️ Container Information
-------------------------------------

OS:            Debian GNU/Linux 12 (bookworm)
Docker user:   www-data
Docker uid:    33
Docker gid:    33
OPcache:       ❌ Disabled

👉 [NOTICE]: Improve PHP performance by setting PHP_OPCACHE_ENABLE=1 (recommended for production).
init-unit: Processing /etc/unit/config.d/ssl-off.json.template → /etc/unit/config.d/config.json...
init-unit: Launching Unit daemon to perform initial configuration...
2024/08/01 05:03:31 [warn] 28#28 Unit is running unprivileged, then it cannot use arbitrary user and group.
2024/08/01 05:03:31 [info] 28#28 unit 1.32.1 started
2024/08/01 05:03:31 [info] 31#31 discovery started
2024/08/01 05:03:31 [notice] 31#31 module: php 8.2.21 "/usr/lib/unit/modules/php.unit.so"
2024/08/01 05:03:31 [info] 29#29 controller started
2024/08/01 05:03:31 [notice] 29#29 process 31 exited with code 0
2024/08/01 05:03:31 [info] 34#34 router started
2024/08/01 05:03:31 [info] 34#34 OpenSSL 3.0.13 30 Jan 2024, 300000d0
{
    "certificates": {},
    "js_modules": {},
    "config": {
        "listeners": {},
        "routes": [],
        "applications": {}
    },

    "status": {
        "connections": {
            "accepted": 0,
            "active": 0,
            "idle": 0,
            "closed": 0
        },

        "requests": {
            "total": 0
        },

        "applications": {}
    }
}
init-unit: Looking for certificate bundles in /etc/unit/config.d...
init-unit: Looking for JavaScript modules in /etc/unit/config.d...
init-unit: Looking for configuration snippets in /etc/unit/config.d...
init-unit: Applying configuration /etc/unit/config.d/config.json
2024/08/01 05:03:31 [info] 39#39 "php" prototype started
2024/08/01 05:03:31 [info] 40#40 "php" application started
2024/08/01 05:03:31 [info] 41#41 "php" application started
✅ OK: HTTP response status code is '200'
{
    "success": "Reconfiguration done."
}
init-unit: Setting access log to STDOUT...
✅ OK: HTTP response status code is '200'
{
    "success": "Reconfiguration done."
}
init-unit: Stopping Unit daemon after initial configuration...
2024/08/01 05:03:31 [notice] 29#29 process 33 exited with code 0
init-unit: Waiting for control socket to be removed...
2024/08/01 05:03:31 [notice] 39#39 app process 40 exited with code 0
2024/08/01 05:03:31 [alert] 39#39 sendmsg(13, -1, -1, 2) failed (32: Broken pipe)
2024/08/01 05:03:31 [notice] 39#39 app process 41 exited with code 0
2024/08/01 05:03:31 [alert] 39#39 sendmsg(13, -1, -1, 2) failed (32: Broken pipe)
2024/08/01 05:03:31 [notice] 29#29 process 34 exited with code 0
2024/08/01 05:03:31 [notice] 29#29 process 39 exited with code 0

init-unit: Unit initial configuration complete; ready for start up...

2024/08/01 05:03:32 [warn] 1#1 Unit is running unprivileged, then it cannot use arbitrary user and group.
2024/08/01 05:03:32 [info] 1#1 unit 1.32.1 started
2024/08/01 05:03:32 [info] 75#75 discovery started
2024/08/01 05:03:32 [notice] 75#75 module: php 8.2.21 "/usr/lib/unit/modules/php.unit.so"
2024/08/01 05:03:32 [info] 1#1 controller started
2024/08/01 05:03:32 [notice] 1#1 process 75 exited with code 0
2024/08/01 05:03:32 [info] 77#77 router started
2024/08/01 05:03:32 [info] 77#77 OpenSSL 3.0.13 30 Jan 2024, 300000d0
2024/08/01 05:03:32 [info] 78#78 "php" prototype started
2024/08/01 05:03:32 [info] 79#79 "php" application started
2024/08/01 05:03:32 [info] 80#80 "php" application started
lukevear commented 3 months ago

For reference, serversideup/php:8.2-unit-v3.1.0 and serversideup/php:8.2-unit-v3.2.0 work without issue.

jaydrogers commented 3 months ago

Thanks for the heads up and the detailed message.

I will take a look into this. It's definitely only affecting unit only.

I have some other open source projects that I am trying to get out the door very soon, so let me swing back to this once I have some bandwidth.

Thanks for your patience! 👍

WoLfulus commented 1 month ago

I ran into this issue today, hopefully #427 or #428 are enough to get this fixed.

jaydrogers commented 1 month ago

Setting return 0 fixed this, as suggested by @WoLfulus (https://github.com/serversideup/docker-php/commit/b6daaeae0ec1b92579944790698aa2252ad74d52)

I left the return 1 out because I wanted the script to exit immediately on those.

This is currently on this PR:

But it will soon be merged into:

I would appreciate some alpha and beta testing if you get the chance! Thanks a ton for your help!