feat: do not clone URLS and VHOST files to new apps
This follows the heroku pattern of ensuring applications are "freshly" created, routing-wise. Closes #2740
This commit is contained in:
@@ -37,7 +37,7 @@ apps_clone_cmd() {
|
||||
|
||||
apps_create "$NEW_APP"
|
||||
pushd "$DOKKU_ROOT/$OLD_APP/." > /dev/null
|
||||
find ./* -not \( -name .cache \) | grep -v -e "./cache" -e "./tls" | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
|
||||
find ./* -not \( -name .cache \) | grep -v "./cache" | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
|
||||
popd > /dev/null 2>&1 || pushd "/tmp" > /dev/null
|
||||
plugn trigger post-app-clone-setup "$OLD_APP" "$NEW_APP"
|
||||
|
||||
@@ -46,8 +46,6 @@ apps_clone_cmd() {
|
||||
fi
|
||||
rm -rf "$NEW_CACHE_DIR"
|
||||
|
||||
[[ -f "$DOKKU_ROOT/$NEW_APP/URLS" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS"
|
||||
[[ -f "$DOKKU_ROOT/$NEW_APP/VHOST" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST"
|
||||
[[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
|
||||
[[ "$SKIP_REBUILD" == "true" ]] || ps_rebuild "$NEW_APP"
|
||||
plugn trigger post-app-clone "$OLD_APP" "$NEW_APP"
|
||||
|
||||
12
plugins/certs/post-app-clone-setup
Executable file
12
plugins/certs/post-app-clone-setup
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
certs_post_app_clone_setup() {
|
||||
declare desc="removes cert file when setting up a clone"
|
||||
declare OLD_APP="$1" NEW_APP="$2"
|
||||
local APP_DIR="$DOKKU_ROOT/$NEW_APP"
|
||||
|
||||
rm -rf "$APP_DIR/tls"
|
||||
}
|
||||
|
||||
certs_post_app_clone_setup "$@"
|
||||
12
plugins/domains/post-app-clone-setup
Executable file
12
plugins/domains/post-app-clone-setup
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
domains_post_app_clone_setup() {
|
||||
declare desc="removes domain files when setting up a clone"
|
||||
declare OLD_APP="$1" NEW_APP="$2"
|
||||
local APP_DIR="$DOKKU_ROOT/$NEW_APP"
|
||||
|
||||
rm -rf "$APP_DIR/URLS" "$APP_DIR/VHOST"
|
||||
}
|
||||
|
||||
domains_post_app_clone_setup "$@"
|
||||
Reference in New Issue
Block a user