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:
Jose Diaz-Gonzalez
2018-12-28 17:07:26 -05:00
parent 51dea4a220
commit 81542ef089
5 changed files with 33 additions and 5 deletions

View File

@@ -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"

View 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 "$@"

View 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 "$@"