Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' for release 0.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalger committed Mar 1, 2020
2 parents d8a5803 + 7f434bb commit b27fc80
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 41 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# Change Log

## 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.2.2..develop)
[All Commits](https://github.com/davidalger/warden/compare/0.2.4..develop)

## Version [0.2.4](https://github.com/davidalger/warden/tree/0.2.4) (2020-02-29)
[All Commits](https://github.com/davidalger/warden/compare/0.2.3..0.2.4)

**Bug Fixes:**

* Updated environment path (`WARDEN_ENV_PATH` in scripts) to use physical vs logical current working directory to resolve issues with using symlinked file paths (issue [#101](https://github.com/davidalger/warden/issues/101))
* Removed confusingly quoted placeholder values related to Blackfire from env file generated by `env-init`
* Removed timeout for Selenium Hub, increased timeout for MFTF's `command.php` endpoint to 10 minutes ([#107](https://github.com/davidalger/warden/pull/107) by [lbajsarowicz](https://github.com/lbajsarowicz))
* Fixed issue where `warden sync start` would infinitely wait when Mutagen encountered an error ([#100](https://github.com/davidalger/warden/pull/100) by [Lunaetic](https://github.com/Lunaetic))

## Version [0.2.3](https://github.com/davidalger/warden/tree/0.2.3) (2020-02-14)
[All Commits](https://github.com/davidalger/warden/compare/0.2.2..0.2.3)
Expand Down
18 changes: 9 additions & 9 deletions commands/env-init.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1

WARDEN_ENV_PATH="$(pwd)"
WARDEN_ENV_PATH="$(pwd -P)"

# TODO: If the .env file already exists; prompt user instead of overwriting
# TODO: Prompt user for inputs when arguments remain unspecified
Expand Down Expand Up @@ -36,10 +36,10 @@ if [[ "${WARDEN_ENV_TYPE}" == "magento1" ]]; then
WARDEN_SELENIUM_DEBUG=0
WARDEN_BLACKFIRE=0
BLACKFIRE_CLIENT_ID="<client_id>"
BLACKFIRE_CLIENT_TOKEN="<client_token>"
BLACKFIRE_SERVER_ID="<server_id>"
BLACKFIRE_SERVER_TOKEN="<server_token>"
BLACKFIRE_CLIENT_ID=
BLACKFIRE_CLIENT_TOKEN=
BLACKFIRE_SERVER_ID=
BLACKFIRE_SERVER_TOKEN=
EOT
fi

Expand All @@ -62,10 +62,10 @@ if [[ "${WARDEN_ENV_TYPE}" == "magento2" ]]; then
WARDEN_SPLIT_SALES=0
WARDEN_SPLIT_CHECKOUT=0
BLACKFIRE_CLIENT_ID="<client_id>"
BLACKFIRE_CLIENT_TOKEN="<client_token>"
BLACKFIRE_SERVER_ID="<server_id>"
BLACKFIRE_SERVER_TOKEN="<server_token>"
BLACKFIRE_CLIENT_ID=
BLACKFIRE_CLIENT_TOKEN=
BLACKFIRE_SERVER_ID=
BLACKFIRE_SERVER_TOKEN=
EOT
fi

Expand Down
3 changes: 2 additions & 1 deletion commands/install.cmd
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1

source "${WARDEN_DIR}/utils/core.sh"
source "${WARDEN_DIR}/utils/install.sh"

if ! ( hash docker-compose 2>/dev/null); then
echo -e "\033[31mdocker-compose is not installed" && exit 1
fi

DOCKER_COMPOSE_VERSION="$(docker-compose -v | grep -oE '[0-9\.]+' | head -n1)"
if ! ( test "$(printf "$DOCKER_COMPOSE_VERSION\n$WARDEN_REQUIRED_DOCKER_COMPOSE" | sort -rV | head -n 1)" == "$DOCKER_COMPOSE_VERSION" ); then
if ! test $(version ${DOCKER_COMPOSE_VERSION}) -ge $(version ${WARDEN_REQUIRED_DOCKER_COMPOSE}); then
echo -e "\033[31mdocker-compose version should be $WARDEN_REQUIRED_DOCKER_COMPOSE or higher ($DOCKER_COMPOSE_VERSION installed)" && exit 1
fi

Expand Down
23 changes: 15 additions & 8 deletions commands/sync.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1

source "${WARDEN_DIR}/utils/core.sh"
source "${WARDEN_DIR}/utils/env.sh"
WARDEN_ENV_PATH="$(locateEnvPath)" || exit $?
loadEnvConfig "${WARDEN_ENV_PATH}" || exit $?
Expand All @@ -24,12 +25,9 @@ fi

## verify mutagen version constraint
MUTAGEN_VERSION=$(mutagen version 2>/dev/null) || true
if ! { \
(( $(echo ${MUTAGEN_VERSION:-0} | cut -d. -f1) >= 1 )) \
|| (( $(echo ${MUTAGEN_VERSION:-0} | cut -d. -f1) == 0 && $(echo ${MUTAGEN_VERSION:-0} | cut -d. -f2) >= 11 )) \
|| (( $(echo ${MUTAGEN_VERSION:-0} | cut -d. -f1) == 0 && $(echo ${MUTAGEN_VERSION:-0} | cut -d. -f2) == 10 && $(echo ${MUTAGEN_VERSION:-0} | cut -d. -f3) >= 3 )); }
then
>&2 printf "\e[01;31mMutagen version 0.10.3 or greater is required (version ${MUTAGEN_VERSION} is installed).\033[0m"
MUTAGEN_REQUIRE=0.10.3
if [[ $OSTYPE =~ ^darwin ]] && ! test $(version ${MUTAGEN_VERSION}) -ge $(version ${MUTAGEN_REQUIRE}); then
>&2 printf "\e[01;31mMutagen version ${MUTAGEN_REQUIRE} or greater is required (version ${MUTAGEN_VERSION} is installed).\033[0m"
>&2 printf "\n\nPlease update Mutagen:\n\n brew upgrade havoc-io/mutagen/mutagen\n\n"
exit 1
fi
Expand All @@ -53,8 +51,17 @@ case "${WARDEN_PARAMS[0]}" in

## 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 printf .; sleep 1; done; echo
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')
>&2 printf "\033[31m\nMutagen encountered an error during sync: ${MUTAGEN_ERROR}\n\033[0m"
exit 1
fi
printf .; sleep 1; done; echo
;;
stop)
## terminate only sessions labeled with this env name
Expand Down
7 changes: 1 addition & 6 deletions docs/installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Installing Warden
* `docker-compose` available in your `$PATH` (can be installed via `brew`, `apt`, `dnf`, or `pip3`)
* [Mutagen](https://mutagen.io/) v0.10.3 or later installed via Homebrew (required on macOS only; Warden will attempt to install this via `brew` if not present when running `warden sync start`).

**Warning: By default Docker Desktop allocates 2GB memory.** This leads to extensive swapping, killed processed and extremely high CPU usage during some Magento actions, like for example running sampledata:deploy and/or installing the application. It is recommended to assign at least 6GB RAM to Docker Desktop prior to deploying any Magento environments on Docker Desktop. This can be corrected via Preferences -> Advanced -> Memory. While you are there, it wouldn't hurt to let Docker have the use of a few more vCPUs (keep it at least 4 less than the maximum CPU allocation however to avoid having macOS contend with Docker for use of cores)
**Warning: By default Docker Desktop allocates 2GB memory.** This leads to extensive swapping, killed processed and extremely high CPU usage during some Magento actions, like for example running sampledata:deploy and/or installing the application. It is recommended to assign at least 6GB RAM to Docker Desktop prior to deploying any Magento environments on Docker Desktop. This can be corrected via Preferences -> Resources -> Advanced -> Memory. While you are there, it wouldn't hurt to let Docker have the use of a few more vCPUs (keep it at least 4 less than the maximum CPU allocation however to avoid having macOS contend with Docker for use of cores)

### Installing via Homebrew

Expand All @@ -26,8 +26,3 @@ Warden may be installed by cloning the repository to the directory of your choic
echo 'export PATH="/opt/warden/bin:$PATH"' >> ~/.bashrc
PATH="/opt/warden/bin:$PATH"
warden up

### Recommended Additions

* `pv` installed and available in your `$PATH` (you can install this via `brew install pv`) for use sending database files to `warden db import` and providing determinate progress indicators for the import. Alternatively `cat` may be used where `pv` is referenced in documentation but will not provide progress indicators.
* On macOS it is **highly recommended** to install `docker-compose` via `pip3 install --user docker-compose` adding `~/Library/Python/3.7/bin/` to your `$PATH` vs relying on the `docker-compose` binary installed by Docker for Mac (or installing via brew, which Docker for Mac overwrites each time it starts); the binary installed by Docker for Mac out of the box takes roughly 8 to 20 times as long to initialize due to entropy related code (for example a `docker-compose version` command will take 2 to 5 seconds vs what should be a fraction of a second). Installing `docker-compose` via a third-party package manager such as `pip3` to a location other than `/usr/local/bin` (which Docker for Mac overwrites on startup) will resolve the slowness caused by Warden using `docker-compose` under the hood.
3 changes: 3 additions & 0 deletions environments/magento2.selenium.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ services:
container_name: ${WARDEN_ENV_NAME}_selenium-hub
hostname: selenium-hub
image: selenium/hub:3.8.1
environment:
GRID_TIMEOUT: 0
GRID_BROWSER_TIMEOUT: 0
networks:
- warden
- default
Expand Down
3 changes: 3 additions & 0 deletions images/nginx/context/etc/nginx/available.d/magento2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,14 @@ location /media/import/ {
location ~* ^/dev/tests/acceptance/utils($|/) {
root $MAGE_ROOT;

# This endpoint runs `bin/magento` CLI, be aware that it needs more time to finish
location ~ ^/dev/tests/acceptance/utils/command.php {
fastcgi_pass $fastcgi_backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;
include fastcgi_params;
}
}
Expand Down
17 changes: 9 additions & 8 deletions images/php-fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM davidalger/php:${PHP_VERSION}-fpm
ENV MAILHOG_HOST mailhog
ENV MAILHOG_PORT 1025

RUN yum install -y which pv sudo bind-utils python36-pip mariadb102 bash-completion rsync \
RUN yum install -y which pv sudo bind-utils python36-pip mariadb102 bash-completion rsync socat \
&& yum clean all \
&& rm -rf /var/cache/yum

Expand Down Expand Up @@ -44,13 +44,14 @@ RUN PHP_VERSION=$(php -v | head -n1 | cut -d' ' -f2 | cut -d. -f1-2) \
&& rm -rf /tmp/sourceguardian

# Install and enable IonCube loader
RUN PHP_VERSION=$(php -v | head -n1 | cut -d' ' -f2 | cut -d. -f1-2 | cut -d. -f1-2 | sed 's/\.//') \
&& if (( ${PHP_VERSION} >= 73 )); \
then echo "php${PHP_VERSION}-ioncube does not exist yet in ius upstream; skipping"; \
else yum install -y php${PHP_VERSION}u-ioncube-loader; \
fi \
&& yum clean all \
&& rm -rf /var/cache/yum
RUN PHP_VERSION=$(php -v | head -n1 | cut -d' ' -f2 | cut -d. -f1-2) \
&& mkdir -p /tmp/ioncube \
&& cd /tmp/ioncube \
&& curl -Os https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar xzf ioncube_loaders_lin_x86-64.tar.gz \
&& cp ioncube/ioncube_loader_lin_${PHP_VERSION}.so "$(php -i | grep '^extension_dir =' | cut -d' ' -f3)/ioncube_loader.so" \
&& echo "zend_extension=ioncube_loader.so" > /etc/php.d/01-ioncube-loader.ini \
&& rm -rf /tmp/ioncube

# Install mhsendmail to support routing email through mailhog
RUN mkdir -p /tmp/mhsendmail \
Expand Down
20 changes: 14 additions & 6 deletions images/php-fpm/context/docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,33 @@ set -e

# configure php additions.ini
cat /etc/php.d/05-additions.ini.template \
| envsubst '${MAILHOG_HOST} ${MAILHOG_PORT}' \
| sudo tee /etc/php.d/05-additions.ini
| envsubst '${MAILHOG_HOST} ${MAILHOG_PORT}' \
| sudo tee /etc/php.d/05-additions.ini

# append warden issued root ca cert to ca-bundle trusted by curl/openssl
if [ -f /etc/ssl/warden-rootca-cert/ca.cert.pem ]; then
cat /etc/ssl/warden-rootca-cert/ca.cert.pem | sudo tee -a /etc/ssl/certs/ca-bundle.crt >/dev/null
cat /etc/ssl/warden-rootca-cert/ca.cert.pem | sudo tee -a /etc/ssl/certs/ca-bundle.crt >/dev/null
fi

# start socat process in background to connect sockets used for agent access within container environment
if [[ -S /run/host-services/ssh-auth.sock ]] \
&& [[ "${SSH_AUTH_SOCK}" != "/run/host-services/ssh-auth.sock" ]]
then
sudo bash -c "nohup socat UNIX-CLIENT:/run/host-services/ssh-auth.sock \
UNIX-LISTEN:${SSH_AUTH_SOCK},fork,user=www-data,group=www-data 1>/var/log/socat-ssh-auth.log 2>&1 &"
fi

# install requested node version if not already installed
NODE_INSTALLED="$(node -v | perl -pe 's/^v([0-9]+)\..*$/$1/')";
if [ "${NODE_INSTALLED}" != "${NODE_VERSION}" ] \
|| [ "${NODE_VERSION}" = "latest" ] || [ "${NODE_VERSION}" = "lts" ]
|| [ "${NODE_VERSION}" = "latest" ] || [ "${NODE_VERSION}" = "lts" ]
then
sudo n "${NODE_VERSION}"
sudo n "${NODE_VERSION}"
fi

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
set -- php-fpm "$@"
fi

exec "$@"
4 changes: 4 additions & 0 deletions images/varnish/4.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM centos:7

RUN yum upgrade -y \
&& yum clean all \
&& rm -rf /var/cache/yum

ARG RPM_SCRIPT=https://packagecloud.io/install/repositories/varnishcache/varnish41/script.rpm.sh
RUN curl -s "${RPM_SCRIPT}" | bash \
&& yum install -y epel-release \
Expand Down
4 changes: 4 additions & 0 deletions images/varnish/6.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM centos:7

RUN yum upgrade -y \
&& yum clean all \
&& rm -rf /var/cache/yum

ARG RPM_SCRIPT=https://packagecloud.io/install/repositories/varnishcache/varnish60lts/script.rpm.sh
RUN curl -s "${RPM_SCRIPT}" | bash \
&& yum install -y epel-release \
Expand Down
6 changes: 6 additions & 0 deletions utils/core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1

function version {
echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }';
}
2 changes: 1 addition & 1 deletion utils/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1

function locateEnvPath () {
local WARDEN_ENV_PATH="$(pwd)"
local WARDEN_ENV_PATH="$(pwd -P)"
while [[ "${WARDEN_ENV_PATH}" != "/" ]]; do
if [[ -f "${WARDEN_ENV_PATH}/.env" ]] \
&& grep "^WARDEN_ENV_NAME" "${WARDEN_ENV_PATH}/.env" >/dev/null \
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.3
0.2.4

0 comments on commit b27fc80

Please sign in to comment.