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

Adds Drupal 11 support #109

Merged
merged 2 commits into from
May 8, 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
2 changes: 2 additions & 0 deletions .github/workflows/pr-drupal-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
- examples/drupal10
- examples/drupal10-mysql8
- examples/drupal10-nginx
- examples/drupal11
- examples/drupal11-nginx
lando-version:
- 3-dev-slim
os:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions builders/drupal11.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'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
switch (_.get(options, 'database', 'mysql')) {
case 'mysql':
options.database = 'mysql:8.0';
break;
case 'mariadb':
options.database = 'mariadb:10.6';
break;
case 'postgres':
options.database = 'postgres:16';
break;
}
// Send it downstream
super(id, options);
};
},
};
116 changes: 116 additions & 0 deletions config/drupal11/default.conf.tpl
Original file line number Diff line number Diff line change
@@ -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;
}

}
111 changes: 111 additions & 0 deletions config/drupal11/mysql.cnf
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading