diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c3120fe..39a77bca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 =============== diff --git a/bin/warden b/bin/warden index 1c6fe601..3a440a37 100755 --- a/bin/warden +++ b/bin/warden @@ -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 diff --git a/commands/db.cmd b/commands/db.cmd index be22b471..ac6464c2 100644 --- a/commands/db.cmd +++ b/commands/db.cmd @@ -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}" ;; *) diff --git a/commands/shell.cmd b/commands/shell.cmd new file mode 100644 index 00000000..2de792ac --- /dev/null +++ b/commands/shell.cmd @@ -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[@]}" "$@" diff --git a/commands/shell.help b/commands/shell.help new file mode 100755 index 00000000..e43b85d1 --- /dev/null +++ b/commands/shell.help @@ -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 <