Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' for release 0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalger committed Apr 15, 2020
2 parents 7d80b36 + 78fcdb9 commit ca9b4c6
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 10 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
## UNRELEASED [x.y.z](https://github.com/davidalger/warden/tree/x.y.z) (yyyy-mm-dd)
[All Commits](https://github.com/davidalger/warden/compare/0.4.0..develop)

## Version [0.4.2](https://github.com/davidalger/warden/tree/0.4.2) (2020-04-15)
[All Commits](https://github.com/davidalger/warden/compare/0.4.1..0.4.2)

**Enhancement:**

* Added `WARDEN_SYNC_IGNORE` to support passing a comma-separated list of additional [per-session-ignores](https://mutagen.io/documentation/synchronization/ignores#per-session-ignores) to Mutagen when sync sessions are started ([#142](https://github.com/davidalger/warden/pull/142) by @davidalger)
* Added pause, resume and monitor to `warden sync` command
* Changed Mutagen sync to pause on `warden env stop` and resume on `warden env up -d`

**Bug Fixes:**

* Removed exclusion of (commonly large) files types (*.sql, *.gz, *.zip, *.bz2) from sync sessions (as introduced in 0.4.0) because it broke the ability to use artifact repositories with composer ([#142](https://github.com/davidalger/warden/pull/142) by @davidalger)

## Version [0.4.1](https://github.com/davidalger/warden/tree/0.4.1) (2020-04-11)
[All Commits](https://github.com/davidalger/warden/compare/0.4.0..0.4.1)

Expand Down
2 changes: 2 additions & 0 deletions commands/env-init.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ if [[ "${WARDEN_ENV_TYPE}" == "magento2" ]]; then
REDIS_VERSION=5.0
VARNISH_VERSION=6.0
WARDEN_SYNC_IGNORE=
WARDEN_ALLURE=0
WARDEN_SELENIUM=0
WARDEN_SELENIUM_DEBUG=0
Expand Down
20 changes: 19 additions & 1 deletion commands/env.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,29 @@ export TRAEFIK_ADDRESS="$(docker container inspect traefik \
' 2>/dev/null || true
)"

## pause mutagen sync if needed
if [[ "${WARDEN_PARAMS[0]}" == "stop" ]] \
&& [[ $OSTYPE =~ ^darwin ]] && [[ -f "${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]
then
warden sync pause
fi

## anything not caught above is simply passed through to docker-compose to orchestrate
docker-compose \
--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 "${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]] \
&& [[ $(warden sync list | grep -i 'Status: \[Paused\]' | wc -l | awk '{print $1}') == "1" ]] \
&& [[ $(warden env ps -q php-fpm) ]] \
&& [[ $(docker container inspect $(warden env ps -q php-fpm) --format '{{ .State.Status }}') = "running" ]] \
&& [[ $(warden env ps -q php-fpm) = $(warden sync list | grep -i 'URL: docker' | awk -F'/' '{print $3}') ]]
then
warden sync resume
fi

## start mutagen sync if needed
if ([[ "${WARDEN_PARAMS[0]}" == "up" ]] || [[ "${WARDEN_PARAMS[0]}" == "start" ]]) \
&& [[ $OSTYPE =~ ^darwin ]] && [[ -f "${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]] \
Expand All @@ -99,7 +117,7 @@ then
fi

## stop mutagen sync if needed
if ([[ "${WARDEN_PARAMS[0]}" == "down" ]] || [[ "${WARDEN_PARAMS[0]}" == "stop" ]]) \
if [[ "${WARDEN_PARAMS[0]}" == "down" ]] \
&& [[ $OSTYPE =~ ^darwin ]] && [[ -f "${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]
then
warden sync stop
Expand Down
16 changes: 14 additions & 2 deletions commands/sync.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ case "${WARDEN_PARAMS[0]}" in

## create sync session based on environment type configuration
mutagen sync create -c "${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" \
--label "warden-sync=${WARDEN_ENV_NAME}" \
--label "warden-sync=${WARDEN_ENV_NAME}" --ignore "${WARDEN_SYNC_IGNORE:-}" \
"${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"
while ! mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \
Expand All @@ -64,6 +64,18 @@ case "${WARDEN_PARAMS[0]}" in
fi
printf .; sleep 1; done; echo
;;
monitor)
## monitor only sessions labeled with this env name
mutagen sync monitor --label-selector "warden-sync=${WARDEN_ENV_NAME}"
;;
pause)
## pause only sessions labeled with this env name
mutagen sync pause --label-selector "warden-sync=${WARDEN_ENV_NAME}"
;;
resume)
## resume only sessions labeled with this env name
mutagen sync resume --label-selector "warden-sync=${WARDEN_ENV_NAME}"
;;
stop)
## terminate only sessions labeled with this env name
mutagen sync terminate --label-selector "warden-sync=${WARDEN_ENV_NAME}"
Expand Down
3 changes: 3 additions & 0 deletions commands/sync.help
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ WARDEN_USAGE=$(cat <<EOF
stop Stops the mutagen sync for the current project environment
list Lists mutagen session status for current project environment
and optionally (with -v) the full configuration
pause Pauses the mutagen sync for the current project environment
resume Resumes the mutagen sync for the current project environment
monitor Continously lists mutagen session status for current project environment
EOF
)
2 changes: 2 additions & 0 deletions docs/environments/initializing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ The below example demonstrates the from-scratch setup of the Magento 2 applicati

BYPASS_VARNISH=false

WARDEN_SYNC_IGNORE=

ELASTICSEARCH_VERSION=6.8
MARIADB_VERSION=10.3
NODE_VERSION=10
Expand Down
6 changes: 0 additions & 6 deletions environments/magento2/magento2.mutagen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ sync:
# IDE files
- ".idea"

# Exclude large files from sync
- "*.sql"
- "*.gz"
- "*.zip"
- "*.bz2"

# Magento files
- "/pub/media"
- "/pub/static/**"
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.1
0.4.2

0 comments on commit ca9b4c6

Please sign in to comment.