Skip to content

Commit

Permalink
Drupal 10 BLT project
Browse files Browse the repository at this point in the history
  • Loading branch information
shelane committed Feb 13, 2023
0 parents commit 8d19d58
Show file tree
Hide file tree
Showing 35 changed files with 3,173 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .docksal/addons/blt/blt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

## Run a BLT command inside the cli container.
##
## Usage: fin blt [command]

fin exec /var/www/vendor/bin/blt "$@"
49 changes: 49 additions & 0 deletions .docksal/commands/init
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

## Run blt setup commands to prepare your local site for
## development.
##
## Usage: fin init

# Abort if anything fails
set -e
#-------------------------- Settings --------------------------------

DOCROOT_PATH="${PROJECT_ROOT}/${DOCROOT}"

#-------------------------- END: Settings --------------------------------

#-------------------------- Helper functions --------------------------------

# Console colors
red='\033[0;31m'
green='\033[0;32m'
green_bg='\033[42m'
yellow='\033[1;33m'
NC='\033[0m'

echo-red () { echo -e "${red}$1${NC}"; }
echo-green () { echo -e "${green}$1${NC}"; }
echo-green-bg () { echo -e "${green_bg}$1${NC}"; }
echo-yellow () { echo -e "${yellow}$1${NC}"; }

#-------------------------- END: Helper Functions --------------------------------

#-------------------------- Execution --------------------------------

# Initialize stack
fin reset -f

# Install project requirements
fin exec composer clear-cache --no-interaction
fin exec COMPOSER_PROCESS_TIMEOUT=2000
fin exec COMPOSER_MEMORY_LIMIT=-1 composer install --no-interaction

# Set up blt
cd $DOCROOT_PATH
fin blt setup --no-interaction

echo
echo -en "${green_bg} DONE! ${NC}"
echo
echo -e "Open ${yellow}http://${VIRTUAL_HOST}${NC} in your browser to verify the setup."
19 changes: 19 additions & 0 deletions .docksal/commands/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

## Test site installation
##
## Usage: fin test

# Abort if anything fails
set -e

# Debug mode switch
if [[ "${DEBUG}" != "" ]]; then
set -x
fi

echo "Testing home page..."
curl -sL -I http://${VIRTUAL_HOST} | grep "HTTP/1.1 200 OK"
curl -sL http://${VIRTUAL_HOST} | grep "My BLT site"
echo "Testing login page..."
curl -sL -I http://${VIRTUAL_HOST}/user/login | grep "HTTP/1.1 200 OK"
29 changes: 29 additions & 0 deletions .docksal/docksal.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This is a shared configuration file that is intended to be stored in the project repo.
# To override a variable locally:
# - create .docksal/docksal-local.env file and local variable overrides there
# - add .docksal/docksal-local.env to .gitignore
#
# After editing, apply changes with 'fin up'

# Use the default Docksal LAMP stack
DOCKSAL_STACK=default

# Lock images versions for LAMP services
# This will prevent images from being updated when Docksal is updated
#WEB_IMAGE='docksal/web:x.x-apache2.4'
DB_IMAGE='docksal/mysql:5.7'
CLI_IMAGE='docksal/cli:php8.1-3.3'

# Override virtual host (matches project folder name by default)
# Override document root ('docroot' by default)
DOCROOT=docroot

# MySQL settings.
# MySQL will be exposed on a random port. Use "fin ps" to check the port.
# To have a static MySQL port assigned, copy the line below into the .docksal/docksal-local.env file
# and replace the host port "0" with a unique host port number (e.g. MYSQL_PORT_MAPPING='33061:3306')
MYSQL_PORT_MAPPING='0:3306'

# Enable/disable xdebug
# To override locally, copy the two lines below into .docksal/docksal-local.env and adjust as necessary
XDEBUG_ENABLED=0
1 change: 1 addition & 0 deletions .docksal/docksal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: "3.9"
150 changes: 150 additions & 0 deletions .docksal/settings/default.local.settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<?php

/**
* @file
* Local development override configuration feature.
*/

use Acquia\Blt\Robo\Common\EnvironmentDetector;
use Drupal\Component\Assertion\Handle;

/**
* Database configuration.
*/
$databases['default']['default'] = [
'database' => getenv('MYSQL_DATABASE'),
'username' => getenv('MYSQL_USER'),
'password' => getenv('MYSQL_PASSWORD'),
'host' => getenv('MYSQL_HOST'),
'port' => '3306',
'driver' => 'mysql',
'prefix' => '',
];

// Use development service parameters.
$settings['container_yamls'][] = EnvironmentDetector::getRepoRoot() . '/docroot/sites/development.services.yml';

// Allow access to update.php.
$settings['update_free_access'] = TRUE;

/**
* Assertions.
*
* The Drupal project primarily uses runtime assertions to enforce the
* expectations of the API by failing when incorrect calls are made by code
* under development.
*
* @see http://php.net/assert
* @see https://www.drupal.org/node/2492225
*
* If you are using PHP 7.0 it is strongly recommended that you set
* zend.assertions=1 in the PHP.ini file (It cannot be changed from .htaccess
* or runtime) on development machines and to 0 in production.
*
* @see https://wiki.php.net/rfc/expectations
*/
assert_options(ASSERT_ACTIVE, TRUE);
Handle::register();

/**
* Show all error messages, with backtrace information.
*
* In case the error level could not be fetched from the database, as for
* example the database connection failed, we rely only on this value.
*/
$config['system.logging']['error_level'] = 'verbose';

/**
* Disable CSS and JS aggregation.
*/
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

/**
* Disable the render cache (this includes the page cache).
*
* Note: you should test with the render cache enabled, to ensure the correct
* cacheability metadata is present. However, in the early stages of
* development, you may want to disable it.
*
* This setting disables the render cache by using the Null cache back-end
* defined by the development.services.yml file above.
*
* Do not use this setting until after the site is installed.
*/
// $settings['cache']['bins']['render'] = 'cache.backend.null';
/**
* Disable Dynamic Page Cache.
*
* Note: you should test with Dynamic Page Cache enabled, to ensure the correct
* cacheability metadata is present (and hence the expected behavior). However,
* in the early stages of development, you may want to disable it.
*/
// $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
/**
* Allow test modules and themes to be installed.
*
* Drupal ignores test modules and themes by default for performance reasons.
* During development it can be useful to install test extensions for debugging
* purposes.
*/
$settings['extension_discovery_scan_tests'] = FALSE;


/**
* Configure static caches.
*
* Note: you should test with the config, bootstrap, and discovery caches
* enabled to test that metadata is cached as expected. However, in the early
* stages of development, you may want to disable them. Overrides to these bins
* must be explicitly set for each bin to change the default configuration
* provided by Drupal core in core.services.yml.
* See https://www.drupal.org/node/2754947
*/

// $settings['cache']['bins']['bootstrap'] = 'cache.backend.null';
// $settings['cache']['bins']['discovery'] = 'cache.backend.null';
// $settings['cache']['bins']['config'] = 'cache.backend.null';
/**
* Enable access to rebuild.php.
*
* This setting can be enabled to allow Drupal's php and database cached
* storage to be cleared via the rebuild.php page. Access to this page can also
* be gained by generating a query string from rebuild_token_calculator.sh and
* using these parameters in a request to rebuild.php.
*/
$settings['rebuild_access'] = FALSE;

/**
* Skip file system permissions hardening.
*
* The system module will periodically check the permissions of your site's
* site directory to ensure that it is not writable by the website user. For
* sites that are managed with a version control system, this can cause problems
* when files in that directory such as settings.php are updated, because the
* user pulling in the changes won't have permissions to modify files in the
* directory.
*/
$settings['skip_permissions_hardening'] = TRUE;

/**
* Files paths.
*/
$settings['file_private_path'] = EnvironmentDetector::getRepoRoot() . '/files-private/' . EnvironmentDetector::getSiteName($site_path);
/**
* Site path.
*
* @var string $site_path
* This is always set and exposed by the Drupal Kernel.
*/
// phpcs:ignore
$settings['file_public_path'] = 'sites/' . EnvironmentDetector::getSiteName($site_path) . '/files';

/**
* Trusted host configuration.
*
* See full description in default.settings.php.
*/
$settings['trusted_host_patterns'] = [
'^.+$',
];
124 changes: 124 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Files and directories suggested to be ignored by Drupal
# @see https://git.drupalcode.org/project/drupal/-/blob/9.3.x/example.gitignore
#
# We allow settings.php to be committed since Acquia's filesystem is read-only
# @see https://www.drupal.org/project/drupal/issues/3257119
/docroot/core
/vendor/
/docroot/sites/*/settings.*.php
/docroot/sites/*/services*.yml
/docroot/sites/*/files
/docroot/sites/*/private
/docroot/sites/simpletest

# Directories specific to this template
/docroot/libraries
/docroot/modules/contrib
/docroot/profiles/contrib
/docroot/themes/contrib

# Files and directories for common development environments, loosely inherited from BLT Project
# @see https://github.com/acquia/blt-project/blob/11.x/.gitignore

# OS X
.DS_Store
.AppleDouble
.LSOverride
._*
.Spotlight-V100
.Trashes

# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/

# Eclipse
*.pydevproject
.project
.metadata
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
*.launch
.externalToolBuilders/

# CDT / PDT
.cproject
.buildpathk

# Emacs
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*

# IntelliJ / PhpStorm
.idea/
atlassian-ide-plugin.xml

# XHProf
xhprof_*

# Sass
.sass-cache
*.css.map

# Netbeans IDE
nbproject
nbproject/*

# DrupalVM
.vagrant/

# DevDesktop
*.dd

# NPM
npm-debug.log

# Drush 9 Checksums
drush/sites/.checksums

# Deprecation detector rules
.rules

# PHPCS
.phpcs-cache

# PHPUnit
.phpunit.result.cache

# Drupal check report.
drupal-check-report.xml

# Local files
local.settings.php
local.drush.yml
local.site.yml
local.services.yml
*.local
local.blt.yml

# oauth keys
oauth_keys/

# env-file
/.env*
/.editorconfig
/.gitattributes
deployment_identifier
/travis_wait*
/files-private
Loading

0 comments on commit 8d19d58

Please sign in to comment.