Files
dokku/plugins/openresty-vhosts/core-post-deploy
T
Jose Diaz-Gonzalez 0690a9b655 fix: clean up stale extracted files on deploy
A failed deploy could leave a non-empty extraction directory behind, such as the scheduler-k3s `kustomization` directory, which caused every following deploy to fail. Leftovers from previous deploys are now fully removed, removing a directory such as `config/kustomize` from the repository now removes the stored copy, and openresty includes now persist across restarts.
2026-10-23 14:37:49 -04:00

38 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/openresty-vhosts/internal-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
fn-openresty-vhosts-promote-includes-dir() {
declare desc="moves the process-specific includes dir into place or removes the stored one"
declare APP="$1" INCLUDES_NAME="$2"
local includes_dir="${DOKKU_LIB_ROOT}/data/openresty-vhosts/app-$APP/$INCLUDES_NAME"
if [[ -d "$includes_dir.$DOKKU_PID" ]]; then
rm -rf "$includes_dir"
mv "$includes_dir.$DOKKU_PID" "$includes_dir"
elif [[ -f "$includes_dir.$DOKKU_PID.missing" ]]; then
rm -f "$includes_dir.$DOKKU_PID.missing"
rm -rf "$includes_dir"
fi
}
trigger-openresty-vhosts-core-post-deploy() {
declare desc="openresty-vhosts core-post-deploy plugin trigger"
declare trigger="core-post-deploy"
declare APP="$1"
local tls_internal
fn-openresty-vhosts-promote-includes-dir "$APP" "openresty-http-includes"
fn-openresty-vhosts-promote-includes-dir "$APP" "openresty-location-includes"
if [[ "$(plugn trigger proxy-type "$APP")" != "openresty" ]]; then
return
fi
dokku_log_info1 "Routing app via openresty"
}
trigger-openresty-vhosts-core-post-deploy "$@"