From 2c95009aca4de240abe8c1a2803842660952ed3a Mon Sep 17 00:00:00 2001 From: Alec Reynolds Date: Tue, 27 Feb 2024 12:18:06 -0800 Subject: [PATCH] PHP 8.3 support. Config testing. Correct mysql.cnf name. --- config/default.conf.tpl | 2 ++ config/{mysql.conf => mysql.cnf} | 5 +++-- config/mysql8.cnf | 5 +++-- config/php.ini | 5 +++-- docs/index.md | 2 +- examples/.lando.local.yml | 2 -- examples/.lando.upstream.yml | 2 +- examples/7.1/README.md | 2 +- examples/7.2/README.md | 2 +- examples/7.4/README.md | 2 +- examples/laravel-custom/.lando.yml | 8 +++++++- examples/laravel-custom/README.md | 16 +++++++++++++--- examples/laravel-custom/config/php.ini | 4 ++-- examples/laravel-defaults/README.md | 16 ++++++++++++++++ examples/laravel-init/README.md | 2 +- examples/laravel-mysql8/README.md | 7 ++++++- examples/laravel-nginx/README.md | 4 ++++ 17 files changed, 65 insertions(+), 21 deletions(-) rename config/{mysql.conf => mysql.cnf} (97%) delete mode 100644 examples/.lando.local.yml diff --git a/config/default.conf.tpl b/config/default.conf.tpl index e255d10..c5e0da1 100644 --- a/config/default.conf.tpl +++ b/config/default.conf.tpl @@ -1,3 +1,5 @@ +# LANDOWORDPRESSNGINXCONF + server { listen 80 default_server; diff --git a/config/mysql.conf b/config/mysql.cnf similarity index 97% rename from config/mysql.conf rename to config/mysql.cnf index d85e082..9862c9d 100644 --- a/config/mysql.conf +++ b/config/mysql.cnf @@ -1,6 +1,7 @@ # # The MySQL database server configuration file for Lando # +# LANDOWORDPRESSMYSQLCNF [mysqld] # @@ -71,7 +72,7 @@ max_binlog_size = 100M #innodb_buffer_pool_size = 384M #innodb_additional_mem_pool_size = 20M # Set .._log_file_size to 25 % of buffer pool size -innodb_log_file_size = 100M +innodb_log_file_size = 101M #innodb_log_buffer_size = 8M innodb_flush_log_at_trx_commit = 0 #innodb_lock_wait_timeout = 50 @@ -82,7 +83,7 @@ innodb_open_files = 256 innodb_io_capacity = 512 innodb_flush_method = O_DIRECT innodb_thread_concurrency = 8 -innodb_lock_wait_timeout = 120 +innodb_lock_wait_timeout = 121 # # * Security Features # diff --git a/config/mysql8.cnf b/config/mysql8.cnf index de0fd89..44ec72a 100644 --- a/config/mysql8.cnf +++ b/config/mysql8.cnf @@ -1,6 +1,7 @@ # # The MySQL database server configuration file for Lando # +# LANDOWORDPRESSMYSQL8CNF [mysqld] # @@ -49,7 +50,7 @@ read_buffer_size = 2M #server-id = 1 #log_bin = /src/.lando/log/mysql-bin.log expire_logs_days = 10 -max_binlog_size = 100M +max_binlog_size = 101M #binlog_do_db = include_database_name #binlog_ignore_db = include_database_name # @@ -77,7 +78,7 @@ innodb_open_files = 256 innodb_io_capacity = 512 innodb_flush_method = O_DIRECT innodb_thread_concurrency = 8 -innodb_lock_wait_timeout = 120 +innodb_lock_wait_timeout = 127 # # * Security Features # diff --git a/config/php.ini b/config/php.ini index a33dacf..18558ff 100644 --- a/config/php.ini +++ b/config/php.ini @@ -1,5 +1,6 @@ [PHP] +; LANDOWORDPRESSPHPINI ;;;;;;;;;;;;;;; ; PHP Globals ; ;;;;;;;;;;;;;;; @@ -36,8 +37,8 @@ xdebug.mode = ${XDEBUG_MODE} ; Globals expose_php = on -max_execution_time = 90 -max_input_time = 900 +max_execution_time = 91 +max_input_time = 901 max_input_vars = 10000 memory_limit = ${PHP_MEMORY_LIMIT} upload_max_filesize = 100M diff --git a/docs/index.md b/docs/index.md index a77b2f6..50f4a01 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,7 +12,7 @@ Lando offers a configurable [recipe](https://docs.lando.dev/core/v3/recipes.html #### Features of this plugin: -* Configurable `php` version from `5.3` all the way to `8.1` +* Configurable `php` version from `5.3` all the way to `8.3` * Configurable `webroot` * Configurable web server (`apache` or `nginx`) * Configurable database backend (`mariadb`, `mysql`, or `postgres`) diff --git a/examples/.lando.local.yml b/examples/.lando.local.yml deleted file mode 100644 index 746a5a5..0000000 --- a/examples/.lando.local.yml +++ /dev/null @@ -1,2 +0,0 @@ -plugins: - "@lando/laravel": ./../../../ diff --git a/examples/.lando.upstream.yml b/examples/.lando.upstream.yml index 383d2bc..746a5a5 100644 --- a/examples/.lando.upstream.yml +++ b/examples/.lando.upstream.yml @@ -1,2 +1,2 @@ plugins: - "@lando/laravel": ../../.. + "@lando/laravel": ./../../../ diff --git a/examples/7.1/README.md b/examples/7.1/README.md index 49903f2..251f77d 100644 --- a/examples/7.1/README.md +++ b/examples/7.1/README.md @@ -16,7 +16,7 @@ lando poweroff # Initialize an empty laravel recipe rm -rf laravel && mkdir -p laravel && cd laravel -cp -f ../../.lando.local.yml .lando.local.yml && cat .lando.local.yml +cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel --option cache=redis --option php='7.1' --option composer_version='1-latest' # Should compose create-project a new laravel app diff --git a/examples/7.2/README.md b/examples/7.2/README.md index 863e14a..e33b114 100644 --- a/examples/7.2/README.md +++ b/examples/7.2/README.md @@ -17,7 +17,7 @@ lando poweroff # Initialize an empty laravel recipe rm -rf laravel && mkdir -p laravel && cd laravel lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel --option cache=redis --option php='7.2' --option composer_version='1-latest' -cp -f ../../.lando.local.yml .lando.local.yml && cat .lando.local.yml +cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml # Should compose create-project a new laravel app cd laravel diff --git a/examples/7.4/README.md b/examples/7.4/README.md index 0b0ff16..89d1d41 100644 --- a/examples/7.4/README.md +++ b/examples/7.4/README.md @@ -17,7 +17,7 @@ lando poweroff # Initialize an empty laravel recipe rm -rf laravel && mkdir -p laravel && cd laravel lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel --option cache=redis -cp -f ../../.lando.local.yml .lando.local.yml && cat .lando.local.yml +cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml # Should compose create-project a new laravel app cd laravel diff --git a/examples/laravel-custom/.lando.yml b/examples/laravel-custom/.lando.yml index 51cadb5..70402df 100644 --- a/examples/laravel-custom/.lando.yml +++ b/examples/laravel-custom/.lando.yml @@ -1,7 +1,7 @@ name: laravel-custom recipe: laravel config: - php: '7.4' + php: '8.3' composer_version: '2.0.7' via: nginx:1.17 webroot: bob @@ -13,6 +13,12 @@ config: php: config/php.ini vhosts: config/default.conf +services: + appserver: + overrides: + environment: + PHP_MEMORY_LIMIT: 2G + # do not remove this plugins: "@lando/laravel": ../.. diff --git a/examples/laravel-custom/README.md b/examples/laravel-custom/README.md index 153486f..2d649a3 100644 --- a/examples/laravel-custom/README.md +++ b/examples/laravel-custom/README.md @@ -28,8 +28,8 @@ lando ssh -s appserver -c "curl -L appserver_nginx" | grep "HI BOB" lando ssh -s appserver_nginx -c "nginx -v" 2>&1 | grep "nginx version" | grep "nginx/1.17" lando ssh -s appserver -c "curl -IL appserver_nginx" | grep Server | grep nginx -# Should use php 7.4 -lando php -v | grep "PHP 7.4" +# Should use php 8.3 +lando php -v | grep "PHP 8.3" # Should use composer 2.0.7 lando ssh -s appserver -c "/bin/sh -c 'NO_COLOR=1 composer -V'" | grep "Composer version 2.0.7" @@ -37,6 +37,16 @@ lando ssh -s appserver -c "/bin/sh -c 'NO_COLOR=1 composer -V'" | grep "Composer # Should be running mysql 5.7 by default lando mysql -V | grep 5.7 +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s appserver -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should allow environment variable PHP_MEMORY_LIMIT to work if used in config file +lando ssh -s appserver -c "curl -L appserver_nginx/info.php" | grep memory_limit | grep 2G + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s appserver -c "php -i" | grep "memory_limit" | grep -e "-1" + # Should be able to connect to the database with the default creds lando mysql laravel -e quit @@ -47,7 +57,7 @@ lando ssh -s cache -c "memcached --version | grep 1.5.12" lando php -m | grep Xdebug # Should be using custom config files -lando ssh -s appserver -c "curl -L appserver_nginx/info.php" | grep memory_limit | grep 513M +lando ssh -s appserver -c "curl -L appserver_nginx/info.php" | grep max_execution_time | grep 92 lando ssh -s appserver_nginx -c "cat /opt/bitnami/nginx/conf/vhosts/lando.conf" | grep server_name | grep pirog lando mysql -u root -e "show variables;" | grep thread_cache_size | grep 12 ``` diff --git a/examples/laravel-custom/config/php.ini b/examples/laravel-custom/config/php.ini index 818a98d..4a8fceb 100644 --- a/examples/laravel-custom/config/php.ini +++ b/examples/laravel-custom/config/php.ini @@ -36,10 +36,10 @@ xdebug.mode = ${XDEBUG_MODE} ; Globals expose_php = on -max_execution_time = 90 +max_execution_time = 92 max_input_time = 900 max_input_vars = 10000 -memory_limit = 513M +memory_limit = ${PHP_MEMORY_LIMIT} upload_max_filesize = 100M post_max_size = 100M error_reporting = E_ALL & ~E_DEPRECATED diff --git a/examples/laravel-defaults/README.md b/examples/laravel-defaults/README.md index 14117f2..5e42d69 100644 --- a/examples/laravel-defaults/README.md +++ b/examples/laravel-defaults/README.md @@ -34,12 +34,28 @@ lando ssh -s appserver -c "curl -IL localhost" | grep Server | grep 2.4 # Should be running mysql 5.7 by default lando mysql -V | grep 5.7 +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s appserver -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should have a 1G php mem limit on appserver +lando ssh -s appserver -c "curl http://localhost/info.php" | grep "memory_limit" | grep "1G" + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s appserver -c "php -i" | grep "memory_limit" | grep -e "-1" + # Should not enable xdebug by default lando php -m | grep xdebug || echo $? | grep 1 # Should use the default database connection info lando mysql laravel -e quit +# Should use the correct default config files +lando ssh -s appserver -c "cat /usr/local/etc/php/conf.d/zzz-lando-my-custom.ini" | grep "; LANDOWORDPRESSPHPINI" +lando ssh -s appserver -c "curl -L http://localhost/info.php" | grep max_execution_time | grep 91 +lando ssh -s database -c "cat /opt/bitnami/mysql/conf/my_custom.cnf" | grep "LANDOWORDPRESSMYSQLCNF" +lando mysql -u root -e "show variables;" | grep innodb_lock_wait_timeout | grep 121 + # Should use composer 2 by default lando ssh -s appserver -c "/bin/sh -c 'NO_COLOR=1 composer -V'" | grep "Composer version 2." ``` diff --git a/examples/laravel-init/README.md b/examples/laravel-init/README.md index da3d34a..5dfcc61 100644 --- a/examples/laravel-init/README.md +++ b/examples/laravel-init/README.md @@ -17,7 +17,7 @@ lando poweroff # Initialize an empty laravel recipe rm -rf laravel && mkdir -p laravel && cd laravel lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel --option cache=redis --option php='8.1' -cp -f ../../.lando.local.yml .lando.local.yml && cat .lando.local.yml +cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml # Should compose create-project a new laravel app cd laravel diff --git a/examples/laravel-mysql8/README.md b/examples/laravel-mysql8/README.md index c67bc96..cc7736b 100644 --- a/examples/laravel-mysql8/README.md +++ b/examples/laravel-mysql8/README.md @@ -17,7 +17,7 @@ lando poweroff # Initialize an empty laravel recipe rm -rf mysql8 && mkdir -p mysql8 && cd mysql8 lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel-mysql8 --option cache=redis --option php='8.1' --option database=mysql:8.0.22 -cp -f ../../.lando.local.yml .lando.local.yml && cat .lando.local.yml +cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml # Should compose create-project a new laravel app cd mysql8 @@ -67,6 +67,11 @@ lando ssh -s cache -c "redis-cli CONFIG GET databases" cd mysql8 lando mysql -ularavel -plaravel laravel -e quit +# Should use the defauly mysql8 config file +cd mysql8 +lando ssh -s database -c "cat /opt/bitnami/mysql/conf/my_custom.cnf" | grep "LANDOWORDPRESSMYSQL8CNF" +lando mysql -u root -e "show variables;" | grep innodb_lock_wait_timeout | grep 127 + # Should have artisan available cd mysql8 lando artisan env diff --git a/examples/laravel-nginx/README.md b/examples/laravel-nginx/README.md index 352eb00..0deb87c 100644 --- a/examples/laravel-nginx/README.md +++ b/examples/laravel-nginx/README.md @@ -32,6 +32,10 @@ lando nginx -v 2>&1 | grep "nginx version" | grep "nginx/1.25" # Should use the php version specified by the user eg 7.4 lando php -v | grep "PHP 7.4" + +# Should load the correct default nginx config +lando ssh -s appserver_nginx -c "cat /opt/bitnami/nginx/conf/vhosts/lando.conf" | grep "LANDOWORDPRESSNGINXCONF" +lando ssh -s appserver_nginx -c "cat /opt/bitnami/nginx/conf/vhosts/lando.conf" | grep "WordPress single site rules." ``` Destroy tests