Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' for releaes 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalger committed Jul 3, 2019
2 parents e3b7d3b + be47e3f commit 70edac6
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
0.1.2
===============

* Added `warden shell` command for easily dropping into the `php-fpm` container (container name is configurable for supporting "local" environment types)
* Added `max_allowed_packet=1024M` to `db` containers for M1 and M2 environments to avoid imports or upgrade routines from failing on large packets.
* Changed `php-fpm` and `php-debug` to use custom images based on `centos:7` as opposed to the `alpine3.9` based official php-fpm images to avoid seg-faults when Source Guardian loader is installed alongside Xdebug.
* Fixed issue with DEFINER stripping in `db import` allowing it to correctly strip from both TRIGGERS and ALGORITHM clauses.

0.1.1
===============

Expand Down
2 changes: 1 addition & 1 deletion bin/warden
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ readonly WARDEN_SSL_DIR="${WARDEN_HOME_DIR}/ssl"
declare WARDEN_HELP=
declare WARDEN_PARAMS=()
declare WARDEN_COMMAND=
declare WARDEN_ANYARGS=(env db)
declare WARDEN_ANYARGS=(env db shell)
declare WARDEN_VERBOSE=

## parse first argument as command and determine validity
Expand Down
3 changes: 2 additions & 1 deletion commands/db.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ case "${WARDEN_PARAMS[0]}" in
mysql -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" "${MYSQL_DATABASE}" "$@"
;;
import)
LC_ALL=C sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | "${WARDEN_DIR}/bin/warden" env exec -T db \
LC_ALL=C sed -E 's/DEFINER[ ]*=[ ]*`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g' \
| "${WARDEN_DIR}/bin/warden" env exec -T db \
mysql -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" "${MYSQL_DATABASE}"
;;
*)
Expand Down
17 changes: 17 additions & 0 deletions commands/shell.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/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/env.sh"
WARDEN_ENV_PATH="$(locateEnvPath)" || exit $?
loadEnvConfig "${WARDEN_ENV_PATH}" || exit $?

## set defaults for this command which can be overriden either using exports in the user
## profile or setting them in the .env configuration on a per-project basis
WARDEN_ENV_SHELL_COMMAND=${WARDEN_ENV_SHELL_COMMAND:-bash}
WARDEN_ENV_SHELL_CONTAINER=${WARDEN_ENV_SHELL_CONTAINER:-php-fpm}

## simply allow the return code from sub-command to bubble up per normal
trap '' ERR

"${WARDEN_DIR}/bin/warden" env exec "${WARDEN_ENV_SHELL_CONTAINER}" \
"${WARDEN_ENV_SHELL_COMMAND}" "${WARDEN_PARAMS[@]}" "$@"
12 changes: 12 additions & 0 deletions commands/shell.help
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1

WARDEN_USAGE=$(cat <<EOF
\033[33mUsage:\033[0m
shell [args]
\033[33mOptions:\033[0m
-h, --help Display this help menu
-v, --verbose Increases verbosity of output
EOF
)
3 changes: 2 additions & 1 deletion commands/usage.help
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WARDEN_HEADER='

WARDEN_USAGE=$(cat <<EOF
${WARDEN_HEADER:1}
Warden version 0.1.1
Warden version 0.1.2
\033[33mUsage:\033[0m
command [options] [arguments]
Expand All @@ -26,6 +26,7 @@ Warden version 0.1.1
env Controls an environment from any point within the root project directory
install Initializes or updates warden configuration on host machine
restart Restarts warden managed containers
shell Launches into a shell within the current project environment
sign-certificate Signs a wildcard certificate including all passed hostnames on the SAN list
start Start services
stop Stop services
Expand Down
7 changes: 5 additions & 2 deletions environments/magento1.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:

php-fpm:
hostname: php-fpm
image: davidalger/warden:mage1-fpm-${PHP_VERSION:-7.2}-alpine
image: davidalger/warden:mage1-fpm-${PHP_VERSION:-7.2}
depends_on:
- db
volumes:
Expand All @@ -29,7 +29,7 @@ services:

php-debug:
hostname: php-debug
image: davidalger/warden:mage1-fpm-${PHP_VERSION:-7.2}-debug-alpine
image: davidalger/warden:mage1-fpm-${PHP_VERSION:-7.2}-debug
environment:
- PHP_IDE_CONFIG=serverName=${WARDEN_ENV_NAME}-docker
depends_on:
Expand All @@ -46,6 +46,9 @@ services:
- MYSQL_DATABASE=${MYSQL_DATABASE:-magento}
- MYSQL_USER=${MYSQL_USER:-magento}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-magento}
command:
- mysqld
- --max_allowed_packet=1024M
volumes:
- dbdata:/var/lib/mysql
networks:
Expand Down
7 changes: 5 additions & 2 deletions environments/magento2.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ services:

php-fpm:
hostname: php-fpm
image: davidalger/warden:mage2-fpm-${PHP_VERSION:-7.2}-alpine
image: davidalger/warden:mage2-fpm-${PHP_VERSION:-7.2}
depends_on:
- db

php-debug:
hostname: php-debug
image: davidalger/warden:mage2-fpm-${PHP_VERSION:-7.2}-debug-alpine
image: davidalger/warden:mage2-fpm-${PHP_VERSION:-7.2}-debug
environment:
- PHP_IDE_CONFIG=serverName=${WARDEN_ENV_NAME}-docker
depends_on:
Expand All @@ -41,6 +41,9 @@ services:
- MYSQL_DATABASE=${MYSQL_DATABASE:-magento}
- MYSQL_USER=${MYSQL_USER:-magento}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-magento}
command:
- mysqld
- --max_allowed_packet=1024M
volumes:
- dbdata:/var/lib/mysql
networks:
Expand Down

0 comments on commit 70edac6

Please sign in to comment.