refactor: remove need for internal dokku calls
Avoid internal dokku calls will avoid potentially expensive subprocesses - in particular, user-auth will be re-invoked, which can be expensive.
This commit is contained in:
5
docs/appendices/0.23.0-migration-guide.md
Normal file
5
docs/appendices/0.23.0-migration-guide.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# 0.23.0 Migration Guide
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- The `plugin:list` command no longer outputs the version for the `plugn` binary.
|
||||||
@@ -2108,6 +2108,21 @@ DOKKU_SCHEDULER="$1"; APP="$2"; IMAGE_REPO="$3"; IMAGE_TAG="$4";
|
|||||||
# TODO
|
# TODO
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `storage-list`
|
||||||
|
|
||||||
|
- Description: Returns a list of storage mounts
|
||||||
|
- Invoked by: `dokku storage:list` and `dokku deploy`
|
||||||
|
- Arguments: `$APP`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
APP="$1"
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
```
|
||||||
### `tags-create`
|
### `tags-create`
|
||||||
|
|
||||||
- Description: Allows you to run commands once a tag for an app image has been added
|
- Description: Allows you to run commands once a tag for an app image has been added
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ Docker releases updates periodically to their engine. We recommend reading their
|
|||||||
|
|
||||||
Before upgrading, check the migration guides to get comfortable with new features and prepare your deployment to be upgraded.
|
Before upgrading, check the migration guides to get comfortable with new features and prepare your deployment to be upgraded.
|
||||||
|
|
||||||
|
- [Upgrading to 0.23](/docs/appendices/0.23.0-migration-guide.md)
|
||||||
- [Upgrading to 0.22](/docs/appendices/0.22.0-migration-guide.md)
|
- [Upgrading to 0.22](/docs/appendices/0.22.0-migration-guide.md)
|
||||||
- [Upgrading to 0.21](/docs/appendices/0.21.0-migration-guide.md)
|
- [Upgrading to 0.21](/docs/appendices/0.21.0-migration-guide.md)
|
||||||
- [Upgrading to 0.20](/docs/appendices/0.20.0-migration-guide.md)
|
- [Upgrading to 0.20](/docs/appendices/0.20.0-migration-guide.md)
|
||||||
|
|||||||
9
dokku
9
dokku
@@ -240,14 +240,7 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
version | -v | --version)
|
version | -v | --version)
|
||||||
if [[ -f "$DOKKU_LIB_ROOT/STABLE_VERSION" ]]; then
|
dokku_version
|
||||||
DOKKU_VERSION=$(cat "${DOKKU_LIB_ROOT}/STABLE_VERSION")
|
|
||||||
elif [[ -f "$DOKKU_LIB_ROOT/VERSION" ]]; then
|
|
||||||
DOKKU_VERSION=$(cat "${DOKKU_LIB_ROOT}/VERSION")
|
|
||||||
else
|
|
||||||
dokku_log_fail "Unable to determine dokku's version"
|
|
||||||
fi
|
|
||||||
echo "dokku version ${DOKKU_VERSION}"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ cmd-report() {
|
|||||||
dokku_log_info1 "sigil version: $(sigil -v)"
|
dokku_log_info1 "sigil version: $(sigil -v)"
|
||||||
dokku_log_info1 "herokuish version: "
|
dokku_log_info1 "herokuish version: "
|
||||||
"$DOCKER_BIN" container run $DOKKU_GLOBAL_RUN_ARGS --rm "$DOKKU_IMAGE" herokuish version | sed "s/^/ /"
|
"$DOCKER_BIN" container run $DOKKU_GLOBAL_RUN_ARGS --rm "$DOKKU_IMAGE" herokuish version | sed "s/^/ /"
|
||||||
dokku_log_info1 "dokku version: $(dokku version)"
|
dokku_log_info1 "dokku version: $(dokku_version)"
|
||||||
|
dokku_log_info1 "plugn version: $(plugn version)"
|
||||||
dokku_log_info1 "dokku plugins: "
|
dokku_log_info1 "dokku plugins: "
|
||||||
dokku plugin:list | sed "s/^/ /"
|
plugn list | sed "s/^/ /"
|
||||||
|
|
||||||
if [[ "$APP" == "--all" ]]; then
|
if [[ "$APP" == "--all" ]]; then
|
||||||
for app in $(dokku_apps); do
|
for app in $(dokku_apps); do
|
||||||
|
|||||||
1
plugins/20_events/storage-list
Symbolic link
1
plugins/20_events/storage-list
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
hook
|
||||||
@@ -17,6 +17,17 @@ dokku_apps() {
|
|||||||
[[ $INSTALLED_APPS ]] && echo "$INSTALLED_APPS"
|
[[ $INSTALLED_APPS ]] && echo "$INSTALLED_APPS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dokku_version() {
|
||||||
|
if [[ -f "$DOKKU_LIB_ROOT/STABLE_VERSION" ]]; then
|
||||||
|
DOKKU_VERSION=$(cat "${DOKKU_LIB_ROOT}/STABLE_VERSION")
|
||||||
|
elif [[ -f "$DOKKU_LIB_ROOT/VERSION" ]]; then
|
||||||
|
DOKKU_VERSION=$(cat "${DOKKU_LIB_ROOT}/VERSION")
|
||||||
|
else
|
||||||
|
dokku_log_fail "Unable to determine dokku's version"
|
||||||
|
fi
|
||||||
|
echo "dokku version ${DOKKU_VERSION}"
|
||||||
|
}
|
||||||
|
|
||||||
dokku_log_quiet() {
|
dokku_log_quiet() {
|
||||||
declare desc="log quiet formatter"
|
declare desc="log quiet formatter"
|
||||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ cmd-plugin-list() {
|
|||||||
declare cmd="plugin"
|
declare cmd="plugin"
|
||||||
[[ "$1" == "$cmd" ]] && shift 1
|
[[ "$1" == "$cmd" ]] && shift 1
|
||||||
|
|
||||||
plugn version
|
|
||||||
plugn list
|
plugn list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ scheduler-docker-local-pre-deploy-chown-app() {
|
|||||||
DOKKU_APP_TYPE=$(config_get "$APP" DOKKU_APP_TYPE || true)
|
DOKKU_APP_TYPE=$(config_get "$APP" DOKKU_APP_TYPE || true)
|
||||||
DOKKU_APP_USER=$(config_get "$APP" DOKKU_APP_USER || true)
|
DOKKU_APP_USER=$(config_get "$APP" DOKKU_APP_USER || true)
|
||||||
DOKKU_APP_USER=${DOKKU_APP_USER:="herokuishuser"}
|
DOKKU_APP_USER=${DOKKU_APP_USER:="herokuishuser"}
|
||||||
APP_PATHS=$(dokku --quiet storage:list "$APP" || true)
|
APP_PATHS=$(plugn trigger storage-list "$APP" "deploy")
|
||||||
|
|
||||||
if [[ -n "$APP_PATHS" ]]; then
|
if [[ -n "$APP_PATHS" ]]; then
|
||||||
CONTAINER_PATHS=$(echo "$APP_PATHS" | awk -F ':' '{ print $2 }' | xargs)
|
CONTAINER_PATHS=$(echo "$APP_PATHS" | awk -F ':' '{ print $2 }' | xargs)
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ cmd-storage-list() {
|
|||||||
declare cmd="storage:list"
|
declare cmd="storage:list"
|
||||||
[[ "$1" == "$cmd" ]] && shift 1
|
[[ "$1" == "$cmd" ]] && shift 1
|
||||||
declare APP="$1"
|
declare APP="$1"
|
||||||
local passed_phases="deploy"
|
local phase="deploy"
|
||||||
|
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
dokku_log_quiet "$APP volume bind-mounts:"
|
dokku_log_quiet "$APP volume bind-mounts:"
|
||||||
get_bind_mounts "$(get_phase_file_path "$passed_phases")"
|
plugn trigger storage-list "$APP" "$phase"
|
||||||
}
|
}
|
||||||
|
|||||||
15
plugins/storage/storage-list
Executable file
15
plugins/storage/storage-list
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/storage/functions"
|
||||||
|
|
||||||
|
trigger-storage-storage-list() {
|
||||||
|
declare desc="storage storage-list trigger"
|
||||||
|
declare trigger="storage-list"
|
||||||
|
declare APP="$1" PHASE="$2"
|
||||||
|
|
||||||
|
get_bind_mounts "$(fn-get-phase-file-path "$APP" "$PHASE")"
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger-storage-storage-list "$@"
|
||||||
Reference in New Issue
Block a user