From 12f071d4bc97d20f5ec5383e734cb6d3b2c38660 Mon Sep 17 00:00:00 2001 From: Aaron Feledy Date: Tue, 7 May 2024 18:56:05 -0400 Subject: [PATCH] Add Drupal 11 support --- .github/workflows/pr-drupal-tests.yml | 2 + CHANGELOG.md | 4 + README.md | 4 +- builders/drupal11.js | 39 +++++++++ config/drupal11/default.conf.tpl | 116 ++++++++++++++++++++++++++ config/drupal11/mysql.cnf | 111 ++++++++++++++++++++++++ config/drupal11/mysql8.cnf | 106 +++++++++++++++++++++++ config/drupal11/php.ini | 50 +++++++++++ docs/config.md | 4 +- docs/development.md | 1 + docs/getting-started.md | 31 ++++++- docs/index.md | 2 +- examples/drupal11-nginx/.gitignore | 1 + examples/drupal11-nginx/README.md | 87 +++++++++++++++++++ examples/drupal11/.gitignore | 1 + examples/drupal11/README.md | 91 ++++++++++++++++++++ inits/drupal11.js | 8 ++ 17 files changed, 652 insertions(+), 6 deletions(-) create mode 100644 builders/drupal11.js create mode 100644 config/drupal11/default.conf.tpl create mode 100644 config/drupal11/mysql.cnf create mode 100644 config/drupal11/mysql8.cnf create mode 100644 config/drupal11/php.ini create mode 100644 examples/drupal11-nginx/.gitignore create mode 100644 examples/drupal11-nginx/README.md create mode 100644 examples/drupal11/.gitignore create mode 100644 examples/drupal11/README.md create mode 100644 inits/drupal11.js diff --git a/.github/workflows/pr-drupal-tests.yml b/.github/workflows/pr-drupal-tests.yml index 30dd5b3..6637581 100644 --- a/.github/workflows/pr-drupal-tests.yml +++ b/.github/workflows/pr-drupal-tests.yml @@ -25,6 +25,8 @@ jobs: - examples/drupal10 - examples/drupal10-mysql8 - examples/drupal10-nginx + - examples/drupal11 + - examples/drupal11-nginx lando-version: - 3-dev-slim os: diff --git a/CHANGELOG.md b/CHANGELOG.md index ca594d9..996ca1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased + +* Added support for Drupal 11 + ## v1.4.0 - [April 16, 2024](https://github.com/lando/drupal/releases/tag/v1.4.0) * Updated version of Composer used with Drupal 9 and 10 to `2-latest`. [#31](https://github.com/lando/drupal/issues/31) diff --git a/README.md b/README.md index 8942ad6..b805a1a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This is the _official_ [Lando](https://lando.dev) plugin for [Drupal](https://www.drupal.org/). When installed it... * Allows users to run `drupal` cms -* Allows users to configure `php` version from `5.3` all the way to `8.1` +* Allows users to configure `php` version from `5.3` all the way to `8.3` * Allows users to configure `webroot` * Allows users to configure web server to (`apache` or `nginx`) * Allows users to configure database backend to (`mariadb`, `mysql`, or `postgres`) @@ -61,7 +61,7 @@ git clone https://github.com/lando/drupal.git && cd drupal yarn install ``` -If you dont' want to install Node 14 or Yarn for whatever reason you can install [Lando](https://docs.lando.dev/basics/installation.html) and use that: +If you don't want to install Node 18 or Yarn for whatever reason you can install [Lando](https://docs.lando.dev/basics/installation.html) and use that: ```bash git clone https://github.com/lando/drupal.git && cd drupal diff --git a/builders/drupal11.js b/builders/drupal11.js new file mode 100644 index 0000000..f2b0283 --- /dev/null +++ b/builders/drupal11.js @@ -0,0 +1,39 @@ +'use strict'; + +// Modules +const _ = require('lodash'); +const path = require('path'); + +/* + * Build Drupal 11 + */ +module.exports = { + name: 'drupal11', + parent: '_drupaly', + config: { + confSrc: path.resolve(__dirname, '..', 'config', 'drupal11'), + defaultFiles: {}, + php: '8.3', + drush: '^13', + composer_version: '2-latest', + }, + builder: (parent, config) => class LandoDrupal11 extends parent { + constructor(id, options = {}) { + options = _.merge({}, config, options); + // Set drush to false + options.drush = false; + + // Let's make sure we set appropriate default versions for things + // See: https://www.drupal.org/docs/system-requirements/database-server-requirements + if (_.get(options, 'database') === 'mysql') { + options.database = 'mysql:8.0'; + } else if (_.get(options, 'database') === 'mariadb') { + options.database = 'mariadb:10.6'; + } else if (_.get(options, 'database') === 'postgres') { + options.database = 'postgres:16'; + } + // Send it downstream + super(id, options); + }; + }, +}; diff --git a/config/drupal11/default.conf.tpl b/config/drupal11/default.conf.tpl new file mode 100644 index 0000000..c3e177c --- /dev/null +++ b/config/drupal11/default.conf.tpl @@ -0,0 +1,116 @@ +# LANDODRUPALNGINXCONF + +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; + root "{{LANDO_WEBROOT}}"; + location = /favicon.ico { + log_not_found off; + access_log off; + } + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + # Very rarely should these ever be accessed outside of your lan + location ~* \.(txt|log)$ { + allow 192.168.0.0/16; + deny all; + } + + location ~ \..*/.*\.php$ { + return 403; + } + + location ~ ^/sites/.*/private/ { + return 403; + } + + # Allow "Well-Known URIs" as per RFC 5785 + location ~* ^/.well-known/ { + allow all; + } + + # Block access to "hidden" files and directories whose names begin with a + # period. This includes directories used by version control systems such + # as Subversion or Git to store control files. + location ~ (^|/)\. { + return 403; + } + + location / { + # try_files $uri @rewrite; # For Drupal <= 6 + try_files $uri /index.php?$query_string; # For Drupal >= 7 + } + + location @rewrite { + #rewrite ^/(.*)$ /index.php?q=$1; # For Drupal <= 6 + rewrite ^ /index.php; # For Drupal >= 7 + } + + # Don't allow direct access to PHP files in the vendor directory. + location ~ /vendor/.*\.php$ { + deny all; + return 404; + } + + # In Drupal 11, we must also match new paths where the '.php' appears in + # the middle, such as update.php/selection. The rule we use is strict, + # and only allows this pattern with the update.php front controller. + # This allows legacy path aliases in the form of + # blog/index.php/legacy-path to continue to route to Drupal nodes. If + # you do not have any paths like that, then you might prefer to use a + # laxer rule, such as: + # location ~ \.php(/|$) { + # The laxer rule will continue to work if Drupal uses this new URL + # pattern with front controllers other than update.php in a future + # release. + location ~ '\.php$|^/update.php' { + fastcgi_split_path_info ^(.+?\.php)(|/.*)$; + # Security note: If you're running a version of PHP older than the + # latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini. + # See http://serverfault.com/q/627903/94922 for details. + include fastcgi_params; + # Block httpoxy attacks. See https://httpoxy.org/. + fastcgi_param HTTP_PROXY ""; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param QUERY_STRING $query_string; + fastcgi_intercept_errors on; + # PHP 5 socket location. + #fastcgi_pass unix:/var/run/php5-fpm.sock; + # PHP 7 socket location. + #fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; + #lando + fastcgi_pass fpm:9000; + } + # Fighting with Styles? This little gem is amazing. + # location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6 + location ~ ^(/[a-z\-]+)?/sites/.*/files/(css|js|styles)/ { # For Drupal >= 7 + try_files $uri @rewrite; + } + # Handle private files through Drupal. Private file's path can come + # with a language prefix. + location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7 + try_files $uri /index.php?$query_string; + } + + location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { + expires max; + log_not_found off; + } + +} diff --git a/config/drupal11/mysql.cnf b/config/drupal11/mysql.cnf new file mode 100644 index 0000000..b8b6190 --- /dev/null +++ b/config/drupal11/mysql.cnf @@ -0,0 +1,111 @@ +# +# The MySQL database server configuration file for Lando +# +# LANDODRUPALMYSQLCNF + +[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/drupal11/mysql8.cnf b/config/drupal11/mysql8.cnf new file mode 100644 index 0000000..e616c5a --- /dev/null +++ b/config/drupal11/mysql8.cnf @@ -0,0 +1,106 @@ +# +# The MySQL database server configuration file for Lando +# +# LANDODRUPALMYSQL8CNF + +[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/drupal11/php.ini b/config/drupal11/php.ini new file mode 100644 index 0000000..6d6a378 --- /dev/null +++ b/config/drupal11/php.ini @@ -0,0 +1,50 @@ +[PHP] + +; LANDODRUPALPHPINI +;;;;;;;;;;;;;;; +; 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/docs/config.md b/docs/config.md index 5f46cb5..7154799 100644 --- a/docs/config.md +++ b/docs/config.md @@ -33,7 +33,7 @@ Note that if the above config options are not enough all Lando recipes can be fu If you've initialized a site with `lando init` there is a good chance this is already set correctly. However, definitely make sure you are vibing the correct major version of Drupal as the underlying server config differs. ```yaml -recipe: drupal10|drupal9|drupal8|drupal7|drupal6 +recipe: drupal11|drupal10|drupal9|drupal8|drupal7|drupal6 config: php: '7.4' ``` @@ -62,7 +62,7 @@ config: composer_version: '1.10.1' ``` -By default, Drupal 9 and 10 use the latest version of Composer 2.x. +By default, Drupal 9 and above use the latest version of Composer 2.x. ## Choosing a webserver diff --git a/docs/development.md b/docs/development.md index 5349b30..eed81f7 100644 --- a/docs/development.md +++ b/docs/development.md @@ -140,6 +140,7 @@ jobs: leia-test: - examples/drupal10 - examples/drupal11 + - examples/drupal12 ``` diff --git a/docs/getting-started.md b/docs/getting-started.md index 6fa80a6..c9a9260 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -28,7 +28,7 @@ mkdir my-first-drupal10-app \ --name my-first-drupal10-app # Create latest drupal10 project via composer -lando composer create-project drupal/recommended-project:10.0.x-dev@dev tmp && cp -r tmp/. . && rm -rf tmp +lando composer create-project drupal/recommended-project:10.x tmp && cp -r tmp/. . && rm -rf tmp # Composer can timeout on install for some machines, if that happens, run the following command and then re-run the previous lando composer command: # lando composer config --global process-timeout 2000 @@ -71,6 +71,35 @@ lando composer require drush/drush # Install drupal lando drush site:install --db-url=mysql://drupal9:drupal9@database/drupal9 -y +# List information about this app +lando info +``` + +```bash:no-line-numbers [DRUPAL 11.x-dev] +# Initialize a drupal11 recipe +mkdir my-first-drupal11-app \ + && cd my-first-drupal11-app \ + && lando init \ + --source cwd \ + --recipe drupal11 \ + --webroot web \ + --name my-first-drupal11-app + +# Create latest drupal11 project via composer +lando composer create-project drupal/recommended-project:11.0.x-dev@dev tmp && cp -r tmp/. . && rm -rf tmp + +# Composer can timeout on install for some machines, if that happens, run the following command and then re-run the previous lando composer command: +# lando composer config --global process-timeout 2000 + +# Start it up +lando start + +# Install a site local drush +lando composer require drush/drush + +# Install drupal +lando drush site:install --db-url=mysql://drupal10:drupal10@database/drupal10 -y + # List information about this app lando info ``` diff --git a/docs/index.md b/docs/index.md index 24731b1..972a3dd 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,7 +10,7 @@ Drupal is a free and open source content-management framework written in PHP and #### Features of this plugin: -* Supports `drupal6`, `drupal7`, `drupal8`, `drupal9` and `drupal10`. +* Supports `drupal6`, `drupal7`, `drupal8`, `drupal9`, `drupal10` and `drupal11`. * Configurable `php` version from `5.3` all the way to `8.3` * Configurable `webroot` * Configurable web server (`apache` or `nginx`) diff --git a/examples/drupal11-nginx/.gitignore b/examples/drupal11-nginx/.gitignore new file mode 100644 index 0000000..68b7d12 --- /dev/null +++ b/examples/drupal11-nginx/.gitignore @@ -0,0 +1 @@ +nginx diff --git a/examples/drupal11-nginx/README.md b/examples/drupal11-nginx/README.md new file mode 100644 index 0000000..ee19810 --- /dev/null +++ b/examples/drupal11-nginx/README.md @@ -0,0 +1,87 @@ +Drupal 11 w/Nginx Example +================ + +This example exists primarily to test the following documentation: + +* [Drupal 11 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 11 codebase +rm -rf nginx && mkdir -p nginx && cd nginx +lando init --source remote --remote-url https://ftp.drupal.org/files/projects/drupal-11.0.x-dev.tar.gz --remote-options="--strip-components 1" --recipe drupal11 --webroot . --name lando-drupal11-nginx --option via=nginx + +# Should start up successfully +cd nginx +cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.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 nginx +lando ssh -s appserver -c "curl -L appserver_nginx" | grep "Drupal 11" + +# Should use 8.3 as the default php version +cd nginx +lando php -v | grep "PHP 8.3" + +# Should be running nginx 1.25 by default +cd nginx +lando ssh -s appserver_nginx -c "nginx -v 2>&1 | grep 1.25" +lando ssh -s appserver -c "curl -IL appserver_nginx" | grep Server | grep nginx + +# Should be running mysql 8.0.x by default +cd nginx +lando mysql -V | grep 8.0 + +# Should be running sqlite 3.34 by default +cd nginx +lando php -r "print_r(SQLite3::version());" | grep versionString | grep 3.34 + +# Should not enable xdebug by default +cd nginx +lando php -m | grep xdebug || echo $? | grep 1 + +# Should use the default database connection info +cd nginx +lando mysql -udrupal11 -pdrupal11 drupal11 -e quit + +# Should use site-local drush if installed +cd nginx +lando composer require drush/drush +lando ssh -c "which drush" | grep "/app/vendor/bin/drush" + +# Should be able to install drupal +cd nginx +lando drush si --db-url=mysql://drupal11:drupal11@database/drupal11 -y + +# Should be able to enable and access jsonapi +cd nginx +lando drush en jsonapi -y +lando ssh -c "curl lando-drupal11-nginx.lndo.site/jsonapi" | grep "action--action" +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +cd nginx +lando destroy -y +lando poweroff +``` diff --git a/examples/drupal11/.gitignore b/examples/drupal11/.gitignore new file mode 100644 index 0000000..9442b1e --- /dev/null +++ b/examples/drupal11/.gitignore @@ -0,0 +1 @@ +drupal11 diff --git a/examples/drupal11/README.md b/examples/drupal11/README.md new file mode 100644 index 0000000..9340e1d --- /dev/null +++ b/examples/drupal11/README.md @@ -0,0 +1,91 @@ +Drupal 11 Example +================ + +This example exists primarily to test the following documentation: + +* [Drupal 11 Recipe](https://docs.lando.dev/plugins/drupal) + +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 11 codebase +rm -rf drupal11 && mkdir -p drupal11 && cd drupal11 +lando init --source remote --remote-url https://ftp.drupal.org/files/projects/drupal-11.0.x-dev.tar.gz --remote-options="--strip-components 1" --recipe drupal11 --webroot . --name lando-drupal11 + +# Should start up successfully +cd drupal11 +cp -f ../../.lando.upstream.yml .lando.upstream.yml && cat .lando.upstream.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 drupal11 +lando ssh -s appserver -c "curl -L localhost" | grep "Drupal 11" + +# Should use 8.3 as the default php version +cd drupal11 +lando php -v | grep "PHP 8.3" + +# Should be running apache 2.4 by default +cd drupal11 +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 drupal11 +lando mysql -V | grep 8.0 + +# Should be running sqlite 3.34 by default +cd drupal11 +lando php -r "print_r(SQLite3::version());" | grep versionString | grep 3.34 + +# Should not enable xdebug by default +cd drupal11 +lando php -m | grep xdebug || echo $? | grep 1 + +# Should use the default database connection info +cd drupal11 +lando mysql -udrupal11 -pdrupal11 drupal11 -e quit + +# Should use a composer version above 2.7.0 +cd drupal11 +lando composer --version | cut -d " " -f 3 | head -n 1 | awk -v min=2.7.0 -F. '($1 > 2) || ($1 == 2 && $2 > 7) || ($1 == 2 && $2 == 7 && $3 > 0)' + +# Should use site-local drush if installed +cd drupal11 +lando composer require drush/drush +lando ssh -c "which drush" | grep "/app/vendor/bin/drush" + +# Should be able to install drupal +cd drupal11 +lando drush si --db-url=mysql://drupal11:drupal11@database/drupal11 -y + +# Should be able to enable and access jsonapi +cd drupal11 +lando drush en jsonapi -y +lando ssh -c "curl localhost/jsonapi" | grep "action--action" +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +cd drupal11 +lando destroy -y +lando poweroff +``` diff --git a/inits/drupal11.js b/inits/drupal11.js new file mode 100644 index 0000000..8a46488 --- /dev/null +++ b/inits/drupal11.js @@ -0,0 +1,8 @@ +'use strict'; + +/* + * Init Lamp + */ +module.exports = { + name: 'drupal11', +};