diff --git a/CHANGELOG.md b/CHANGELOG.md index 878840f..d0ae9a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,13 @@ -## v1.1.1 - [March 4, 2024](https://github.com/lando/lamp/releases/tag/v1.1.1) +## v1.2.1 - [March 6, 2024](https://github.com/lando/lamp/releases/tag/v1.2.1) ### Fixes * Improved `database` selection for purposes of `config` loading, fixes some `database` bootup issues when the `database` type is overriden downstream +### Internal + +* Updated config testing. + ## v1.2.0 - [February 27, 2024](https://github.com/lando/lamp/releases/tag/v1.2.0) ### New Features diff --git a/config/default.conf.tpl b/config/default.conf.tpl new file mode 100644 index 0000000..165001b --- /dev/null +++ b/config/default.conf.tpl @@ -0,0 +1,68 @@ +# WordPress single site rules. +# Designed to be included in any server {} block. +# LANDOLAMPNGINXCONF + +# Upstream to abstract backend connection(s) for php +upstream php { + server fpm:9000; +} + +server { + + listen 80 default_server; + listen 443 ssl; + + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + ssl_verify_client off; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + port_in_redirect off; + client_max_body_size 100M; + + ## Your only path reference. + root "{{LANDO_WEBROOT}}"; + + ## This should be in your http block and if it is, it's not needed here. + index index.php; + + location = /favicon.ico { + log_not_found off; + access_log off; + } + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + location / { + # This is cool because no php is touched for static content. + # include the "?$args" part so non-default permalinks doesn't break when using query string + try_files $uri $uri/ /index.php?$args; + } + + location ~ \.php$ { + #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name; + include fastcgi_params; + fastcgi_intercept_errors on; + fastcgi_pass php; + fastcgi_buffers 16 16k; + fastcgi_buffer_size 32k; + } + + location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { + expires max; + log_not_found off; + } +} diff --git a/config/mysql.cnf b/config/mysql.cnf new file mode 100644 index 0000000..6afcca8 --- /dev/null +++ b/config/mysql.cnf @@ -0,0 +1,110 @@ +# +# The MySQL database server configuration file for Lando +# LANDOLAMPMYSQLCNF + +[mysqld] +# +# * Basic Settings +# +# Data is stored in a volume on the db container /sql +default-storage-engine = innodb + +# +# * Fine Tuning +# +key_buffer_size = 384M +max_allowed_packet = 32M +thread_stack = 400K +thread_cache_size = 8 +# This replaces the startup script and checks MyISAM tables if needed +# the first time they are touched +#max_connections = 100 +#table_cache = 64 +#thread_concurrency = 10 +read_rnd_buffer_size = 8M +myisam_sort_buffer_size = 64M +table_open_cache = 512 +sort_buffer_size = 2M +read_buffer_size = 2M + +# +# * Query Cache Configuration +# +query_cache_limit = 1M +query_cache_size = 64M +# +# * Logging and Replication +# +# Both location gets rotated by the cronjob. +# Be aware that this log type is a performance killer. +# As of 5.1 you can enable the log at runtime! +#general_log_file = /src/.lando/log/mysql.log +#general_log = 1 +# +# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf. +# +# Here you can see queries with especially long duration +#log_slow_queries = /var/log/mysql/mysql-slow.log +#long_query_time = 2 +#log-queries-not-using-indexes +# +# The following can be used as easy to replay backup logs or for replication. +# note: if you are setting up a replication slave, see README.Debian about +# other settings you may need to change. +#server-id = 1 +#log_bin = /src/.lando/log/mysql-bin.log +expire_logs_days = 10 +max_binlog_size = 100M +#binlog_do_db = include_database_name +#binlog_ignore_db = include_database_name +# +# * InnoDB +# +# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. +# Read the manual for more InnoDB related options. There are many! +# +# Uncomment the following if you are using InnoDB tables +#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend +#innodb_log_group_home_dir = C:\mysql\data/ +# You can set .._buffer_pool_size up to 50 - 80 % +# of RAM but beware of setting memory usage too high +#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 = 101M +#innodb_log_buffer_size = 8M +innodb_flush_log_at_trx_commit = 0 +#innodb_lock_wait_timeout = 50 +innodb_buffer_pool_size = 384M +innodb_log_buffer_size = 4M +innodb_file_per_table = 1 +innodb_open_files = 256 +innodb_io_capacity = 512 +innodb_flush_method = O_DIRECT +innodb_thread_concurrency = 8 +innodb_lock_wait_timeout = 121 +# +# * Security Features +# +# Read the manual, too, if you want chroot! +# chroot = /var/lib/mysql/ +# +# For generating SSL certificates I recommend the OpenSSL GUI "tinyca". +# +# ssl-ca=/etc/mysql/cacert.pem +# ssl-cert=/etc/mysql/server-cert.pem +# ssl-key=/etc/mysql/server-key.pem + +[mysqldump] +quick +quote-names +max_allowed_packet = 32M + +[mysql] +#no-auto-rehash # faster start of mysql but no tab completion + +[isamchk] +key_buffer_size = 384M +sort_buffer_size = 256M +read_buffer = 2M +write_buffer = 2M diff --git a/config/mysql8.cnf b/config/mysql8.cnf new file mode 100644 index 0000000..30e231a --- /dev/null +++ b/config/mysql8.cnf @@ -0,0 +1,105 @@ +# +# The MySQL database server configuration file for Lando +# LANDOLAMPMYSQL8CNF + +[mysqld] +# +# * Basic Settings +# +# Data is stored in a volume on the db container /sql +default-storage-engine = innodb + +# +# * Fine Tuning +# +key_buffer_size = 384M +max_allowed_packet = 32M +thread_stack = 400K +thread_cache_size = 8 +# This replaces the startup script and checks MyISAM tables if needed +# the first time they are touched +#max_connections = 100 +#table_cache = 64 +#thread_concurrency = 10 +read_rnd_buffer_size = 8M +myisam_sort_buffer_size = 64M +table_open_cache = 512 +sort_buffer_size = 2M +read_buffer_size = 2M + +# +# * Logging and Replication +# +# Both location gets rotated by the cronjob. +# Be aware that this log type is a performance killer. +# As of 5.1 you can enable the log at runtime! +#general_log_file = /src/.lando/log/mysql.log +#general_log = 1 +# +# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf. +# +# Here you can see queries with especially long duration +#log_slow_queries = /var/log/mysql/mysql-slow.log +#long_query_time = 2 +#log-queries-not-using-indexes +# +# The following can be used as easy to replay backup logs or for replication. +# note: if you are setting up a replication slave, see README.Debian about +# other settings you may need to change. +#server-id = 1 +#log_bin = /src/.lando/log/mysql-bin.log +expire_logs_days = 10 +max_binlog_size = 101M +#binlog_do_db = include_database_name +#binlog_ignore_db = include_database_name +# +# * InnoDB +# +# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. +# Read the manual for more InnoDB related options. There are many! +# +# Uncomment the following if you are using InnoDB tables +#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend +#innodb_log_group_home_dir = C:\mysql\data/ +# You can set .._buffer_pool_size up to 50 - 80 % +# of RAM but beware of setting memory usage too high +#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_buffer_size = 8M +innodb_flush_log_at_trx_commit = 0 +#innodb_lock_wait_timeout = 50 +innodb_buffer_pool_size = 384M +innodb_log_buffer_size = 4M +innodb_file_per_table = 1 +innodb_open_files = 256 +innodb_io_capacity = 512 +innodb_flush_method = O_DIRECT +innodb_thread_concurrency = 8 +innodb_lock_wait_timeout = 127 +# +# * Security Features +# +# Read the manual, too, if you want chroot! +# chroot = /var/lib/mysql/ +# +# For generating SSL certificates I recommend the OpenSSL GUI "tinyca". +# +# ssl-ca=/etc/mysql/cacert.pem +# ssl-cert=/etc/mysql/server-cert.pem +# ssl-key=/etc/mysql/server-key.pem + +[mysqldump] +quick +quote-names +max_allowed_packet = 32M + +[mysql] +#no-auto-rehash # faster start of mysql but no tab completion + +[isamchk] +key_buffer_size = 384M +sort_buffer_size = 256M +read_buffer = 2M +write_buffer = 2M diff --git a/config/php.ini b/config/php.ini new file mode 100644 index 0000000..8d6b492 --- /dev/null +++ b/config/php.ini @@ -0,0 +1,49 @@ +[PHP] +; LANDOLAMPPHPINI +;;;;;;;;;;;;;;; +; PHP Globals ; +;;;;;;;;;;;;;;; + +short_open_tag = Off +output_buffering = 4096 +allow_call_time_pass_reference = Off +request_order = "GP" +register_long_arrays = Off +register_argc_argv = Off +magic_quotes_gpc = Off +enable_dl = Off +allow_url_fopen = On +realpath_cache_size = "800K" +realpath_cache_ttl = "86400" +disable_functions = +sendmail_path=/bin/true +;include_path = ".:/usr/share/pear:/usr/share/php" + +[Date] +date.timezone = "UTC" + +;;;;;;;;;;;;;;;;;;;;;; +;; PACKAGE SETTINGS ;; +;;;;;;;;;;;;;;;;;;;;;; + +; Xdebug +xdebug.max_nesting_level = 512 +xdebug.show_exception_trace = 0 +xdebug.collect_params = 0 +xdebug.remote_autostart = 1 +xdebug.start_with_request = trigger +xdebug.mode = ${XDEBUG_MODE} + +; Globals +expose_php = on +max_execution_time = 91 +max_input_time = 901 +max_input_vars = 10000 +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = 100M +post_max_size = 100M +error_reporting = E_ALL & ~E_DEPRECATED +ignore_repeated_errors = on +html_errors = off +display_errors = on +log_errors = on diff --git a/examples/lamp-defaults/README.md b/examples/lamp-defaults/README.md index 56ab211..b053e0b 100644 --- a/examples/lamp-defaults/README.md +++ b/examples/lamp-defaults/README.md @@ -50,6 +50,12 @@ lando php -m | grep xdebug || echo $? | grep 1 # Should use the default database connection info lando mysql lamp -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 "; LANDOLAMPPHPINI" +lando ssh -s appserver_nginx -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 "LANDOLAMPMYSQLCNF" +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." ```