-
Notifications
You must be signed in to change notification settings - Fork 78
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
5 changed files
with
200 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
8.4#2024-12-13T06:49:08.017486Z | ||
8.3#2024-12-13T06:49:08.017486Z | ||
8.2#2024-12-13T06:49:08.017486Z | ||
8.1#2024-12-13T06:49:08.017486Z | ||
8.4#2024-12-16T16:30:46.606418Z | ||
8.3#2024-12-16T16:30:46.606418Z | ||
8.2#2024-12-16T16:30:46.606418Z | ||
8.1#2024-12-16T16:30:46.606418Z |
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,78 @@ | ||
version: "2" | ||
|
||
services: | ||
nginx: | ||
image: wodby/nginx | ||
environment: | ||
NGINX_BACKEND_HOST: php | ||
NGINX_VHOST_PRESET: drupal7 | ||
NGINX_SERVER_ROOT: /var/www/html/web | ||
NGINX_SERVER_NAME: drupal7.test | ||
volumes: | ||
- codebase:/var/www/html | ||
- files:/mnt/files | ||
depends_on: | ||
- php | ||
|
||
mariadb: | ||
image: wodby/mariadb | ||
environment: | ||
MYSQL_ROOT_PASSWORD: password | ||
MYSQL_USER: drupal | ||
MYSQL_PASSWORD: drupal | ||
MYSQL_DATABASE: drupal | ||
|
||
valkey: | ||
image: wodby/valkey | ||
environment: | ||
VALKEY_PASSWORD: valkey | ||
|
||
varnish: | ||
image: wodby/varnish:4 | ||
depends_on: | ||
- nginx | ||
environment: | ||
VARNISH_SECRET: secret | ||
VARNISH_BACKEND_HOST: nginx | ||
VARNISH_BACKEND_PORT: 80 | ||
VARNISH_CONFIG_PRESET: drupal | ||
VARNISH_PURGE_EXTERNAL_REQUEST_HEADER: X-Real-IP | ||
|
||
php: | ||
image: $IMAGE | ||
environment: | ||
DEBUG: 1 | ||
PHP_SESSION_COOKIE_LIFETIME: 2000000 | ||
PHP_SESSION_GC_DIVISOR: 100 | ||
PHP_SESSION_GC_MAXLIFETIME: 200000 | ||
DOCROOT_SUBDIR: web | ||
DRUPAL_ENABLE_REDIS_CACHE: 1 | ||
DRUPAL_VERSION: 7 | ||
DRUPAL_SITE: default | ||
DRUPAL_HASH_SALT: drupal-bad-hash-salt | ||
DRUPAL_FILES_SYNC_SALT: drupal-files-sync-bad-salt | ||
WODBY_HOSTS: |- | ||
["drupal7.test","drupal7.wodby.wod.by","test.drupal7.wodby.wod.by"] | ||
WODBY_HOST_PRIMARY: drupal7.test | ||
WODBY_URL_PRIMARY: http://drupal7.test | ||
DB_HOST: mariadb | ||
DB_USER: drupal | ||
DB_PASSWORD: drupal | ||
DB_NAME: drupal | ||
DB_DRIVER: mysql | ||
VARNISH_HOST: varnish | ||
VARNISH_TERMINAL_PORT: 6082 | ||
VARNISH_SECRET: secret | ||
VARNISH_VERSION: 4 | ||
REDIS_HOST: valkey | ||
REDIS_PORT: 6379 | ||
REDIS_PASSWORD: valkey | ||
PHP_SENDMAIL_PATH: /bin/true | ||
volumes: | ||
- codebase:/var/www/html | ||
- files:/mnt/files | ||
- ./tests.sh:/usr/local/bin/tests.sh | ||
|
||
volumes: | ||
codebase: | ||
files: |
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,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [[ -n "${DEBUG}" ]]; then | ||
set -x | ||
fi | ||
|
||
check_ready() { | ||
docker compose exec -T "${1}" make check-ready "${@:2}" -f /usr/local/bin/actions.mk | ||
} | ||
|
||
docker compose up -d | ||
|
||
check_ready nginx max_try=10 | ||
check_ready php max_try=10 | ||
check_ready mariadb max_try=12 wait_seconds=5 | ||
|
||
# Fix php volumes permissions again | ||
# Docker sets ephemeral shared volume ownership to default user (wodby) in nginx container (started after php) | ||
# In case of -dev-macos version of php images wodby owner uid/gid in php and nginx containers do not match | ||
if [[ "${IMAGE}" =~ "-dev-macos" ]]; then | ||
docker compose exec -T php sudo init_container | ||
fi | ||
|
||
docker compose exec -T --user=0 php apk add --update jq | ||
docker compose exec -T php tests.sh | ||
docker compose down -v |
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,84 @@ | ||
#!/usr/bin/env bash | ||
|
||
# TODO: test sites.php entries | ||
|
||
set -e | ||
|
||
if [[ -n "${DEBUG}" ]]; then | ||
set -x | ||
fi | ||
|
||
check_rq() { | ||
echo "Checking requirement: ${1} must be ${2}" | ||
# TODO: remove COLUMNS=0 with drush 8.1.17 release | ||
# see https://github.com/drush-ops/drush/issues/3410 | ||
COLUMNS=0 drush rq --format=json | jq ".\"${1}\".value" | grep -q "${2}" | ||
echo "OK" | ||
} | ||
|
||
check_status() { | ||
echo "Checking status: ${1} must be ${2}" | ||
# TODO: remove COLUMNS=0 with drush 8.1.17 release | ||
# see https://github.com/drush-ops/drush/issues/3410 | ||
COLUMNS=0 drush status --format=yaml | grep -q "${1}: ${2}" | ||
echo "OK" | ||
} | ||
|
||
run_action() { | ||
make "${@}" -f /usr/local/bin/actions.mk | ||
} | ||
|
||
echo -n "Checking environment variables... " | ||
env | grep -q ^DOCROOT_SUBDIR= | ||
env | grep -q ^DRUPAL_VERSION= | ||
env | grep -q ^DRUPAL_SITE= | ||
echo "OK" | ||
|
||
if [[ -n "${DOCROOT_SUBDIR}" ]]; then | ||
DRUPAL_ROOT="${APP_ROOT}/${DOCROOT_SUBDIR}" | ||
else | ||
DRUPAL_ROOT="${APP_ROOT}" | ||
fi | ||
|
||
FILES_ARCHIVE_URL="https://s3.amazonaws.com/wodby-sample-files/drupal-php-import-test/files.tar.gz" | ||
GIT_URL="https://github.com/drupal-composer/drupal-project.git" | ||
|
||
make git-clone url="${GIT_URL}" -f /usr/local/bin/actions.mk | ||
make git-checkout target=7.x -f /usr/local/bin/actions.mk | ||
|
||
COMPOSER_MEMORY_LIMIT=-1 composer install -n | ||
composer require drupal/varnish drupal/redis | ||
|
||
cd "${DRUPAL_ROOT}" | ||
|
||
run_action files-import source="${FILES_ARCHIVE_URL}" | ||
run_action init-drupal | ||
|
||
echo -n "Checking drush... " | ||
drush version --format=yaml | ||
echo "OK" | ||
|
||
drush si -vvv -y --db-url="${DB_DRIVER}://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}" | ||
drush en varnish redis -y --quiet | ||
|
||
run_action cache-clear | ||
|
||
check_status "root" "${DRUPAL_ROOT}" | ||
check_status "drupal-settings-file" "sites/${DRUPAL_SITE}/settings.php" | ||
check_status "site" "sites/${DRUPAL_SITE}" | ||
check_status "files" "sites/${DRUPAL_SITE}/files" | ||
check_status "private" "${FILES_DIR}/private" | ||
check_status "temp" "/tmp" | ||
|
||
check_rq "redis" "Connected, using the <em>PhpRedis</em> client" | ||
check_rq "varnish" "Running" | ||
check_rq "file system" "Writable (<em>public</em> download method)" | ||
check_rq "settings.php" "Protected" | ||
|
||
echo -n "Checking imported files... " | ||
curl -s -I -H "host: ${WODBY_HOST_PRIMARY}" "nginx/sites/default/files/logo.png" | grep -q "200 OK" | ||
echo "OK" | ||
|
||
echo -n "Checking Drupal homepage... " | ||
curl -s -H "host: ${WODBY_HOST_PRIMARY}" "nginx" | grep -q "Drupal ${DRUPAL_VERSION} (http://drupal.org)" | ||
echo "OK" |