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

Add support for Drupal #646

Merged
merged 2 commits into from
Apr 24, 2023
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
9 changes: 6 additions & 3 deletions commands/env-init.help
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ WARDEN_USAGE=$(cat <<EOF
per-project configuration. See documentation for details:
https://docs.warden.dev/environments/types.html#local

drupal Nginx, php-fpm, and db (mariadb) pre-configured for running
Drupal

laravel Nginx, php-fpm, db (mariadb), and redis services
pre-configured for running Laravel

magento2 Nginx, varnish, php-fpm, db (mariadb), elasticsearch, redis,
and rabbitmq services pre configured for Magento 2; on macOS
systems code files are synced into container using mutagen
Expand All @@ -23,9 +29,6 @@ WARDEN_USAGE=$(cat <<EOF
magento1 Nginx, php-fpm, db (mariadb), and redis services
pre-configured for running Magento 1

laravel Nginx, php-fpm, db (mariadb), and redis services
pre-configured for running Laravel

symfony Nginx, php-fpm, db (mariadb), and redis services
pre-configured for running Symfony 4+
Due to the fact that Symfony uses '.env' file too,
Expand Down
13 changes: 13 additions & 0 deletions environments/drupal/db.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3.5"
services:
db:
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-drupal}
- MYSQL_DATABASE=${MYSQL_DATABASE:-drupal}
- MYSQL_USER=${MYSQL_USER:-drupal}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-drupal}
command:
- mysqld
- --max_allowed_packet=1024M
- --explicit_defaults_for_timestamp=on
- --transaction-isolation=READ-COMMITTED
6 changes: 6 additions & 0 deletions environments/drupal/drupal.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3.5"
services:
nginx:
environment:
- NGINX_PUBLIC=/web
- NGINX_TEMPLATE=/drupal.conf
17 changes: 17 additions & 0 deletions environments/drupal/drupal.darwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.5"

x-volumes: &volumes
- .${WARDEN_WEB_ROOT:-}/web/sites/default/files:/var/www/html/web/sites/default/files:cached
- .${WARDEN_WEB_ROOT:-}/web/sites/default/private:/var/www/html/web/sites/default/private:cached
- appdata:/var/www/html

x-environment: &environment
- CHOWN_DIR_LIST=web/sites/default/files web/sites/default/private ${CHOWN_DIR_LIST:-}

services:
nginx: { volumes: *volumes }
php-fpm: { volumes: *volumes, environment: *environment }
php-debug: { volumes: *volumes, environment: *environment }

volumes:
appdata:
28 changes: 28 additions & 0 deletions environments/drupal/drupal.mutagen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
sync:
defaults:
mode: two-way-resolved
watch:
pollingInterval: 10
ignore:
vcs: true
paths:
# Root .git folder
- "/.git/"

# System files
- ".DS_Store"
- "._*"

# Vim files
- "*~"
- "*.sw[a-p]"

# Drupal files
- "web/sites/default/files/**"
- "web/sites/default/private/**"


permissions:
defaultFileMode: "0644"
defaultDirectoryMode: "0755"
8 changes: 8 additions & 0 deletions environments/drupal/drupal.settings.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.5"

x-volumes: &settings
- .${WARDEN_WEB_ROOT:-}/web/sites/default/settings.php:/var/www/html/web/sites/default/settings.php

services:
php-fpm: { volumes: *settings }
php-debug: { volumes: *settings }
24 changes: 24 additions & 0 deletions environments/drupal/init.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
DB_DISTRIBUTION=mariadb
DB_DISTRIBUTION_VERSION=10.4
NODE_VERSION=18
COMPOSER_VERSION=2
PHP_VERSION=8.2
PHP_XDEBUG_3=1

WARDEN_DB=1
WARDEN_RABBITMQ=0
WARDEN_REDIS=0

RABBITMQ_VERSION=3.8

WARDEN_SYNC_IGNORE=

WARDEN_ALLURE=0
WARDEN_SELENIUM=0
WARDEN_SELENIUM_DEBUG=0
WARDEN_BLACKFIRE=0

BLACKFIRE_CLIENT_ID=
BLACKFIRE_CLIENT_TOKEN=
BLACKFIRE_SERVER_ID=
BLACKFIRE_SERVER_TOKEN=
34 changes: 34 additions & 0 deletions environments/drupal/init.env.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# If Drupal directories exist, make sure the minimum user-content upload directories exist
if [[ -d "${WARDEN_ENV_PATH}/web/sites/default" ]] && [[ ! -d "${WARDEN_ENV_PATH}/web/sites/default/files" ]]
then
echo -e "\033[1;33m[!] \033[0mCreating missing user-content directory: \"\033[36m${WARDEN_ENV_PATH}/web/sites/default/files\033[0m\"."
mkdir -p "${WARDEN_ENV_PATH}/web/sites/default/files"
fi

if [[ ! -d "${WARDEN_ENV_PATH}/web/sites/default/private" ]]; then
echo -e "\033[1;33m[!] \033[0mCreating missing private user-content directory: \"\033[36m${WARDEN_ENV_PATH}/web/sites/default/private\033[0m\"."
mkdir -p "${WARDEN_ENV_PATH}/web/sites/default/private"
cat > "${WARDEN_ENV_PATH}/web/sites/default/private/.htaccess" <<-EOT
# Drupal SA-CORE-2013-003
# This file attempts to provide defense in depth to Apache servers. See
# https://www.drupal.org/forum/newsletters/security-advisories-for-drupal-core/2013-11-20/sa-core-2013-003-drupal-core

# Turn off all options we don't need.
Options None
Options +FollowSymLinks

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
php_flag engine off
</IfModule>

Deny from all
EOT
fi