Add Docksal configuration
This commit is contained in:
parent
601b18c0df
commit
f59152c352
3
.docksal/.gitignore
vendored
Normal file
3
.docksal/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Exclude local configuration overrides
|
||||
docksal-local.env
|
||||
docksal-local.yml
|
107
.docksal/commands/init
Executable file
107
.docksal/commands/init
Executable file
|
@ -0,0 +1,107 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## Initialize a Docksal powered Wordpress site
|
||||
##
|
||||
## Usage: fin init
|
||||
|
||||
# Abort if anything fails
|
||||
set -e
|
||||
|
||||
#-------------------------- Settings --------------------------------
|
||||
|
||||
# PROJECT_ROOT is passed from fin.
|
||||
# The following variables are configured in the '.env' file: DOCROOT, VIRTUAL_HOST.
|
||||
|
||||
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}"; }
|
||||
|
||||
is_windows ()
|
||||
{
|
||||
local res=$(uname | grep 'CYGWIN_NT')
|
||||
if [[ "$res" != "" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#-------------------------- END: Helper functions --------------------------------
|
||||
|
||||
#-------------------------- Functions --------------------------------
|
||||
|
||||
# Generate wp-config.php file
|
||||
generate_config ()
|
||||
{
|
||||
cd $DOCROOT_PATH
|
||||
|
||||
fin exec "rm -f wp-config.php"
|
||||
fin exec "wp core config --dbname=${MYSQL_DATABASE} --dbuser=${MYSQL_USER} --dbpass=${MYSQL_PASSWORD} --dbhost=db"
|
||||
}
|
||||
|
||||
# Install site
|
||||
site_install ()
|
||||
{
|
||||
cd $DOCROOT_PATH
|
||||
|
||||
fin exec "wp core install \
|
||||
--url=${VIRTUAL_HOST} \
|
||||
--title='My WordPress Site' \
|
||||
--admin_user=${WP_ADMIN_USER} \
|
||||
--admin_password=${WP_ADMIN_PASS} \
|
||||
--admin_email=${WP_ADMIN_EMAIL}"
|
||||
}
|
||||
|
||||
#-------------------------- END: Functions --------------------------------
|
||||
|
||||
#-------------------------- Execution --------------------------------
|
||||
|
||||
if [[ "$PROJECT_ROOT" == "" ]]; then
|
||||
echo-red "\$PROJECT_ROOT is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $DOCKER_RUNNING == "true" ]]; then
|
||||
echo -e "${green_bg} Step 1 ${NC}${green} Recreating services...${NC}"
|
||||
fin reset -f
|
||||
else
|
||||
echo -e "${green_bg} Step 1 ${NC}${green} Creating services...${NC}"
|
||||
fin up
|
||||
fi
|
||||
|
||||
echo "Waiting 10s for MySQL to initialize...";
|
||||
sleep 10
|
||||
|
||||
# Project initialization steps
|
||||
echo -e "${green_bg} Step 2 ${NC}${green} Generating wp-config.php...${NC}"
|
||||
generate_config
|
||||
|
||||
echo -e "${green_bg} Step 3 ${NC}${green} Installing site...${NC}"
|
||||
time site_install
|
||||
|
||||
|
||||
if is_windows; then
|
||||
echo-green "Add ${VIRTUAL_HOST} to your hosts file (/etc/hosts), e.g.:"
|
||||
echo-green "192.168.64.100 ${VIRTUAL_HOST}"
|
||||
echo
|
||||
fi
|
||||
|
||||
echo -en "${green_bg} DONE! ${NC} "
|
||||
echo -e "Open ${yellow}http://${VIRTUAL_HOST}${NC} in your browser to verify the setup."
|
||||
echo -e "Admin panel: ${yellow}http://${VIRTUAL_HOST}/wp-admin${NC}. User/password: ${yellow}${WP_ADMIN_USER}/${WP_ADMIN_PASS}${NC} "
|
||||
|
||||
#-------------------------- END: Execution --------------------------------
|
19
.docksal/commands/test
Executable file
19
.docksal/commands/test
Executable file
|
@ -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 WordPress Site"
|
||||
echo "Testing login page..."
|
||||
curl -sL -I http://${VIRTUAL_HOST}/wp-admin | grep "HTTP/1.1 200 OK"
|
37
.docksal/docksal.env
Normal file
37
.docksal/docksal.env
Normal file
|
@ -0,0 +1,37 @@
|
|||
# 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
|
||||
|
||||
# Use the default Docksal 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/db:x.x-mysql-5.6'
|
||||
#CLI_IMAGE='docksal/cli:x.x-php7.1'
|
||||
|
||||
# Docksal configuration.
|
||||
COMPOSE_PROJECT_NAME=wordcamp2019
|
||||
#VIRTUAL_HOST=wordpress.docksal
|
||||
DOCROOT=.
|
||||
|
||||
# MySQL settings.
|
||||
MYSQL_ROOT_PASSWORD=root
|
||||
MYSQL_USER=user
|
||||
MYSQL_PASSWORD=user
|
||||
MYSQL_DATABASE=default
|
||||
# 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
|
||||
|
||||
# Wordpress settings
|
||||
WP_ADMIN_USER=admin
|
||||
WP_ADMIN_PASS=admin
|
||||
WP_ADMIN_EMAIL=info@example.com
|
1
.docksal/docksal.yml
Normal file
1
.docksal/docksal.yml
Normal file
|
@ -0,0 +1 @@
|
|||
version: "2.1"
|
6
.docksal/etc/mysql/my.cnf
Normal file
6
.docksal/etc/mysql/my.cnf
Normal file
|
@ -0,0 +1,6 @@
|
|||
[mysqld]
|
||||
|
||||
# Enable slow query logging
|
||||
#long_query_time=1
|
||||
#slow_query_log=1
|
||||
#slow_query_log_file=/dev/stdout
|
4
.docksal/etc/php/php-fpm.conf
Normal file
4
.docksal/etc/php/php-fpm.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
; PHP FPM settings
|
||||
[www]
|
||||
; Maximum amount of memory a script may consume
|
||||
;php_admin_value[memory_limit] = 256M
|
4
.docksal/etc/php/php.ini
Normal file
4
.docksal/etc/php/php.ini
Normal file
|
@ -0,0 +1,4 @@
|
|||
; Global PHP settings
|
||||
[php]
|
||||
; Maximum amount of memory a script may consume
|
||||
;memory_limit = 1024M
|
Loading…
Reference in a new issue