From d5773cccb8ae169434414d11edf7a657b50fe902 Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 13:59:47 +0100 Subject: [PATCH 01/12] Delete environments/magento2/magento2.darwin.yml Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- environments/magento2/magento2.darwin.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 environments/magento2/magento2.darwin.yml diff --git a/environments/magento2/magento2.darwin.yml b/environments/magento2/magento2.darwin.yml deleted file mode 100644 index 62f21d0f..00000000 --- a/environments/magento2/magento2.darwin.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: "3.5" - -x-volumes: &volumes - - .${WARDEN_WEB_ROOT:-}/pub/media:/var/www/html/pub/media:cached - - appdata:/var/www/html - -x-environment: &environment - - CHOWN_DIR_LIST=pub/media ${CHOWN_DIR_LIST:-} - -services: - nginx: { volumes: *volumes } - php-fpm: { volumes: *volumes, environment: *environment } - php-debug: { volumes: *volumes, environment: *environment } - -volumes: - appdata: From 40a569db9118b319b93fd8568384733c2f398949 Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:00:38 +0100 Subject: [PATCH 02/12] Delete environments/magento2/magento2.mutagen.yml Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- environments/magento2/magento2.mutagen.yml | 30 ---------------------- 1 file changed, 30 deletions(-) delete mode 100644 environments/magento2/magento2.mutagen.yml diff --git a/environments/magento2/magento2.mutagen.yml b/environments/magento2/magento2.mutagen.yml deleted file mode 100644 index 9de33738..00000000 --- a/environments/magento2/magento2.mutagen.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -sync: - defaults: - mode: two-way-resolved - watch: - pollingInterval: 10 - ignore: - vcs: false - paths: - # Root .git folder - - "/.git/" - - # System files - - ".DS_Store" - - "._*" - - # Vim files - - "*~" - - "*.sw[a-p]" - - # Magento files - - "/pub/media" - - "/pub/static/**" - - "!/pub/static/.htaccess" - - "/var/**" - - "!/var/.htaccess" - - permissions: - defaultFileMode: "0644" - defaultDirectoryMode: "0755" From a2158b5553fcfa1b8f3c4aac1b53a0fa92563801 Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:01:42 +0100 Subject: [PATCH 03/12] Delete environments/drupal/drupal.mutagen.yml Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- environments/drupal/drupal.mutagen.yml | 28 -------------------------- 1 file changed, 28 deletions(-) delete mode 100644 environments/drupal/drupal.mutagen.yml diff --git a/environments/drupal/drupal.mutagen.yml b/environments/drupal/drupal.mutagen.yml deleted file mode 100644 index fd21a4aa..00000000 --- a/environments/drupal/drupal.mutagen.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -sync: - defaults: - mode: two-way-resolved - watch: - pollingInterval: 10 - ignore: - vcs: true - paths: - # Root .git folder - - "/.git/" - - # System files - - ".DS_Store" - - "._*" - - # Vim files - - "*~" - - "*.sw[a-p]" - - # Drupal files - - "web/sites/default/files/**" - - "web/sites/default/private/**" - - - permissions: - defaultFileMode: "0644" - defaultDirectoryMode: "0755" From d48c9b41a568c7b267ca8aa4272fc5686489d9cc Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:02:24 +0100 Subject: [PATCH 04/12] Delete environments/drupal/drupal.darwin.yml Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- environments/drupal/drupal.darwin.yml | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 environments/drupal/drupal.darwin.yml diff --git a/environments/drupal/drupal.darwin.yml b/environments/drupal/drupal.darwin.yml deleted file mode 100644 index 2a18e5bc..00000000 --- a/environments/drupal/drupal.darwin.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: "3.5" - -x-volumes: &volumes - - .${WARDEN_WEB_ROOT:-}/web/sites/default/files:/var/www/html/web/sites/default/files:cached - - .${WARDEN_WEB_ROOT:-}/web/sites/default/private:/var/www/html/web/sites/default/private:cached - - appdata:/var/www/html - -x-environment: &environment - - CHOWN_DIR_LIST=web/sites/default/files web/sites/default/private ${CHOWN_DIR_LIST:-} - -services: - nginx: { volumes: *volumes } - php-fpm: { volumes: *volumes, environment: *environment } - php-debug: { volumes: *volumes, environment: *environment } - -volumes: - appdata: From 494abe8f936584466512f30b73d46c76d35e0165 Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:03:10 +0100 Subject: [PATCH 05/12] Delete environments/magento1/magento1.mutagen.yml Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- environments/magento1/magento1.mutagen.yml | 24 ---------------------- 1 file changed, 24 deletions(-) delete mode 100644 environments/magento1/magento1.mutagen.yml diff --git a/environments/magento1/magento1.mutagen.yml b/environments/magento1/magento1.mutagen.yml deleted file mode 100644 index 454da1e3..00000000 --- a/environments/magento1/magento1.mutagen.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -sync: - defaults: - mode: two-way-resolved - watch: - pollingInterval: 10 - ignore: - vcs: true - paths: - # System files - - ".DS_Store" - - "._*" - - # Vim files - - "*~" - - "*.sw[a-p]" - - # Magento files - - "/media" - - "/var/**" - - permissions: - defaultFileMode: "0644" - defaultDirectoryMode: "0755" From f48ae9917ea507f6c939b310611384bf91c30ec6 Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:03:31 +0100 Subject: [PATCH 06/12] Delete environments/magento1/magento1.darwin.yml Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- environments/magento1/magento1.darwin.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 environments/magento1/magento1.darwin.yml diff --git a/environments/magento1/magento1.darwin.yml b/environments/magento1/magento1.darwin.yml deleted file mode 100644 index 045c1e52..00000000 --- a/environments/magento1/magento1.darwin.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: "3.5" - -x-volumes: &volumes - - .${WARDEN_WEB_ROOT:-}/media:/var/www/html/media:cached - - appdata:/var/www/html - -x-environment: &environment - - CHOWN_DIR_LIST=media ${CHOWN_DIR_LIST:-} - -services: - nginx: { volumes: *volumes } - php-fpm: { volumes: *volumes, environment: *environment } - php-debug: { volumes: *volumes, environment: *environment } - -volumes: - appdata: From 5767acd14244c3fa38ba1562bd500941a59e1977 Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:04:09 +0100 Subject: [PATCH 07/12] Delete environments/shopware/shopware.mutagen.yml Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- environments/shopware/shopware.mutagen.yml | 24 ---------------------- 1 file changed, 24 deletions(-) delete mode 100644 environments/shopware/shopware.mutagen.yml diff --git a/environments/shopware/shopware.mutagen.yml b/environments/shopware/shopware.mutagen.yml deleted file mode 100644 index 58cb10df..00000000 --- a/environments/shopware/shopware.mutagen.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -sync: - defaults: - mode: two-way-resolved - watch: - pollingInterval: 10 - ignore: - vcs: true - paths: - # System files - - ".DS_Store" - - "._*" - - # Vim files - - "*~" - - "*.sw[a-p]" - - # Application files - - "/public/media" - - "/var" - - permissions: - defaultFileMode: "0644" - defaultDirectoryMode: "0755" From 167aead4ef39dfc579882eed251b13f457ad4765 Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:04:20 +0100 Subject: [PATCH 08/12] Delete environments/shopware/shopware.darwin.yml Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- environments/shopware/shopware.darwin.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 environments/shopware/shopware.darwin.yml diff --git a/environments/shopware/shopware.darwin.yml b/environments/shopware/shopware.darwin.yml deleted file mode 100644 index cfee1635..00000000 --- a/environments/shopware/shopware.darwin.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: "3.5" - -x-volumes: &volumes - - .${WARDEN_WEB_ROOT:-}/public/media:/var/www/html/public/media:cached - - appdata:/var/www/html - -x-environment: &environment - - CHOWN_DIR_LIST=public/media ${CHOWN_DIR_LIST:-} - -services: - nginx: { volumes: *volumes } - php-fpm: { volumes: *volumes, environment: *environment } - php-debug: { volumes: *volumes, environment: *environment } - -volumes: - appdata: From 914fe561d24a51a1839201e0f2e5ee09dcab1478 Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:05:24 +0100 Subject: [PATCH 09/12] Update env.cmd Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- commands/env.cmd | 59 ------------------------------------------------ 1 file changed, 59 deletions(-) diff --git a/commands/env.cmd b/commands/env.cmd index 7f464e1a..52d35192 100644 --- a/commands/env.cmd +++ b/commands/env.cmd @@ -174,66 +174,7 @@ TRAEFIK_ADDRESS="$(docker container inspect traefik \ )" export TRAEFIK_ADDRESS; -if [[ $OSTYPE =~ ^darwin ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" - - if [[ -f "${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" - fi - - if [[ -f "${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" - fi - - if [[ -f "${WARDEN_ENV_PATH}/.warden/mutagen.yml" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_ENV_PATH}/.warden/mutagen.yml" - fi -fi - -## pause mutagen sync if needed -if [[ "${WARDEN_PARAMS[0]}" == "stop" ]] \ - && [[ $OSTYPE =~ ^darwin ]] && [[ -f "${MUTAGEN_SYNC_FILE}" ]] -then - $WARDEN_BIN sync pause -fi - ## pass orchestration through to docker compose ${DOCKER_COMPOSE_COMMAND} \ --project-directory "${WARDEN_ENV_PATH}" -p "${WARDEN_ENV_NAME}" \ "${DOCKER_COMPOSE_ARGS[@]}" "${WARDEN_PARAMS[@]}" "$@" - -## resume mutagen sync if available and php-fpm container id hasn't changed -if { [[ "${WARDEN_PARAMS[0]}" == "up" ]] || [[ "${WARDEN_PARAMS[0]}" == "start" ]]; } \ - && [[ $OSTYPE =~ ^darwin ]] && [[ -f "${MUTAGEN_SYNC_FILE}" ]] \ - && [[ $($WARDEN_BIN sync list | grep -ci 'Status: \[Paused\]' | awk '{print $1}') == "1" ]] \ - && [[ $($WARDEN_BIN env ps -q php-fpm) ]] \ - && [[ $(docker container inspect "$($WARDEN_BIN env ps -q php-fpm)" --format '{{ .State.Status }}') = "running" ]] \ - && [[ $($WARDEN_BIN env ps -q php-fpm) = $($WARDEN_BIN sync list | grep -i 'URL: docker' | awk -F'/' '{print $3}') ]] -then - $WARDEN_BIN sync resume -fi - -if [[ $OSTYPE =~ ^darwin ]] && [[ -f "${MUTAGEN_SYNC_FILE}" ]] # If we're using Mutagen -then - MUTAGEN_VERSION=$(mutagen version) - CONNECTION_STATE_STRING='Connected state: Connected' - if [[ $(version "${MUTAGEN_VERSION}") -ge $(version '0.15.0') ]]; then - CONNECTION_STATE_STRING='Connected: Yes' - fi - - ## start mutagen sync if needed - if { [[ "${WARDEN_PARAMS[0]}" == "up" ]] || [[ "${WARDEN_PARAMS[0]}" == "start" ]]; } \ - && [[ $($WARDEN_BIN sync list | grep -c "${CONNECTION_STATE_STRING}" | awk '{print $1}') != "2" ]] \ - && [[ $($WARDEN_BIN env ps -q php-fpm) ]] \ - && [[ $(docker container inspect "$($WARDEN_BIN env ps -q php-fpm)" --format '{{ .State.Status }}') = "running" ]] - then - $WARDEN_BIN sync start - fi -fi - -## stop mutagen sync if needed -if [[ "${WARDEN_PARAMS[0]}" == "down" ]] \ - && [[ $OSTYPE =~ ^darwin ]] && [[ -f "${MUTAGEN_SYNC_FILE}" ]] -then - $WARDEN_BIN sync stop -fi From 859d7b30946063ee501c763e09a42685f5241b46 Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:06:05 +0100 Subject: [PATCH 10/12] Delete commands/sync.cmd Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- commands/sync.cmd | 85 ----------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 commands/sync.cmd diff --git a/commands/sync.cmd b/commands/sync.cmd deleted file mode 100644 index 00de23ec..00000000 --- a/commands/sync.cmd +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash -[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1 - -WARDEN_ENV_PATH="$(locateEnvPath)" || exit $? -loadEnvConfig "${WARDEN_ENV_PATH}" || exit $? - -if (( ${#WARDEN_PARAMS[@]} == 0 )); then - fatal "This command has required params; use --help for details." -fi - -## disable sync command on non-darwin environments where it should not be used -if [[ ${WARDEN_ENV_SUBT} != "darwin" ]]; then - fatal "Mutagen sync sessions are not used on \"${WARDEN_ENV_SUBT}\" host environments." -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 - -## verify mutagen version constraint -MUTAGEN_VERSION=$(mutagen version 2>/dev/null) || true -MUTAGEN_REQUIRE=0.11.8 -if [[ $OSTYPE =~ ^darwin ]] && ! test $(version ${MUTAGEN_VERSION}) -ge $(version ${MUTAGEN_REQUIRE}); then - error "Mutagen version ${MUTAGEN_REQUIRE} or greater is required (version ${MUTAGEN_VERSION} is installed)." - >&2 printf "\nPlease update Mutagen:\n\n brew upgrade havoc-io/mutagen/mutagen\n\n" - exit 1 -fi - -if [[ $OSTYPE =~ ^darwin && -z "${MUTAGEN_SYNC_FILE}" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" - - if [[ -f "${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" - fi - - if [[ -f "${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" - fi - - if [[ -f "${WARDEN_ENV_PATH}/.warden/mutagen.yml" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_ENV_PATH}/.warden/mutagen.yml" - fi -fi - -## if no mutagen configuration file exists for the environment type, exit with error -if [[ ! -f "${MUTAGEN_SYNC_FILE}" ]]; then - fatal "Mutagen configuration does not exist for environment type \"${WARDEN_ENV_TYPE}\"" -fi - -## sub-command execution -case "${WARDEN_PARAMS[0]}" in - start) - ## terminate any existing sessions with matching env label - mutagen sync terminate --label-selector "warden-sync=${WARDEN_ENV_NAME}" - - ## create sync session based on environment type configuration - mutagen sync create -c "${MUTAGEN_SYNC_FILE}" \ - --label "warden-sync=${WARDEN_ENV_NAME}" --ignore "${WARDEN_SYNC_IGNORE:-}" \ - "${WARDEN_ENV_PATH}${WARDEN_WEB_ROOT:-}" "docker://$($WARDEN_BIN 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" - while ! mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \ - | grep -i 'watching for changes'>/dev/null; - do - if mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \ - | grep -i 'Last error' > /dev/null; then - MUTAGEN_ERROR=$(mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \ - | sed -n 's/Last error: \(.*\)/\1/p') - fatal "Mutagen encountered an error during sync: ${MUTAGEN_ERROR}" - fi - printf .; sleep 1; done; echo - ;; - stop) - mutagen sync terminate --label-selector "warden-sync=${WARDEN_ENV_NAME}" - ;; - list|flush|monitor|pause|reset|resume) - mutagen sync "${WARDEN_PARAMS[@]}" "${@}" --label-selector "warden-sync=${WARDEN_ENV_NAME}" - ;; - *) - fatal "The command \"${WARDEN_PARAMS[0]}\" does not exist. Please use --help for usage." - ;; -esac From 9edd13ba0a4894d154fba05152c959de7a70ce97 Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:06:24 +0100 Subject: [PATCH 11/12] Delete commands/sync.help Disable Mutagen because it slows down the installation and the mount is fast enough on Mac --- commands/sync.help | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100755 commands/sync.help diff --git a/commands/sync.help b/commands/sync.help deleted file mode 100755 index e2eedf16..00000000 --- a/commands/sync.help +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1 - -WARDEN_USAGE=$(cat < - -\033[33mOptions:\033[0m - -h, --help Display this help menu - -\033[33mCommands:\033[0m - start Starts mutagen sync for the current project environment - stop Stops the mutagen sync for the current project environment - list Lists mutagen session status for current project environment - and optionally (with -l) the full configuration - - monitor Continously lists mutagen session status for current project - flush Force a synchronization cycle on sync session for current project - pause Pauses the mutagen sync for the current project environment - resume Resumes the mutagen sync for the current project environment - reset Reset synchronization session history for current project environment -EOF -) From e22fdbbd68148755a693b583ec4d144906745cde Mon Sep 17 00:00:00 2001 From: "Mr. Lewis" Date: Wed, 7 Feb 2024 14:07:42 +0100 Subject: [PATCH 12/12] Update env-init.help Update the env-init help section by removing mutagen --- commands/env-init.help | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/commands/env-init.help b/commands/env-init.help index 255a45fb..c03d2bb1 100755 --- a/commands/env-init.help +++ b/commands/env-init.help @@ -21,10 +21,7 @@ WARDEN_USAGE=$(cat <