From 76dd0252ee95dc03ddb23c2c6ccfedab68635623 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 19 Dec 2017 00:54:20 -0500 Subject: [PATCH] feat: add pre-start trigger for notifying on application start Closes #2713 --- docs/development/plugin-triggers.md | 18 ++++++++++++++++++ plugins/ps/functions | 1 + 2 files changed, 19 insertions(+) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index d3d1058fe..c5d947c54 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -932,6 +932,24 @@ APP="$1"; verify_app_name "$APP" # TODO ``` +### `pre-start` + +- Description: Can be used to run commands before an application is started +- Invoked by: `dokku ps:start` +- Arguments: `$APP` +- Example: + +```shell +#!/usr/bin/env bash +# Notifies an example url that an application is starting + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +APP="$1"; + +curl "https://example.com/starting/${APP}" || true +``` + ### `proxy-build-config` - Description: Builds the proxy implementation configuration for a given app diff --git a/plugins/ps/functions b/plugins/ps/functions index 25f6ce401..e4816403f 100755 --- a/plugins/ps/functions +++ b/plugins/ps/functions @@ -93,6 +93,7 @@ ps_start() { local IMAGE_TAG=$(get_running_image_tag "$APP"); if (is_deployed "$APP"); then + plugn trigger pre-start "$APP" if ! (is_app_running "$APP"); then release_and_deploy "$APP" "$IMAGE_TAG" else