chore: remove deprecated tar plugin

This plugin was deprecated in 0.24.0 in favor of git:from-archive. Users should migrate to the new command.
This commit is contained in:
Jose Diaz-Gonzalez
2021-10-09 18:43:53 -04:00
parent aa77638ca7
commit d1a16717b3
18 changed files with 9 additions and 306 deletions

View File

@@ -3,6 +3,7 @@
## Removals
- The `tags` plugin - deprecated in [0.24.0](/docs/appendices/0.24.0-migration-guide.md) - was removed. Users are highly encouraged to switch their workflows to `git:from-image`.
- The `tar` plugin - deprecated in [0.24.0](/docs/appendices/0.24.0-migration-guide.md) - was removed. Users are highly encouraged to switch their workflows to `git:from-archive`.
## Changes

View File

@@ -1,38 +0,0 @@
# Tarball Deployment
> Warning: As of 0.24.0, this functionality is deprecated in favor of the [`git:from-archive`](/docs/deployment/methods/git.md#initializing-an-app-repository-from-an-archive-file) command. It will be removed in a future release, and is considered unmaintained. Users are highly encouraged to switch their workflows to `git:from-archive`.
>
> New as of 0.4.0
```
tar:from <app> <url> # Loads an app tarball from url
tar:in <app> # Reads an tarball containing the app from stdin
```
> When triggering `dokku ps:rebuild APP` on an application deployed via the `tar` plugin, the following may occur:
>
> - Applications previously deployed via another method (`git`): The application may revert to a state before the latest custom image tag was deployed.
> - Applications that were only ever deployed via the `tar` plugin: The application will be properly rebuilt.
>
> Please use the appropriate `tar` command when redeploying an application deployed via tarball.
## Usage
### Deploying from a tarball
In some cases, it may be useful to deploy an application from a tarball. For instance, if you implemented a non-Git based deployment plugin, tarring the generated artifact may be an easier route to interface with the existing Dokku infrastructure.
You can place the tarball on an external webserver and deploy via the `tar:from` command.
```shell
dokku tar:from node-js-app https://dokku.me/releases/node-js-app/v1
```
### Deploying via stdin
As an alternative, a deploy can be trigged from a tarball read from stdin using the `tar:in` command:
```shell
# run from the generated artifact directory
tar c . $* | dokku tar:in node-js-app
```

View File

@@ -346,8 +346,8 @@ curl "http://httpstat.us/200"
> To avoid issues with community plugins, this plugin trigger should be used _only_ for core plugins. Please avoid using this trigger in your own plugins.
- Description: Allows you to modify the contents of an app _after_ it has been extracted from git/tarball but _before_ the image source type is detected.
- Invoked by: `dokku tar:in`, `dokku tar:from` and the `receive-app` plugin trigger
- Description: Allows you to modify the contents of an app _after_ it has been extracted from git but _before_ the image source type is detected.
- Invoked by: The `receive-app` plugin trigger
- Arguments: `$APP` `$TMP_WORK_DIR` `$REV`
- Example:
@@ -1349,8 +1349,8 @@ sudo service haproxy reload
### `post-extract`
- Description: Allows you to modify the contents of an app _after_ it has been extracted from git/tarball but _before_ the image source type is detected.
- Invoked by: `dokku tar:in`, `dokku tar:from` and the `receive-app` plugin trigger
- Description: Allows you to modify the contents of an app _after_ it has been extracted from git but _before_ the image source type is detected.
- Invoked by: The `receive-app` plugin trigger
- Arguments: `$APP` `$TMP_WORK_DIR` `$REV`
- Example:

View File

@@ -71,16 +71,6 @@ new buildpacks that were released:
dokku ps:rebuild --all
```
> If you have any applications deployed via the `tar` commands, do not run the `ps:rebuild --all` command,
> and instead trigger `ps:rebuild` manually for each `git`-deployed application:
>
> ```
> dokku ps:rebuild APP
> ```
>
> Please see the [tar documentation](/docs/deployment/methods/tar.md)
> for instructions on rebuilding applications deployed by those plugins.
## Upgrading using `dokku-update`
We provide a helpful binary called `dokku-update`. This is a recommended package that:

View File

@@ -30,9 +30,6 @@ This command will gather all the running container IDs for your app and call `do
### Rebuilding apps
> Warning: This section applies only to git-based deploys, and only works deterministically for these apps. Please see the [images documentation](/docs/deployment/methods/images.md) and [tar documentation](/docs/deployment/methods/tar.md)
> in for more information concerning rebuilding those apps.
It may be useful to rebuild an app at will, such as for commands that do not rebuild an app or when skipping a rebuild after setting multiple config values. For these use cases, the `ps:rebuild` function can be used.
```shell

View File

@@ -122,7 +122,6 @@
<a href="#" class="list-group-item disabled">Deployment Methods</a>
<a href="/{{NAME}}/deployment/methods/git/" class="list-group-item">Git Deployment</a>
<a href="/{{NAME}}/deployment/methods/tar/" class="list-group-item">Tarfile Deployment</a>
<a href="#" class="list-group-item disabled">Configuration</a>

View File

@@ -22,7 +22,9 @@
"deployment/methods/herokuish-buildpacks": "deployment/builders/herokuish-buildpacks/",
"deployment/images": "deployment/methods/git/#initializing-an-app-repository-from-a-docker-image",
"deployment/tar": "deployment/methods/git/#initializing-an-app-repository-from-an-archive-file",
"deployment/methods/images": "deployment/methods/git/#initializing-an-app-repository-from-a-docker-image",
"deployment/methods/tar": "deployment/methods/git/#initializing-an-app-repository-from-an-archive-file",
"configuration-management": "configuration/environment-variables/",
"deployment/ssl-configuration": "configuration/ssl/",
"nginx": "configuration/nginx/",

View File

@@ -1036,7 +1036,7 @@ merge_dedupe_list() {
}
acquire_app_deploy_lock() {
declare desc="acquire advisory lock for use in git/tar deploys"
declare desc="acquire advisory lock for use in deploys"
local APP="$1"
local LOCK_TYPE="${2:-waiting}"
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
@@ -1047,7 +1047,7 @@ acquire_app_deploy_lock() {
}
release_app_deploy_lock() {
declare desc="release advisory lock used in git/tar deploys"
declare desc="release advisory lock used in deploys"
local APP="$1"
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"

View File

@@ -1,16 +0,0 @@
#!/usr/bin/env bash
[[ " help tar:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/tar/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | tar:help)
cmd-tar-help "$@"
;;
*)
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac

View File

@@ -1,23 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
trigger-tar-deploy-source() {
declare desc="tar deploy-source plugin trigger"
declare trigger="deploy-source"
declare APP="$1"
local STDIN
STDIN=$(cat)
# bail if another source is detected
if [[ -n "$STDIN" ]]; then
echo "$STDIN"
return
fi
if [[ -f "$DOKKU_ROOT/$APP/src.tar" ]]; then
echo "tar"
fi
}
trigger-tar-deploy-source "$@"

View File

@@ -1,90 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
tar_build() {
declare desc="builds apps from tarball via command line"
local APP="$1"
shift 1
# clean up after ourselves
local TAR_BUILD_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
trap "rm -rf '$TAR_BUILD_TMP_WORK_DIR' >/dev/null" RETURN INT TERM EXIT
# extract tar file
chmod 755 "$TAR_BUILD_TMP_WORK_DIR"
pushd "$TAR_BUILD_TMP_WORK_DIR" >/dev/null
# Detect a common prefix that all files in the tar have, and strip off each directory found in it
local COMMON_PREFIX=$(tar -tf "$DOKKU_ROOT/$APP/src.tar" | sed -e 'N;s/^\(.*\).*\n\1.*$/\1\n\1/;D')
local BOGUS_PARTS=$(echo "$COMMON_PREFIX " | awk 'BEGIN{FS="/"} {print NF-1}')
dokku_log_info1_quiet "Striping $BOGUS_PARTS worth of directories from tarball"
tar -x -C "$TAR_BUILD_TMP_WORK_DIR" -f "$DOKKU_ROOT/$APP/src.tar" --strip-components="$BOGUS_PARTS"
chmod -R u+r "$TAR_BUILD_TMP_WORK_DIR"
local DOKKU_APP_DISABLE_ANSI_PREFIX_REMOVAL DOKKU_GLOBAL_DISABLE_ANSI_PREFIX_REMOVAL DOKKU_DISABLE_ANSI_PREFIX_REMOVAL
DOKKU_APP_DISABLE_ANSI_PREFIX_REMOVAL=$(config_get "$APP" DOKKU_DISABLE_ANSI_PREFIX_REMOVAL || true)
DOKKU_GLOBAL_DISABLE_ANSI_PREFIX_REMOVAL=$(config_get --global DOKKU_DISABLE_ANSI_PREFIX_REMOVAL || true)
DOKKU_DISABLE_ANSI_PREFIX_REMOVAL=${DOKKU_APP_DISABLE_ANSI_PREFIX_REMOVAL:="$DOKKU_GLOBAL_DISABLE_ANSI_PREFIX_REMOVAL"}
if [[ "$DOKKU_DISABLE_ANSI_PREFIX_REMOVAL" == "true" ]]; then
tar_trigger_build "$APP" "$TAR_BUILD_TMP_WORK_DIR"
else
tar_trigger_build "$APP" "$TAR_BUILD_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
fi
}
tar_trigger_build() {
declare desc="triggers the actual build process for a given app within a directory at a particular revision"
declare APP="$1" TMP_WORK_DIR="$2" REV="$3"
local BUILDER
plugn trigger core-post-extract "$APP" "$TMP_WORK_DIR" "$REV"
plugn trigger post-extract "$APP" "$TMP_WORK_DIR" "$REV"
BUILDER="$(plugn trigger builder-detect "$APP" "$TMP_WORK_DIR" | head -n1 || true)"
[[ -z "$BUILDER" ]] && BUILDER="herokuish"
plugn trigger pre-receive-app "$APP" "$BUILDER" "$TMP_WORK_DIR" "$REV"
dokku_receive "$APP" "$BUILDER" "$TMP_WORK_DIR"
}
cmd-tar-in() {
declare desc="deploys app from tarball on STDIN via command line"
declare cmd="tar:in"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
tee "$DOKKU_ROOT/$APP/src.tar" | wc -c
tar_receive_app "$APP"
}
cmd-tar-from() {
declare desc="deploys app from tarball at URL via command line"
declare cmd="tar:from"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" URL="$2"
verify_app_name "$APP"
shift 2
curl -# --insecure -L "$URL" | cmd-tar-in "tar:in" "$APP" "$@"
}
tar_receive_app() {
declare desc="tar receive-app plugin trigger"
declare APP="$1"
# Don't trigger tar build if there is no tarball.
if [[ ! -f "$DOKKU_ROOT/$APP/src.tar" ]]; then
true
else
acquire_app_deploy_lock "$APP"
tar_build "$@"
release_app_deploy_lock "$APP"
fi
}

View File

@@ -1,33 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-tar-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="tar"
local plugin_description="Manage app deploys via tar"
if [[ "$CMD" == "${plugin_name}:help" ]]; then
echo -e "Usage: dokku ${plugin_name}[:COMMAND]"
echo ''
echo "$plugin_description"
echo ''
echo 'Additional commands:'
fn-help-content | sort | column -c2 -t -s,
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
fn-help-content
else
cat <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
tar:in <app>, Reads an tarball containing the app from stdin
tar:from <app> <url>, Loads an app tarball from url
help_content
}

View File

@@ -1,4 +0,0 @@
[plugin]
description = "dokku core tar plugin"
version = "0.25.7"
[plugin.config]

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/tar/functions"
tar_receive_app "$@"

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/tar/help-functions"
cmd-tar-help "tar:help"

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/tar/functions"
cmd-tar-from "$@"

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/tar/functions"
cmd-tar-in "$@"

View File

@@ -1,58 +0,0 @@
#!/usr/bin/env bats
load test_helper
setup() {
global_setup
create_app
}
teardown() {
destroy_app
global_teardown
}
deploy_app_tar() {
APP_TYPE="$1"; APP_TYPE=${APP_TYPE:="nodejs-express"}
TMP=$(mktemp -d "/tmp/dokku.me.XXXXX")
rmdir "$TMP" && cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/$APP_TYPE" "$TMP"
pushd "$TMP" &>/dev/null || exit 1
trap 'popd &>/dev/null || true; rm -rf "$TMP"' RETURN INT TERM
shift 1
tar c . $* | ssh dokku@dokku.me tar:in $TEST_APP || destroy_app $?
sleep 5 # nginx needs some time to itself...
}
@test "(tar) tar:help" {
run /bin/bash -c "dokku tar"
echo "output: $output"
echo "status: $status"
assert_output_contains "Manage app deploys via tar"
help_output="$output"
run /bin/bash -c "dokku tar:help"
echo "output: $output"
echo "status: $status"
assert_output_contains "Manage app deploys via tar"
assert_output "$help_output"
}
@test "(tar) non-tarbomb deploy using tar:in" {
deploy_app_tar nodejs-express --transform 's,^,prefix/,'
run /bin/bash -c "response=\"$(curl -s -S ${TEST_APP}.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(tar) tarbomb deploy using tar:in" {
deploy_app_tar nodejs-express
run /bin/bash -c "response=\"$(curl -s -S ${TEST_APP}.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
echo "output: $output"
echo "status: $status"
assert_success
}