yii2-docker icon indicating copy to clipboard operation
yii2-docker copied to clipboard

Feature/nginx-unit flavour

Open razvanphp opened this issue 2 years ago • 3 comments

Hello,

Since there are multiple tests online about how nginx-unit is faster than fpm+nginx combo + the added benefit of simplicity having just one container with no supervisord, would this repo be a good place to contribute this?

What would be the recommended approach? Have some tests added/run?

Thank you! R

razvanphp avatar May 24 '23 16:05 razvanphp

Likely yes but it would be great to have actual benchmarks.

samdark avatar May 24 '23 18:05 samdark

sure, here is what I was referring to: https://habr.com/en/articles/646397/

Also, our app runs fine in this environment/setup since the official unit image is based on the official php-cli image -- but we could also use it as a baseimage intermediate to pull the unitd binaries + modules from:

root@8418299f6480:/app# php -v
PHP 8.2.6 (cli) (built: May 23 2023 04:11:52) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.6, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.6, Copyright (c), by Zend Technologies
root@8418299f6480:/app#
root@8418299f6480:/app# unitd --version
unit version: 1.30.0
configured as ./configure --prefix=/usr --statedir=/var/lib/unit --control=unix:/var/run/control.unit.sock --pid=/var/run/unit.pid --log=/var/log/unit.log --tmpdir=/var/tmp --user=unit --group=unit --openssl --libdir=/usr/lib/aarch64-linux-gnu --njs --cc-opt='-g -O2 -ffile-prefix-map=/unit=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --ld-opt='-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie' --modulesdir=/usr/lib/unit/modules
root@8418299f6480:/app# php requirements.php 

Yii Application Requirement Checker

This script checks if your server configuration meets the requirements
for running Yii application.
It checks if the server is running the right version of PHP,
if appropriate PHP extensions have been loaded, and if php.ini file settings are correct.

Check conclusion:
-----------------

PHP version: OK

Reflection extension: OK

PCRE extension: OK

SPL extension: OK

Ctype extension: OK

MBString extension: OK

OpenSSL extension: OK

Intl extension: OK

ICU version: OK

ICU Data version: OK

Fileinfo extension: OK

DOM extension: OK

IPv6 support: OK

PDO extension: OK

PDO SQLite extension: OK

PDO MySQL extension: OK

PDO PostgreSQL extension: WARNING!!!
Required by: All DB-related classes
Memo: Required for PostgreSQL database.

Memcache extension: WARNING!!!
Required by: MemCache

GD PHP extension with FreeType support: OK

ImageMagick PHP extension with PNG support: WARNING!!!
Required by: Captcha
Memo: Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.

Expose PHP: WARNING!!!
Required by: Security reasons
Memo: "expose_php" should be disabled at php.ini

PHP allow url include: OK

PHP mail SMTP: OK

------------------------------------------
Errors: 0   Warnings: 4   Total checks: 23

root@8418299f6480:/app#

razvanphp avatar May 24 '23 19:05 razvanphp

@razvanphp Here's a very rough first "build layout": https://github.com/yiisoft/yii2-docker/tree/feature/nginxunit

It builds, but the correct config is missing, you might start from there to create a working image.

It might be possible to re-unify the Dockerfiles, but this depends maily on the OS used in the Docker image.

PS: Comment Apache section and uncomment https://github.com/yiisoft/yii2-docker/blob/feature/nginxunit/.env-dist#L26-L30 after files has been copied to .env

schmunk42 avatar May 25 '23 10:05 schmunk42