mirror of
https://github.com/cytopia/devilbox.git
synced 2025-01-18 10:46:23 +00:00
Fix symlink handling with watcherd
This commit is contained in:
parent
6b18f7b71d
commit
2679acc569
@ -226,3 +226,29 @@ run_fail() {
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
### Create and validate vhost directory
|
||||
###
|
||||
create_vhost_dir() {
|
||||
local vhost="${1}"
|
||||
|
||||
echo "Ensure vhost '${vhost}' is created"
|
||||
|
||||
# Clean vhost dir
|
||||
cd "${DVLBOX_PATH}"
|
||||
while docker-compose exec --user devilbox -T php curl -sS --fail "http://php/vhosts.php" | grep ">${vhost}<" >/dev/null; do
|
||||
echo "Deleting vhost: ${vhost}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'rm -rf /shared/httpd/${vhost} && sleep 5;'" "1" "${DVLBOX_PATH}"
|
||||
done
|
||||
|
||||
# Create vhost dir
|
||||
cd "${DVLBOX_PATH}"
|
||||
while ! docker-compose exec --user devilbox -T php curl -sS --fail "http://php/vhosts.php" | grep ">${vhost}<" >/dev/null; do
|
||||
echo "Recreating vhost: ${vhost}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'rm -rf /shared/httpd/${vhost} && sleep 5;'" "1" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'mkdir -p /shared/httpd/${vhost} && sleep 5;'" "1" "${DVLBOX_PATH}"
|
||||
done
|
||||
echo "Vhost is present: ${vhost}"
|
||||
}
|
||||
|
@ -43,42 +43,45 @@ fi
|
||||
###
|
||||
MYSQL_ROOT_PASSWORD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "MYSQL_ROOT_PASSWORD" )"
|
||||
TLD_SUFFIX="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "TLD_SUFFIX" )"
|
||||
VHOST="my-cakephp"
|
||||
|
||||
# Create vhost dir
|
||||
create_vhost_dir "${VHOST}"
|
||||
|
||||
|
||||
# Setup CakePHP project
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'mkdir -p /shared/httpd/cakephp'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/cakephp; rm -rf cakephp; composer create-project --no-interaction --prefer-dist cakephp/app cakephp 3.8'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/cakephp; ln -sf cakephp/webroot htdocs'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/${VHOST}; composer create-project --no-interaction --prefer-dist cakephp/app cakephp 3.8'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/${VHOST}; ln -sf cakephp/webroot htdocs'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php mysql -u root -h mysql --password=\"${MYSQL_ROOT_PASSWORD}\" -e \"DROP DATABASE IF EXISTS my_cake; CREATE DATABASE my_cake;\"" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
|
||||
# Configure CakePHP database settings
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'host' =>.*/'host' => 'mysql',/g\" /shared/httpd/cakephp/cakephp/config/app.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'username' =>.*/'username' => 'root',/g\" /shared/httpd/cakephp/cakephp/config/app.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'password' =>.*/'password' => '${MYSQL_ROOT_PASSWORD}',/g\" /shared/httpd/cakephp/cakephp/config/app.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'database' =>.*/'database' => 'my_cake',/g\" /shared/httpd/cakephp/cakephp/config/app.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'host' =>.*/'host' => 'mysql',/g\" /shared/httpd/${VHOST}/cakephp/config/app.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'username' =>.*/'username' => 'root',/g\" /shared/httpd/${VHOST}/cakephp/config/app.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'password' =>.*/'password' => '${MYSQL_ROOT_PASSWORD}',/g\" /shared/httpd/${VHOST}/cakephp/config/app.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'database' =>.*/'database' => 'my_cake',/g\" /shared/httpd/${VHOST}/cakephp/config/app.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
|
||||
# Test CakePHP
|
||||
ERROR=0
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'mbstring'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'mbstring'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'openssl'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'openssl'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'intl'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'intl'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'tmp directory'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'tmp directory'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'logs directory'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'logs directory'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'connect to the database'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'connect to the database'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
|
||||
if [ "${ERROR}" = "1" ]; then
|
||||
run "docker-compose exec --user devilbox -T php curl 'http://cakephp.${TLD_SUFFIX}' || true" "1" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php curl 'http://${VHOST}.${TLD_SUFFIX}' || true" "1" "${DVLBOX_PATH}"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -67,19 +67,22 @@ fi
|
||||
###
|
||||
MYSQL_ROOT_PASSWORD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "MYSQL_ROOT_PASSWORD" )"
|
||||
TLD_SUFFIX="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "TLD_SUFFIX" )"
|
||||
VHOST="my-drupal"
|
||||
|
||||
# Create vhost dir
|
||||
create_vhost_dir "${VHOST}"
|
||||
|
||||
|
||||
# Setup Drupal project
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'mkdir -p /shared/httpd/drupal'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/drupal; sudo rm -rf drupal; composer-1 create-project --no-interaction --prefer-dist drupal-composer/drupal-project drupal 8.x-dev'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/drupal; ln -sf drupal/web htdocs'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/${VHOST}; composer-1 create-project --no-interaction --prefer-dist drupal-composer/drupal-project drupal 8.x-dev'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/${VHOST}; ln -sf drupal/web htdocs'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php mysql -u root -h mysql --password=\"${MYSQL_ROOT_PASSWORD}\" -e \"DROP DATABASE IF EXISTS my_drupal; CREATE DATABASE my_drupal;\"" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
|
||||
# Configure Drupal
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/drupal/htdocs/; ${DRUSH} site-install standard --db-url='mysql://root:${MYSQL_ROOT_PASSWORD}@mysql/my_drupal' --site-name=Example -y'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/${VHOST}/htdocs/; ${DRUSH} site-install standard --db-url='mysql://root:${MYSQL_ROOT_PASSWORD}@mysql/my_drupal' --site-name=Example -y'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
|
||||
# Test Drupal
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://drupal.${TLD_SUFFIX}' | tac | tac | grep 'Welcome to Example'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
run "docker-compose exec --user devilbox -T php curl 'http://drupal.${TLD_SUFFIX}' || true"
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep 'Welcome to Example'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
run "docker-compose exec --user devilbox -T php curl 'http://${VHOST}.${TLD_SUFFIX}' || true"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -49,19 +49,17 @@ TLD_SUFFIX="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "TLD_SUFFIX" )"
|
||||
###
|
||||
### Custom variables
|
||||
###
|
||||
VHOST="my-wordpress"
|
||||
DB_NAME="my_wp"
|
||||
PROJECT_NAME="this-is-my-grepable-project-name"
|
||||
VHOST="my-wordpress"
|
||||
|
||||
# Create vhost dir
|
||||
create_vhost_dir "${VHOST}"
|
||||
|
||||
|
||||
# Download Wordpress
|
||||
run "docker-compose exec --user devilbox -T php bash -c ' \
|
||||
rm -rf /shared/httpd/${VHOST}' || true" "1" "${DVLBOX_PATH}"
|
||||
|
||||
run "sleep 5"
|
||||
run "docker-compose exec --user devilbox -T php bash -c ' \
|
||||
mkdir -p /shared/httpd/${VHOST} \
|
||||
&& git clone https://github.com/WordPress/WordPress /shared/httpd/${VHOST}/wordpress \
|
||||
git clone https://github.com/WordPress/WordPress /shared/httpd/${VHOST}/wordpress \
|
||||
&& ln -sf wordpress /shared/httpd/${VHOST}/htdocs'" \
|
||||
"${RETRIES}" "${DVLBOX_PATH}"
|
||||
|
||||
@ -92,9 +90,6 @@ run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/define(\\s*'DB_HO
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/define(\\s*'WP_DEBUG.*/define('WP_DEBUG', true);/g\" /shared/httpd/${VHOST}/wordpress/wp-config.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php php -l /shared/httpd/${VHOST}/wordpress/wp-config.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
|
||||
# Debug configuration
|
||||
run "./check-config.sh" "1" "${DVLBOX_PATH}" || true
|
||||
|
||||
# Install Wordpress
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail -L -XPOST -c cookie.txt -b cookie.txt \
|
||||
'http://${VHOST}.${TLD_SUFFIX}/wp-admin/install.php?step=1'\
|
||||
|
@ -221,7 +221,7 @@ services:
|
||||
# Web Server
|
||||
# ------------------------------------------------------------
|
||||
httpd:
|
||||
image: devilbox/${HTTPD_SERVER}:0.34
|
||||
image: devilbox/${HTTPD_SERVER}:0.35
|
||||
hostname: httpd
|
||||
|
||||
environment:
|
||||
|
Loading…
Reference in New Issue
Block a user