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

PHP 8.3 support. Config testing. Correct mysql.cnf name. #53

Merged
merged 4 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/pr-laravel-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
- examples/laravel-nginx
- examples/7.1
- examples/7.2
- examples/7.4
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion builders/laravel.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ module.exports = {
defaultFiles: {
php: 'php.ini',
},
php: '7.4',
php: '8.3',
services: {appserver: {overrides: {environment: {
APP_LOG: 'errorlog',
}}}},
Expand Down
2 changes: 2 additions & 0 deletions config/default.conf.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# LANDOLARAVELNGINXCONF

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
#
# LANDOLARAVELMYSQLCNF

[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
#
# LANDOLARAVELMYSQL8CNF

[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]

; LANDOLARAVELPHPINI
;;;;;;;;;;;;;;;
; 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
1 change: 0 additions & 1 deletion examples/7.4/.gitignore

This file was deleted.

85 changes: 0 additions & 85 deletions examples/7.4/README.md

This file was deleted.

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
20 changes: 18 additions & 2 deletions examples/laravel-defaults/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Run the following commands to validate things are rolling as they should.
# Should serve from app root by default
lando ssh -s appserver -c "curl -L localhost" | grep "DEFAULTS"

# Should use 7.4 as the default php version
lando php -v | grep "PHP 7.4"
# Should use 8.3 as the default php version
lando php -v | grep "PHP 8.3"

# Should be running apache 2.4 by default
lando ssh -s appserver -c "apachectl -V | grep 2.4"
Expand All @@ -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 "; LANDOLARAVELPHPINI"
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 "LANDOLARAVELMYSQLCNF"
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
10 changes: 5 additions & 5 deletions examples/laravel-init/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Laravel PHP 8.1 Example
Laravel Init Example
===============

This example exists primarily to test the following documentation:
Expand All @@ -16,8 +16,8 @@ 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
lando init --source cwd --recipe laravel --webroot app/public --name lando-laravel --option cache=redis
cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.yml

# Should compose create-project a new laravel app
cd laravel
Expand All @@ -42,9 +42,9 @@ lando ssh -s appserver -c "curl -L localhost" | grep "Laravel"
cd laravel
lando ssh -s appserver -c 'cd /var/www/.composer && composer show laravel/installer' | grep 'v4.'

# Should use 7.4 as the default php version
# Should use 8.3 as the default php version
cd laravel
lando php -v | grep "PHP 8.1"
lando php -v | grep "PHP 8.3"

# Should be running apache 2.4 by default
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 "LANDOLARAVELMYSQL8CNF"
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
3 changes: 3 additions & 0 deletions examples/laravel-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ 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 "LANDOLARAVELNGINXCONF"
```

Destroy tests
Expand Down
Loading