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

Increased test coverage for Drupal nginx images. PHP 8.3 bump. #66

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
This template includes everything necessary to run on [Lagoon](https://www.github.com/uselagoon/lagoon) (in both the local development environments or on hosted Lagoon clusters.)

This project template should provide a kickstart for managing your site
dependencies with [Composer](https://getcomposer.org/). It is based on the [original Drupal Composer Template](https://github.com/drupal-composer/drupal-project),
dependencies with [Composer](https://getcomposer.org/). It is based on the [original Drupal Composer Template](https://github.com/drupal-composer/drupal-project),

## Included Services

This example contains the following services:
* Drupal 10 (prerelease versions)
* PHP 8.1
* PHP 8.3
* NGINX
* MariaDB 10.6

Expand Down Expand Up @@ -73,7 +73,7 @@ lando drush si -y
```

6. Visit the new site @ `http://drupal10-base.lndo.site`

7. For more information on how to configure your site, check out the [documentation](https://docs.lando.dev/config/lagoon.html).

## What does the template do?
Expand All @@ -93,7 +93,7 @@ When installing the given `composer.json` some tasks are taken care of:

## Updating Drupal Core

Follow the steps below to update your core files. Scaffolding is managed by Drupal core. See the `assets/` directory for more information.
Follow the steps below to update your core files. Scaffolding is managed by Drupal core. See the `assets/` directory for more information.

1. Run `composer update drupal/core-recommended drupal/core-dev-pinned --with-dependencies`

Expand Down
43 changes: 39 additions & 4 deletions TESTING_dockercompose.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Docker Compose Drupal 10 base - php8.1, nginx, mariadb
Docker Compose Drupal 10 base - php8.3, nginx, mariadb
======================================================

This is a docker-compose version of the Lando example tests:
Expand Down Expand Up @@ -45,8 +45,8 @@ docker-compose exec -T cli bash -c "env | grep LAGOON=" | grep cli-drupal
docker-compose exec -T cli bash -c "env" | grep LAGOON_ROUTE | grep drupal10-base.docker.amazee.io
docker-compose exec -T cli bash -c "env" | grep LAGOON_ENVIRONMENT_TYPE | grep development

# Should be running PHP 8
docker-compose exec -T cli bash -c "php -v" | grep "PHP 8"
# Should be running PHP 8.3
docker-compose exec -T cli bash -c "php -v" | grep "PHP 8.3"

# Should have composer
docker-compose exec -T cli bash -c "composer --version"
Expand All @@ -67,7 +67,42 @@ docker-compose exec -T cli bash -c "node --version"
docker-compose exec -T cli bash -c "yarn --version"

# Should have a running Drupal 10 site served by nginx on port 8080
docker-compose exec -T cli bash -c "curl -kL http://nginx:8080" | grep "Drush Site-Install"
docker-compose exec -T cli bash -c "curl -skL http://nginx:8080" | grep "Drush Site-Install"

# Should have index.php redirection rules
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/index.php/node" | grep "HTTP/1.1 301"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/index.php/node" | grep "Location: http://nginx/node"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/index.php/node/1" | grep "HTTP/1.1 301"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/index.php/node/1" | grep "Location: http://nginx/node/1"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/index.php/node/1?query=true" | grep "HTTP/1.1 301"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/index.php/node/1?query=true" | grep "Location: http://nginx/node/1?query=true"

# Should block random text files
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/INSTALL.txt" | grep "HTTP/1.1 404"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/README.md" | grep "HTTP/1.1 404"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/sites/README.txt" | grep "HTTP/1.1 404"

# Should not block text files in public files
docker-compose exec -T nginx bash -c "echo banana > /app/web/sites/default/files/test.txt"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/sites/default/files/test.txt" | grep "HTTP/1.1 200"

# Should allow .well-known static files
docker-compose exec -T nginx bash -c "mkdir -p /app/web/.well-known/"
docker-compose exec -T nginx bash -c "echo banana > /app/web/.well-known/apple-developer-merchantid-domain-association"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/.well-known/apple-developer-merchantid-domain-association" | grep "HTTP/1.1 200"

# Should block other dot files.
docker-compose exec -T nginx bash -c "mkdir -p /app/web/.aws/"
docker-compose exec -T nginx bash -c "echo banana > /app/web/.aws/credentials.yml"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/.aws/credentials.yml" | grep "HTTP/1.1 404"

# Should block database dump downloads
docker-compose exec -T nginx bash -c "echo banana > /app/web/dumpy.sql"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/dumpy.sql" | grep "HTTP/1.1 404"

# Should block random PHP files from executing
docker-compose exec -T nginx bash -c "echo PD9waHAgcGhwaW5mbygpOz8+ | base64 -d > /app/web/info.php"
docker-compose exec -T cli bash -c "curl -sIk http://nginx:8080/info.php" | grep "HTTP/1.1 404"

# Should be able to db-export and db-import the database
docker-compose exec -T cli bash -c "drush sql-dump --result-file /app/test.sql"
Expand Down
6 changes: 3 additions & 3 deletions TESTING_lando.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Lando Drupal 10 base - php8.1, nginx, mariadb
Lando Drupal 10 base - php8.3, nginx, mariadb
=============================================

This example exists primarily to test the following documentation:
Expand Down Expand Up @@ -46,8 +46,8 @@ lando ssh -c "env | grep LAGOON=" | grep cli-drupal
lando ssh -c "env" | grep LAGOON_ROUTE | grep drupal10-base.lndo.site
lando ssh -c "env" | grep LAGOON_ENVIRONMENT_TYPE | grep development

# Should be running PHP 8.1
lando ssh -c "php -v" | grep "PHP 8.1"
# Should be running PHP 8.3
lando ssh -c "php -v" | grep "PHP 8.3"

# Should have composer
lando composer --version
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"drupal/core-composer-scaffold": true,
"drupal/core-project-message": true,
"phpstan/extension-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"php-http/discovery": true
}
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion lagoon/cli.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM uselagoon/php-8.1-cli-drupal:latest
FROM uselagoon/php-8.3-cli-drupal:latest

COPY composer.* /app/
COPY assets /app/assets
Expand Down
2 changes: 1 addition & 1 deletion lagoon/php.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG CLI_IMAGE
FROM ${CLI_IMAGE} as cli

FROM uselagoon/php-8.1-fpm:latest
FROM uselagoon/php-8.3-fpm:latest

COPY --from=cli /app /app
Loading