From 9eab17af116a7030d30a18a59713702f7db53b90 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 1 Dec 2022 21:47:59 -0500 Subject: [PATCH] refactor: setup app domains in the post-create hook This is more consistent with app setup, at the cost of making it so developers must disable domains manually afterwards. --- docs/appendices/0.29.0-migration-guide.md | 1 + docs/development/plugin-triggers.md | 15 --------------- plugins/caddy-vhosts/docker-args-process-deploy | 3 --- plugins/domains/{domains-setup => post-create} | 8 ++++---- plugins/nginx-vhosts/proxy-build-config | 1 - plugins/traefik-vhosts/docker-args-process-deploy | 3 --- 6 files changed, 5 insertions(+), 26 deletions(-) rename plugins/domains/{domains-setup => post-create} (74%) diff --git a/docs/appendices/0.29.0-migration-guide.md b/docs/appendices/0.29.0-migration-guide.md index ee8cb8578..0dc3d4ffe 100644 --- a/docs/appendices/0.29.0-migration-guide.md +++ b/docs/appendices/0.29.0-migration-guide.md @@ -12,3 +12,4 @@ - The `DOKKU_WAIT_TO_RETIRE` environment variable has been migrated to a `checks` property named `wait-to-retire` and will be ignored if set as an environment variable. - The `Procfile` is now extracted when source code is extracted for a build and not from the built image. Users can specify alternative paths via the `procfile-path` property of the `ps` plugin. See the [process management documentation](/docs/processes/process-management.md#changing-the-procfile-location) for more information on how to configure the `Procfile` path for your application. +- The `domains-setup` trigger has been removed. Initial app domains will now be automatically setup during app creation. diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index eca55a663..743ffcc6a 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -713,21 +713,6 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # TODO ``` -### `domains-setup` - -- Description: Initializes domains for an app if enabled -- Invoked by: -- Arguments: `$APP` -- Example: - -```shell -#!/usr/bin/env bash - -set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x - -# TODO -``` - ### `domains-vhost-enabled` - Description: Checks if a virtual hosts are enabled for an app diff --git a/plugins/caddy-vhosts/docker-args-process-deploy b/plugins/caddy-vhosts/docker-args-process-deploy index 7272a741c..60a4c232e 100755 --- a/plugins/caddy-vhosts/docker-args-process-deploy +++ b/plugins/caddy-vhosts/docker-args-process-deploy @@ -30,9 +30,6 @@ trigger-caddy-vhosts-docker-args-process-deploy() { return fi - # run this silently or the output will be set as a label - plugn trigger domains-setup "$APP" >/dev/null - # ensure we have a port mapping plugn trigger proxy-configure-ports "$APP" diff --git a/plugins/domains/domains-setup b/plugins/domains/post-create similarity index 74% rename from plugins/domains/domains-setup rename to plugins/domains/post-create index 1ace670ce..9ba77db67 100755 --- a/plugins/domains/domains-setup +++ b/plugins/domains/post-create @@ -3,17 +3,17 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions" set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -trigger-domains-domains-setup() { +trigger-domains-post-create() { declare desc="creates vhost files as necessary" - declare trigger="domains-setup" + declare trigger="post-create" declare APP="$1" if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then - dokku_log_info1 "App virtual host support disabled, skipping domains setup" + dokku_log_info1 "App virtual host support disabled, skipping domain setup" return fi domains_setup "$APP" } -trigger-domains-domains-setup "$@" +trigger-domains-post-create "$@" diff --git a/plugins/nginx-vhosts/proxy-build-config b/plugins/nginx-vhosts/proxy-build-config index 4e85e32ca..c9c330e6c 100755 --- a/plugins/nginx-vhosts/proxy-build-config +++ b/plugins/nginx-vhosts/proxy-build-config @@ -16,7 +16,6 @@ trigger-nginx-vhosts-proxy-build-config() { HAS_NETWORK_CONFIG="$(plugn trigger network-config-exists "$APP")" if [[ "$HAS_NETWORK_CONFIG" == "true" ]]; then - plugn trigger domains-setup "$APP" plugn trigger network-build-config "$APP" nginx_build_config "$APP" if [[ -f "${DOKKU_LIB_ROOT}/data/nginx-vhosts/app-$APP/nginx.conf.sigil.$DOKKU_PID" ]]; then diff --git a/plugins/traefik-vhosts/docker-args-process-deploy b/plugins/traefik-vhosts/docker-args-process-deploy index 83e7d1da5..7eb3d2b47 100755 --- a/plugins/traefik-vhosts/docker-args-process-deploy +++ b/plugins/traefik-vhosts/docker-args-process-deploy @@ -30,9 +30,6 @@ trigger-traefik-vhosts-docker-args-process-deploy() { return fi - # run this silently or the output will be set as a label - plugn trigger domains-setup "$APP" >/dev/null - # ensure we have a port mapping plugn trigger proxy-configure-ports "$APP"