From 4b3de76f94ce3053f616dfb9f5b2224370f0c480 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 3 Mar 2018 17:49:55 -0500 Subject: [PATCH 1/7] fix: add missing events --- plugins/20_events/post-app-clone | 1 + plugins/20_events/post-app-rename | 1 + plugins/20_events/post-extract | 1 + plugins/20_events/pre-start | 1 + plugins/20_events/uninstall | 1 + 5 files changed, 5 insertions(+) create mode 120000 plugins/20_events/post-app-clone create mode 120000 plugins/20_events/post-app-rename create mode 120000 plugins/20_events/post-extract create mode 120000 plugins/20_events/pre-start create mode 120000 plugins/20_events/uninstall diff --git a/plugins/20_events/post-app-clone b/plugins/20_events/post-app-clone new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-app-clone @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/post-app-rename b/plugins/20_events/post-app-rename new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-app-rename @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/post-extract b/plugins/20_events/post-extract new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-extract @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/pre-start b/plugins/20_events/pre-start new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/pre-start @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/uninstall b/plugins/20_events/uninstall new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/uninstall @@ -0,0 +1 @@ +hook \ No newline at end of file From 25982e961d0a7254e96fb680fc959b86e10a165a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 3 Mar 2018 17:50:08 -0500 Subject: [PATCH 2/7] docs: remove event that is no longer triggered --- docs/development/plugin-triggers.md | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 8ffb93740..a3473d832 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -44,23 +44,6 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # TODO ``` -### `bind-external-ip` - -- Description: Allows you to disable binding to the external box ip -- Invoked by: `dokku deploy` -- Arguments: `$APP` -- Example: - -```shell -#!/usr/bin/env bash -# Force always binding to the docker ip, no matter -# what the settings are for a given app. - -set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x - -echo false -``` - ### `check-deploy` - Description: Allows you to run checks on a deploy before Dokku allows the container to handle requests. From 15747612cd7b2ad5218530560d3a11b91cfb8c54 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 3 Mar 2018 17:50:14 -0500 Subject: [PATCH 3/7] feat: sort list of events --- plugins/20_events/subcommands/list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/20_events/subcommands/list b/plugins/20_events/subcommands/list index aa6c206af..3f43bf25d 100755 --- a/plugins/20_events/subcommands/list +++ b/plugins/20_events/subcommands/list @@ -8,7 +8,7 @@ events_list_cmd() { local PLUGIN_DIR="$(dirname "$0")/.." if [[ "$DOKKU_EVENTS" ]]; then - local logged="$(find "$PLUGIN_DIR" -type l -printf '%f ' 2>/dev/null | sort)" + local logged="$(find "$PLUGIN_DIR" -type l -printf '%f\n' 2>/dev/null | sort -n)" dokku_col_log_info2_quiet "Events currently logged" local hook From eb0f49f08c7cfbba78eb8c918dd1e13c09358a52 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 3 Mar 2018 17:50:26 -0500 Subject: [PATCH 4/7] docs: cleanup events documentation --- docs/advanced-usage/event-logs.md | 41 ++++++++++++++----------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/docs/advanced-usage/event-logs.md b/docs/advanced-usage/event-logs.md index 524a6423e..645b6f77f 100644 --- a/docs/advanced-usage/event-logs.md +++ b/docs/advanced-usage/event-logs.md @@ -36,10 +36,8 @@ Jul 3 16:10:02 dokku.me dokku[128114]: INVOKED: docker-args-run( nhl ) Jul 3 16:10:03 dokku.me dokku[128136]: INVOKED: post-release-buildpack( pythonapp ) Jul 3 16:10:03 dokku.me dokku[128195]: INVOKED: pre-deploy( pythonapp ) Jul 3 16:10:23 dokku.me dokku[129253]: INVOKED: docker-args-deploy( pythonapp ) -Jul 3 16:10:24 dokku.me dokku[129337]: INVOKED: bind-external-ip( pythonapp ) Jul 3 16:10:24 dokku.me dokku[129451]: INVOKED: check-deploy( pythonapp 6274ced0d4be11af4490cd18abaf77cdd593f025133f403d984e80d86a39acec web 5000 10.0.16.80 ) Jul 3 16:10:35 dokku.me dokku[129561]: INVOKED: docker-args-deploy( pythonapp ) -Jul 3 16:10:35 dokku.me dokku[129649]: INVOKED: bind-external-ip( pythonapp ) Jul 3 16:10:36 dokku.me dokku[129760]: INVOKED: check-deploy( pythonapp ac88a56ee4161ff37e4b92d1498c3eadc91f0aa7c8b81b44fc077e2a51d54cc0 worker ) Jul 3 16:10:46 dokku.me dokku[129851]: INVOKED: post-deploy( pythonapp ) Jul 3 16:10:46 dokku.me dokku[129945]: INVOKED: nginx-pre-reload( pythonapp ) @@ -56,29 +54,28 @@ dokku events:list ``` =====> Events currently logged -docker-args-build -pre-delete -post-deploy -receive-app -pre-release-buildpack -nginx-pre-reload -docker-args-deploy -post-build-buildpack -post-domains-update -post-release-dockerfile check-deploy -git-pre-pull -git-post-pull -nginx-hostname -bind-external-ip -pre-deploy -post-delete dependencies -pre-build-buildpack +docker-args-build +docker-args-deploy docker-args-run -pre-build-dockerfile -post-release-buildpack +git-post-pull +git-pre-pull +nginx-hostname +nginx-pre-reload +post-build-buildpack post-build-dockerfile +post-delete +post-deploy +post-domains-update +post-release-buildpack +post-release-dockerfile +pre-build-buildpack +pre-build-dockerfile +pre-delete +pre-deploy +pre-release-buildpack pre-release-dockerfile +receive-app update -``` +``` \ No newline at end of file From 9e6a0997352777a0603e5e3a28ffc82094ca3c6e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 3 Mar 2018 17:57:34 -0500 Subject: [PATCH 5/7] fix: remove unused trigger --- plugins/20_events/bind-external-ip | 1 - 1 file changed, 1 deletion(-) delete mode 120000 plugins/20_events/bind-external-ip diff --git a/plugins/20_events/bind-external-ip b/plugins/20_events/bind-external-ip deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/bind-external-ip +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file From 81feac76173b2a2d6d1ccdfbc44dc3e6a59b34a2 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 3 Mar 2018 17:57:52 -0500 Subject: [PATCH 6/7] docs: reorganize documentation page --- docs/development/plugin-triggers.md | 161 ++++++++++++++-------------- 1 file changed, 78 insertions(+), 83 deletions(-) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index a3473d832..cbe6cb59a 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -29,21 +29,6 @@ The following plugin triggers describe those available to a Dokku installation. > The example plugin trigger code is not guaranteed to be implemented as in within dokku, and are merely simplified examples. Please look at the Dokku source for larger, more in-depth examples. -### `post-config-update` - -- Description: Allows you to get notified when one or more configs is added or removed. Action can be *set* or *unset* -- Invoked by: `dokku config:set`, `dokku config:unset` -- Arguments: `$APP` `set|unset` `key1=VALUE1 key2=VALUE2` -- Example: - -```shell -#!/usr/bin/env bash - -set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x - -# TODO -``` - ### `check-deploy` - Description: Allows you to run checks on a deploy before Dokku allows the container to handle requests. @@ -162,22 +147,6 @@ case "$DOKKU_DISTRO" in esac ``` -### `deployed-app-image-tag` - -- Description: Used to manage the tag of the image being deployed. Useful for deploying a specific version of an image, or when deploying from an external registry -- Invoked by: `internal function dokku_deploy_cmd() (deploy phase)` -- Arguments: `$APP` -- Example: - -```shell -#!/usr/bin/env bash - -set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x - -# customize the tag version -echo 'not-latest' -``` - ### `deployed-app-image-repo` - Description: Used to manage the full repo of the image being deployed. Useful for deploying from an external registry where the repository name is not `dokku/$APP` @@ -195,6 +164,22 @@ APP="$1" echo "dokkupaas/$APP" ``` +### `deployed-app-image-tag` + +- Description: Used to manage the tag of the image being deployed. Useful for deploying a specific version of an image, or when deploying from an external registry +- Invoked by: `internal function dokku_deploy_cmd() (deploy phase)` +- Arguments: `$APP` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +# customize the tag version +echo 'not-latest' +``` + ### `deployed-app-repository` - Description: Used to manage the remote repository of the image being deployed. @@ -223,19 +208,14 @@ echo 'derp.dkr.ecr.us-east-1.amazonaws.com' # to bust cache at any arbitrary point in a Dockerfile build set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -cache-bust-build-arg() { - declare desc="dockerfile cache busting plugin trigger" - local STDIN=$(cat) - local APP="$1" IMAGE_SOURCE_TYPE="$2" - local output="" +STDIN=$(cat) +APP="$1"; IMAGE_SOURCE_TYPE="$2" +output="" - if [[ "$IMAGE_SOURCE_TYPE" == "dockerfile" ]]; then - output=" --build-arg CACHEBUST=$(date +%s)" - fi - echo -n "$STDIN$output" -} - -cache-bust-build-arg "$@" +if [[ "$IMAGE_SOURCE_TYPE" == "dockerfile" ]]; then + output=" --build-arg CACHEBUST=$(date +%s)" +fi +echo -n "$STDIN$output" ``` ### `docker-args-deploy` @@ -402,11 +382,11 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # TODO ``` -### `network-get-property` +### `network-get-port` -- Description: Return the network value for an application's property +- Description: Return the port for a given app container - Invoked by: `internally triggered by a deploy` -- Arguments: `$APP $KEY` +- Arguments: `$APP $PROC_TYPE $CONTAINER_ID $IS_HEROKUISH_CONTAINER` - Example: ```shell @@ -417,11 +397,11 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # TODO ``` -### `network-get-port` +### `network-get-property` -- Description: Return the port for a given app container +- Description: Return the network value for an application's property - Invoked by: `internally triggered by a deploy` -- Arguments: `$APP $PROC_TYPE $CONTAINER_ID $IS_HEROKUISH_CONTAINER` +- Arguments: `$APP $KEY` - Example: ```shell @@ -562,6 +542,21 @@ APP="$1"; verify_app_name "$APP" # TODO ``` +### `post-config-update` + +- Description: Allows you to get notified when one or more configs is added or removed. Action can be *set* or *unset* +- Invoked by: `dokku config:set`, `dokku config:unset` +- Arguments: `$APP` `set|unset` `key1=VALUE1 key2=VALUE2` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +# TODO +``` + ### `post-create` - Description: Can be used to run commands after an application is created. @@ -817,6 +812,40 @@ docker commit $id $IMAGE > /dev/null dokku_log_info1 "Building UI Complete" ``` +### `pre-disable-vhost` + +- Description: Allows you to run commands before the VHOST feature is disabled +- Invoked by: `dokku domains:disable` +- Arguments: `$APP` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +APP="$1"; verify_app_name "$APP" + +# TODO +``` + +### `pre-enable-vhost` + +- Description: Allows you to run commands before the VHOST feature is enabled +- Invoked by: `dokku domains:enable` +- Arguments: `$APP` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +APP="$1"; verify_app_name "$APP" + +# TODO +``` + ### `pre-receive-app` - Description: Allows you to customize the contents of an application directory before they are processed for deployment. The `IMAGE_SOURCE_TYPE` can be any of `[herokuish, dockerfile]` @@ -881,40 +910,6 @@ verify_app_name "$APP" # TODO ``` -### `pre-disable-vhost` - -- Description: Allows you to run commands before the VHOST feature is disabled -- Invoked by: `dokku domains:disable` -- Arguments: `$APP` -- Example: - -```shell -#!/usr/bin/env bash - -set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -APP="$1"; verify_app_name "$APP" - -# TODO -``` - -### `pre-enable-vhost` - -- Description: Allows you to run commands before the VHOST feature is enabled -- Invoked by: `dokku domains:enable` -- Arguments: `$APP` -- Example: - -```shell -#!/usr/bin/env bash - -set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -APP="$1"; verify_app_name "$APP" - -# TODO -``` - ### `pre-start` - Description: Can be used to run commands before an application is started From 63616796cb96e8236605b18d6bb8e34b448d84ad Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 3 Mar 2018 17:58:04 -0500 Subject: [PATCH 7/7] docs: add missing docs for plugin triggers --- docs/development/plugin-triggers.md | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index cbe6cb59a..6bcc83697 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -478,6 +478,36 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x nginx -t ``` +### `post-app-clone` + +- Description: Allows you to run commands after an application was cloned. +- Invoked by: `dokku apps:clone` +- Arguments: `$OLD_APP_NAME $NEW_APP_NAME` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +# TODO +``` + +### `post-app-rename` + +- Description: Allows you to run commands after an application was renamed. +- Invoked by: `dokku apps:rename` +- Arguments: `$OLD_APP_NAME $NEW_APP_NAME` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +# TODO +``` + ### `post-build-buildpack` - Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using buildpacks.