From dccd7e7f89410a99b2e619de954a5f9d925a9f6c Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 30 Mar 2020 20:09:04 -0400 Subject: [PATCH] feat: move all image names to config file This allows us to more quickly update the image versions in use for tertiary images. --- common-functions | 5 +++-- config | 5 +++++ functions | 2 +- install | 8 ++++---- subcommands/destroy | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/common-functions b/common-functions index 38f2abe..286d484 100755 --- a/common-functions +++ b/common-functions @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config" set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_AVAILABLE_PATH/config/functions" @@ -217,7 +218,7 @@ service_backup() { fi # shellcheck disable=SC2086 - docker run --rm $BACKUP_PARAMETERS dokku/s3backup:0.10.1 + docker run --rm $BACKUP_PARAMETERS "$PLUGIN_S3BACKUP_IMAGE" } service_backup_auth() { @@ -686,7 +687,7 @@ service_port_unpause() { echo "${PORTS[@]}" >"$PORT_FILE" # shellcheck disable=SC2046 - docker run -d --link "$SERVICE_NAME:$PLUGIN_COMMAND_PREFIX" --name "$EXPOSED_NAME" $(docker_ports_options "${PORTS[@]}") --restart always --label dokku=ambassador --label "dokku.ambassador=$PLUGIN_COMMAND_PREFIX" dokku/ambassador:0.3.1 >/dev/null + docker run -d --link "$SERVICE_NAME:$PLUGIN_COMMAND_PREFIX" --name "$EXPOSED_NAME" $(docker_ports_options "${PORTS[@]}") --restart always --label dokku=ambassador --label "dokku.ambassador=$PLUGIN_COMMAND_PREFIX" "$PLUGIN_AMBASSADOR_IMAGE" >/dev/null if [[ "$LOG_FAIL" == "true" ]]; then dokku_log_info1 "Service $SERVICE exposed on port(s) [container->host]: $(service_exposed_ports "$SERVICE")" fi diff --git a/config b/config index 7cf7445..d8fdb18 100644 --- a/config +++ b/config @@ -24,3 +24,8 @@ export PLUGIN_BASE_PATH="$PLUGIN_PATH" if [[ -n $DOKKU_API_VERSION ]]; then export PLUGIN_BASE_PATH="$PLUGIN_ENABLED_PATH" fi + +export PLUGIN_BUSYBOX_IMAGE="busybox:1.31.0-uclibc" +export PLUGIN_AMBASSADOR_IMAGE="dokku/ambassador:0.3.1" +export PLUGIN_S3BACKUP_IMAGE="dokku/s3backup:0.10.1" +export PLUGIN_WAIT_IMAGE="dokku/wait:0.4.1" diff --git a/functions b/functions index 42a4bfa..aad85dd 100755 --- a/functions +++ b/functions @@ -76,7 +76,7 @@ service_create_container() { echo "$ID" >"$SERVICE_ROOT/ID" dokku_log_verbose_quiet "Waiting for container to be ready" - docker run --rm --link "$SERVICE_NAME:$PLUGIN_COMMAND_PREFIX" dokku/wait:0.4.1 -p "$PLUGIN_DATASTORE_WAIT_PORT" >/dev/null + docker run --rm --link "$SERVICE_NAME:$PLUGIN_COMMAND_PREFIX" "$PLUGIN_WAIT_IMAGE" -p "$PLUGIN_DATASTORE_WAIT_PORT" >/dev/null dokku_log_verbose_quiet "Creating container database" docker exec "$SERVICE_NAME" su - postgres -c "createdb -E utf8 $DATABASE_NAME" 2>/dev/null || dokku_log_verbose_quiet 'Already exists' diff --git a/install b/install index edc5520..6521cc3 100755 --- a/install +++ b/install @@ -17,10 +17,10 @@ plugin-install() { } pull-docker-image "${PLUGIN_IMAGE}:${PLUGIN_IMAGE_VERSION}" - pull-docker-image "busybox:1.31.0-uclibc" - pull-docker-image "dokku/ambassador:0.3.1" - pull-docker-image "dokku/s3backup:0.10.1" - pull-docker-image "dokku/wait:0.4.1" + pull-docker-image "$PLUGIN_BUSYBOX_IMAGE" + pull-docker-image "$PLUGIN_AMBASSADOR_IMAGE" + pull-docker-image "$PLUGIN_S3BACKUP_IMAGE" + pull-docker-image "$PLUGIN_WAIT_IMAGE" mkdir -p "$PLUGIN_DATA_ROOT" || echo "Failed to create $PLUGIN_SERVICE data directory" chown dokku:dokku "$PLUGIN_DATA_ROOT" diff --git a/subcommands/destroy b/subcommands/destroy index 5b5d776..b3c8902 100755 --- a/subcommands/destroy +++ b/subcommands/destroy @@ -45,7 +45,7 @@ service-destroy-cmd() { service_container_rm "$SERVICE" dokku_log_verbose_quiet "Removing data" - docker run --rm -v "$SERVICE_HOST_ROOT/data:/data" -v "$SERVICE_HOST_ROOT/config:/config" busybox:1.31.0-uclibc chmod 777 -R /config /data + docker run --rm -v "$SERVICE_HOST_ROOT/data:/data" -v "$SERVICE_HOST_ROOT/config:/config" "$PLUGIN_BUSYBOX_IMAGE" chmod 777 -R /config /data rm -rf "$SERVICE_ROOT" dokku_log_info2 "$PLUGIN_SERVICE container deleted: $SERVICE"