From aa345fad010528098a8b72b33a35d96d5b0ff9db Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Mon, 20 Jun 2016 11:39:08 -0700 Subject: [PATCH] revert automatically binding storage mounts in build phase. closes #2254 --- docs/dokku-storage.md | 9 +++++++++ plugins/storage/subcommands/mount | 2 +- plugins/storage/subcommands/unmount | 2 +- tests/unit/20_storage.bats | 15 --------------- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/docs/dokku-storage.md b/docs/dokku-storage.md index c36be4b49..52c8dea75 100644 --- a/docs/dokku-storage.md +++ b/docs/dokku-storage.md @@ -41,6 +41,15 @@ Your app may be used in a cluster that requires containers or resources not runn Your app may have services that are running in memory and need to be backed up locally (like a key store). Mount a non ephemeral storage mount will allow backups that are not lost when the app is shut down. +### Build phase + +By default, dokku will only bind storage mounts during the deploy and run phases. Under certain conditions, one might want to bind a storage mount during the build phase. This can be accomplished by using the `docker-options` plugin directly. +``` +$ dokku docker-options:add "-v /tmp/python-test:/opt/test" +``` + +NOTE: **This can cause data loss** if you bind a mount under `/app` in buildpack apps as herokuish will attempt to remove the original app path during the build phase. + ## Docker-Options Note The storage plugins is compatible with storage mounts created with the docker-options. The storage plugin will only list mounts from the deploy phase. diff --git a/plugins/storage/subcommands/mount b/plugins/storage/subcommands/mount index b078fe4e6..b82a550cb 100755 --- a/plugins/storage/subcommands/mount +++ b/plugins/storage/subcommands/mount @@ -7,7 +7,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" storage_mount_cmd() { declare desc="Add bind-mount, redeploy app if running" local cmd="storage:mount" - local passed_phases=(build deploy run) + local passed_phases=(deploy run) [[ -z $3 || $4 ]] && dokku_log_fail "storage:mount requires an app and a two paths divided by colon." verify_app_name "$2" && local APP="$2" verify_paths "$3" && local MOUNT_PATH="$3" diff --git a/plugins/storage/subcommands/unmount b/plugins/storage/subcommands/unmount index 2e371a423..d460386d5 100755 --- a/plugins/storage/subcommands/unmount +++ b/plugins/storage/subcommands/unmount @@ -7,7 +7,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" storage_unmount_cmd() { declare desc="Remove bind-mount, restart app if running" local cmd="storage:unmount" - local passed_phases=(build deploy run) + local passed_phases=(deploy run) [[ -z $3 || $4 ]] && dokku_log_fail "storage:unmount requires an app and a two paths divided by colon." verify_app_name "$2" && local APP="$2" verify_paths "$3" && local MOUNT_PATH="$3" diff --git a/tests/unit/20_storage.bats b/tests/unit/20_storage.bats index 6eb229fad..a2b0059c7 100644 --- a/tests/unit/20_storage.bats +++ b/tests/unit/20_storage.bats @@ -38,18 +38,3 @@ teardown() { assert_output "Mount path does not exist." assert_failure } - -@test "(storage) storage:mount (dockerfile)" { - run /bin/bash -c "dokku storage:mount $TEST_APP /tmp/mount:/mount" - echo "output: "$output - echo "status: "$status - assert_success - - deploy_app dockerfile - - CID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) - run /bin/bash -c "docker inspect -f '{{ .HostConfig.Binds }}' $CID" - echo "output: "$output - echo "status: "$status - assert_output "[/tmp/mount:/mount]" -}