-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
services: | ||
nginx: | ||
image: $IMAGE | ||
environment: | ||
DEBUG: 1 | ||
NGINX_BACKEND_HOST: drupal | ||
NGINX_VHOST_PRESET: drupal11 | ||
NGINX_SERVER_EXTRA_CONF_FILEPATH: /var/www/html/server.conf | ||
NGINX_ALLOW_XML_ENDPOINTS: 1 | ||
NGINX_LOG_FORMAT_OVERRIDE: '$$http_x_forwarded_for - $$remote_user [$$time_local] "$$request" $$status $$body_bytes_sent "$$http_referer" "$$http_user_agent"' | ||
depends_on: | ||
- drupal | ||
volumes: | ||
- codebase:/var/www/html | ||
- ./server.conf:/var/www/html/server.conf | ||
drupal: | ||
image: drupal:11-fpm-alpine | ||
volumes: | ||
- codebase:/var/www/html | ||
|
||
volumes: | ||
codebase: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [[ -n "${DEBUG}" ]]; then | ||
set -x | ||
fi | ||
|
||
nginx_exec() { | ||
docker compose exec -T nginx "${@}" | ||
} | ||
|
||
clean_exit() { | ||
docker compose down -v | ||
} | ||
trap clean_exit EXIT | ||
|
||
docker compose up -d | ||
|
||
nginx_exec make check-ready -f /usr/local/bin/actions.mk | ||
|
||
# TODO: check endpoints of installed Drupal | ||
|
||
echo "Checking Drupal endpoints" | ||
echo -n "Checking / page... " | ||
nginx_exec curl -s -S -I "localhost" | grep '302 Found' | ||
echo -n "authorize.php... " | ||
nginx_exec curl -s -S -I "localhost/core/authorize.php" | grep '500 Service unavailable' | ||
echo -n "install.php... " | ||
nginx_exec curl -s -S -I "localhost/core/install.php" | grep '200 OK' | ||
echo -n "statistics.php... " | ||
nginx_exec curl -s -S -I "localhost/core/modules/statistics/statistics.php" | grep '500 Service unavailable' | ||
echo -n "cron... " | ||
nginx_exec curl -s -S -I "localhost/cron" | grep '302 Found' | ||
echo -n "index.php... " | ||
nginx_exec curl -s -S -I "localhost/index.php" | grep '302 Found' | ||
echo -n "update.php... " | ||
nginx_exec curl -s -S -I "localhost/update.php" | grep '302 Found' | ||
echo -n ".htaccess... " | ||
nginx_exec curl -s -S -I "localhost/.htaccess" | grep '403 Forbidden' | ||
echo -n "favicon.ico... " | ||
nginx_exec curl -s -S -I "localhost/favicon.ico" | grep '200 OK' | ||
echo -n "robots.txt... " | ||
nginx_exec curl -s -S -I "localhost/robots.txt" | grep '200 OK' | ||
echo -n "humans.txt... " | ||
nginx_exec curl -s -S -I "localhost/humans.txt" | grep '302 Found' | ||
echo -n "ads.txt... " | ||
nginx_exec curl -s -S -I "localhost/ads.txt" | grep '302 Found' | ||
echo -n "drupal.js... " | ||
nginx_exec curl -s -S -I "localhost/core/misc/drupal.js" | grep '200 OK' | ||
echo -n "druplicon.png... " | ||
nginx_exec curl -s -S -I "localhost/core/misc/druplicon.png" | grep '200 OK' | ||
echo -n "Checking composer.json" | ||
nginx_exec curl -s -S -I "localhost/composer.json" | grep '404 Not Found' | ||
echo -n "Checking package.json" | ||
nginx_exec curl -s -S -I "localhost/core/package.json" | grep '404 Not Found' | ||
echo -n "Checking web.config" | ||
nginx_exec curl -s -S -I "localhost/web.config" | grep '404 Not Found' | ||
|
||
echo -n "Checking non existing php endpoint... " | ||
nginx_exec curl -s -S -I "localhost/non-existing.php" | grep '404 Not Found' | ||
echo -n "Checking user-defined internal temporal redirect... " | ||
nginx_exec curl -s -S -I "localhost/redirect-internal-temporal" | grep '302 Moved Temporarily' | ||
echo -n "Checking user-defined internal permanent redirect... " | ||
nginx_exec curl -s -S -I "localhost/redirect-internal-permanent" | grep '301 Moved Permanently' | ||
echo -n "Checking user-defined external redirect... " | ||
nginx_exec curl -s -S -I "localhost/redirect-external" | grep '302 Moved Temporarily' | ||
echo -n "Checking CSP header... " | ||
nginx_exec curl -s -S -I "localhost" | grep "frame-ancestors 'self'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
rewrite ^/redirect-internal-permanent$ /index.php permanent; | ||
rewrite ^/redirect-internal-temporal$ /index.php redirect; | ||
rewrite ^/redirect-external$ http://example.com/ redirect; |