From ac75c726ad19d65b730909ae85d3001298e8f69d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Wed, 26 Aug 2015 22:53:00 +0200 Subject: [PATCH 01/32] Plugins management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We had an issue with third party plugins installing things via apt while already installing dokku itself via apt. To resolve this, `plugins-install` and `plugins-install-dependencies` now can take a `--core` flag allowing to execute the install hook only on core plugins and not on third party plugins. Another feature with this modification is the ability to disable/enable plugins. Two new commands now exist: * `plugins:enable ` to enable a previously disabled plugin * `plugins:disable ` to disable an installed plugin. This won’t work on core plugins. --- Makefile | 21 +++++++++++++-------- debian/postinst | 2 +- dokku | 37 ++++++++++++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 6ac803847..643a107e4 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,10 @@ SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb STACK_URL ?= https://github.com/gliderlabs/herokuish.git PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest -PLUGINS_PATH ?= /var/lib/dokku/plugins +DOKKU_LIB_ROOT ?= /var/lib/dokku +PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/plugins +CORE_PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/core-plugins +DISABLED_PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/disabled-plugins # If the first argument is "vagrant-dokku"... ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS))) @@ -44,13 +47,15 @@ packer: copyfiles: cp dokku /usr/local/bin/dokku - mkdir -p ${PLUGINS_PATH} - find ${PLUGINS_PATH} -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf + mkdir -p ${CORE_PLUGINS_PATH} ${PLUGINS_PATH} ${DISABLED_PLUGINS_PATH} + rm -rf ${CORE_PLUGINS_PATH}/* find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \ - rm -Rf ${PLUGINS_PATH}/$$plugin && \ - cp -R plugins/$$plugin ${PLUGINS_PATH} && \ - touch ${PLUGINS_PATH}/$$plugin/.core; \ + rm -Rf ${CORE_PLUGINS_PATH}/$$plugin && \ + rm -rf ${PLUGINS_PATH}/$$plugin && \ + cp -R plugins/$$plugin ${CORE_PLUGINS_PATH} && \ + ln -s ${CORE_PLUGINS_PATH}/$$plugin ${PLUGINS_PATH}; \ done + chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} ${DISABLED_PLUGINS_PATH} $(MAKE) addman addman: @@ -62,10 +67,10 @@ version: git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION plugin-dependencies: pluginhook - dokku plugins-install-dependencies + dokku plugins-install-dependencies --core plugins: pluginhook docker - dokku plugins-install + dokku plugins-install --core dependencies: apt-update sshcommand pluginhook docker help2man man-db $(MAKE) -e stack diff --git a/debian/postinst b/debian/postinst index d9d94b818..a0e8dd590 100755 --- a/debian/postinst +++ b/debian/postinst @@ -16,7 +16,7 @@ case "$1" in sshcommand create dokku /usr/local/bin/dokku egrep -i "^docker" /etc/group || groupadd docker usermod -aG docker dokku - dokku plugins-install + dokku plugins-install --core rm -f /home/dokku/VERSION cp /var/lib/dokku/STABLE_VERSION /home/dokku/VERSION diff --git a/dokku b/dokku index 9625e5905..42bfcd234 100755 --- a/dokku +++ b/dokku @@ -5,8 +5,11 @@ shopt -s nullglob export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"} export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"} export DOKKU_ROOT=${DOKKU_ROOT:=~dokku} +export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"} -export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} +export PLUGIN_PATH=${PLUGIN_PATH:="$DOKKU_LIB_ROOT/plugins"} +export PLUGIN_CORE_PATH=${PLUGIN_CORE_PATH:="$DOKKU_LIB_ROOT/core-plugins"} +export PLUGIN_DISABLED_PATH=${PLUGIN_DISABLED_PATH:="$DOKKU_LIB_ROOT/disabled-plugins"} export DOKKU_NOT_IMPLEMENTED_EXIT=10 export DOKKU_VALID_EXIT=0 @@ -199,14 +202,22 @@ case "$1" in ;; plugins) - ls -1 -d $PLUGIN_PATH/*/ + for plugin in "$PLUGIN_PATH"/*/; do + basename "$plugin" + done ;; plugins-install) + if [[ $2 == "--core" ]]; then + export PLUGIN_PATH="$PLUGIN_CORE_PATH" + fi pluginhook install ;; plugins-install-dependencies) + if [[ $2 == "--core" ]]; then + export PLUGIN_PATH="$PLUGIN_CORE_PATH" + fi pluginhook dependencies ;; @@ -214,6 +225,23 @@ case "$1" in pluginhook update ;; + plugins:disable) + PLUGIN="$2" + [[ -e $PLUGIN_CORE_PATH/$PLUGIN ]] && echo "Cannot disable a core plugin" && exit 1 + [[ -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin already disabled" && exit 1 + [[ ! -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 + mv "$PLUGIN_PATH/$PLUGIN" "$PLUGIN_DISABLED_PATH" + echo "Plugin $PLUGIN disabled" + ;; + + plugins:enable) + PLUGIN="$2" + [[ -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin already enabled" && exit 1 + [[ ! -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 + mv "$PLUGIN_DISABLED_PATH/$PLUGIN" "$PLUGIN_PATH" + echo "Plugin $PLUGIN enabled" + ;; + # DEPRECATED as of v0.3.14 deploy:all) echo "*DEPRECATED* in v0.3.14: deploy:all will be removed in future versions" @@ -228,8 +256,11 @@ case "$1" in cat<, Enable a previously disabled plugin + plugins:disable , Disable an installed plugin (third-party only) EOF ;; From 7a545759f27f98ba0a5be1a642119050242ca0fa Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Fri, 12 Jun 2015 18:07:08 -0700 Subject: [PATCH 02/32] initial pass at switching to plugn --- Makefile | 19 +++++---- dokku | 28 ++++++------ plugins/00_dokku-standard/commands | 61 ++++++++++++++------------- plugins/00_dokku-standard/plugin.toml | 4 ++ plugins/20_events/plugin.toml | 4 ++ plugins/apps/commands | 6 +-- plugins/apps/plugin.toml | 4 ++ plugins/backup/commands | 8 ++-- plugins/backup/plugin.toml | 4 ++ plugins/build-env/plugin.toml | 4 ++ plugins/certs/commands | 2 +- plugins/certs/plugin.toml | 4 ++ plugins/checks/plugin.toml | 4 ++ plugins/common/plugin.toml | 4 ++ plugins/config/commands | 2 +- plugins/config/plugin.toml | 4 ++ plugins/docker-options/commands | 2 +- plugins/docker-options/plugin.toml | 4 ++ plugins/domains/commands | 10 ++--- plugins/domains/plugin.toml | 4 ++ plugins/enter/plugin.toml | 4 ++ plugins/git/commands | 12 +++--- plugins/git/plugin.toml | 4 ++ plugins/nginx-vhosts/commands | 4 +- plugins/nginx-vhosts/plugin.toml | 4 ++ plugins/ps/commands | 20 ++++----- plugins/ps/plugin.toml | 4 ++ plugins/shell/commands | 2 +- plugins/shell/plugin.toml | 4 ++ plugins/tags/commands | 4 +- plugins/tags/plugin.toml | 4 ++ plugins/tar/commands | 2 +- plugins/tar/plugin.toml | 4 ++ 33 files changed, 163 insertions(+), 91 deletions(-) create mode 100644 plugins/00_dokku-standard/plugin.toml create mode 100644 plugins/20_events/plugin.toml create mode 100644 plugins/apps/plugin.toml create mode 100644 plugins/backup/plugin.toml create mode 100644 plugins/build-env/plugin.toml create mode 100644 plugins/certs/plugin.toml create mode 100644 plugins/checks/plugin.toml create mode 100644 plugins/common/plugin.toml create mode 100644 plugins/config/plugin.toml create mode 100644 plugins/docker-options/plugin.toml create mode 100644 plugins/domains/plugin.toml create mode 100644 plugins/enter/plugin.toml create mode 100644 plugins/git/plugin.toml create mode 100644 plugins/nginx-vhosts/plugin.toml create mode 100644 plugins/ps/plugin.toml create mode 100644 plugins/shell/plugin.toml create mode 100644 plugins/tags/plugin.toml create mode 100644 plugins/tar/plugin.toml diff --git a/Makefile b/Makefile index 643a107e4..60380bf68 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ DOKKU_VERSION = master SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand -PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb +PLUGN_URL ?= https://github.com/progrium/plugn/releases/download/v0.1.0/plugn_0.1.0_linux_x86_64.tgz STACK_URL ?= https://github.com/gliderlabs/herokuish.git PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest DOKKU_LIB_ROOT ?= /var/lib/dokku @@ -23,7 +23,7 @@ else BUILD_STACK_TARGETS = build-in-docker endif -.PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku +.PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku include tests.mk include deb.mk @@ -50,10 +50,11 @@ copyfiles: mkdir -p ${CORE_PLUGINS_PATH} ${PLUGINS_PATH} ${DISABLED_PLUGINS_PATH} rm -rf ${CORE_PLUGINS_PATH}/* find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \ + rm -Rf ${PLUGINS_PATH}/available/$$plugin && \ rm -Rf ${CORE_PLUGINS_PATH}/$$plugin && \ rm -rf ${PLUGINS_PATH}/$$plugin && \ cp -R plugins/$$plugin ${CORE_PLUGINS_PATH} && \ - ln -s ${CORE_PLUGINS_PATH}/$$plugin ${PLUGINS_PATH}; \ + ln -s ${CORE_PLUGINS_PATH}/$$plugin ${PLUGINS_PATH}/available; \ done chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} ${DISABLED_PLUGINS_PATH} $(MAKE) addman @@ -66,13 +67,13 @@ addman: version: git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION -plugin-dependencies: pluginhook +plugin-dependencies: plugn dokku plugins-install-dependencies --core -plugins: pluginhook docker +plugins: plugn docker dokku plugins-install --core -dependencies: apt-update sshcommand pluginhook docker help2man man-db +dependencies: apt-update sshcommand plugn docker help2man man-db $(MAKE) -e stack apt-update: @@ -89,9 +90,9 @@ sshcommand: chmod +x /usr/local/bin/sshcommand sshcommand create dokku /usr/local/bin/dokku -pluginhook: - wget -qO /tmp/pluginhook_0.1.0_amd64.deb ${PLUGINHOOK_URL} - dpkg -i /tmp/pluginhook_0.1.0_amd64.deb +plugn: + wget -qO /tmp/plugn_latest.tgz ${PLUGN_URL} + tar xzf /tmp/plugn_latest.tgz -C /usr/local/bin docker: aufs apt-get install -qq -y curl diff --git a/dokku b/dokku index 42bfcd234..49fade16e 100755 --- a/dokku +++ b/dokku @@ -16,7 +16,7 @@ export DOKKU_VALID_EXIT=0 export DOKKU_LOGS_DIR=${DOKKU_LOGS_DIR:="/var/log/dokku"} export DOKKU_EVENTS_LOGFILE=${DOKKU_EVENTS_LOGFILE:="$DOKKU_LOGS_DIR/events.log"} -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" [[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc [[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source $f; done @@ -66,7 +66,7 @@ case "$1" in [[ -z $2 ]] && dokku_log_fail "Please specify an app to deploy" APP="$2"; IMAGE_TAG="$3"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" - pluginhook pre-deploy $APP $IMAGE_TAG + plugn trigger pre-deploy $APP $IMAGE_TAG is_image_herokuish_based "$IMAGE" && DOKKU_HEROKUISH=true DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE" @@ -85,11 +85,11 @@ case "$1" in DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX" # start the app - DOCKER_ARGS=$(: | pluginhook docker-args $APP deploy $IMAGE_TAG) + DOCKER_ARGS=$(: | plugn trigger docker-args $APP deploy $IMAGE_TAG) DOCKER_ARGS+=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' " - DOCKER_ARGS+=$(: | pluginhook docker-args-deploy $APP $IMAGE_TAG) + DOCKER_ARGS+=$(: | plugn trigger docker-args-deploy $APP $IMAGE_TAG) [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " - BIND_EXTERNAL=$(pluginhook bind-external-ip $APP) + BIND_EXTERNAL=$(plugn trigger bind-external-ip $APP) [[ -n "$DOKKU_HEROKUISH" ]] && START_CMD="/start $PROC_TYPE" @@ -133,7 +133,7 @@ case "$1" in else trap kill_new INT TERM EXIT dokku_log_info1 "Running pre-flight checks" - pluginhook check-deploy $APP $id $PROC_TYPE $port $ipaddr + plugn trigger check-deploy $APP $id $PROC_TYPE $port $ipaddr trap - INT TERM EXIT fi @@ -161,7 +161,7 @@ case "$1" in done < "$DOKKU_SCALE_FILE" dokku_log_info1 "Running post-deploy" - pluginhook post-deploy $APP $port $ipaddr + plugn trigger post-deploy $APP $port $ipaddr # kill the old container if [[ -n "$oldids" ]]; then @@ -202,27 +202,25 @@ case "$1" in ;; plugins) - for plugin in "$PLUGIN_PATH"/*/; do - basename "$plugin" - done + plugn list ;; plugins-install) if [[ $2 == "--core" ]]; then export PLUGIN_PATH="$PLUGIN_CORE_PATH" fi - pluginhook install + plugn trigger install ;; plugins-install-dependencies) if [[ $2 == "--core" ]]; then export PLUGIN_PATH="$PLUGIN_CORE_PATH" fi - pluginhook dependencies + plugn trigger dependencies ;; plugins-update) - pluginhook update + plugn trigger update ;; plugins:disable) @@ -253,7 +251,7 @@ case "$1" in echo "" echo "Options:" - cat< /dev/null [[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR - # *DEPRECATED* in v0.3.15: `pluginhook pre-build` will be removed in future releases - pluginhook pre-build "$APP" - # *DEPRECATED* in v0.3.22: `pluginhook pre-build-buildstep` will be removed in future releases - pluginhook pre-build-buildstep "$APP" - pluginhook pre-build-buildpack "$APP" + # *DEPRECATED* in v0.3.15: `plugn trigger pre-build` will be removed in future releases + plugn trigger pre-build "$APP" + # *DEPRECATED* in v0.3.22: `plugn trigger pre-build-buildstep` will be removed in future releases + plugn trigger pre-build-buildstep "$APP" + plugn trigger pre-build-buildpack "$APP" - # *DEPRECATED* in v0.3.14: `pluginhook docker-args` will be removed in future releases + # *DEPRECATED* in v0.3.14: `plugn trigger docker-args` will be removed in future releases # https://github.com/progrium/dokku/issues/896 & https://github.com/progrium/dokku/issues/906 - DOCKER_ARGS=$(: | pluginhook docker-args $APP build) - DOCKER_ARGS+=$(: | pluginhook docker-args-build $APP) + DOCKER_ARGS=$(: | plugn trigger docker-args $APP build) + DOCKER_ARGS+=$(: | plugn trigger docker-args-build $APP) [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build) docker attach $id test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null - # *DEPRECATED* in v0.3.15: `pluginhook post-build` will be removed in future releases - pluginhook post-build "$APP" - # *DEPRECATED* in v0.3.22: `pluginhook post-build-buildstep` will be removed in future releases - pluginhook post-build-buildstep "$APP" - pluginhook post-build-buildpack "$APP" + # *DEPRECATED* in v0.3.15: `plugn trigger post-build` will be removed in future releases + plugn trigger post-build "$APP" + # *DEPRECATED* in v0.3.22: `plugn trigger post-build-buildstep` will be removed in future releases + plugn trigger post-build-buildstep "$APP" + plugn trigger post-build-buildpack "$APP" ;; dockerfile) # extract first port from Dockerfile DOCKERFILE_PORT=$(get_dockerfile_exposed_port Dockerfile) [[ -n "$DOCKERFILE_PORT" ]] && config_set --no-restart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT - pluginhook pre-build-dockerfile "$APP" + plugn trigger pre-build-dockerfile "$APP" [[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache" docker build $DOKKU_DOCKER_BUILD_OPTS -t "$IMAGE" . - pluginhook post-build-dockerfile "$APP" + plugn trigger post-build-dockerfile "$APP" ;; *) @@ -66,11 +66,11 @@ case "$1" in case "$IMAGE_SOURCE_TYPE" in herokuish) - # *DEPRECATED* in v0.3.15: `pluginhook pre-release` will be removed in future releases - pluginhook pre-release $APP $IMAGE_TAG - # *DEPRECATED* in v0.3.22: `pluginhook pre-release-buildstep` will be removed in future releases - pluginhook pre-release-buildstep $APP $IMAGE_TAG - pluginhook pre-release-buildpack $APP $IMAGE_TAG + # *DEPRECATED* in v0.3.15: `plugn trigger pre-release` will be removed in future releases + plugn trigger pre-release "$APP" "$IMAGE_TAG" + # *DEPRECATED* in v0.3.22: `plugn trigger pre-release-buildstep` will be removed in future releases + plugn trigger pre-release-buildstep "$APP" "$IMAGE_TAG" + plugn trigger pre-release-buildpack "$APP" "$IMAGE_TAG" if [[ -n $(config_export global) ]]; then id=$(config_export global | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh") test "$(docker wait $id)" -eq 0 @@ -81,16 +81,17 @@ case "$1" in test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null fi - # *DEPRECATED* in v0.3.15: `pluginhook post-release` will be removed in future releases - pluginhook post-release $APP $IMAGE_TAG - # *DEPRECATED* in v0.3.22: `pluginhook post-release-buildstep` will be removed in future releases - pluginhook post-release-buildstep $APP $IMAGE_TAG - pluginhook post-release-buildpack $APP $IMAGE_TAG + # *DEPRECATED* in v0.3.15: `plugn trigger post-release` will be removed in future releases + plugn trigger post-release "$APP" "$IMAGE_TAG" + # *DEPRECATED* in v0.3.22: `plugn trigger post-release-buildstep` will be removed in future releases + plugn trigger post-release-buildstep "$APP" "$IMAGE_TAG" + plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG" ;; dockerfile) - pluginhook pre-release-dockerfile $APP $IMAGE_TAG - pluginhook post-release-dockerfile $APP $IMAGE_TAG + # buildstep plugins don't necessarily make sense for dockerfiles. call the new breed!!! + plugn trigger pre-release-dockerfile "$APP" "$IMAGE_TAG" + plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG" ;; *) @@ -175,8 +176,8 @@ case "$1" in shift 2 - DOCKER_ARGS=$(: | pluginhook docker-args $APP run $IMAGE_TAG) - DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP $IMAGE_TAG) + DOCKER_ARGS=$(: | plugn trigger docker-args $APP run $IMAGE_TAG) + DOCKER_ARGS+=$(: | plugn trigger docker-args-run $APP $IMAGE_TAG) [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " [[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm" has_tty && DOKKU_RUN_OPTS+=" -i -t" @@ -222,7 +223,7 @@ case "$1" in ;; help) - cat && cat< [-t], Show the last logs for an application (-t follows) run , Run a command in the environment of an application diff --git a/plugins/00_dokku-standard/plugin.toml b/plugins/00_dokku-standard/plugin.toml new file mode 100644 index 000000000..a11d89221 --- /dev/null +++ b/plugins/00_dokku-standard/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core standard plugin" +version = "0.4.0" +[plugin.config] diff --git a/plugins/20_events/plugin.toml b/plugins/20_events/plugin.toml new file mode 100644 index 000000000..0379b2986 --- /dev/null +++ b/plugins/20_events/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core events logging plugin" +version = "0.4.0" +[plugin.config] diff --git a/plugins/apps/commands b/plugins/apps/commands index 47a1b304f..5d407ac89 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -38,7 +38,7 @@ case "$1" in echo "Destroying $APP (including all add-ons)" - pluginhook pre-delete $APP $IMAGE_TAG + plugn trigger pre-delete $APP $IMAGE_TAG DOKKU_APP_CIDS=$(get_app_container_ids $APP) if [[ -n $DOKKU_APP_CIDS ]]; then for ID in $DOKKU_APP_CIDS;do @@ -47,11 +47,11 @@ case "$1" in done fi - pluginhook post-delete $APP $IMAGE_TAG + plugn trigger post-delete $APP $IMAGE_TAG ;; help | apps:help) - cat && cat<, Create a new app apps:destroy , Permanently destroy an app diff --git a/plugins/apps/plugin.toml b/plugins/apps/plugin.toml new file mode 100644 index 000000000..8996403e0 --- /dev/null +++ b/plugins/apps/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core apps plugin" +version = "0.4.0" +[plugin.config] diff --git a/plugins/backup/commands b/plugins/backup/commands index 1d1cf0655..2fa160979 100755 --- a/plugins/backup/commands +++ b/plugins/backup/commands @@ -11,7 +11,7 @@ case "$1" in BACKUP_TMP_DIR=$(mktemp -d) BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar" - : | pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from - + : | plugn trigger backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from - pushd $BACKUP_DIR > /dev/null find . -maxdepth 1 -type d -not -name . | sed 's:./::g' > "$BACKUP_TMP_DIR/.dokku_backup_apps" @@ -63,7 +63,7 @@ case "$1" in BACKUP_ROOT="$BACKUP_TMP_DIR""$DOKKU_ROOT" TARGET_DIR="$DOKKU_ROOT" - if ! pluginhook backup-check $VERSION "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"; then + if ! plugn trigger backup-check $VERSION "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"; then if $force; then echo "-f used. Ignoring warnings." else @@ -75,7 +75,7 @@ case "$1" in while read app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps # have the plugins import their stuff - pluginhook backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps" + plugn trigger backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps" rm -rf $BACKUP_TMP_DIR @@ -83,7 +83,7 @@ case "$1" in ;; help | backup:help) - cat && cat<|--global), Display all global or app-specific config vars config:get (|--global) KEY, Display a global or app-specific config value config:set (|--global) KEY1=VALUE1 [KEY2=VALUE2 ...], Set one or more config vars diff --git a/plugins/config/plugin.toml b/plugins/config/plugin.toml new file mode 100644 index 000000000..21b3aa661 --- /dev/null +++ b/plugins/config/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core config plugin" +version = "0.4.0" +[plugin.config] diff --git a/plugins/docker-options/commands b/plugins/docker-options/commands index 3834660a9..472b862f4 100755 --- a/plugins/docker-options/commands +++ b/plugins/docker-options/commands @@ -140,7 +140,7 @@ case "$1" in # Display usage help help) - cat && cat<, Display apps docker options for all phases docker-options , Display apps docker options for phase (comma separated phase list) docker-options:add OPTION, Add docker option to app for phase (comma separated phase list) diff --git a/plugins/docker-options/plugin.toml b/plugins/docker-options/plugin.toml new file mode 100644 index 000000000..b986665b1 --- /dev/null +++ b/plugins/docker-options/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core docker-options plugin" +version = "0.4.0" +[plugin.config] diff --git a/plugins/domains/commands b/plugins/domains/commands index 9f4f78a11..2371acf7e 100755 --- a/plugins/domains/commands +++ b/plugins/domains/commands @@ -57,7 +57,7 @@ case "$1" in if [[ -f "$DOKKU_ROOT/VHOST" ]]; then dokku_log_info1 "Creating new $VHOST_PATH..." SUBDOMAIN=${APP/%\.${VHOST}/} - hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST) + hostname=$(: | plugn trigger nginx-hostname $APP $SUBDOMAIN $VHOST) if [[ ! -n $hostname ]]; then if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then hostname="${APP/\//-}" @@ -95,7 +95,7 @@ case "$1" in done # we need to restart the app to make sure we're binding to the appropriate network interface dokku nginx:build-config $APP - pluginhook post-domains-update $APP + plugn trigger post-domains-update $APP for DOMAIN in "$@";do dokku_log_info1 "Added $DOMAIN to $APP" done @@ -109,7 +109,7 @@ case "$1" in rm -f "$DOKKU_ROOT/$APP/VHOST" dokku domains:setup $APP - pluginhook post-domains-update $APP + plugn trigger post-domains-update $APP dokku_log_info1 "Cleared domains in $APP" ;; @@ -130,7 +130,7 @@ case "$1" in for DOMAIN in "$@";do sed -i "/^$DOMAIN$/d" "$DOKKU_ROOT/$APP/VHOST" done - pluginhook post-domains-update $APP + plugn trigger post-domains-update $APP for DOMAIN in "$@";do dokku_log_info1 "Removed $DOMAIN from $APP" done @@ -138,7 +138,7 @@ case "$1" in ;; help | domains:help) - cat && cat<, List custom domains for app domains:add DOMAIN, Add a custom domain to app domains:clear , Clear all custom domains for app diff --git a/plugins/domains/plugin.toml b/plugins/domains/plugin.toml new file mode 100644 index 000000000..61195367e --- /dev/null +++ b/plugins/domains/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core domains plugin" +version = "0.4.0" +[plugin.config] diff --git a/plugins/enter/plugin.toml b/plugins/enter/plugin.toml new file mode 100644 index 000000000..3e42aeea1 --- /dev/null +++ b/plugins/enter/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core enter plugin" +version = "0.4.0" +[plugin.config] diff --git a/plugins/git/commands b/plugins/git/commands index 4848db0f3..44b471d9d 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -36,11 +36,11 @@ case "$1" in # Only run this script for the master branch. You can remove this # if block if you wish to run it for others as well. if [[ $refname = "refs/heads/master" ]] ; then - # broken out into pluginhook so we might support other methods to receive an app - pluginhook -p receive-app $APP $newrev + # broken out into plugin so we might support other methods to receive an app + plugn trigger receive-app $APP $newrev else if test -f "$PLUGIN_PATH"/enabled/*/receive-branch; then - pluginhook receive-branch $APP $newrev $refname + plugn trigger receive-branch $APP $newrev $refname else echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master." echo $'\e[1G\e[K'"-----> for example, try 'git push ${refname/refs\/heads\/}:master'" @@ -51,9 +51,9 @@ case "$1" in git-upload-pack) APP="$(echo $2 | perl -pe 's/(?, (Re)builds nginx config for given app EOF ;; diff --git a/plugins/nginx-vhosts/plugin.toml b/plugins/nginx-vhosts/plugin.toml new file mode 100644 index 000000000..7356a63d8 --- /dev/null +++ b/plugins/nginx-vhosts/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core nginx-vhosts plugin" +version = "0.4.0" +[plugin.config] diff --git a/plugins/ps/commands b/plugins/ps/commands index a24b10a58..b7c5101ec 100755 --- a/plugins/ps/commands +++ b/plugins/ps/commands @@ -14,7 +14,7 @@ case "$1" in dokku_log_info1_quiet "running processes in container: $CID" docker exec $DOKKU_RUN_OPTS $CID /bin/sh -c "ps auxwww" done - ;; + ;; ps:start) [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" @@ -28,7 +28,7 @@ case "$1" in else echo "App $APP already running" fi - ;; + ;; ps:stop) [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" @@ -43,14 +43,14 @@ case "$1" in else echo "App $APP already stopped" fi - ;; + ;; ps:rebuild) [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" APP="$2"; verify_app_name "$APP" - pluginhook -p receive-app $APP - ;; + plugn trigger receive-app $APP + ;; ps:rebuildall) shopt -s nullglob @@ -60,7 +60,7 @@ case "$1" in is_deployed $APP && dokku ps:rebuild $APP done shopt -u nullglob - ;; + ;; ps:restart) [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" @@ -70,7 +70,7 @@ case "$1" in ! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0 release_and_deploy "$APP" "$IMAGE_TAG" - ;; + ;; ps:restartall) shopt -s nullglob @@ -80,7 +80,7 @@ case "$1" in dokku ps:restart $APP done shopt -u nullglob - ;; + ;; ps:scale) [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" @@ -98,10 +98,10 @@ case "$1" in set_scale "$APP" "$@" release_and_deploy "$APP" "$IMAGE_TAG" fi - ;; + ;; help | ps:help) - cat && cat<, List processes running in app container(s) ps:scale = [=], Set how many instances of a given process to run ps:start , Start app container(s) diff --git a/plugins/ps/plugin.toml b/plugins/ps/plugin.toml new file mode 100644 index 000000000..128e3456e --- /dev/null +++ b/plugins/ps/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core ps plugin" +version = "0.4.0" +[plugin.config] diff --git a/plugins/shell/commands b/plugins/shell/commands index cdb05637a..686963ced 100755 --- a/plugins/shell/commands +++ b/plugins/shell/commands @@ -47,7 +47,7 @@ case "$1" in ;; help | shell:help) - cat && cat< Date: Fri, 12 Jun 2015 18:14:19 -0700 Subject: [PATCH 03/32] filter out toml files when linting --- tests.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.mk b/tests.mk index 65b2c6f87..56f22fb2a 100644 --- a/tests.mk +++ b/tests.mk @@ -65,7 +65,7 @@ lint: # SC2001: See if you can use ${variable//search/replace} instead. - https://github.com/koalaman/shellcheck/wiki/SC2001 @echo linting... @$(QUIET) shellcheck -e SC2029 ./contrib/dokku_client.sh - @$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | grep -v directory | awk '{ print $$1 }' | sed 's/://g' | grep -v dokku_client.sh | xargs shellcheck -e SC2034,SC2086,SC2143,SC2001 + @$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | egrep -v "directory|toml" | awk '{ print $$1 }' | sed 's/://g' | grep -v dokku_client.sh | xargs shellcheck -e SC2034,SC2086,SC2143,SC2001 unit-tests: @echo running unit tests... From 6c914173cb0adb3fd0c8d00907758b4d74c9a388 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Sat, 13 Jun 2015 09:52:56 -0700 Subject: [PATCH 04/32] set PLUGIN_PATH on plugn calls --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 60380bf68..7a427c900 100644 --- a/Makefile +++ b/Makefile @@ -49,12 +49,14 @@ copyfiles: cp dokku /usr/local/bin/dokku mkdir -p ${CORE_PLUGINS_PATH} ${PLUGINS_PATH} ${DISABLED_PLUGINS_PATH} rm -rf ${CORE_PLUGINS_PATH}/* + test -d ${PLUGINS_PATH}/enabled || PLUGIN_PATH=${PLUGINS_PATH} plugn init find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \ rm -Rf ${PLUGINS_PATH}/available/$$plugin && \ rm -Rf ${CORE_PLUGINS_PATH}/$$plugin && \ rm -rf ${PLUGINS_PATH}/$$plugin && \ cp -R plugins/$$plugin ${CORE_PLUGINS_PATH} && \ ln -s ${CORE_PLUGINS_PATH}/$$plugin ${PLUGINS_PATH}/available; \ + PLUGIN_PATH=${PLUGINS_PATH} plugn enable $$plugin ;\ done chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} ${DISABLED_PLUGINS_PATH} $(MAKE) addman From 5d8359c12e0176deb94c7f49216432de0cf3131e Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Sat, 13 Jun 2015 10:05:00 -0700 Subject: [PATCH 05/32] fix nginx template paths --- plugins/nginx-vhosts/commands | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 4a018aa31..96a227e64 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -95,7 +95,7 @@ EOF if [[ -n "$SSL_INUSE" ]]; then SCHEME="https" - [[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf.template" + [[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="(dirname $0)/templates/nginx.ssl.conf.template" SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH || true) NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH || true) @@ -111,7 +111,7 @@ EOF if [[ -n "$NONSSL_VHOSTS" ]]; then NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ') xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS" - [[ -z "$NGINX_CUSTOM_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf.template" + [[ -z "$NGINX_CUSTOM_TEMPLATE" ]] && NGINX_TEMPLATE="$(dirname $0)/templates/nginx.conf.template" eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF" fi From 6d70751cfc4e8245293821c26e261c85e92edaec Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Mon, 15 Jun 2015 09:25:26 -0700 Subject: [PATCH 06/32] force removal of app directory on post-delete --- plugins/apps/post-delete | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/apps/post-delete b/plugins/apps/post-delete index 5c71e01a2..b2a5c0cd8 100755 --- a/plugins/apps/post-delete +++ b/plugins/apps/post-delete @@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_PATH/common/functions" APP="$1"; IMAGE_REPO=$(get_app_image_repo $APP) -[[ -n $APP ]] && rm -r "$DOKKU_ROOT/$APP" > /dev/null +[[ -n $APP ]] && rm -rf "$DOKKU_ROOT/$APP" > /dev/null # remove all application containers & images # shellcheck disable=SC2046 From 2a4cbc7bee151768d4322393376fad0a75a80fc9 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 16 Jun 2015 10:02:38 -0700 Subject: [PATCH 07/32] [ci skip] update docs --- .../{plugin-creation.md => plugn-creation.md} | 17 ++++++-- .../{pluginhooks.md => plugn-triggers.md} | 40 +++++++++---------- docs/plugins.md | 5 ++- docs/template.html | 4 +- 4 files changed, 38 insertions(+), 28 deletions(-) rename docs/development/{plugin-creation.md => plugn-creation.md} (92%) rename docs/development/{pluginhooks.md => plugn-triggers.md} (85%) diff --git a/docs/development/plugin-creation.md b/docs/development/plugn-creation.md similarity index 92% rename from docs/development/plugin-creation.md rename to docs/development/plugn-creation.md index 13ee06120..d7b58d844 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugn-creation.md @@ -1,14 +1,14 @@ -# Plugin Creation +# Plugn Creation If you create your own plugin: 1. Take a look at the plugins shipped with dokku and hack away! -2. Check out the [list of hooks](http://progrium.viewdocs.io/dokku/development/pluginhooks) your plugin can implement. +2. Check out the [list of hooks](http://progrium.viewdocs.io/dokku/development/plugn-triggers) your plugin can implement. 3. Upload your plugin to github with a repository name in form of `dokku-` (e.g. `dokku-mariadb`) 4. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it. 5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases -### Sample plugin +### Sample plugn The below plugin is a dummy `dokku hello` plugin. If your plugin exposes commands, this is a good template for your `commands` file: @@ -31,7 +31,7 @@ case "$1" in ;; help) - cat && cat<, Says "Hello " hello:world, Says "Hello world" EOF @@ -44,6 +44,15 @@ EOF esac ``` +Each plugn requires a `plugin.toml` descriptor file with the following required fields: + +```shell +[plugin] +description = "dokku hello plugin" +version = "0.1.0" +[plugin.config] +``` + A few notes: - You should always support `DOKKU_TRACE` as specified on the 2nd line of the plugin. diff --git a/docs/development/pluginhooks.md b/docs/development/plugn-triggers.md similarity index 85% rename from docs/development/pluginhooks.md rename to docs/development/plugn-triggers.md index 63287f670..f727bd059 100644 --- a/docs/development/pluginhooks.md +++ b/docs/development/plugn-triggers.md @@ -1,15 +1,15 @@ -# Pluginhooks +# Plugn triggers -[Pluginhooks](https://github.com/progrium/pluginhook) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration. +[Plugn triggers](https://github.com/progrium/plugn) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration. -Pluginhooks are simply scripts that are executed by the system. You can use any language you want, so long as the script: +Plugn triggers are simply scripts that are executed by the system. You can use any language you want, so long as the script: - Is executable - Has the proper language requirements installed -For instance, if you wanted to write a pluginhook in PHP, you would need to have `php` installed and available on the CLI prior to pluginhook invocation. +For instance, if you wanted to write a plugn trigger in PHP, you would need to have `php` installed and available on the CLI prior to plugn trigger invocation. -The following is an example for the `nginx-hostname` pluginhook. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named `nginx-hostname` with the following code in your plugin, it would be invoked by dokku during the normal app deployment process: +The following is an example for the `nginx-hostname` plugn trigger. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named `nginx-hostname` with the following code in your plugn trigger, it would be invoked by dokku during the normal app deployment process: ```shell #!/usr/bin/env bash @@ -21,17 +21,17 @@ NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev` echo "$NEW_SUBDOMAIN.$VHOST" ``` -## Available Pluginhooks +## Available Plugn triggers -There are a number of plugin-related pluginhooks. These can be optionally implemented by plugins and allow integration into the standard dokku plugin setup/backup/teardown process. +There are a number of plugin-related triggers. These can be optionally implemented by plugins and allow integration into the standard dokku setup/backup/teardown process. -The following pluginhooks describe those available to a dokku installation. As well, there is an example for each pluginhook that you can use as templates for your own plugin development. +The following plugn triggers describe those available to a dokku installation. As well, there is an example for each trigger that you can use as templates for your own plugn development. -> The example pluginhook code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples. +> The example plugn trigger code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples. ### `install` -- Description: Used to setup any files/configuration for a plugin. +- Description: Used to setup any files/configuration for a plugn. - Invoked by: `dokku plugins-install`. - Arguments: None - Example: @@ -57,7 +57,7 @@ fi ```shell #!/usr/bin/env bash -# Installs nginx for the current plugin +# Installs nginx for the current plugn # Supports both opensuse and ubuntu set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x @@ -76,7 +76,7 @@ esac ### `update` -- Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates. +- Description: Can be used to run plugn updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates. - Invoked by: `dokku plugins-update`. - Arguments: None - Example: @@ -93,20 +93,20 @@ sudo BUILD_STACK=true make install ### `commands help` -- Description: Used to aggregate all plugin `help` output. Your plugin should implement a `help` command in your `commands` file to take advantage of this pluginhook. This must be implemented inside the `commands` pluginhook file. +- Description: Used to aggregate all plugn `help` output. Your plugn should implement a `help` command in your `commands` file to take advantage of this plugn trigger. This must be implemented inside the `commands` plugn file. - Invoked by: `dokku help` - Arguments: None - Example: ```shell #!/usr/bin/env bash -# Outputs help for the derp plugin +# Outputs help for the derp plugn set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | derp:help) - cat && cat< dokku plugins-install ``` diff --git a/docs/template.html b/docs/template.html index fa646570e..0346c1e63 100644 --- a/docs/template.html +++ b/docs/template.html @@ -76,8 +76,8 @@ Development - Plugin Creation - Pluginhooks + Plugn Creation + Plugn Triggers Test Suite Release Process From e2d138f55eaa9989e82ee71ed40784a7dfacd743 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Thu, 25 Jun 2015 07:43:59 -0700 Subject: [PATCH 08/32] [ci skip] revert awkward doc change --- docs/development/{plugn-creation.md => plugin-creation.md} | 2 +- docs/template.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename docs/development/{plugn-creation.md => plugin-creation.md} (99%) diff --git a/docs/development/plugn-creation.md b/docs/development/plugin-creation.md similarity index 99% rename from docs/development/plugn-creation.md rename to docs/development/plugin-creation.md index d7b58d844..eb1b5d98e 100644 --- a/docs/development/plugn-creation.md +++ b/docs/development/plugin-creation.md @@ -1,4 +1,4 @@ -# Plugn Creation +# Plugin Creation If you create your own plugin: diff --git a/docs/template.html b/docs/template.html index 0346c1e63..d62e6f420 100644 --- a/docs/template.html +++ b/docs/template.html @@ -76,7 +76,7 @@ Development - Plugn Creation + Plugin Creation Plugn Triggers Test Suite Release Process From fcfc02be52ba8afcbb60cef9f727890dd6655caf Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Thu, 25 Jun 2015 16:56:17 -0700 Subject: [PATCH 09/32] [ci skip] rename plugn-triggers doc file --- docs/development/plugin-creation.md | 2 +- docs/development/{plugn-triggers.md => pluginhooks.md} | 2 +- docs/template.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename docs/development/{plugn-triggers.md => pluginhooks.md} (98%) diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index eb1b5d98e..fb9b6adfd 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -3,7 +3,7 @@ If you create your own plugin: 1. Take a look at the plugins shipped with dokku and hack away! -2. Check out the [list of hooks](http://progrium.viewdocs.io/dokku/development/plugn-triggers) your plugin can implement. +2. Check out the [list of triggers](http://progrium.viewdocs.io/dokku/development/plughooks) your plugin can implement. 3. Upload your plugin to github with a repository name in form of `dokku-` (e.g. `dokku-mariadb`) 4. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it. 5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases diff --git a/docs/development/plugn-triggers.md b/docs/development/pluginhooks.md similarity index 98% rename from docs/development/plugn-triggers.md rename to docs/development/pluginhooks.md index f727bd059..3f1dd7e62 100644 --- a/docs/development/plugn-triggers.md +++ b/docs/development/pluginhooks.md @@ -1,6 +1,6 @@ # Plugn triggers -[Plugn triggers](https://github.com/progrium/plugn) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration. +[Plugn triggers](https://github.com/progrium/plugn) (formerly [pluginhooks](https://github.com/progrium/pluginhook)) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration. Plugn triggers are simply scripts that are executed by the system. You can use any language you want, so long as the script: diff --git a/docs/template.html b/docs/template.html index d62e6f420..878df1201 100644 --- a/docs/template.html +++ b/docs/template.html @@ -77,7 +77,7 @@ Development Plugin Creation - Plugn Triggers + Plugn Triggers Test Suite Release Process From 37b8ccbe9d894c909f2b56fd550be8936fb661b1 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Thu, 25 Jun 2015 16:57:26 -0700 Subject: [PATCH 10/32] [ci skip] revert another awkward doc change --- docs/development/plugin-creation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index fb9b6adfd..e0f92aa88 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -8,7 +8,7 @@ If you create your own plugin: 4. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it. 5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases -### Sample plugn +### Sample plugin The below plugin is a dummy `dokku hello` plugin. If your plugin exposes commands, this is a good template for your `commands` file: From ad72a137e11a62f9dc06c448938b132f2cff1526 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 7 Sep 2015 03:52:11 -0400 Subject: [PATCH 11/32] Fix sourcing of functions --- docs/development/plugin-creation.md | 4 ++-- docs/development/pluginhooks.md | 18 +++++++++--------- plugins/00_dokku-standard/commands | 4 ++-- plugins/20_events/commands | 2 +- plugins/20_events/hook | 2 +- plugins/20_events/install | 2 +- plugins/apps/commands | 2 +- plugins/apps/post-delete | 4 ++-- plugins/apps/pre-delete | 2 +- plugins/build-env/pre-build | 4 ++-- plugins/certs/commands | 4 ++-- plugins/certs/functions | 2 +- plugins/checks/check-deploy | 4 ++-- plugins/config/commands | 4 ++-- plugins/config/docker-args-deploy | 4 ++-- plugins/config/functions | 2 +- plugins/docker-options/commands | 2 +- plugins/domains/commands | 6 +++--- plugins/domains/functions | 2 +- plugins/enter/commands | 2 +- plugins/git/commands | 2 +- plugins/git/receive-app | 2 +- plugins/nginx-vhosts/bind-external-ip | 2 +- plugins/nginx-vhosts/commands | 8 ++++---- plugins/nginx-vhosts/post-deploy | 4 ++-- plugins/nginx-vhosts/post-domains-update | 2 +- plugins/ps/commands | 4 ++-- plugins/ps/functions | 2 +- plugins/ps/pre-deploy | 4 ++-- plugins/tags/commands | 4 ++-- plugins/tags/functions | 2 +- plugins/tar/commands | 2 +- plugins/tar/receive-app | 2 +- tests/unit/core_ports.bats | 4 ++-- 34 files changed, 60 insertions(+), 60 deletions(-) diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index e0f92aa88..d27abc9a1 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -3,7 +3,7 @@ If you create your own plugin: 1. Take a look at the plugins shipped with dokku and hack away! -2. Check out the [list of triggers](http://progrium.viewdocs.io/dokku/development/plughooks) your plugin can implement. +2. Check out the [list of triggers](http://progrium.viewdocs.io/dokku/development/pluginhooks) your plugin can implement. 3. Upload your plugin to github with a repository name in form of `dokku-` (e.g. `dokku-mariadb`) 4. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it. 5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases @@ -15,7 +15,7 @@ The below plugin is a dummy `dokku hello` plugin. If your plugin exposes command ```shell #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" case "$1" in hello) diff --git a/docs/development/pluginhooks.md b/docs/development/pluginhooks.md index 3f1dd7e62..71360ae75 100644 --- a/docs/development/pluginhooks.md +++ b/docs/development/pluginhooks.md @@ -252,7 +252,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # Installs the graphicsmagick package into the container set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -279,7 +279,7 @@ docker commit $ID $IMAGE > /dev/null # Installs a package specified by the `CONTAINER_PACKAGE` env var set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -305,7 +305,7 @@ docker commit $ID $IMAGE > /dev/null #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -323,7 +323,7 @@ verify_app_name "$APP" #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -343,7 +343,7 @@ verify_app_name "$APP" # `DOKKU_DISABLE_DEPLOY` env var is set to `true` for an app set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/config/functions" +source "$PLUGIN_PATH/available/config/functions" CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}" @@ -368,7 +368,7 @@ fi # Runs gulp in our container set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -407,7 +407,7 @@ curl "http://httpstat.us/200" # Clears out the gulp asset build cache for applications set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -462,7 +462,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -480,7 +480,7 @@ verify_app_name "$APP" #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 58dd50d51..878690068 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$PLUGIN_PATH/config/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/config/functions" case "$1" in build) diff --git a/plugins/20_events/commands b/plugins/20_events/commands index c3b817735..4c5b7dea8 100755 --- a/plugins/20_events/commands +++ b/plugins/20_events/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" PLUGIN_DIR="$(dirname $0)" diff --git a/plugins/20_events/hook b/plugins/20_events/hook index 5357e931b..3d4090faf 100755 --- a/plugins/20_events/hook +++ b/plugins/20_events/hook @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" [[ ! "$DOKKU_EVENTS" ]] || dokku_log_pluginhook_call "$(basename $0)" "$@" diff --git a/plugins/20_events/install b/plugins/20_events/install index 8951bd4d1..ec70b44ec 100755 --- a/plugins/20_events/install +++ b/plugins/20_events/install @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" DOKKU_RSYSLOG_FILTER=/etc/rsyslog.d/99-dokku.conf DOKKU_LOGROTATE_FILE=/etc/logrotate.d/dokku diff --git a/plugins/apps/commands b/plugins/apps/commands index 5d407ac89..5e5ab8f98 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" case "$1" in apps) diff --git a/plugins/apps/post-delete b/plugins/apps/post-delete index b2a5c0cd8..11051a912 100755 --- a/plugins/apps/post-delete +++ b/plugins/apps/post-delete @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -APP="$1"; IMAGE_REPO=$(get_app_image_repo $APP) +source "$PLUGIN_PATH/available/common/functions" +APP="$1"; IMAGE_REPO=$(get_app_image_repo $APP) [[ -n $APP ]] && rm -rf "$DOKKU_ROOT/$APP" > /dev/null # remove all application containers & images diff --git a/plugins/apps/pre-delete b/plugins/apps/pre-delete index a8eb8facb..e9727d6b6 100755 --- a/plugins/apps/pre-delete +++ b/plugins/apps/pre-delete @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG); CACHE_DIR="$DOKKU_ROOT/$APP/cache" verify_app_name "$APP" diff --git a/plugins/build-env/pre-build b/plugins/build-env/pre-build index 98e9afd99..78870aa7b 100755 --- a/plugins/build-env/pre-build +++ b/plugins/build-env/pre-build @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$PLUGIN_PATH/config/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/config/functions" APP="$1"; IMAGE=$(get_app_image_name $APP); BUILD_ENV="" verify_app_name "$APP" diff --git a/plugins/certs/commands b/plugins/certs/commands index 464755643..b74849cd3 100755 --- a/plugins/certs/commands +++ b/plugins/certs/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$(dirname $0)/../common/functions" -source "$(dirname $0)/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/certs/functions" is_tar_import() { [[ -t 0 ]] && return 1 diff --git a/plugins/certs/functions b/plugins/certs/functions index e125c72ed..532087bb1 100755 --- a/plugins/certs/functions +++ b/plugins/certs/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" # returns 'global', 'app', 'false' # if both are configured, app trumps global diff --git a/plugins/checks/check-deploy b/plugins/checks/check-deploy index 85ac68dce..3b8ab3c9a 100755 --- a/plugins/checks/check-deploy +++ b/plugins/checks/check-deploy @@ -35,8 +35,8 @@ # set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$PLUGIN_PATH/config/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/config/functions" APP="$1"; DOKKU_APP_CONTAINER_ID="$2"; DOKKU_APP_CONTAINER_TYPE="$3"; DOKKU_APP_LISTEN_PORT="$4"; DOKKU_APP_LISTEN_IP="$5" if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then diff --git a/plugins/config/commands b/plugins/config/commands index 4aaba2b66..b259541ff 100755 --- a/plugins/config/commands +++ b/plugins/config/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$PLUGIN_PATH/config/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/config/functions" case "$1" in config) diff --git a/plugins/config/docker-args-deploy b/plugins/config/docker-args-deploy index f63a2cb5b..2348d820a 100755 --- a/plugins/config/docker-args-deploy +++ b/plugins/config/docker-args-deploy @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$PLUGIN_PATH/config/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/config/functions" STDIN=$(cat); APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE" diff --git a/plugins/config/functions b/plugins/config/functions index a07d23fbc..dd69b50bb 100644 --- a/plugins/config/functions +++ b/plugins/config/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" config_export() { local CONFIG_TYPE="$1" diff --git a/plugins/docker-options/commands b/plugins/docker-options/commands index 472b862f4..ac4069fb8 100755 --- a/plugins/docker-options/commands +++ b/plugins/docker-options/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" PHASES=(build deploy run) diff --git a/plugins/domains/commands b/plugins/domains/commands index 2371acf7e..f6863c60f 100755 --- a/plugins/domains/commands +++ b/plugins/domains/commands @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$PLUGIN_PATH/config/functions" -source "$PLUGIN_PATH/domains/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/config/functions" +source "$PLUGIN_PATH/available/domains/functions" RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}" diff --git a/plugins/domains/functions b/plugins/domains/functions index f79e889ee..74c1a6ea1 100755 --- a/plugins/domains/functions +++ b/plugins/domains/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$(dirname $0)/../common/functions" +source "$PLUGIN_PATH/available/common/functions" get_app_domains() { local APP=$1; verify_app_name $APP diff --git a/plugins/enter/commands b/plugins/enter/commands index dd5a592ef..1dcceaf3d 100755 --- a/plugins/enter/commands +++ b/plugins/enter/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" case "$1" in enter) diff --git a/plugins/git/commands b/plugins/git/commands index 44b471d9d..ced23cef3 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" git_build_app_repo() { verify_app_name "$1" diff --git a/plugins/git/receive-app b/plugins/git/receive-app index 7d51d025d..11dd7541e 100755 --- a/plugins/git/receive-app +++ b/plugins/git/receive-app @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; REV="$2" diff --git a/plugins/nginx-vhosts/bind-external-ip b/plugins/nginx-vhosts/bind-external-ip index f3988c9ae..01f1f57b1 100755 --- a/plugins/nginx-vhosts/bind-external-ip +++ b/plugins/nginx-vhosts/bind-external-ip @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/config/functions" +source "$PLUGIN_PATH/available/config/functions" APP="$1" NO_VHOST=$(config_get $APP NO_VHOST || true) diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 96a227e64..59703aead 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -1,9 +1,9 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$PLUGIN_PATH/certs/functions" -source "$PLUGIN_PATH/config/functions" -source "$PLUGIN_PATH/domains/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/certs/functions" +source "$PLUGIN_PATH/available/config/functions" +source "$PLUGIN_PATH/available/domains/functions" validate_nginx () { set +e diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index 70b033b6e..e29efb5c2 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$PLUGIN_PATH/config/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/config/functions" APP="$1" if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then diff --git a/plugins/nginx-vhosts/post-domains-update b/plugins/nginx-vhosts/post-domains-update index 945057998..edb88b6f8 100755 --- a/plugins/nginx-vhosts/post-domains-update +++ b/plugins/nginx-vhosts/post-domains-update @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1" diff --git a/plugins/ps/commands b/plugins/ps/commands index b7c5101ec..cdf045996 100755 --- a/plugins/ps/commands +++ b/plugins/ps/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$(dirname $0)/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/ps/functions" case "$1" in ps) diff --git a/plugins/ps/functions b/plugins/ps/functions index c21498f05..b0e3a1091 100755 --- a/plugins/ps/functions +++ b/plugins/ps/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" print_dokku_scale_file() { local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE" diff --git a/plugins/ps/pre-deploy b/plugins/ps/pre-deploy index 80488ed13..d80691134 100755 --- a/plugins/ps/pre-deploy +++ b/plugins/ps/pre-deploy @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$(dirname $0)/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/ps/functions" APP="$1" diff --git a/plugins/tags/commands b/plugins/tags/commands index b832212a2..c787840b1 100755 --- a/plugins/tags/commands +++ b/plugins/tags/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" -source "$(dirname $0)/functions" +source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_PATH/available/tags/functions" case "$1" in tags) diff --git a/plugins/tags/functions b/plugins/tags/functions index 7dd55157b..155e2778f 100755 --- a/plugins/tags/functions +++ b/plugins/tags/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" tag_image() { docker tag -f "$1" "$2" diff --git a/plugins/tar/commands b/plugins/tar/commands index b751e8772..1032fd5fe 100755 --- a/plugins/tar/commands +++ b/plugins/tar/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" case "$1" in tar-from|tar:from) diff --git a/plugins/tar/receive-app b/plugins/tar/receive-app index 0bf09425b..88e6525a8 100755 --- a/plugins/tar/receive-app +++ b/plugins/tar/receive-app @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/common/functions" +source "$PLUGIN_PATH/available/common/functions" APP="$1"; REV="$2" diff --git a/tests/unit/core_ports.bats b/tests/unit/core_ports.bats index 696159ce8..fbfa297e8 100644 --- a/tests/unit/core_ports.bats +++ b/tests/unit/core_ports.bats @@ -165,7 +165,7 @@ check_urls() { } @test "(core) port exposure (dockerfile raw port)" { - source "$PLUGIN_PATH/common/functions" + source "$PLUGIN_PATH/available/common/functions" cat< $DOCKERFILE EXPOSE 3001/udp EXPOSE 3003 @@ -178,7 +178,7 @@ EOF } @test "(core) port exposure (dockerfile tcp port)" { - source "$PLUGIN_PATH/common/functions" + source "$PLUGIN_PATH/available/common/functions" cat< $DOCKERFILE EXPOSE 3001/udp EXPOSE 3000/tcp From ce23cf6ce667f354fe34e4fa67fc809c787b9c29 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 7 Sep 2015 03:55:37 -0400 Subject: [PATCH 12/32] rename dokku_log_pluginhook_call --- plugins/20_events/hook | 2 +- plugins/20_events/install | 2 +- plugins/common/functions | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/20_events/hook b/plugins/20_events/hook index 3d4090faf..96237195d 100755 --- a/plugins/20_events/hook +++ b/plugins/20_events/hook @@ -2,4 +2,4 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_PATH/available/common/functions" -[[ ! "$DOKKU_EVENTS" ]] || dokku_log_pluginhook_call "$(basename $0)" "$@" +[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename $0)" "$@" diff --git a/plugins/20_events/install b/plugins/20_events/install index ec70b44ec..8e90f3409 100755 --- a/plugins/20_events/install +++ b/plugins/20_events/install @@ -49,6 +49,6 @@ if [[ "$flag_rsyslog_needs_restart" == "y" ]]; then service rsyslog restart fi -[[ ! "$DOKKU_EVENTS" ]] || dokku_log_pluginhook_call "$(basename $0)" "$@" +[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename $0)" "$@" exit 0 diff --git a/plugins/common/functions b/plugins/common/functions index 1a12eeb6b..c84ff522e 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -94,7 +94,7 @@ dokku_log_event() { logger -t dokku -i -- "$@" } -dokku_log_pluginhook_call() { +dokku_log_plugn_trigger_call() { local l_hook l_hook="$1" ; shift From aaae9adac3ccd006d84e5e523c9f882448c27546 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 7 Sep 2015 03:55:58 -0400 Subject: [PATCH 13/32] update last doc references to pluginhook [ci skip] --- docs/components.md | 2 +- docs/development/plugin-creation.md | 4 ++-- docs/nginx.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/components.md b/docs/components.md index a6bfa453f..fc43b9a91 100644 --- a/docs/components.md +++ b/docs/components.md @@ -2,7 +2,7 @@ * [Docker](https://github.com/dotcloud/docker) - Container runtime and manager * [Herokuish](https://github.com/gliderlabs/herokuish) - Buildpack builder - * [pluginhook](https://github.com/progrium/pluginhook) - Shell based plugins and hooks + * [plugn](https://github.com/progrium/plugn) - Shell based plugins and hooks * [sshcommand](https://github.com/progrium/sshcommand) - Fixed commands over SSH Looking to keep codebase as simple and hackable as possible, so try to keep your line count down. diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index d27abc9a1..9290a6707 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -88,5 +88,5 @@ A few notes: dokku config:set --no-restart APP KEY1=VALUE1 [KEY2=VALUE2 ...] dokku config:unset --no-restart APP KEY1 [KEY2 ...] ``` -- From time to time you may want to allow other plugins access to (some of) your plugin's functionality. You can expose this by including a `functions` file in your plugin for others to source. Consider all functions in that file to be publicly accessible by other plugins. Any functions not wished to be made "public" should reside within your pluginhook or commands files. -- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See [pluginhooks](http://progrium.viewdocs.io/dokku/development/pluginhooks) doc for examples. +- From time to time you may want to allow other plugins access to (some of) your plugin's functionality. You can expose this by including a `functions` file in your plugin for others to source. Consider all functions in that file to be publicly accessible by other plugins. Any functions not wished to be made "public" should reside within your plugin trigger or commands files. +- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See the [plugin triggers](http://progrium.viewdocs.io/dokku/development/pluginhooks) doc for examples. diff --git a/docs/nginx.md b/docs/nginx.md index 944514bc2..2bbbbe92e 100644 --- a/docs/nginx.md +++ b/docs/nginx.md @@ -126,7 +126,7 @@ scheme://subdomain.domain.tld The `subdomain` is inferred from the pushed application name, while the `domain` is set during initial configuration in the `$DOKKU_ROOT/VHOST` file. -You can optionally override this in a plugin by implementing the `nginx-hostname` pluginhook. For example, you can reverse the subdomain with the following sample `nginx-hostname` pluginhook: +You can optionally override this in a plugin by implementing the `nginx-hostname` plugin trigger. For example, you can reverse the subdomain with the following sample `nginx-hostname` plugin trigger: ```shell #!/usr/bin/env bash From b3ddcbed5375b71787f8099bd50f05381c2ec57a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 7 Sep 2015 13:41:05 -0400 Subject: [PATCH 14/32] Remove deprecated calls --- docs/dokku-events-logs.md | 12 +++++----- docs/process-management.md | 3 --- dokku | 3 +-- plugins/00_dokku-standard/commands | 24 ++----------------- .../{pre-build => pre-build-buildpack} | 5 ---- plugins/config/commands | 12 ---------- plugins/shell/commands | 5 ++-- plugins/tar/commands | 1 - 8 files changed, 12 insertions(+), 53 deletions(-) rename plugins/build-env/{pre-build => pre-build-buildpack} (88%) diff --git a/docs/dokku-events-logs.md b/docs/dokku-events-logs.md index 8ff961adb..462855d53 100644 --- a/docs/dokku-events-logs.md +++ b/docs/dokku-events-logs.md @@ -21,10 +21,10 @@ Enabling dokku events logger Dokku will then write log entries to ``/var/log/syslog`` as well as a Dokku-specific logs sub-directory ``/var/log/dokku/events.log``, which can be easily displayed with the command `dokku events`: ``` -Jul 3 16:09:48 dokku.me dokku[127630]: INVOKED: pre-release-buildstep( pythonapp ) +Jul 3 16:09:48 dokku.me dokku[127630]: INVOKED: pre-release-buildpack( pythonapp ) Jul 3 16:10:02 dokku.me dokku[128095]: INVOKED: docker-args-run( rubyapp ) 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-buildstep( pythonapp ) +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 ) @@ -47,10 +47,10 @@ docker-args-build pre-delete post-deploy receive-app -pre-release-buildstep +pre-release-buildpack nginx-pre-reload docker-args-deploy -post-build-buildstep +post-build-buildpack post-domains-update post-release-dockerfile check-deploy @@ -63,10 +63,10 @@ bind-external-ip pre-deploy post-delete dependencies -pre-build-buildstep +pre-build-buildpack docker-args-run pre-build-dockerfile -post-release-buildstep +post-release-buildpack post-build-dockerfile pre-release-dockerfile update diff --git a/docs/process-management.md b/docs/process-management.md index f7c5e6b4c..bf28f79e1 100644 --- a/docs/process-management.md +++ b/docs/process-management.md @@ -13,9 +13,6 @@ ps:start Start app container(s) ps:stop Stop app container(s) ``` -*NOTE*: As of v0.3.14, `dokku deploy:all` in now deprecated by `ps:restartall` and will be removed in a future version. - - ## Scaling Dokku allows you to run multiple process types at different container counts. For example, if you had an app that contained 1 web app listener and 1 background job processor, dokku can, spin up 1 container for each process type defined in the Procfile. By default we will only start the web process. However, if you wanted 2 job processors running simultaneously, you can modify this behavior in a few ways. diff --git a/dokku b/dokku index 49fade16e..662203a2e 100755 --- a/dokku +++ b/dokku @@ -85,8 +85,7 @@ case "$1" in DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX" # start the app - DOCKER_ARGS=$(: | plugn trigger docker-args $APP deploy $IMAGE_TAG) - DOCKER_ARGS+=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' " + DOCKER_ARGS=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' " DOCKER_ARGS+=$(: | plugn trigger docker-args-deploy $APP $IMAGE_TAG) [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " BIND_EXTERNAL=$(plugn trigger bind-external-ip $APP) diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 878690068..0175fe9f1 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -19,26 +19,15 @@ case "$1" in test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null [[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR - # *DEPRECATED* in v0.3.15: `plugn trigger pre-build` will be removed in future releases - plugn trigger pre-build "$APP" - # *DEPRECATED* in v0.3.22: `plugn trigger pre-build-buildstep` will be removed in future releases - plugn trigger pre-build-buildstep "$APP" plugn trigger pre-build-buildpack "$APP" - # *DEPRECATED* in v0.3.14: `plugn trigger docker-args` will be removed in future releases - # https://github.com/progrium/dokku/issues/896 & https://github.com/progrium/dokku/issues/906 - DOCKER_ARGS=$(: | plugn trigger docker-args $APP build) - DOCKER_ARGS+=$(: | plugn trigger docker-args-build $APP) + DOCKER_ARGS=$(: | plugn trigger docker-args-build $APP) [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build) docker attach $id test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null - # *DEPRECATED* in v0.3.15: `plugn trigger post-build` will be removed in future releases - plugn trigger post-build "$APP" - # *DEPRECATED* in v0.3.22: `plugn trigger post-build-buildstep` will be removed in future releases - plugn trigger post-build-buildstep "$APP" plugn trigger post-build-buildpack "$APP" ;; @@ -66,10 +55,6 @@ case "$1" in case "$IMAGE_SOURCE_TYPE" in herokuish) - # *DEPRECATED* in v0.3.15: `plugn trigger pre-release` will be removed in future releases - plugn trigger pre-release "$APP" "$IMAGE_TAG" - # *DEPRECATED* in v0.3.22: `plugn trigger pre-release-buildstep` will be removed in future releases - plugn trigger pre-release-buildstep "$APP" "$IMAGE_TAG" plugn trigger pre-release-buildpack "$APP" "$IMAGE_TAG" if [[ -n $(config_export global) ]]; then id=$(config_export global | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh") @@ -81,10 +66,6 @@ case "$1" in test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null fi - # *DEPRECATED* in v0.3.15: `plugn trigger post-release` will be removed in future releases - plugn trigger post-release "$APP" "$IMAGE_TAG" - # *DEPRECATED* in v0.3.22: `plugn trigger post-release-buildstep` will be removed in future releases - plugn trigger post-release-buildstep "$APP" "$IMAGE_TAG" plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG" ;; @@ -176,8 +157,7 @@ case "$1" in shift 2 - DOCKER_ARGS=$(: | plugn trigger docker-args $APP run $IMAGE_TAG) - DOCKER_ARGS+=$(: | plugn trigger docker-args-run $APP $IMAGE_TAG) + DOCKER_ARGS=$(: | plugn trigger docker-args-run $APP $IMAGE_TAG) [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " [[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm" has_tty && DOKKU_RUN_OPTS+=" -i -t" diff --git a/plugins/build-env/pre-build b/plugins/build-env/pre-build-buildpack similarity index 88% rename from plugins/build-env/pre-build rename to plugins/build-env/pre-build-buildpack index 78870aa7b..6916ae0a7 100755 --- a/plugins/build-env/pre-build +++ b/plugins/build-env/pre-build-buildpack @@ -6,11 +6,6 @@ source "$PLUGIN_PATH/available/config/functions" APP="$1"; IMAGE=$(get_app_image_name $APP); BUILD_ENV="" verify_app_name "$APP" -[[ -f "$DOKKU_ROOT/BUILD_ENV" ]] && cat "$DOKKU_ROOT/BUILD_ENV" >> "$DOKKU_ROOT/ENV" && { - dokku_log_info2 "Using a global BUILD_ENV file is deprecated as of 0.3.26" - rm "$DOKKU_ROOT/BUILD_ENV" -} - config_get --global CURL_CONNECT_TIMEOUT > /dev/null 2>&1 || config_set --global CURL_CONNECT_TIMEOUT=5 config_get --global CURL_TIMEOUT > /dev/null 2>&1 || config_set --global CURL_TIMEOUT=30 diff --git a/plugins/config/commands b/plugins/config/commands index b259541ff..96955ae2b 100755 --- a/plugins/config/commands +++ b/plugins/config/commands @@ -20,18 +20,6 @@ case "$1" in config_unset "$@" ;; - config:set-norestart) - dokku_log_info2 "$1 is deprecated as of v0.3.22" - shift 1 - dokku config:set --no-restart "$@" - ;; - - config:unset-norestart) - dokku_log_info2 "$1 is deprecated as of v0.3.22" - shift 1 - dokku config:unset --no-restart "$@" - ;; - help | config:help) cat<|--global), Display all global or app-specific config vars diff --git a/plugins/shell/commands b/plugins/shell/commands index 686963ced..0d3b73fbd 100755 --- a/plugins/shell/commands +++ b/plugins/shell/commands @@ -30,15 +30,16 @@ case "$1" in [[ "$line" != "$(fc -ln -1 | trim)" ]] && history -s "$line" case $CMD in - # shell builtins + # shell builtins clear) clear ;; + quit|exit) break ;; - # Not a built-in, run as regular dokku command + # Not a built-in, run as regular dokku command *) dokku $line || true esac diff --git a/plugins/tar/commands b/plugins/tar/commands index 1032fd5fe..4388a1cc5 100755 --- a/plugins/tar/commands +++ b/plugins/tar/commands @@ -49,7 +49,6 @@ case "$1" in tar -x -C "$TMP_WORK_DIR" -f "$DOKKU_ROOT/$APP/src.tar" --strip-components=$BOGUS_PARTS chmod -R u+r "$TMP_WORK_DIR" - #find -name .git -prune -exec rm -rf {} \; > /dev/null if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; then dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/" From c9bca838f0e7c60517c67f6e125b4670f8215a11 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 7 Sep 2015 14:40:24 -0400 Subject: [PATCH 15/32] Add missing $ --- plugins/nginx-vhosts/commands | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 59703aead..21b14b985 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -95,7 +95,7 @@ EOF if [[ -n "$SSL_INUSE" ]]; then SCHEME="https" - [[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="(dirname $0)/templates/nginx.ssl.conf.template" + [[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$(dirname $0)/templates/nginx.ssl.conf.template" SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH || true) NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH || true) From 92497cf0958500638ea952f570b8d85579467654 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 8 Sep 2015 11:21:38 -0400 Subject: [PATCH 16/32] Do not delete containers with the label dokku.service [ci skip] --- plugins/common/functions | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/common/functions b/plugins/common/functions index c84ff522e..983e763e8 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -323,8 +323,13 @@ release_and_deploy() { docker_cleanup() { # delete all non-running containers + # if a container has the label `dokku.service`, + # then that container is not deleted. + # This can be used to mark data containers + # as non-removable by the cleanup function # shellcheck disable=SC2046 - docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true + docker rm $(comm <(docker ps -aq -f 'status=exited' | sort) <(docker ps -aq -f 'status=exited' -f 'label=dokku.service' | sort) -3) &> /dev/null || true + # delete unused images # shellcheck disable=SC2046 docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null & From 525e6f503dcd08db17949be0de7267c532429b78 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 7 Sep 2015 13:41:05 -0400 Subject: [PATCH 17/32] Remove deprecated calls --- plugins/20_events/post-build-buildpack~HEAD | 1 + plugins/20_events/post-build-buildpack~Remove deprecated calls | 1 + plugins/20_events/post-release-buildpack~HEAD | 1 + plugins/20_events/post-release-buildpack~Remove deprecated calls | 1 + plugins/20_events/pre-build-buildpack~HEAD | 1 + plugins/20_events/pre-build-buildpack~Remove deprecated calls | 1 + plugins/20_events/pre-release-buildpack~HEAD | 1 + plugins/20_events/pre-release-buildpack~Remove deprecated calls | 1 + 8 files changed, 8 insertions(+) create mode 120000 plugins/20_events/post-build-buildpack~HEAD create mode 120000 plugins/20_events/post-build-buildpack~Remove deprecated calls create mode 120000 plugins/20_events/post-release-buildpack~HEAD create mode 120000 plugins/20_events/post-release-buildpack~Remove deprecated calls create mode 120000 plugins/20_events/pre-build-buildpack~HEAD create mode 120000 plugins/20_events/pre-build-buildpack~Remove deprecated calls create mode 120000 plugins/20_events/pre-release-buildpack~HEAD create mode 120000 plugins/20_events/pre-release-buildpack~Remove deprecated calls diff --git a/plugins/20_events/post-build-buildpack~HEAD b/plugins/20_events/post-build-buildpack~HEAD new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-build-buildpack~HEAD @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/post-build-buildpack~Remove deprecated calls b/plugins/20_events/post-build-buildpack~Remove deprecated calls new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-build-buildpack~Remove deprecated calls @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/post-release-buildpack~HEAD b/plugins/20_events/post-release-buildpack~HEAD new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-release-buildpack~HEAD @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/post-release-buildpack~Remove deprecated calls b/plugins/20_events/post-release-buildpack~Remove deprecated calls new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-release-buildpack~Remove deprecated calls @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/pre-build-buildpack~HEAD b/plugins/20_events/pre-build-buildpack~HEAD new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/pre-build-buildpack~HEAD @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/pre-build-buildpack~Remove deprecated calls b/plugins/20_events/pre-build-buildpack~Remove deprecated calls new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/pre-build-buildpack~Remove deprecated calls @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/pre-release-buildpack~HEAD b/plugins/20_events/pre-release-buildpack~HEAD new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/pre-release-buildpack~HEAD @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/pre-release-buildpack~Remove deprecated calls b/plugins/20_events/pre-release-buildpack~Remove deprecated calls new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/pre-release-buildpack~Remove deprecated calls @@ -0,0 +1 @@ +hook \ No newline at end of file From cd3af6b96177e5afc5074e67f377a3a9929c28c3 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 8 Sep 2015 08:50:17 -0700 Subject: [PATCH 18/32] rename buildstep hooks to buildpack --- plugins/20_events/post-build-buildpack~HEAD | 1 - plugins/20_events/post-release-buildpack~HEAD | 1 - plugins/20_events/pre-build-buildpack~HEAD | 1 - plugins/20_events/pre-release-buildpack~HEAD | 1 - 4 files changed, 4 deletions(-) delete mode 120000 plugins/20_events/post-build-buildpack~HEAD delete mode 120000 plugins/20_events/post-release-buildpack~HEAD delete mode 120000 plugins/20_events/pre-build-buildpack~HEAD delete mode 120000 plugins/20_events/pre-release-buildpack~HEAD diff --git a/plugins/20_events/post-build-buildpack~HEAD b/plugins/20_events/post-build-buildpack~HEAD deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/post-build-buildpack~HEAD +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/post-release-buildpack~HEAD b/plugins/20_events/post-release-buildpack~HEAD deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/post-release-buildpack~HEAD +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/pre-build-buildpack~HEAD b/plugins/20_events/pre-build-buildpack~HEAD deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/pre-build-buildpack~HEAD +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/pre-release-buildpack~HEAD b/plugins/20_events/pre-release-buildpack~HEAD deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/pre-release-buildpack~HEAD +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file From aaa7a4ecb03d7577504a5fc1a0547af68ee1a140 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 8 Sep 2015 14:35:00 -0400 Subject: [PATCH 19/32] Revert change that whitelisted dokku-labeled containers Rather than having a one-off hack for "blessed" containers, we should solve the issue properly. As that would take a bit more work, reverting to the previous state is preferred. Better that we solve a problem problem than with a hack that we'll need to roll back in the future. Refs #1220 [ci skip] --- plugins/common/functions | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/common/functions b/plugins/common/functions index 983e763e8..8e1dcccb2 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -323,12 +323,8 @@ release_and_deploy() { docker_cleanup() { # delete all non-running containers - # if a container has the label `dokku.service`, - # then that container is not deleted. - # This can be used to mark data containers - # as non-removable by the cleanup function # shellcheck disable=SC2046 - docker rm $(comm <(docker ps -aq -f 'status=exited' | sort) <(docker ps -aq -f 'status=exited' -f 'label=dokku.service' | sort) -3) &> /dev/null || true + docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true # delete unused images # shellcheck disable=SC2046 From e873f27eac405faea05a06e77bea55a28e4dcd7a Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 8 Sep 2015 11:50:27 -0700 Subject: [PATCH 20/32] remove remnants of bad rebase --- plugins/20_events/post-build-buildpack~Remove deprecated calls | 1 - plugins/20_events/post-release-buildpack~Remove deprecated calls | 1 - plugins/20_events/pre-build-buildpack~Remove deprecated calls | 1 - plugins/20_events/pre-release-buildpack~Remove deprecated calls | 1 - 4 files changed, 4 deletions(-) delete mode 120000 plugins/20_events/post-build-buildpack~Remove deprecated calls delete mode 120000 plugins/20_events/post-release-buildpack~Remove deprecated calls delete mode 120000 plugins/20_events/pre-build-buildpack~Remove deprecated calls delete mode 120000 plugins/20_events/pre-release-buildpack~Remove deprecated calls diff --git a/plugins/20_events/post-build-buildpack~Remove deprecated calls b/plugins/20_events/post-build-buildpack~Remove deprecated calls deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/post-build-buildpack~Remove deprecated calls +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/post-release-buildpack~Remove deprecated calls b/plugins/20_events/post-release-buildpack~Remove deprecated calls deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/post-release-buildpack~Remove deprecated calls +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/pre-build-buildpack~Remove deprecated calls b/plugins/20_events/pre-build-buildpack~Remove deprecated calls deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/pre-build-buildpack~Remove deprecated calls +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/pre-release-buildpack~Remove deprecated calls b/plugins/20_events/pre-release-buildpack~Remove deprecated calls deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/pre-release-buildpack~Remove deprecated calls +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file From 18d234a9250ab2f4e500f989010c7a0dd19b331b Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 8 Sep 2015 12:14:57 -0700 Subject: [PATCH 21/32] move plugin-* to plugin: namespace --- Makefile | 4 +- debian/postinst | 4 +- docs/development/plugin-creation.md | 2 +- docs/development/pluginhooks.md | 8 ++-- docs/plugins.md | 2 +- dokku | 47 +--------------------- plugins/plugin/commands | 62 +++++++++++++++++++++++++++++ plugins/plugin/plugin.toml | 4 ++ 8 files changed, 77 insertions(+), 56 deletions(-) create mode 100755 plugins/plugin/commands create mode 100644 plugins/plugin/plugin.toml diff --git a/Makefile b/Makefile index 7a427c900..dd6cc517a 100644 --- a/Makefile +++ b/Makefile @@ -70,10 +70,10 @@ version: git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION plugin-dependencies: plugn - dokku plugins-install-dependencies --core + dokku plugin:install-dependencies --core plugins: plugn docker - dokku plugins-install --core + dokku plugin:install --core dependencies: apt-update sshcommand plugn docker help2man man-db $(MAKE) -e stack diff --git a/debian/postinst b/debian/postinst index a0e8dd590..07c27fe4e 100755 --- a/debian/postinst +++ b/debian/postinst @@ -16,7 +16,7 @@ case "$1" in sshcommand create dokku /usr/local/bin/dokku egrep -i "^docker" /etc/group || groupadd docker usermod -aG docker dokku - dokku plugins-install --core + dokku plugin:install --core rm -f /home/dokku/VERSION cp /var/lib/dokku/STABLE_VERSION /home/dokku/VERSION @@ -31,7 +31,7 @@ case "$1" in db_get "dokku/vhost_enable" if [ "$RET" = "true" ]; then - db_get "dokku/hostname" + db_get "dokku/hostname" echo "$RET" > "${DOKKU_ROOT}/VHOST" else rm -f "${DOKKU_ROOT}/VHOST" diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index 9290a6707..6a967d5d1 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -65,7 +65,7 @@ A few notes: ```shell IMAGE=$(docker images | grep "user/repo" | awk '{print $3}') if [[ -z $IMAGE ]]; then - dokku_log_fail "user/repo image not found... Did you run 'dokku plugins-install'?" + dokku_log_fail "user/repo image not found... Did you run 'dokku plugin:install'?" fi ``` diff --git a/docs/development/pluginhooks.md b/docs/development/pluginhooks.md index 71360ae75..ea7cd3a3a 100644 --- a/docs/development/pluginhooks.md +++ b/docs/development/pluginhooks.md @@ -32,7 +32,7 @@ The following plugn triggers describe those available to a dokku installation. A ### `install` - Description: Used to setup any files/configuration for a plugn. -- Invoked by: `dokku plugins-install`. +- Invoked by: `dokku plugin:install`. - Arguments: None - Example: @@ -50,8 +50,8 @@ fi ### `dependencies` -- Description: Used to install system-level dependencies. Invoked by `plugins-install-dependencies`. -- Invoked by: `dokku plugins-install-dependencies` +- Description: Used to install system-level dependencies. Invoked by `plugin:install-dependencies`. +- Invoked by: `dokku plugin:install-dependencies` - Arguments: None - Example: @@ -77,7 +77,7 @@ esac ### `update` - Description: Can be used to run plugn updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates. -- Invoked by: `dokku plugins-update`. +- Invoked by: `dokku plugin:update`. - Arguments: None - Example: diff --git a/docs/plugins.md b/docs/plugins.md index 610724ed5..b1f71dba5 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -15,7 +15,7 @@ Let's take a quick look at the current dokku nginx plugin that's shipped with do ```shell cd /var/lib/dokku/plugins/available git clone -dokku plugins-install +dokku plugin:install ``` ## Creating your own plugin diff --git a/dokku b/dokku index 662203a2e..53db1b7f2 100755 --- a/dokku +++ b/dokku @@ -36,7 +36,7 @@ if [[ "${args[0]}" =~ ^--.* ]]; then fi ! has_tty && DOKKU_QUIET_OUTPUT=1 -if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then +if [[ $(id -un) != "dokku" && $1 != plugin:install* && $1 != "plugin:update" ]]; then sudo -u dokku -E -H $0 "$@" exit fi @@ -200,45 +200,6 @@ case "$1" in docker_cleanup ;; - plugins) - plugn list - ;; - - plugins-install) - if [[ $2 == "--core" ]]; then - export PLUGIN_PATH="$PLUGIN_CORE_PATH" - fi - plugn trigger install - ;; - - plugins-install-dependencies) - if [[ $2 == "--core" ]]; then - export PLUGIN_PATH="$PLUGIN_CORE_PATH" - fi - plugn trigger dependencies - ;; - - plugins-update) - plugn trigger update - ;; - - plugins:disable) - PLUGIN="$2" - [[ -e $PLUGIN_CORE_PATH/$PLUGIN ]] && echo "Cannot disable a core plugin" && exit 1 - [[ -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin already disabled" && exit 1 - [[ ! -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 - mv "$PLUGIN_PATH/$PLUGIN" "$PLUGIN_DISABLED_PATH" - echo "Plugin $PLUGIN disabled" - ;; - - plugins:enable) - PLUGIN="$2" - [[ -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin already enabled" && exit 1 - [[ ! -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 - mv "$PLUGIN_DISABLED_PATH/$PLUGIN" "$PLUGIN_PATH" - echo "Plugin $PLUGIN enabled" - ;; - # DEPRECATED as of v0.3.14 deploy:all) echo "*DEPRECATED* in v0.3.14: deploy:all will be removed in future versions" @@ -252,12 +213,6 @@ case "$1" in cat<, Enable a previously disabled plugin - plugins:disable , Disable an installed plugin (third-party only) EOF ;; diff --git a/plugins/plugin/commands b/plugins/plugin/commands new file mode 100755 index 000000000..213111c8e --- /dev/null +++ b/plugins/plugin/commands @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_PATH/available/common/functions" + +case "$1" in + plugin) + plugn list + ;; + + plugin:install) + if [[ $2 == "--core" ]]; then + export PLUGIN_PATH="$PLUGIN_CORE_PATH" + fi + plugn trigger install + ;; + + plugin:install-dependencies) + if [[ $2 == "--core" ]]; then + export PLUGIN_PATH="$PLUGIN_CORE_PATH" + fi + plugn trigger dependencies + ;; + + plugin:update) + plugn trigger update + ;; + + plugins:disable) + PLUGIN="$2" + [[ -e $PLUGIN_CORE_PATH/$PLUGIN ]] && echo "Cannot disable a core plugin" && exit 1 + [[ -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin already disabled" && exit 1 + [[ ! -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 + mv "$PLUGIN_PATH/$PLUGIN" "$PLUGIN_DISABLED_PATH" + echo "Plugin $PLUGIN disabled" + ;; + + plugins:enable) + PLUGIN="$2" + [[ -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin already enabled" && exit 1 + [[ ! -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 + mv "$PLUGIN_DISABLED_PATH/$PLUGIN" "$PLUGIN_PATH" + echo "Plugin $PLUGIN enabled" + ;; + + help | ps:help) + cat<, Enable a previously disabled plugin + plugin:disable , Disable an installed plugin (third-party only) +EOF + ;; + + *) + exit $DOKKU_NOT_IMPLEMENTED_EXIT + ;; + +esac + + diff --git a/plugins/plugin/plugin.toml b/plugins/plugin/plugin.toml new file mode 100644 index 000000000..fbcfc4da7 --- /dev/null +++ b/plugins/plugin/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core plugin plugin" +version = "0.4.0" +[plugin.config] From 424f9f1e5bb18dc52c6462971e41dcf85b1feb11 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 8 Sep 2015 12:31:13 -0700 Subject: [PATCH 22/32] only use plugn when referring to the project or command. otherwise use plugin --- docs/advanced-installation.md | 2 +- docs/development/plugin-creation.md | 6 +-- .../{pluginhooks.md => plugin-triggers.md} | 38 +++++++++---------- docs/template.html | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) rename docs/development/{pluginhooks.md => plugin-triggers.md} (86%) diff --git a/docs/advanced-installation.md b/docs/advanced-installation.md index bab3666b9..eed676675 100644 --- a/docs/advanced-installation.md +++ b/docs/advanced-installation.md @@ -16,7 +16,7 @@ cd dokku sudo make install ``` -The `Makefile` allows source URLs to be overridden to include customizations from your own repositories. The `DOCKER_URL`, `PLUGINHOOK_URL`, `SSHCOMMAND_URL` and `STACK_URL` environment variables may be set to override the defaults (see the `Makefile` for how these apply). Example: +The `Makefile` allows source URLs to be overridden to include customizations from your own repositories. The `DOCKER_URL`, `PLUGN_URL`, `SSHCOMMAND_URL` and `STACK_URL` environment variables may be set to override the defaults (see the `Makefile` for how these apply). Example: ```shell sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index 6a967d5d1..c3d5fe808 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -3,7 +3,7 @@ If you create your own plugin: 1. Take a look at the plugins shipped with dokku and hack away! -2. Check out the [list of triggers](http://progrium.viewdocs.io/dokku/development/pluginhooks) your plugin can implement. +2. Check out the [list of triggers](http://progrium.viewdocs.io/dokku/development/plugin-triggers) your plugin can implement. 3. Upload your plugin to github with a repository name in form of `dokku-` (e.g. `dokku-mariadb`) 4. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it. 5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases @@ -44,7 +44,7 @@ EOF esac ``` -Each plugn requires a `plugin.toml` descriptor file with the following required fields: +Each plugin requires a `plugin.toml` descriptor file with the following required fields: ```shell [plugin] @@ -89,4 +89,4 @@ A few notes: dokku config:unset --no-restart APP KEY1 [KEY2 ...] ``` - From time to time you may want to allow other plugins access to (some of) your plugin's functionality. You can expose this by including a `functions` file in your plugin for others to source. Consider all functions in that file to be publicly accessible by other plugins. Any functions not wished to be made "public" should reside within your plugin trigger or commands files. -- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See the [plugin triggers](http://progrium.viewdocs.io/dokku/development/pluginhooks) doc for examples. +- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See the [plugin triggers](http://progrium.viewdocs.io/dokku/development/plugin-triggers) doc for examples. diff --git a/docs/development/pluginhooks.md b/docs/development/plugin-triggers.md similarity index 86% rename from docs/development/pluginhooks.md rename to docs/development/plugin-triggers.md index ea7cd3a3a..3f5b193b8 100644 --- a/docs/development/pluginhooks.md +++ b/docs/development/plugin-triggers.md @@ -1,15 +1,15 @@ -# Plugn triggers +# Plugin triggers -[Plugn triggers](https://github.com/progrium/plugn) (formerly [pluginhooks](https://github.com/progrium/pluginhook)) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration. +[Plugin triggers](https://github.com/progrium/plugn) (formerly [pluginhooks](https://github.com/progrium/pluginhook)) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration. -Plugn triggers are simply scripts that are executed by the system. You can use any language you want, so long as the script: +Plugin triggers are simply scripts that are executed by the system. You can use any language you want, so long as the script: - Is executable - Has the proper language requirements installed -For instance, if you wanted to write a plugn trigger in PHP, you would need to have `php` installed and available on the CLI prior to plugn trigger invocation. +For instance, if you wanted to write a plugin trigger in PHP, you would need to have `php` installed and available on the CLI prior to plugin trigger invocation. -The following is an example for the `nginx-hostname` plugn trigger. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named `nginx-hostname` with the following code in your plugn trigger, it would be invoked by dokku during the normal app deployment process: +The following is an example for the `nginx-hostname` plugin trigger. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named `nginx-hostname` with the following code in your plugin trigger, it would be invoked by dokku during the normal app deployment process: ```shell #!/usr/bin/env bash @@ -21,17 +21,17 @@ NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev` echo "$NEW_SUBDOMAIN.$VHOST" ``` -## Available Plugn triggers +## Available plugin triggers There are a number of plugin-related triggers. These can be optionally implemented by plugins and allow integration into the standard dokku setup/backup/teardown process. -The following plugn triggers describe those available to a dokku installation. As well, there is an example for each trigger that you can use as templates for your own plugn development. +The following plugin triggers describe those available to a dokku installation. As well, there is an example for each trigger that you can use as templates for your own plugin development. -> The example plugn trigger code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples. +> The example plugin trigger code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples. ### `install` -- Description: Used to setup any files/configuration for a plugn. +- Description: Used to setup any files/configuration for a plugin. - Invoked by: `dokku plugin:install`. - Arguments: None - Example: @@ -57,7 +57,7 @@ fi ```shell #!/usr/bin/env bash -# Installs nginx for the current plugn +# Installs nginx for the current plugin # Supports both opensuse and ubuntu set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x @@ -76,7 +76,7 @@ esac ### `update` -- Description: Can be used to run plugn updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates. +- Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates. - Invoked by: `dokku plugin:update`. - Arguments: None - Example: @@ -93,14 +93,14 @@ sudo BUILD_STACK=true make install ### `commands help` -- Description: Used to aggregate all plugn `help` output. Your plugn should implement a `help` command in your `commands` file to take advantage of this plugn trigger. This must be implemented inside the `commands` plugn file. +- Description: Used to aggregate all plugin `help` output. Your plugin should implement a `help` command in your `commands` file to take advantage of this plugin trigger. This must be implemented inside the `commands` plugin file. - Invoked by: `dokku help` - Arguments: None - Example: ```shell #!/usr/bin/env bash -# Outputs help for the derp plugn +# Outputs help for the derp plugin set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x @@ -121,7 +121,7 @@ esac ### `backup-export` -- Description: Used to backup files for a given plugn. If your plugn writes files to disk, this plugn trigger should be used to echo out their full paths. Any files listed will be copied by the backup plugn to the backup tar.gz. +- Description: Used to backup files for a given plugin. If your plugin writes files to disk, this plugin trigger should be used to echo out their full paths. Any files listed will be copied by the backup plugin to the backup tar.gz. - Invoked by: `dokku backup:export` - Arguments: `$VERSION $DOKKU_ROOT` - Example: @@ -157,7 +157,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x ### `backup-import` -- Description: Allows a plugn to import specific files from a `$BACKUP_ROOT` to the `DOKKU_ROOT` directory. +- Description: Allows a plugin to import specific files from a `$BACKUP_ROOT` to the `DOKKU_ROOT` directory. - Invoked by: `dokku backup:import` - Arguments: `$VERSION $BACKUP_ROOT $DOKKU_ROOT $BACKUP_TMP_DIR/.dokku_backup_apps` - Example: @@ -513,8 +513,8 @@ echo false ```shell #!/usr/bin/env bash -# Reloads haproxy for our imaginary haproxy plugn -# that replaces the nginx-vhosts plugn +# Reloads haproxy for our imaginary haproxy plugin +# that replaces the nginx-vhosts plugin set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x @@ -596,7 +596,7 @@ nginx -t ```shell #!/usr/bin/env bash -# For our imaginary mercurial plugn, triggers a rebuild +# For our imaginary mercurial plugin, triggers a rebuild set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x @@ -626,7 +626,7 @@ if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then REFERENCE_REPO="$DOKKU_ROOT/$reference_app git clone --bare --shared --reference "$REFERENCE_REPO" "$REFERENCE_REPO" "$DOKKU_ROOT/$APP" > /dev/null fi -pluginhook receive-app $APP $newrev +plugn trigger receive-app $APP $newrev ``` ### `tags-create` diff --git a/docs/template.html b/docs/template.html index 878df1201..ec20cf893 100644 --- a/docs/template.html +++ b/docs/template.html @@ -77,7 +77,7 @@ Development Plugin Creation - Plugn Triggers + Plugin Triggers Test Suite Release Process From bef51a1c6b96fb408cef9c969b91660d7ef7eef4 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 8 Sep 2015 12:31:30 -0700 Subject: [PATCH 23/32] initial pass at converting deb to plugn --- Makefile | 2 +- deb.mk | 30 +++++++++++++++--------------- debian/control | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index dd6cc517a..675c3bbb9 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ release: deb-all package_cloud packer package_cloud: package_cloud push dokku/dokku/ubuntu/trusty herokuish*.deb package_cloud push dokku/dokku/ubuntu/trusty sshcommand*.deb - package_cloud push dokku/dokku/ubuntu/trusty pluginhook*.deb + package_cloud push dokku/dokku/ubuntu/trusty plugn*.deb package_cloud push dokku/dokku/ubuntu/trusty rubygem*.deb package_cloud push dokku/dokku/ubuntu/trusty dokku*.deb diff --git a/deb.mk b/deb.mk index 73d03bc52..ae7b28f90 100644 --- a/deb.mk +++ b/deb.mk @@ -8,11 +8,11 @@ DOKKU_DESCRIPTION = 'Docker powered mini-Heroku in around 100 lines of Bash' DOKKU_REPO_NAME ?= progrium/dokku DOKKU_ARCHITECTURE = amd64 -PLUGINHOOK_DESCRIPTION = 'Simple dispatcher and protocol for shell-based plugins, an improvement to hook scripts' -PLUGINHOOK_REPO_NAME ?= progrium/pluginhook -PLUGINHOOK_VERSION ?= 0.2.0 -PLUGINHOOK_ARCHITECTURE = amd64 -PLUGINHOOK_PACKAGE_NAME = pluginhook_$(PLUGINHOOK_VERSION)_$(PLUGINHOOK_ARCHITECTURE).deb +PLUGN_DESCRIPTION = 'Hook system that lets users extend your application with plugins' +PLUGN_REPO_NAME ?= progrium/plugn +PLUGN_VERSION ?= 0.1.0 +PLUGN_ARCHITECTURE = amd64 +PLUGN_PACKAGE_NAME = plugn_$(PLUGN_VERSION)_$(PLUGN_ARCHITECTURE).deb SSHCOMMAND_DESCRIPTION = 'Turn SSH into a thin client specifically for your app' SSHCOMMAND_REPO_NAME ?= progrium/sshcommand @@ -26,7 +26,7 @@ GOROOT = /usr/lib/go GOBIN = /usr/bin/go GOPATH = /home/vagrant/gocode -.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-gems deb-pluginhook deb-setup deb-sshcommand +.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-gems deb-plugn deb-setup deb-sshcommand install-from-deb: echo "--> Initial apt-get update" @@ -54,7 +54,7 @@ install-from-deb: echo "--> Done!" -deb-all: deb-herokuish deb-dokku deb-gems deb-pluginhook deb-sshcommand +deb-all: deb-herokuish deb-dokku deb-gems deb-plugn deb-sshcommand mv /tmp/*.deb . echo "Done" @@ -128,24 +128,24 @@ deb-gems: deb-setup find /tmp/tmp/cache -name '*.gem' | xargs -rn1 fpm -d ruby -d ruby --prefix /var/lib/gems/1.9.1 -s gem -t deb -a $(GEM_ARCHITECTURE) mv *.deb /tmp -deb-pluginhook: deb-setup - rm -rf /tmp/tmp /tmp/build $(PLUGINHOOK_PACKAGE_NAME) +deb-plugn: deb-setup + rm -rf /tmp/tmp /tmp/build $(PLUGN_PACKAGE_NAME) mkdir -p /tmp/tmp /tmp/build echo "-> Cloning repository" - git clone -q "git@github.com:$(PLUGINHOOK_REPO_NAME).git" /tmp/tmp/pluginhook > /dev/null - rm -rf /tmp/tmp/pluginhook/.git /tmp/tmp/pluginhook/.gitignore + git clone -q "git@github.com:$(PLUGN_REPO_NAME).git" /tmp/tmp/plugn > /dev/null + rm -rf /tmp/tmp/plugn/.git /tmp/tmp/plugn/.gitignore echo "-> Copying files into place" mkdir -p /tmp/build/usr/local/bin $(GOPATH) sudo apt-get update > /dev/null sudo apt-get install -qq -y git golang mercurial 2>&1 > /dev/null export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && go get "golang.org/x/crypto/ssh/terminal" - export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && cd /tmp/tmp/pluginhook && go build -o pluginhook - mv /tmp/tmp/pluginhook/pluginhook /tmp/build/usr/local/bin/pluginhook + export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && cd /tmp/tmp/plugn && go build -o plugn + mv /tmp/tmp/plugn/plugn /tmp/build/usr/local/bin/plugn - echo "-> Creating $(PLUGINHOOK_PACKAGE_NAME)" - sudo fpm -t deb -s dir -C /tmp/build -n pluginhook -v $(PLUGINHOOK_VERSION) -a $(PLUGINHOOK_ARCHITECTURE) -p $(PLUGINHOOK_PACKAGE_NAME) --url "https://github.com/$(PLUGINHOOK_REPO_NAME)" --description $(PLUGINHOOK_DESCRIPTION) --license 'MIT License' . + echo "-> Creating $(PLUGN_PACKAGE_NAME)" + sudo fpm -t deb -s dir -C /tmp/build -n plugn -v $(PLUGN_VERSION) -a $(PLUGN_ARCHITECTURE) -p $(PLUGN_PACKAGE_NAME) --url "https://github.com/$(PLUGN_REPO_NAME)" --description $(PLUGN_DESCRIPTION) --license 'MIT License' . mv *.deb /tmp deb-sshcommand: deb-setup diff --git a/debian/control b/debian/control index d4b026362..d297bc846 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Version: 0.3.12 Section: base Priority: optional Architecture: amd64 -Depends: locales, git, make, curl, software-properties-common, lxc-docker-1.6.2, gcc, python-software-properties, man-db, herokuish, sshcommand, pluginhook +Depends: locales, git, make, curl, software-properties-common, lxc-docker-1.6.2, gcc, python-software-properties, man-db, herokuish, sshcommand, plugn Pre-Depends: nginx, dnsutils, ruby, ruby-dev, rubygem-rack, rubygem-rack-protection, rubygem-sinatra, rubygem-tilt, apparmor, cgroupfs-mount | cgroup-lite Maintainer: Jose Diaz-Gonzalez Description: Docker powered mini-Heroku in around 100 lines of Bash From 30631692a592d2e397fb99dbe5a63728bf16c6bd Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 8 Sep 2015 17:32:12 -0700 Subject: [PATCH 24/32] cat is no longer needed by plugn --- plugins/git/receive-app | 2 +- plugins/tar/commands | 2 +- plugins/tar/receive-app | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/git/receive-app b/plugins/git/receive-app index 11dd7541e..da534d709 100755 --- a/plugins/git/receive-app +++ b/plugins/git/receive-app @@ -6,7 +6,7 @@ APP="$1"; REV="$2" # Don't trigger git build if there is no git repository. if [ ! -d "$DOKKU_ROOT/$APP/refs" ]; then - cat || true + true else dokku git-build $APP $REV fi diff --git a/plugins/tar/commands b/plugins/tar/commands index 4388a1cc5..902157ef6 100755 --- a/plugins/tar/commands +++ b/plugins/tar/commands @@ -15,7 +15,7 @@ case "$1" in APP="$2" verify_app_name "$2" tee "$DOKKU_ROOT/$APP/src.tar" | wc -c - plugn trigger -p receive-app $APP + plugn trigger receive-app $APP ;; tar-build) diff --git a/plugins/tar/receive-app b/plugins/tar/receive-app index 88e6525a8..57b05857b 100755 --- a/plugins/tar/receive-app +++ b/plugins/tar/receive-app @@ -6,7 +6,7 @@ APP="$1"; REV="$2" # Don't trigger tar build if there is no tarball. if [ ! -f "$DOKKU_ROOT/$APP/src.tar" ]; then - cat || true + true else dokku tar-build $APP fi From d6341e9ab756395bae87a7fe3ac977185dcb4e0d Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Wed, 9 Sep 2015 13:19:17 -0700 Subject: [PATCH 25/32] set DOKKU_API_VERSION initially to 1 --- dokku | 1 + 1 file changed, 1 insertion(+) diff --git a/dokku b/dokku index 53db1b7f2..c90d694b2 100755 --- a/dokku +++ b/dokku @@ -10,6 +10,7 @@ export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"} export PLUGIN_PATH=${PLUGIN_PATH:="$DOKKU_LIB_ROOT/plugins"} export PLUGIN_CORE_PATH=${PLUGIN_CORE_PATH:="$DOKKU_LIB_ROOT/core-plugins"} export PLUGIN_DISABLED_PATH=${PLUGIN_DISABLED_PATH:="$DOKKU_LIB_ROOT/disabled-plugins"} +export DOKKU_API_VERSION=1 export DOKKU_NOT_IMPLEMENTED_EXIT=10 export DOKKU_VALID_EXIT=0 From 8095df79f674912a05390d9f58171d98212e19fa Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Wed, 9 Sep 2015 18:27:42 -0700 Subject: [PATCH 26/32] implement core plugin mgmt using plugn. add tests. --- Makefile | 14 +++--- dokku | 12 +++-- plugins/00_dokku-standard/commands | 4 +- plugins/20_events/commands | 2 +- plugins/20_events/hook | 2 +- plugins/20_events/install | 2 +- plugins/WARNING | 2 - plugins/apps/commands | 2 +- plugins/apps/post-delete | 2 +- plugins/apps/pre-delete | 2 +- plugins/build-env/pre-build-buildpack | 4 +- plugins/certs/commands | 4 +- plugins/certs/functions | 2 +- plugins/checks/check-deploy | 4 +- plugins/config/commands | 4 +- plugins/config/docker-args-deploy | 4 +- plugins/config/functions | 2 +- plugins/docker-options/commands | 2 +- plugins/domains/commands | 6 +-- plugins/domains/functions | 2 +- plugins/enter/commands | 2 +- plugins/git/commands | 2 +- plugins/git/receive-app | 2 +- plugins/nginx-vhosts/bind-external-ip | 2 +- plugins/nginx-vhosts/commands | 8 +-- plugins/nginx-vhosts/post-deploy | 4 +- plugins/nginx-vhosts/post-domains-update | 2 +- plugins/plugin/commands | 64 ++++++++++++++++-------- plugins/plugin/functions | 41 +++++++++++++++ plugins/ps/commands | 4 +- plugins/ps/functions | 2 +- plugins/ps/pre-deploy | 4 +- plugins/tags/commands | 4 +- plugins/tags/functions | 2 +- plugins/tar/commands | 2 +- plugins/tar/receive-app | 2 +- tests/unit/core_ports.bats | 4 +- tests/unit/plugin.bats | 45 +++++++++++++++++ tests/unit/test_helper.bash | 7 ++- 39 files changed, 199 insertions(+), 82 deletions(-) delete mode 100644 plugins/WARNING create mode 100755 plugins/plugin/functions create mode 100644 tests/unit/plugin.bats diff --git a/Makefile b/Makefile index 675c3bbb9..cb805223f 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,6 @@ PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest DOKKU_LIB_ROOT ?= /var/lib/dokku PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/plugins CORE_PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/core-plugins -DISABLED_PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/disabled-plugins # If the first argument is "vagrant-dokku"... ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS))) @@ -47,18 +46,21 @@ packer: copyfiles: cp dokku /usr/local/bin/dokku - mkdir -p ${CORE_PLUGINS_PATH} ${PLUGINS_PATH} ${DISABLED_PLUGINS_PATH} + mkdir -p ${CORE_PLUGINS_PATH} ${PLUGINS_PATH} rm -rf ${CORE_PLUGINS_PATH}/* + test -d ${CORE_PLUGINS_PATH}/enabled || PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn init test -d ${PLUGINS_PATH}/enabled || PLUGIN_PATH=${PLUGINS_PATH} plugn init find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \ + rm -Rf ${CORE_PLUGINS_PATH}/available/$$plugin && \ rm -Rf ${PLUGINS_PATH}/available/$$plugin && \ - rm -Rf ${CORE_PLUGINS_PATH}/$$plugin && \ + rm -rf ${CORE_PLUGINS_PATH}/$$plugin && \ rm -rf ${PLUGINS_PATH}/$$plugin && \ - cp -R plugins/$$plugin ${CORE_PLUGINS_PATH} && \ - ln -s ${CORE_PLUGINS_PATH}/$$plugin ${PLUGINS_PATH}/available; \ + cp -R plugins/$$plugin ${CORE_PLUGINS_PATH}/available && \ + ln -s ${CORE_PLUGINS_PATH}/available/$$plugin ${PLUGINS_PATH}/available; \ + PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn enable $$plugin ;\ PLUGIN_PATH=${PLUGINS_PATH} plugn enable $$plugin ;\ done - chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} ${DISABLED_PLUGINS_PATH} + chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} $(MAKE) addman addman: diff --git a/dokku b/dokku index c90d694b2..fa1265d8d 100755 --- a/dokku +++ b/dokku @@ -8,8 +8,12 @@ export DOKKU_ROOT=${DOKKU_ROOT:=~dokku} export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"} export PLUGIN_PATH=${PLUGIN_PATH:="$DOKKU_LIB_ROOT/plugins"} +export PLUGIN_AVAILABLE_PATH=${PLUGIN_AVAILABLE_PATH:="$PLUGIN_PATH/available"} +export PLUGIN_ENABLED_PATH=${PLUGIN_ENABLED_PATH:="$PLUGIN_PATH/enabled"} export PLUGIN_CORE_PATH=${PLUGIN_CORE_PATH:="$DOKKU_LIB_ROOT/core-plugins"} -export PLUGIN_DISABLED_PATH=${PLUGIN_DISABLED_PATH:="$DOKKU_LIB_ROOT/disabled-plugins"} +export PLUGIN_CORE_AVAILABLE_PATH=${PLUGIN_CORE_AVAILABLE_PATH:="$PLUGIN_CORE_PATH/available"} +export PLUGIN_CORE_ENABLED_PATH=${PLUGIN_CORE_ENABLED_PATH:="$PLUGIN_CORE_PATH/enabled"} + export DOKKU_API_VERSION=1 export DOKKU_NOT_IMPLEMENTED_EXIT=10 export DOKKU_VALID_EXIT=0 @@ -17,7 +21,7 @@ export DOKKU_VALID_EXIT=0 export DOKKU_LOGS_DIR=${DOKKU_LOGS_DIR:="/var/log/dokku"} export DOKKU_EVENTS_LOGFILE=${DOKKU_EVENTS_LOGFILE:="$DOKKU_LOGS_DIR/events.log"} -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" [[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc [[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source $f; done @@ -37,7 +41,7 @@ if [[ "${args[0]}" =~ ^--.* ]]; then fi ! has_tty && DOKKU_QUIET_OUTPUT=1 -if [[ $(id -un) != "dokku" && $1 != plugin:install* && $1 != "plugin:update" ]]; then +if [[ $(id -un) != "dokku" && $1 != plugin:*install* && $1 != "plugin:update" ]]; then sudo -u dokku -E -H $0 "$@" exit fi @@ -219,7 +223,7 @@ EOF *) implemented=0 - for script in $PLUGIN_PATH/enabled/*/commands; do + for script in $PLUGIN_ENABLED_PATH/*/commands; do set +e; $script "$@" ; exit_code=$? ; set -e if [[ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]]; then continue diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 0175fe9f1..70e9ddc74 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/config/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" case "$1" in build) diff --git a/plugins/20_events/commands b/plugins/20_events/commands index 4c5b7dea8..7d9d502d6 100755 --- a/plugins/20_events/commands +++ b/plugins/20_events/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" PLUGIN_DIR="$(dirname $0)" diff --git a/plugins/20_events/hook b/plugins/20_events/hook index 96237195d..e9a05dd21 100755 --- a/plugins/20_events/hook +++ b/plugins/20_events/hook @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" [[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename $0)" "$@" diff --git a/plugins/20_events/install b/plugins/20_events/install index 8e90f3409..deed941d4 100755 --- a/plugins/20_events/install +++ b/plugins/20_events/install @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" DOKKU_RSYSLOG_FILTER=/etc/rsyslog.d/99-dokku.conf DOKKU_LOGROTATE_FILE=/etc/logrotate.d/dokku diff --git a/plugins/WARNING b/plugins/WARNING deleted file mode 100644 index d3eee9aac..000000000 --- a/plugins/WARNING +++ /dev/null @@ -1,2 +0,0 @@ - -Please note that the hooks in Dokku are experimental and are likely to change quite a bit. \ No newline at end of file diff --git a/plugins/apps/commands b/plugins/apps/commands index 5e5ab8f98..9c79b2e55 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" case "$1" in apps) diff --git a/plugins/apps/post-delete b/plugins/apps/post-delete index 11051a912..91fe06e20 100755 --- a/plugins/apps/post-delete +++ b/plugins/apps/post-delete @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; IMAGE_REPO=$(get_app_image_repo $APP) [[ -n $APP ]] && rm -rf "$DOKKU_ROOT/$APP" > /dev/null diff --git a/plugins/apps/pre-delete b/plugins/apps/pre-delete index e9727d6b6..376baa94b 100755 --- a/plugins/apps/pre-delete +++ b/plugins/apps/pre-delete @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG); CACHE_DIR="$DOKKU_ROOT/$APP/cache" verify_app_name "$APP" diff --git a/plugins/build-env/pre-build-buildpack b/plugins/build-env/pre-build-buildpack index 6916ae0a7..2ca012bb1 100755 --- a/plugins/build-env/pre-build-buildpack +++ b/plugins/build-env/pre-build-buildpack @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/config/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" APP="$1"; IMAGE=$(get_app_image_name $APP); BUILD_ENV="" verify_app_name "$APP" diff --git a/plugins/certs/commands b/plugins/certs/commands index b74849cd3..4f96949d7 100755 --- a/plugins/certs/commands +++ b/plugins/certs/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/certs/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/certs/functions" is_tar_import() { [[ -t 0 ]] && return 1 diff --git a/plugins/certs/functions b/plugins/certs/functions index 532087bb1..1e852846b 100755 --- a/plugins/certs/functions +++ b/plugins/certs/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" # returns 'global', 'app', 'false' # if both are configured, app trumps global diff --git a/plugins/checks/check-deploy b/plugins/checks/check-deploy index 3b8ab3c9a..1cb990bb2 100755 --- a/plugins/checks/check-deploy +++ b/plugins/checks/check-deploy @@ -35,8 +35,8 @@ # set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/config/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" APP="$1"; DOKKU_APP_CONTAINER_ID="$2"; DOKKU_APP_CONTAINER_TYPE="$3"; DOKKU_APP_LISTEN_PORT="$4"; DOKKU_APP_LISTEN_IP="$5" if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then diff --git a/plugins/config/commands b/plugins/config/commands index 96955ae2b..f42f3e2d6 100755 --- a/plugins/config/commands +++ b/plugins/config/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/config/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" case "$1" in config) diff --git a/plugins/config/docker-args-deploy b/plugins/config/docker-args-deploy index 2348d820a..6d7b161c4 100755 --- a/plugins/config/docker-args-deploy +++ b/plugins/config/docker-args-deploy @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/config/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" STDIN=$(cat); APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE" diff --git a/plugins/config/functions b/plugins/config/functions index dd69b50bb..51debd179 100644 --- a/plugins/config/functions +++ b/plugins/config/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" config_export() { local CONFIG_TYPE="$1" diff --git a/plugins/docker-options/commands b/plugins/docker-options/commands index ac4069fb8..e2e434de7 100755 --- a/plugins/docker-options/commands +++ b/plugins/docker-options/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" PHASES=(build deploy run) diff --git a/plugins/domains/commands b/plugins/domains/commands index f6863c60f..4156e423b 100755 --- a/plugins/domains/commands +++ b/plugins/domains/commands @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/config/functions" -source "$PLUGIN_PATH/available/domains/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/domains/functions" RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}" diff --git a/plugins/domains/functions b/plugins/domains/functions index 74c1a6ea1..2a69c42a0 100755 --- a/plugins/domains/functions +++ b/plugins/domains/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" get_app_domains() { local APP=$1; verify_app_name $APP diff --git a/plugins/enter/commands b/plugins/enter/commands index 1dcceaf3d..b8e0bdbdc 100755 --- a/plugins/enter/commands +++ b/plugins/enter/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" case "$1" in enter) diff --git a/plugins/git/commands b/plugins/git/commands index ced23cef3..910df652d 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" git_build_app_repo() { verify_app_name "$1" diff --git a/plugins/git/receive-app b/plugins/git/receive-app index da534d709..79dbfeae6 100755 --- a/plugins/git/receive-app +++ b/plugins/git/receive-app @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; REV="$2" diff --git a/plugins/nginx-vhosts/bind-external-ip b/plugins/nginx-vhosts/bind-external-ip index 01f1f57b1..2fca6e4a5 100755 --- a/plugins/nginx-vhosts/bind-external-ip +++ b/plugins/nginx-vhosts/bind-external-ip @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/config/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" APP="$1" NO_VHOST=$(config_get $APP NO_VHOST || true) diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 21b14b985..7c0711287 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -1,9 +1,9 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/certs/functions" -source "$PLUGIN_PATH/available/config/functions" -source "$PLUGIN_PATH/available/domains/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/certs/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/domains/functions" validate_nginx () { set +e diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index e29efb5c2..6d6a2325e 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/config/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" APP="$1" if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then diff --git a/plugins/nginx-vhosts/post-domains-update b/plugins/nginx-vhosts/post-domains-update index edb88b6f8..20abd9d5e 100755 --- a/plugins/nginx-vhosts/post-domains-update +++ b/plugins/nginx-vhosts/post-domains-update @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1" diff --git a/plugins/plugin/commands b/plugins/plugin/commands index 213111c8e..8541d9294 100755 --- a/plugins/plugin/commands +++ b/plugins/plugin/commands @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/plugin/functions" case "$1" in plugin) @@ -8,10 +9,20 @@ case "$1" in ;; plugin:install) - if [[ $2 == "--core" ]]; then - export PLUGIN_PATH="$PLUGIN_CORE_PATH" - fi - plugn trigger install + case "$2" in + --core) + [[ "$#" -gt 2 ]] && dokku_log_info1_quiet "Cannot install additional core plugins, running core plugin install trigger" + PLUGIN_PATH="$PLUGIN_CORE_PATH" plugn trigger install + ;; + https:*|git:*) + PLUGIN_GIT_URL="$2" + download_and_enable_plugin $PLUGIN_GIT_URL + plugn trigger install + ;; + *) + plugn trigger install + ;; + esac ;; plugin:install-dependencies) @@ -22,34 +33,45 @@ case "$1" in ;; plugin:update) - plugn trigger update + case "$2" in + https:*|git:*) + PLUGIN_GIT_URL="$2" + download_and_enable_plugin $PLUGIN_GIT_URL + plugn trigger update + ;; + *) + plugn trigger update + ;; + esac ;; - plugins:disable) + plugin:disable) + [[ -z $2 ]] && dokku_log_fail "Please specify a plugin to disable" PLUGIN="$2" - [[ -e $PLUGIN_CORE_PATH/$PLUGIN ]] && echo "Cannot disable a core plugin" && exit 1 - [[ -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin already disabled" && exit 1 - [[ ! -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 - mv "$PLUGIN_PATH/$PLUGIN" "$PLUGIN_DISABLED_PATH" - echo "Plugin $PLUGIN disabled" + disable_plugin "$PLUGIN" ;; - plugins:enable) + plugin:enable) + [[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable" PLUGIN="$2" - [[ -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin already enabled" && exit 1 - [[ ! -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 - mv "$PLUGIN_DISABLED_PATH/$PLUGIN" "$PLUGIN_PATH" - echo "Plugin $PLUGIN enabled" + enable_plugin "$PLUGIN" ;; - help | ps:help) + plugin:uninstall) + [[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable" + PLUGIN="$2" + uninstall_plugin "$PLUGIN" + ;; + + help | plugin:help) cat<, Enable a previously disabled plugin plugin:disable , Disable an installed plugin (third-party only) + plugin:uninstall , Uninstall a plugin (third-party only) EOF ;; diff --git a/plugins/plugin/functions b/plugins/plugin/functions new file mode 100755 index 000000000..a30c6dcc7 --- /dev/null +++ b/plugins/plugin/functions @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" + +disable_plugin() { + local PLUGIN="$1" + [[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot disable a core plugin" + [[ ! -e $PLUGIN_ENABLED_PATH/$PLUGIN ]] && dokku_log_fail "Plugin already disabled" + [[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist" + plugn disable $PLUGIN + dokku_log_info1_quiet "Plugin $PLUGIN disabled" +} + +enable_plugin() { + local PLUGIN="$1" + [[ -e $PLUGIN_ENABLED_PATH/$PLUGIN ]] && dokku_log_fail "Plugin already enabled" + [[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist" + plugn enable $PLUGIN + dokku_log_info1_quiet "Plugin $PLUGIN enabled" +} + +download_plugin() { + local PLUGIN_GIT_URL="$1" + plugn install $PLUGIN_GIT_URL +} + +download_and_enable_plugin() { + local PLUGIN_GIT_URL="$1" + local PLUGIN_NAME=$(echo $PLUGIN_GIT_URL | awk -F '/' '{ print $NF }' | sed -e "s:.git::g") + dokku_log_info1_quiet "Cloning plugin repo $PLUGIN_GIT_URL to $PLUGIN_AVAILABLE_PATH/$PLUGIN_NAME" + download_plugin $PLUGIN_GIT_URL + enable_plugin $PLUGIN_NAME +} + +uninstall_plugin() { + local PLUGIN_NAME="$1" + [[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot uninstall a core plugin" + [[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist" + plugn uninstall $PLUGIN_NAME + dokku_log_info1_quiet "Plugin $PLUGIN uninstalled" +} diff --git a/plugins/ps/commands b/plugins/ps/commands index cdf045996..37a052783 100755 --- a/plugins/ps/commands +++ b/plugins/ps/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/ps/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions" case "$1" in ps) diff --git a/plugins/ps/functions b/plugins/ps/functions index b0e3a1091..64f667210 100755 --- a/plugins/ps/functions +++ b/plugins/ps/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" print_dokku_scale_file() { local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE" diff --git a/plugins/ps/pre-deploy b/plugins/ps/pre-deploy index d80691134..ea0d574bd 100755 --- a/plugins/ps/pre-deploy +++ b/plugins/ps/pre-deploy @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/ps/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions" APP="$1" diff --git a/plugins/tags/commands b/plugins/tags/commands index c787840b1..c255f25bd 100755 --- a/plugins/tags/commands +++ b/plugins/tags/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" -source "$PLUGIN_PATH/available/tags/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/tags/functions" case "$1" in tags) diff --git a/plugins/tags/functions b/plugins/tags/functions index 155e2778f..df1721dfd 100755 --- a/plugins/tags/functions +++ b/plugins/tags/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" tag_image() { docker tag -f "$1" "$2" diff --git a/plugins/tar/commands b/plugins/tar/commands index 902157ef6..76da3766f 100755 --- a/plugins/tar/commands +++ b/plugins/tar/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" case "$1" in tar-from|tar:from) diff --git a/plugins/tar/receive-app b/plugins/tar/receive-app index 57b05857b..e84dc3dba 100755 --- a/plugins/tar/receive-app +++ b/plugins/tar/receive-app @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; REV="$2" diff --git a/tests/unit/core_ports.bats b/tests/unit/core_ports.bats index fbfa297e8..79f6c1b95 100644 --- a/tests/unit/core_ports.bats +++ b/tests/unit/core_ports.bats @@ -165,7 +165,7 @@ check_urls() { } @test "(core) port exposure (dockerfile raw port)" { - source "$PLUGIN_PATH/available/common/functions" + source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" cat< $DOCKERFILE EXPOSE 3001/udp EXPOSE 3003 @@ -178,7 +178,7 @@ EOF } @test "(core) port exposure (dockerfile tcp port)" { - source "$PLUGIN_PATH/available/common/functions" + source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" cat< $DOCKERFILE EXPOSE 3001/udp EXPOSE 3000/tcp diff --git a/tests/unit/plugin.bats b/tests/unit/plugin.bats new file mode 100644 index 000000000..dfa0a849d --- /dev/null +++ b/tests/unit/plugin.bats @@ -0,0 +1,45 @@ +#!/usr/bin/env bats + +load test_helper +TEST_PLUGIN_NAME=smoke-test-plugin +TEST_PLUGIN_GIT_REPO=https://github.com/dokku/${TEST_PLUGIN_NAME}.git + +remove_test_plugin() { + rm -rf $PLUGIN_ENABLED_PATH/$TEST_PLUGIN_NAME $PLUGIN_AVAILABLE_PATH/$TEST_PLUGIN_NAME +} + +teardown() { + remove_test_plugin || true +} + +@test "(plugin) plugin:install, plugin:disable, plugin:uninstall" { + run bash -c "dokku plugin:install $TEST_PLUGIN_GIT_REPO" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku plugin | grep enabled | grep $TEST_PLUGIN_NAME" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku plugin:disable $TEST_PLUGIN_NAME" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku plugin | grep disabled | grep $TEST_PLUGIN_NAME" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku plugin:uninstall $TEST_PLUGIN_NAME" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku plugin | grep $TEST_PLUGIN_NAME" + echo "output: "$output + echo "status: "$status + assert_failure +} diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index 9bb6c4ae4..a552569dd 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -2,7 +2,12 @@ # constants DOKKU_ROOT=${DOKKU_ROOT:=~dokku} -PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} +DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"} +PLUGIN_PATH=${PLUGIN_PATH:="$DOKKU_LIB_ROOT/plugins"} +PLUGIN_AVAILABLE_PATH=${PLUGIN_AVAILABLE_PATH:="$PLUGIN_PATH/available"} +PLUGIN_ENABLED_PATH=${PLUGIN_ENABLED_PATH:="$PLUGIN_PATH/enabled"} +PLUGIN_CORE_PATH=${PLUGIN_CORE_PATH:="$DOKKU_LIB_ROOT/core-plugins"} +PLUGIN_CORE_AVAILABLE_PATH=${PLUGIN_CORE_AVAILABLE_PATH:="$PLUGIN_CORE_PATH/available"} TEST_APP=my-cool-guy-test-app # test functions From 4bcc9ac05d001fb156d29e1462581a2e7d5c0f32 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 7 Sep 2015 13:41:05 -0400 Subject: [PATCH 27/32] Remove deprecated calls --- plugins/20_events/post-build-buildpack~HEAD | 1 + plugins/20_events/post-build-buildpack~Remove deprecated calls | 1 + plugins/20_events/post-release-buildpack~HEAD | 1 + plugins/20_events/post-release-buildpack~Remove deprecated calls | 1 + plugins/20_events/pre-build-buildpack~HEAD | 1 + plugins/20_events/pre-build-buildpack~Remove deprecated calls | 1 + plugins/20_events/pre-release-buildpack~HEAD | 1 + plugins/20_events/pre-release-buildpack~Remove deprecated calls | 1 + 8 files changed, 8 insertions(+) create mode 120000 plugins/20_events/post-build-buildpack~HEAD create mode 120000 plugins/20_events/post-build-buildpack~Remove deprecated calls create mode 120000 plugins/20_events/post-release-buildpack~HEAD create mode 120000 plugins/20_events/post-release-buildpack~Remove deprecated calls create mode 120000 plugins/20_events/pre-build-buildpack~HEAD create mode 120000 plugins/20_events/pre-build-buildpack~Remove deprecated calls create mode 120000 plugins/20_events/pre-release-buildpack~HEAD create mode 120000 plugins/20_events/pre-release-buildpack~Remove deprecated calls diff --git a/plugins/20_events/post-build-buildpack~HEAD b/plugins/20_events/post-build-buildpack~HEAD new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-build-buildpack~HEAD @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/post-build-buildpack~Remove deprecated calls b/plugins/20_events/post-build-buildpack~Remove deprecated calls new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-build-buildpack~Remove deprecated calls @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/post-release-buildpack~HEAD b/plugins/20_events/post-release-buildpack~HEAD new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-release-buildpack~HEAD @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/post-release-buildpack~Remove deprecated calls b/plugins/20_events/post-release-buildpack~Remove deprecated calls new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/post-release-buildpack~Remove deprecated calls @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/pre-build-buildpack~HEAD b/plugins/20_events/pre-build-buildpack~HEAD new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/pre-build-buildpack~HEAD @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/pre-build-buildpack~Remove deprecated calls b/plugins/20_events/pre-build-buildpack~Remove deprecated calls new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/pre-build-buildpack~Remove deprecated calls @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/pre-release-buildpack~HEAD b/plugins/20_events/pre-release-buildpack~HEAD new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/pre-release-buildpack~HEAD @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/pre-release-buildpack~Remove deprecated calls b/plugins/20_events/pre-release-buildpack~Remove deprecated calls new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/pre-release-buildpack~Remove deprecated calls @@ -0,0 +1 @@ +hook \ No newline at end of file From e8fb585fa818c03e0007add1066d4f96a535c61a Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 8 Sep 2015 08:50:17 -0700 Subject: [PATCH 28/32] rename buildstep hooks to buildpack --- plugins/20_events/post-build-buildpack~HEAD | 1 - plugins/20_events/post-release-buildpack~HEAD | 1 - plugins/20_events/pre-build-buildpack~HEAD | 1 - plugins/20_events/pre-release-buildpack~HEAD | 1 - 4 files changed, 4 deletions(-) delete mode 120000 plugins/20_events/post-build-buildpack~HEAD delete mode 120000 plugins/20_events/post-release-buildpack~HEAD delete mode 120000 plugins/20_events/pre-build-buildpack~HEAD delete mode 120000 plugins/20_events/pre-release-buildpack~HEAD diff --git a/plugins/20_events/post-build-buildpack~HEAD b/plugins/20_events/post-build-buildpack~HEAD deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/post-build-buildpack~HEAD +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/post-release-buildpack~HEAD b/plugins/20_events/post-release-buildpack~HEAD deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/post-release-buildpack~HEAD +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/pre-build-buildpack~HEAD b/plugins/20_events/pre-build-buildpack~HEAD deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/pre-build-buildpack~HEAD +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/pre-release-buildpack~HEAD b/plugins/20_events/pre-release-buildpack~HEAD deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/pre-release-buildpack~HEAD +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file From 5fdd69a65780b7b0784aaf1c94129ef3776d8602 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 8 Sep 2015 11:50:27 -0700 Subject: [PATCH 29/32] remove remnants of bad rebase --- plugins/20_events/post-build-buildpack~Remove deprecated calls | 1 - plugins/20_events/post-release-buildpack~Remove deprecated calls | 1 - plugins/20_events/pre-build-buildpack~Remove deprecated calls | 1 - plugins/20_events/pre-release-buildpack~Remove deprecated calls | 1 - 4 files changed, 4 deletions(-) delete mode 120000 plugins/20_events/post-build-buildpack~Remove deprecated calls delete mode 120000 plugins/20_events/post-release-buildpack~Remove deprecated calls delete mode 120000 plugins/20_events/pre-build-buildpack~Remove deprecated calls delete mode 120000 plugins/20_events/pre-release-buildpack~Remove deprecated calls diff --git a/plugins/20_events/post-build-buildpack~Remove deprecated calls b/plugins/20_events/post-build-buildpack~Remove deprecated calls deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/post-build-buildpack~Remove deprecated calls +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/post-release-buildpack~Remove deprecated calls b/plugins/20_events/post-release-buildpack~Remove deprecated calls deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/post-release-buildpack~Remove deprecated calls +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/pre-build-buildpack~Remove deprecated calls b/plugins/20_events/pre-build-buildpack~Remove deprecated calls deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/pre-build-buildpack~Remove deprecated calls +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file diff --git a/plugins/20_events/pre-release-buildpack~Remove deprecated calls b/plugins/20_events/pre-release-buildpack~Remove deprecated calls deleted file mode 120000 index 5178a749f..000000000 --- a/plugins/20_events/pre-release-buildpack~Remove deprecated calls +++ /dev/null @@ -1 +0,0 @@ -hook \ No newline at end of file From 872fbc130ebc6edc31f4178742d6305e0c938bba Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Thu, 10 Sep 2015 09:48:12 -0700 Subject: [PATCH 30/32] new trigger for failed container retirement --- dokku | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dokku b/dokku index fa1265d8d..3dd1f314c 100755 --- a/dokku +++ b/dokku @@ -192,7 +192,7 @@ case "$1" in # on to the next. docker stop $oldid \ || docker kill $oldid \ - || pluginhook retire-container-failed $APP # Trigger pluginhook for event logging + || plugn trigger retire-container-failed $APP # plugin trigger for event logging done ) & disown -a # Use trap since disown/nohup don't seem to keep child alive From cadba248b6afd543694923fe5db9dbdb97b164e7 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 14 Sep 2015 22:42:40 -0400 Subject: [PATCH 31/32] Fix source paths for common functions [ci skip] --- docs/development/plugin-creation.md | 2 +- docs/development/plugin-triggers.md | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index c3d5fe808..7c5c1a9cf 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -15,7 +15,7 @@ The below plugin is a dummy `dokku hello` plugin. If your plugin exposes command ```shell #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" case "$1" in hello) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 3f5b193b8..1be82393e 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -252,7 +252,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # Installs the graphicsmagick package into the container set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -279,7 +279,7 @@ docker commit $ID $IMAGE > /dev/null # Installs a package specified by the `CONTAINER_PACKAGE` env var set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -305,7 +305,7 @@ docker commit $ID $IMAGE > /dev/null #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -323,7 +323,7 @@ verify_app_name "$APP" #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -343,7 +343,7 @@ verify_app_name "$APP" # `DOKKU_DISABLE_DEPLOY` env var is set to `true` for an app set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/config/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}" @@ -368,7 +368,7 @@ fi # Runs gulp in our container set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -407,7 +407,7 @@ curl "http://httpstat.us/200" # Clears out the gulp asset build cache for applications set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -462,7 +462,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" @@ -480,7 +480,7 @@ verify_app_name "$APP" #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_PATH/available/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) verify_app_name "$APP" From c929edfbe5968735ff4fd9a358dca76bacb57299 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 15 Sep 2015 02:22:08 -0700 Subject: [PATCH 32/32] Source plugins from $PLUGIN_AVAILABLE_PATH when not using common plugin This will allow us to override any core plugin --- docs/development/plugin-triggers.md | 2 +- plugins/00_dokku-standard/commands | 2 +- plugins/build-env/pre-build-buildpack | 2 +- plugins/certs/commands | 2 +- plugins/checks/check-deploy | 2 +- plugins/config/commands | 2 +- plugins/config/docker-args-deploy | 2 +- plugins/domains/commands | 4 ++-- plugins/nginx-vhosts/bind-external-ip | 2 +- plugins/nginx-vhosts/commands | 6 +++--- plugins/nginx-vhosts/post-deploy | 2 +- plugins/plugin/commands | 2 +- plugins/ps/commands | 2 +- plugins/ps/pre-deploy | 2 +- plugins/tags/commands | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 1be82393e..50e7fdb35 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -343,7 +343,7 @@ verify_app_name "$APP" # `DOKKU_DISABLE_DEPLOY` env var is set to `true` for an app set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}" diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 70e9ddc74..66429afad 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" case "$1" in build) diff --git a/plugins/build-env/pre-build-buildpack b/plugins/build-env/pre-build-buildpack index 2ca012bb1..3e83c7b43 100755 --- a/plugins/build-env/pre-build-buildpack +++ b/plugins/build-env/pre-build-buildpack @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" APP="$1"; IMAGE=$(get_app_image_name $APP); BUILD_ENV="" verify_app_name "$APP" diff --git a/plugins/certs/commands b/plugins/certs/commands index 4f96949d7..ba6e62bc0 100755 --- a/plugins/certs/commands +++ b/plugins/certs/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/certs/functions" +source "$PLUGIN_AVAILABLE_PATH/certs/functions" is_tar_import() { [[ -t 0 ]] && return 1 diff --git a/plugins/checks/check-deploy b/plugins/checks/check-deploy index 1cb990bb2..4ff53ad50 100755 --- a/plugins/checks/check-deploy +++ b/plugins/checks/check-deploy @@ -36,7 +36,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" APP="$1"; DOKKU_APP_CONTAINER_ID="$2"; DOKKU_APP_CONTAINER_TYPE="$3"; DOKKU_APP_LISTEN_PORT="$4"; DOKKU_APP_LISTEN_IP="$5" if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then diff --git a/plugins/config/commands b/plugins/config/commands index f42f3e2d6..191af9f52 100755 --- a/plugins/config/commands +++ b/plugins/config/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" case "$1" in config) diff --git a/plugins/config/docker-args-deploy b/plugins/config/docker-args-deploy index 6d7b161c4..51d80f193 100755 --- a/plugins/config/docker-args-deploy +++ b/plugins/config/docker-args-deploy @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" STDIN=$(cat); APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE" diff --git a/plugins/domains/commands b/plugins/domains/commands index 4156e423b..553862634 100755 --- a/plugins/domains/commands +++ b/plugins/domains/commands @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/domains/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/domains/functions" RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}" diff --git a/plugins/nginx-vhosts/bind-external-ip b/plugins/nginx-vhosts/bind-external-ip index 2fca6e4a5..b5f5c01d5 100755 --- a/plugins/nginx-vhosts/bind-external-ip +++ b/plugins/nginx-vhosts/bind-external-ip @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" APP="$1" NO_VHOST=$(config_get $APP NO_VHOST || true) diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 7c0711287..be64d1751 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -1,9 +1,9 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/certs/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/domains/functions" +source "$PLUGIN_AVAILABLE_PATH/certs/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/domains/functions" validate_nginx () { set +e diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index 6d6a2325e..e3fd84430 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" APP="$1" if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then diff --git a/plugins/plugin/commands b/plugins/plugin/commands index 8541d9294..8df025c37 100755 --- a/plugins/plugin/commands +++ b/plugins/plugin/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/plugin/functions" +source "$PLUGIN_AVAILABLE_PATH/plugin/functions" case "$1" in plugin) diff --git a/plugins/ps/commands b/plugins/ps/commands index 37a052783..61b5d25ae 100755 --- a/plugins/ps/commands +++ b/plugins/ps/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions" +source "$PLUGIN_AVAILABLE_PATH/ps/functions" case "$1" in ps) diff --git a/plugins/ps/pre-deploy b/plugins/ps/pre-deploy index ea0d574bd..84f132d89 100755 --- a/plugins/ps/pre-deploy +++ b/plugins/ps/pre-deploy @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions" +source "$PLUGIN_AVAILABLE_PATH/ps/functions" APP="$1" diff --git a/plugins/tags/commands b/plugins/tags/commands index c255f25bd..58061e835 100755 --- a/plugins/tags/commands +++ b/plugins/tags/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/tags/functions" +source "$PLUGIN_AVAILABLE_PATH/tags/functions" case "$1" in tags)