Skip to content

Commit

Permalink
lando/lando#1462: Add mysql8.cnf files to all Drupal recipes. (#51)
Browse files Browse the repository at this point in the history
* lando/lando#1462: Add mysql8.cnf files to all Drupal recipes.

* lando/lando#1462: Test MySQL 8 on the Drupal 10 recipe.

* #1462: Separate out MySQL8 tests from drupal10 default test.

* #1462: Improve mysql8 test to ensure db version and test Drupal 10 install.

* lando/lando#1462: Refactor Drupal 10 MySQL 8 test with --option flag on ? From where should we get your app's codebase? (Use arrow keys)
  acquia
❯ current working directory
  github
  lagoon
  pantheon
  platformsh
  remote git repo or archive �[29D�[29C.
  • Loading branch information
reynoldsalec committed Feb 27, 2023
1 parent 155d203 commit b418dd5
Show file tree
Hide file tree
Showing 10 changed files with 610 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-drupal-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- examples/drupal8
- examples/drupal9
- examples/drupal10
- examples/drupal10-mysql8
lando-versions:
- edge
os:
Expand Down
1 change: 1 addition & 0 deletions examples/drupal10-mysql8/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mysql8
82 changes: 82 additions & 0 deletions examples/drupal10-mysql8/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Drupal 10 w/MySQL 8 Example
================

This example exists primarily to test the following documentation:

* [Drupal 10 Recipe](https://docs.lando.dev/config/drupal10.html)

Start up tests
--------------

Run the following commands to get up and running with this example.

```bash
# Should poweroff
lando poweroff

# Should initialize the latest Drupal 10 codebase
rm -rf mysql8 && mkdir -p mysql8 && cd mysql8
lando init --source remote --remote-url https://ftp.drupal.org/files/projects/drupal-10.0.x-dev.tar.gz --remote-options="--strip-components 1" --recipe drupal10 --webroot . --name lando-drupal10-mysql8 --option database=mysql:8.0.22

# Should start up successfully
cd mysql8
echo -e "\nplugins:\n \"@lando/drupal/\": ./../../" >> .lando.yml
lando start
```

Verification commands
---------------------

Run the following commands to validate things are rolling as they should.

```bash
# Should return the drupal installation page by default
cd mysql8
lando ssh -s appserver -c "curl -L localhost" | grep "Drupal 10"

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

# Should be running apache 2.4 by default
cd mysql8
lando ssh -s appserver -c "apachectl -V | grep 2.4"
lando ssh -s appserver -c "curl -IL localhost" | grep Server | grep 2.4

# Should be running mysql 8.0.x by default
cd mysql8
lando mysql -V | grep 8.0

# Should be running sqlite 3.34 by default
cd mysql8
lando php -r "print_r(SQLite3::version());" | grep versionString | grep 3.34

# Should not enable xdebug by default
cd mysql8
lando php -m | grep xdebug || echo $? | grep 1

# Should use the default database connection info
cd mysql8
lando mysql -udrupal10 -pdrupal10 drupal10 -e quit

# Should use site-local drush if installed
cd mysql8
lando composer require drush/drush
lando ssh -c "which drush" | grep "/app/vendor/bin/drush"

# Should be able to install drupal
cd mysql8
lando drush si --db-url=mysql://drupal10:drupal10@database/drupal10 -y
```

Destroy tests
-------------

Run the following commands to trash this app like nothing ever happened.

```bash
# Should be destroyed with success
cd mysql8
lando destroy -y
lando poweroff
```
2 changes: 1 addition & 1 deletion examples/drupal10/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Drupal 10 Example
Drupal 10 w/MySQL 8 Example
================

This example exists primarily to test the following documentation:
Expand Down
1 change: 0 additions & 1 deletion recipes/drupal10/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ module.exports = {
} else if (_.get(options, 'database') === 'postgres') {
options.database = 'postgres:12';
}

// Send it downstream
super(id, options);
};
Expand Down
105 changes: 105 additions & 0 deletions recipes/drupal10/mysql8.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#
# The MySQL database server configuration file for Lando
#

[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 = 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 = 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 = 120
#
# * 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
105 changes: 105 additions & 0 deletions recipes/drupal6/mysql8.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#
# The MySQL database server configuration file for Lando
#

[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 = 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 = 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 = 120
#
# * 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
Loading

0 comments on commit b418dd5

Please sign in to comment.