From 4a03bd7511abc524e43edac489dd7d2a444f827f Mon Sep 17 00:00:00 2001 From: David Alger Date: Wed, 19 Jun 2019 13:22:20 -0500 Subject: [PATCH 1/5] Fixed issue with docker-compose exit codes would result in error messages from global trap --- commands/env.cmd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/commands/env.cmd b/commands/env.cmd index 14b08767..588bee59 100644 --- a/commands/env.cmd +++ b/commands/env.cmd @@ -10,6 +10,9 @@ if (( ${#WARDEN_PARAMS[@]} == 0 )); then exit 1 fi +## simply allow the return code from docker-compose to bubble up per normal +trap '' ERR + ## anything not caught above is simply passed through to docker-compose to orchestrate docker-compose \ --project-directory "${WARDEN_ENV_PATH}" \ From 3fdf110fc802cf9eaf9b54b21fcb2dade09e1165 Mon Sep 17 00:00:00 2001 From: David Alger Date: Wed, 19 Jun 2019 13:22:50 -0500 Subject: [PATCH 2/5] Changed images for php-fpm to use environment type specfic images from davidalger/warden repository --- environments/magento1.yml | 2 +- environments/magento2-mutagen.yml | 2 +- environments/magento2-native.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/environments/magento1.yml b/environments/magento1.yml index 2d942488..3471cfad 100644 --- a/environments/magento1.yml +++ b/environments/magento1.yml @@ -21,7 +21,7 @@ services: php-fpm: hostname: php-fpm - image: davidalger/php:${PHP_VERSION:-7.2}-fpm-alpine + image: davidalger/warden:mage1-fpm-${PHP_VERSION:-7.2}-alpine depends_on: - db volumes: diff --git a/environments/magento2-mutagen.yml b/environments/magento2-mutagen.yml index 0af48ca1..1e1bd15a 100644 --- a/environments/magento2-mutagen.yml +++ b/environments/magento2-mutagen.yml @@ -26,7 +26,7 @@ services: php-fpm: hostname: php-fpm - image: davidalger/php:${PHP_VERSION:-7.2}-fpm-alpine + image: davidalger/warden:mage2-fpm-${PHP_VERSION:-7.2}-alpine depends_on: - db volumes: diff --git a/environments/magento2-native.yml b/environments/magento2-native.yml index 1778b9d4..433fc693 100644 --- a/environments/magento2-native.yml +++ b/environments/magento2-native.yml @@ -25,7 +25,7 @@ services: php-fpm: hostname: php-fpm - image: davidalger/php:${PHP_VERSION:-7.2}-fpm-alpine + image: davidalger/warden:mage2-fpm-${PHP_VERSION:-7.2}-alpine depends_on: - db volumes: From cf74edfb4d4332fa363e00a6e29c051c20606d15 Mon Sep 17 00:00:00 2001 From: David Alger Date: Wed, 19 Jun 2019 13:36:10 -0500 Subject: [PATCH 3/5] Added support for WARDEN_WEB_ROOT env setting to publish a sub-dir into /var/www/html --- commands/sync.cmd | 2 +- environments/magento1.yml | 4 ++-- environments/magento2-mutagen.yml | 4 ++-- environments/magento2-native.yml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/commands/sync.cmd b/commands/sync.cmd index 371cb32a..b7ee7ac0 100644 --- a/commands/sync.cmd +++ b/commands/sync.cmd @@ -26,7 +26,7 @@ case "${WARDEN_PARAMS[0]}" in ## create sync session based on environment type configuration mutagen create -c "${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}.toml" \ --label "warden-sync=${WARDEN_ENV_NAME}" \ - "${WARDEN_ENV_PATH}" "docker://$(warden env ps -q php-fpm)/var/www/html" + "${WARDEN_ENV_PATH}${WARDEN_WEB_ROOT:-}" "docker://$(warden env ps -q php-fpm)/var/www/html" ## wait for sync session to complete initial sync before exiting echo "Waiting for initial synchronization to complete" diff --git a/environments/magento1.yml b/environments/magento1.yml index 3471cfad..8e14e4bc 100644 --- a/environments/magento1.yml +++ b/environments/magento1.yml @@ -11,7 +11,7 @@ services: - db - php-fpm volumes: - - ./:/var/www/html:delegated + - .${WARDEN_WEB_ROOT:-}/:/var/www/html:delegated labels: - traefik.docker.network=warden - traefik.frontend.rule=Host:${TRAEFIK_SUBDOMAIN:-www}.${TRAEFIK_DOMAIN} @@ -26,7 +26,7 @@ services: - db volumes: - ~/.composer:/home/www-data/.composer:delegated - - ./:/var/www/html:delegated + - .${WARDEN_WEB_ROOT:-}/:/var/www/html:delegated db: hostname: mariadb diff --git a/environments/magento2-mutagen.yml b/environments/magento2-mutagen.yml index 1e1bd15a..efed725b 100644 --- a/environments/magento2-mutagen.yml +++ b/environments/magento2-mutagen.yml @@ -9,7 +9,7 @@ services: - db - php-fpm volumes: - - ./pub/media:/var/www/html/pub/media:delegated + - .${WARDEN_WEB_ROOT:-}/pub/media:/var/www/html/pub/media:delegated - appdata:/var/www/html varnish: @@ -31,7 +31,7 @@ services: - db volumes: - ~/.composer:/home/www-data/.composer:delegated - - ./pub/media:/var/www/html/pub/media:delegated + - .${WARDEN_WEB_ROOT:-}/pub/media:/var/www/html/pub/media:delegated - appdata:/var/www/html db: diff --git a/environments/magento2-native.yml b/environments/magento2-native.yml index 433fc693..2eb8374c 100644 --- a/environments/magento2-native.yml +++ b/environments/magento2-native.yml @@ -9,7 +9,7 @@ services: - db - php-fpm volumes: - - ./:/var/www/html:delegated + - .${WARDEN_WEB_ROOT:-}/:/var/www/html:delegated varnish: hostname: varnish @@ -30,7 +30,7 @@ services: - db volumes: - ~/.composer:/home/www-data/.composer:delegated - - ./:/var/www/html:delegated + - .${WARDEN_WEB_ROOT:-}/:/var/www/html:delegated db: hostname: mariadb From a84a10784a5f9ee74c6b3571abd95f055a3df85b Mon Sep 17 00:00:00 2001 From: David Alger Date: Wed, 19 Jun 2019 14:53:29 -0500 Subject: [PATCH 4/5] Added auto-install of mutagen where not already present when a sync command is run --- commands/sync.cmd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commands/sync.cmd b/commands/sync.cmd index b7ee7ac0..f795ce6f 100644 --- a/commands/sync.cmd +++ b/commands/sync.cmd @@ -10,6 +10,12 @@ if (( ${#WARDEN_PARAMS[@]} == 0 )); then exit 1 fi +## attempt to install mutagen if not already present +if ! which mutagen >/dev/null; then + echo -e "\033[33mMutagen could not be found; attempting install via brew.\033[0m" + brew install havoc-io/mutagen/mutagen +fi + ## sub-command execution case "${WARDEN_PARAMS[0]}" in start) From ece1b4b78fa5d253d77eafe9431fdf2a26153ddf Mon Sep 17 00:00:00 2001 From: David Alger Date: Wed, 19 Jun 2019 17:38:17 -0500 Subject: [PATCH 5/5] Updated CL and version number --- CHANGELOG.md | 8 ++++++++ commands/usage.help | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa961d9b..1557305d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +0.1.0-beta5 +=============== + +* Fixed issue with docker-compose exit codes would result in error messages from global trap +* Added auto-install of mutagen where not already present when any sync command is run +* Added support for WARDEN_WEB_ROOT env setting to publish a sub-dir into /var/www/html +* Changed images for php-fpm to use environment type specfic images from davidalger/warden repository + 0.1.0-beta4 =============== diff --git a/commands/usage.help b/commands/usage.help index 56b66104..ce270e15 100755 --- a/commands/usage.help +++ b/commands/usage.help @@ -11,7 +11,7 @@ WARDEN_HEADER=' WARDEN_USAGE=$(cat <