-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
6 changed files
with
189 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Exclude local configuration overrides | ||
docksal-local.env | ||
docksal-local.yml |
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,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
## Initialize stack and site (full reset) | ||
## | ||
## Usage: fin init | ||
|
||
# Abort if anything fails | ||
set -e | ||
|
||
#-------------------------- Helper functions -------------------------------- | ||
|
||
# Console colors | ||
red='\033[0;31m' | ||
green='\033[0;32m' | ||
green_bg='\033[1;97;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}"; } | ||
|
||
#-------------------------- Execution -------------------------------- | ||
|
||
# Stack initialization | ||
echo -e "${green_bg} Step 1 ${NC}${green} Initializing stack...${NC}" | ||
fin project reset -f | ||
|
||
# Site initialization | ||
echo -e "${green_bg} Step 2 ${NC}${green} Initializing site...${NC}" | ||
# This runs inside cli using http://docs.docksal.io/en/v1.4.0/fin/custom-commands/#executing-commands-inside-cli | ||
fin init-site | ||
|
||
echo -e "${green_bg} DONE! ${NC}${green} Completed all initialization steps.${NC}" | ||
|
||
#-------------------------- END: Execution -------------------------------- |
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,99 @@ | ||
#!/usr/bin/env bash | ||
|
||
#: exec_target = cli | ||
|
||
## Initialize/reinstall site | ||
## | ||
## Usage: fin init-site | ||
|
||
# Abort if anything fails | ||
set -e | ||
|
||
#-------------------------- Settings -------------------------------- | ||
|
||
# PROJECT_ROOT and DOCROOT are set as env variables in cli | ||
SITE_DIRECTORY="default" | ||
DOCROOT_PATH="${PROJECT_ROOT}/${DOCROOT}" | ||
SITEDIR_PATH="${DOCROOT_PATH}/sites/${SITE_DIRECTORY}" | ||
|
||
#-------------------------- END: Settings -------------------------------- | ||
|
||
#-------------------------- Helper functions -------------------------------- | ||
|
||
# Console colors | ||
red='\033[0;31m' | ||
green='\033[0;32m' | ||
green_bg='\033[1;97;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}"; } | ||
|
||
# Copy a settings file. | ||
# Skips if the destination file already exists. | ||
# @param $1 source file | ||
# @param $2 destination file | ||
copy_settings_file() | ||
{ | ||
local source="$1" | ||
local dest="$2" | ||
|
||
if [[ ! -f $dest ]]; then | ||
echo "Copying ${dest}..." | ||
cp $source $dest | ||
else | ||
echo "${dest} already in place." | ||
fi | ||
} | ||
|
||
#-------------------------- END: Helper functions -------------------------------- | ||
|
||
#-------------------------- Functions -------------------------------- | ||
|
||
composer_install () | ||
{ | ||
cd "$PROJECT_ROOT" | ||
echo-green "Installing dependencies..." | ||
composer install | ||
} | ||
|
||
# Initialize local settings files | ||
init_settings () | ||
{ | ||
# Copy from settings templates | ||
copy_settings_file "${SITEDIR_PATH}/default.settings.local.php" "${SITEDIR_PATH}/settings.local.php" | ||
} | ||
|
||
# Fix file/folder permissions | ||
fix_permissions () | ||
{ | ||
echo-green "Making site directory writable..." | ||
chmod 755 "${SITEDIR_PATH}" | ||
} | ||
|
||
# Install site | ||
site_install () | ||
{ | ||
cd "$DOCROOT_PATH" | ||
|
||
echo-green "Installing Drupal..." | ||
drush site-install standard -y --site-name='My Drupal 9 Site' | ||
} | ||
|
||
#-------------------------- END: Functions -------------------------------- | ||
|
||
#-------------------------- Execution -------------------------------- | ||
|
||
# Project initialization steps | ||
time -p composer_install | ||
fix_permissions | ||
init_settings | ||
time -p site_install | ||
|
||
echo -e "Open ${yellow}http://${VIRTUAL_HOST}${NC} in your browser to verify the setup." | ||
echo-yellow "Look for admin login credentials in the output above." | ||
|
||
#-------------------------- END: Execution -------------------------------- |
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,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 Drupal 9 Site" | ||
echo "Testing login page..." | ||
curl -sL -I http://${VIRTUAL_HOST}/user/login | grep "HTTP/1.1 200 OK" |
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,30 @@ | ||
# 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/apache:2.4-2.5' | ||
#DB_IMAGE='docksal/mariadb:10.6-1.3' | ||
#CLI_IMAGE='docksal/cli:php8.1-3.2' | ||
|
||
# Override virtual host (matches project folder name by default) | ||
#VIRTUAL_HOST=drupal9.docksal | ||
# Override document root ('docroot' by default) | ||
DOCROOT=web | ||
|
||
# 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 |
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 @@ | ||
version: "3.9" |