mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Merge pull request #3280 from dokku/better-scheduler-support
Better scheduler support
This commit is contained in:
@@ -173,6 +173,7 @@ install-dokku-from-deb-package() {
|
||||
[[ -n $DOKKU_HOSTNAME ]] && echo "dokku dokku/hostname string $DOKKU_HOSTNAME" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_SKIP_KEY_FILE ]] && echo "dokku dokku/skip_key_file boolean $DOKKU_SKIP_KEY_FILE" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_KEY_FILE ]] && echo "dokku dokku/key_file string $DOKKU_KEY_FILE" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_NGINX_ENABLE ]] && echo "dokku dokku/nginx_enable string $DOKKU_NGINX_ENABLE" | sudo debconf-set-selections
|
||||
|
||||
if [[ -n $DOKKU_CHECKOUT ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
|
||||
@@ -120,6 +120,7 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
proc.stdin.close()
|
||||
proc.wait()
|
||||
|
||||
set_debconf_selection('boolean', 'nginx_enable', 'true')
|
||||
set_debconf_selection('boolean', 'skip_key_file', 'true')
|
||||
set_debconf_selection('boolean', 'vhost_enable', vhost_enable)
|
||||
set_debconf_selection('boolean', 'web_config', 'false')
|
||||
|
||||
1
debian/config
vendored
1
debian/config
vendored
@@ -17,6 +17,7 @@ if [ $RET = "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
db_input "high" "dokku/nginx_enable" || true
|
||||
db_input "high" "dokku/hostname" || true
|
||||
db_input "high" "dokku/vhost_enable" || true
|
||||
if [ "$ACTION" != "reconfigure" ]; then
|
||||
|
||||
6
debian/postinst
vendored
6
debian/postinst
vendored
@@ -59,9 +59,13 @@ case "$1" in
|
||||
fi
|
||||
done
|
||||
|
||||
db_get "dokku/nginx_enable"
|
||||
echo "Enabling all core plugins"
|
||||
find ${DOKKU_LIB_ROOT}/core-plugins/available -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do
|
||||
if [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then
|
||||
if [ "$plugin" = "nginx-vhosts" ] && [ "$RET" = "false" ]; then
|
||||
echo "Skipping enable of nginx-vhosts plugin"
|
||||
continue
|
||||
elif [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then
|
||||
ln -s ${DOKKU_LIB_ROOT}/core-plugins/available/$plugin ${DOKKU_LIB_ROOT}/plugins/available/$plugin;
|
||||
PLUGIN_PATH=${DOKKU_LIB_ROOT}/core-plugins plugn enable $plugin
|
||||
PLUGIN_PATH=${DOKKU_LIB_ROOT}/plugins plugn enable $plugin
|
||||
|
||||
5
debian/postrm
vendored
5
debian/postrm
vendored
@@ -21,7 +21,10 @@ main() {
|
||||
rm -f /etc/systemd/system/dokku-redeploy.service
|
||||
rm -f /etc/update-motd.d/99-dokku
|
||||
|
||||
(nginx -t && service nginx reload) || true
|
||||
db_get "dokku/nginx_enable"
|
||||
if [ "$RET" = "true" ]; then
|
||||
(nginx -t && service nginx reload) || true
|
||||
fi
|
||||
|
||||
if [[ "$1" == "purge" ]]; then
|
||||
rm -f /etc/nginx/conf.d/dokku.conf
|
||||
|
||||
5
debian/templates
vendored
5
debian/templates
vendored
@@ -22,3 +22,8 @@ Template: dokku/key_file
|
||||
Description: Keyfile for initial user:
|
||||
Type: string
|
||||
Default: /root/.ssh/id_rsa.pub
|
||||
|
||||
Template: dokku/nginx_enable
|
||||
Description: Enable nginx-vhosts plugin?
|
||||
Type: boolean
|
||||
Default: true
|
||||
|
||||
@@ -41,3 +41,4 @@ After setting the desired options, proceed with the installation as described ab
|
||||
| dokku/hostname | string | dokku.me | Hostname, used as vhost domain and for showing app URL after deploy |
|
||||
| dokku/skip_key_file| boolean | false | Don't check for the existence of the dokku/key_file. Warning: Setting this to true, will require you to manually add an SSH key later on. |
|
||||
| dokku/key_file | string | /root/.ssh/id_rsa.pub | Path on disk to an SSH key to add to the Dokku user (Will be ignored on `dpkg-reconfigure`) |
|
||||
| dokku/nginx_enable | boolean | true | Enable nginx-vhosts plugin |
|
||||
|
||||
@@ -9,7 +9,7 @@ dokku_run_cmd() {
|
||||
verify_app_name "$APP"
|
||||
shift 2
|
||||
|
||||
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger scheduler-run "$DOKKU_SCHEDULER" "$APP" "$@"
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ apps_destroy() {
|
||||
echo "Destroying $APP (including all add-ons)"
|
||||
plugn trigger pre-delete "$APP" "$IMAGE_TAG"
|
||||
|
||||
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
local REMOVE_CONTAINERS="true"
|
||||
plugn trigger scheduler-stop "$DOKKU_SCHEDULER" "$APP" "$REMOVE_CONTAINERS"
|
||||
plugn trigger post-delete "$APP" "$IMAGE_TAG"
|
||||
@@ -63,4 +63,4 @@ apps_maybe_create() {
|
||||
suppress_output apps_create "$APP"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,6 +221,22 @@ get_app_image_name() {
|
||||
echo "$IMAGE"
|
||||
}
|
||||
|
||||
get_app_scheduler() {
|
||||
declare desc="fetch the scheduler for a given application"
|
||||
declare APP="$1"
|
||||
local DOKKU_SCHEDULER
|
||||
|
||||
DOKKU_APP_SCHEDULER="$(config_get "$APP" DOKKU_SCHEDULER || true)"
|
||||
DOKKU_GLOBAL_SCHEDULER="$(config_get --global DOKKU_SCHEDULER || true)"
|
||||
|
||||
DOKKU_SCHEDULER=${DOKKU_APP_SCHEDULER:="$DOKKU_GLOBAL_SCHEDULER"}
|
||||
if [[ -z "$DOKKU_SCHEDULER" ]]; then
|
||||
DOKKU_SCHEDULER="docker-local"
|
||||
fi
|
||||
|
||||
echo "$DOKKU_SCHEDULER"
|
||||
}
|
||||
|
||||
get_running_image_tag() {
|
||||
declare desc="retrieve current image tag for a given app. returns empty string if no deployed containers are found"
|
||||
local APP="$1"
|
||||
@@ -559,7 +575,7 @@ dokku_deploy_cmd() {
|
||||
declare APP="$1" IMAGE_TAG="$2"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger scheduler-deploy "$DOKKU_SCHEDULER" "$APP" "$IMAGE_TAG"
|
||||
}
|
||||
|
||||
@@ -633,8 +649,7 @@ docker_cleanup() {
|
||||
fi
|
||||
|
||||
dokku_log_info1 "Cleaning up..."
|
||||
local DOKKU_SCHEDULER="docker-local"
|
||||
[[ -n "$APP" ]] && DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger scheduler-docker-cleanup "$DOKKU_SCHEDULER" "$APP" "$FORCE_CLEANUP"
|
||||
|
||||
# delete all non-running containers
|
||||
|
||||
@@ -26,7 +26,7 @@ fn-logs-failed-single() {
|
||||
local DOKKU_SCHEDULER
|
||||
|
||||
dokku_log_info2_quiet "${APP} failed deploy logs"
|
||||
DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger scheduler-logs-failed "$DOKKU_SCHEDULER" "$APP"
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ ps_stop() {
|
||||
! (is_deployed "$APP") && dokku_log_warn "App $APP has not been deployed" && exit 0
|
||||
|
||||
dokku_log_quiet "Stopping $APP ..."
|
||||
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger scheduler-stop "$DOKKU_SCHEDULER" "$APP"
|
||||
plugn trigger post-stop "$APP"
|
||||
}
|
||||
@@ -208,4 +208,4 @@ fn-ps-is-app-running() {
|
||||
declare APP="$1"
|
||||
APP_STATUS=$(fn-ps-app-status "$APP")
|
||||
echo "$APP_STATUS" | cut -d ' ' -f 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,7 @@ ps_restore_cmd() {
|
||||
local APP="$2"
|
||||
local DOKKU_SCHEDULER
|
||||
|
||||
DOKKU_SCHEDULER=$(config_get --global DOKKU_SCHEDULER || echo "docker-local")
|
||||
if [[ -n "$APP" ]]; then
|
||||
DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
fi
|
||||
|
||||
DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger pre-restore "$DOKKU_SCHEDULER"
|
||||
|
||||
if [[ -n "$APP" ]]; then
|
||||
|
||||
@@ -43,7 +43,7 @@ scheduler-docker-local-check-deploy() {
|
||||
local trigger="scheduler-docker-local-check-deploy"
|
||||
local APP="$1"; local DOKKU_APP_CONTAINER_ID="$2"; local DOKKU_APP_CONTAINER_TYPE="$3"; local DOKKU_APP_LISTEN_PORT="$4"; local DOKKU_APP_LISTEN_IP="$5"
|
||||
|
||||
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -9,7 +9,7 @@ scheduler-docker-local-core-post-deploy() {
|
||||
declare APP="$1";
|
||||
local APP_ROOT="$DOKKU_ROOT/$APP"
|
||||
|
||||
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -8,7 +8,7 @@ scheduler-docker-local-post-delete() {
|
||||
declare trigger="scheduler-docker-local post-delete"
|
||||
declare APP="$1"
|
||||
|
||||
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -11,7 +11,7 @@ scheduler-docker-local-pre-deploy() {
|
||||
local IMAGE DISABLE_CHOWN DOCKER_ARGS DOKKU_APP_TYPE DOKKU_APP_USER APP_PATHS CONTAINER_PATHS
|
||||
declare -a ARG_ARRAY
|
||||
|
||||
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -10,7 +10,7 @@ tags_create_cmd() {
|
||||
local APP="$2"; local IMAGE_TAG="$3"; local IMAGE_REPO=$(get_app_image_repo "$APP")
|
||||
verify_app_name "$APP"
|
||||
|
||||
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger scheduler-tags-create "$DOKKU_SCHEDULER" "$APP" "$IMAGE_REPO:latest" "$IMAGE_REPO:$IMAGE_TAG"
|
||||
|
||||
dokku_log_info2_quiet "Added $IMAGE_TAG tag to $IMAGE_REPO"
|
||||
|
||||
@@ -16,7 +16,7 @@ tags_destroy_cmd() {
|
||||
;;
|
||||
|
||||
*)
|
||||
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger scheduler-tags-destroy "$DOKKU_SCHEDULER" "$APP" "$IMAGE_REPO" "$IMAGE_TAG"
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user