Skip to content

Commit

Permalink
PHP 8.3 support. Config testing. Correct mysql.cnf name.
Browse files Browse the repository at this point in the history
  • Loading branch information
reynoldsalec committed Feb 27, 2024
1 parent 1cb1a58 commit 2c95009
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 21 deletions.
2 changes: 2 additions & 0 deletions config/default.conf.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# LANDOWORDPRESSNGINXCONF

server {
listen 80 default_server;
Expand Down
5 changes: 3 additions & 2 deletions config/mysql.conf → config/mysql.cnf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#
# The MySQL database server configuration file for Lando
#
# LANDOWORDPRESSMYSQLCNF

[mysqld]
#
Expand Down Expand Up @@ -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
Expand All @@ -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
#
Expand Down
5 changes: 3 additions & 2 deletions config/mysql8.cnf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#
# The MySQL database server configuration file for Lando
#
# LANDOWORDPRESSMYSQL8CNF

[mysqld]
#
Expand Down Expand Up @@ -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
#
Expand Down Expand Up @@ -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
#
Expand Down
5 changes: 3 additions & 2 deletions config/php.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[PHP]

; LANDOWORDPRESSPHPINI
;;;;;;;;;;;;;;;
; PHP Globals ;
;;;;;;;;;;;;;;;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
2 changes: 0 additions & 2 deletions examples/.lando.local.yml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/.lando.upstream.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
plugins:
"@lando/laravel": ../../..
"@lando/laravel": ./../../../
2 changes: 1 addition & 1 deletion examples/7.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/7.2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/7.4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion examples/laravel-custom/.lando.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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": ../..
Expand Down
16 changes: 13 additions & 3 deletions examples/laravel-custom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,25 @@ 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"

# 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

Expand All @@ -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
```
Expand Down
4 changes: 2 additions & 2 deletions examples/laravel-custom/config/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions examples/laravel-defaults/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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."
```
Expand Down
2 changes: 1 addition & 1 deletion examples/laravel-init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion examples/laravel-mysql8/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions examples/laravel-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2c95009

Please sign in to comment.