Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa3d21b4ae | ||
|
|
67dd094d58 | ||
|
|
b414ca165a | ||
|
|
028d82517f | ||
|
|
8852c3fc03 | ||
|
|
095be6dbaf | ||
|
|
a9fcde1404 | ||
|
|
b3efd6ef80 | ||
|
|
2e0a9b6c6e | ||
|
|
4b6ca068e7 | ||
|
|
7a3e380c24 | ||
|
|
b56616cdc7 | ||
|
|
6c2e96b37e | ||
|
|
d668c50abb | ||
|
|
c4c9f88c94 | ||
|
|
a5c60c2b07 | ||
|
|
589d28730f | ||
|
|
be5d09776a | ||
|
|
c105f97ed5 | ||
|
|
dc72b8ac33 | ||
|
|
33fbe15fc6 | ||
|
|
181a1a18fa | ||
|
|
b74cb9cc9f | ||
|
|
5a541fc340 |
57
.github/labels.yml
vendored
Normal file
57
.github/labels.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
labels:
|
||||
- name: bc-break
|
||||
color: eb6420
|
||||
- name: blocks release
|
||||
color: "000000"
|
||||
- name: 'difficulty: easy'
|
||||
color: c5def5
|
||||
- name: 'difficulty: hard'
|
||||
color: e99695
|
||||
- name: 'difficulty: medium'
|
||||
color: fef2c0
|
||||
- name: hacktoberfest
|
||||
color: b0581d
|
||||
- name: 'needs: documentation'
|
||||
color: c2e0c6
|
||||
- name: 'needs: more info'
|
||||
color: c2e0c6
|
||||
- name: 'needs: rebase'
|
||||
color: c2e0c6
|
||||
- name: 'needs: tests'
|
||||
color: c2e0c6
|
||||
- name: 'status: duplicate'
|
||||
color: cccccc
|
||||
- name: 'status: fix-provided'
|
||||
color: c5def5
|
||||
- name: 'status: future'
|
||||
color: c5def5
|
||||
- name: 'status: has plan'
|
||||
color: c5def5
|
||||
- name: 'status: invalid'
|
||||
color: cccccc
|
||||
- name: 'status: merge for next minor'
|
||||
color: c5def5
|
||||
- name: 'status: merge for next patch'
|
||||
color: c5def5
|
||||
- name: 'status: wontfix'
|
||||
color: cccccc
|
||||
- name: 'type: bug'
|
||||
color: e01b1b
|
||||
- name: 'type: documentation'
|
||||
color: 0052cc
|
||||
- name: 'type: enhancement'
|
||||
color: 09ab3c
|
||||
- name: 'type: question'
|
||||
color: cc317c
|
||||
- name: 'type: refactor'
|
||||
color: 0052cc
|
||||
- name: 'type: rfc'
|
||||
color: 0052cc
|
||||
- name: 'type: roadmap'
|
||||
color: 0052cc
|
||||
- name: 'type: service'
|
||||
color: "5319e7"
|
||||
- name: 'type: support'
|
||||
color: cc317c
|
||||
- name: 'type: tests'
|
||||
color: 0052cc
|
||||
@@ -1,6 +1,6 @@
|
||||
# dokku postgres [](https://travis-ci.org/dokku/dokku-postgres) [](https://webchat.freenode.net/?channels=dokku)
|
||||
|
||||
Official postgres plugin for dokku. Currently defaults to installing [postgres 10.4](https://hub.docker.com/_/postgres/).
|
||||
Official postgres plugin for dokku. Currently defaults to installing [postgres 11.2](https://hub.docker.com/_/postgres/).
|
||||
|
||||
## requirements
|
||||
|
||||
@@ -10,7 +10,7 @@ Official postgres plugin for dokku. Currently defaults to installing [postgres 1
|
||||
## installation
|
||||
|
||||
```shell
|
||||
# on 0.4.x+
|
||||
# on 0.12.x+
|
||||
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
|
||||
```
|
||||
|
||||
@@ -60,7 +60,7 @@ dokku postgres:create lolipop
|
||||
# it *must* be compatible with the
|
||||
# official postgres image
|
||||
export POSTGRES_IMAGE="postgres"
|
||||
export POSTGRES_IMAGE_VERSION="10.4"
|
||||
export POSTGRES_IMAGE_VERSION="11.2"
|
||||
dokku postgres:create lolipop
|
||||
|
||||
# you can also specify custom environment
|
||||
|
||||
3
commands
3
commands
@@ -2,7 +2,8 @@
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
|
||||
[[ " help $PLUGIN_COMMAND_PREFIX:help $PLUGIN_COMMAND_PREFIX $PLUGIN_COMMAND_PREFIX:default " == *" $1 "* ]] || [[ "$1" == "$PLUGIN_COMMAND_PREFIX:"* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/help-functions"
|
||||
|
||||
|
||||
143
common-functions
143
common-functions
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
docker_ports_options() {
|
||||
@@ -18,10 +19,14 @@ get_container_ip() {
|
||||
|
||||
get_database_name() {
|
||||
declare desc="Retrieves a sanitized database name"
|
||||
declare DATABASE="$1"
|
||||
# some datastores do not like special characters in database names
|
||||
# so we need to normalize them out
|
||||
echo "$DATABASE" | tr .- _
|
||||
declare SERVICE="$1"
|
||||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||
|
||||
if [[ ! -f "$SERVICE_ROOT/DATABASE_NAME" ]]; then
|
||||
echo "$SERVICE" > "$SERVICE_ROOT/DATABASE_NAME"
|
||||
fi
|
||||
|
||||
cat "$SERVICE_ROOT/DATABASE_NAME"
|
||||
}
|
||||
|
||||
get_random_ports() {
|
||||
@@ -83,6 +88,18 @@ is_implemented_command() {
|
||||
return 0
|
||||
}
|
||||
|
||||
is_valid_service_name() {
|
||||
declare desc="Validates a service name"
|
||||
declare SERVICE="$1"
|
||||
[[ -z "$SERVICE" ]] && return 1
|
||||
|
||||
if [[ "$SERVICE" =~ ^[A-Za-z0-9_-]+$ ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
remove_from_links_file() {
|
||||
declare desc="Removes an app from the service link file"
|
||||
declare SERVICE="$1" APP="$2"
|
||||
@@ -97,25 +114,40 @@ remove_from_links_file() {
|
||||
sort "$LINKS_FILE" -u -o "$LINKS_FILE"
|
||||
}
|
||||
|
||||
service_dns_hostname() {
|
||||
declare desc="Retrieves the alias of a service"
|
||||
declare SERVICE="$1"
|
||||
local SERVICE_NAME="$(get_service_name "$SERVICE")"
|
||||
echo "$SERVICE_NAME" | tr ._ -
|
||||
retry-docker-command() {
|
||||
local ID="$1" COMMAND="$2"
|
||||
local i=0 success=false
|
||||
until [ $i -ge 100 ]; do
|
||||
set +e
|
||||
docker exec -it "$ID" sh -c "$COMMAND" 2>/dev/null
|
||||
exit_code=$?
|
||||
set -e
|
||||
if [[ "$exit_code" == 0 ]]; then
|
||||
success=true
|
||||
break
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 1
|
||||
done
|
||||
if [[ $i -gt 0 ]]; then
|
||||
dokku_log_verbose "Container command retried ${i} time(s): ${COMMAND}"
|
||||
fi
|
||||
[[ "$success" == "true" ]] || dokku_log_fail "Failed to run command: ${COMMAND}"
|
||||
}
|
||||
|
||||
service_alternative_alias() {
|
||||
declare desc="Retrieves an alternative alias for a service"
|
||||
declare EXISTING_CONFIG="$1"
|
||||
local COLORS=(AQUA BLACK BLUE FUCHSIA GRAY GREEN LIME MAROON NAVY OLIVE PURPLE RED SILVER TEAL WHITE YELLOW)
|
||||
local ALIAS;
|
||||
local ALIAS
|
||||
|
||||
for COLOR in "${COLORS[@]}"; do
|
||||
ALIAS="${PLUGIN_ALT_ALIAS}_${COLOR}"
|
||||
local IN_USE=$(echo "$EXISTING_CONFIG" | grep "${ALIAS}_URL")
|
||||
if [[ -n $IN_USE ]]; then
|
||||
unset ALIAS
|
||||
if [[ -z "$IN_USE" ]]; then
|
||||
break
|
||||
fi
|
||||
unset ALIAS
|
||||
done
|
||||
echo "$ALIAS"
|
||||
}
|
||||
@@ -185,7 +217,7 @@ service_backup() {
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
docker run --rm $BACKUP_PARAMETERS dokkupaas/s3backup:0.8.0
|
||||
docker run --rm $BACKUP_PARAMETERS dokku/s3backup:0.9.4
|
||||
}
|
||||
|
||||
service_backup_auth() {
|
||||
@@ -248,14 +280,6 @@ service_backup_schedule_cat() {
|
||||
cat "$CRON_FILE"
|
||||
}
|
||||
|
||||
service_backup_unschedule() {
|
||||
declare desc="unschedules the backup of the service"
|
||||
declare SERVICE="$1"
|
||||
local CRON_FILE="/etc/cron.d/dokku-${PLUGIN_COMMAND_PREFIX}-${SERVICE}"
|
||||
|
||||
sudo /bin/rm -f "$CRON_FILE"
|
||||
}
|
||||
|
||||
service_backup_set_encryption() {
|
||||
declare desc="Sets up backup encryption"
|
||||
declare SERVICE="$1" ENCRYPTION_KEY="$2"
|
||||
@@ -266,6 +290,14 @@ service_backup_set_encryption() {
|
||||
echo "$ENCRYPTION_KEY" >"${SERVICE_BACKUP_ENCRYPTION_ROOT}/ENCRYPTION_KEY"
|
||||
}
|
||||
|
||||
service_backup_unschedule() {
|
||||
declare desc="unschedules the backup of the service"
|
||||
declare SERVICE="$1"
|
||||
local CRON_FILE="/etc/cron.d/dokku-${PLUGIN_COMMAND_PREFIX}-${SERVICE}"
|
||||
|
||||
sudo /bin/rm -f "$CRON_FILE"
|
||||
}
|
||||
|
||||
service_backup_unset_encryption() {
|
||||
declare desc="Removes backup encryption"
|
||||
declare SERVICE="$1"
|
||||
@@ -295,6 +327,13 @@ service_container_rm() {
|
||||
fi
|
||||
}
|
||||
|
||||
service_dns_hostname() {
|
||||
declare desc="Retrieves the alias of a service"
|
||||
declare SERVICE="$1"
|
||||
local SERVICE_NAME="$(get_service_name "$SERVICE")"
|
||||
echo "$SERVICE_NAME" | tr ._ -
|
||||
}
|
||||
|
||||
service_enter() {
|
||||
declare desc="enters running app container of specified proc type"
|
||||
declare SERVICE="$1" && shift 1
|
||||
@@ -479,7 +518,9 @@ service_logs() {
|
||||
|
||||
service_parse_args() {
|
||||
declare desc="cli arg parser"
|
||||
local next_index=1; local skip=false; local args=("$@")
|
||||
local next_index=1
|
||||
local skip=false
|
||||
local args=("$@")
|
||||
|
||||
for arg in "$@"; do
|
||||
shift
|
||||
@@ -496,7 +537,7 @@ service_parse_args() {
|
||||
"--restart-apps") set -- "$@" "-R" ;;
|
||||
"--root-password") set -- "$@" "-r" ;;
|
||||
"--user") set -- "$@" "-u" ;;
|
||||
*) set -- "$@" "$arg"
|
||||
*) set -- "$@" "$arg" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -504,29 +545,41 @@ service_parse_args() {
|
||||
while getopts "a:c:C:d:i:I:m:p:q:R:r:u:" opt; do
|
||||
case "$opt" in
|
||||
a)
|
||||
SERVICE_ALIAS="${OPTARG^^}"; export SERVICE_ALIAS="${SERVICE_ALIAS%_URL}"
|
||||
SERVICE_ALIAS="${OPTARG^^}"
|
||||
export SERVICE_ALIAS="${SERVICE_ALIAS%_URL}"
|
||||
;;
|
||||
c) export PLUGIN_CONFIG_OPTIONS=$OPTARG
|
||||
c)
|
||||
export PLUGIN_CONFIG_OPTIONS=$OPTARG
|
||||
;;
|
||||
C) export SERVICE_CUSTOM_ENV=$OPTARG
|
||||
C)
|
||||
export SERVICE_CUSTOM_ENV=$OPTARG
|
||||
;;
|
||||
d) export SERVICE_DATABASE=$OPTARG
|
||||
d)
|
||||
export SERVICE_DATABASE=$OPTARG
|
||||
;;
|
||||
i) export PLUGIN_IMAGE=$OPTARG
|
||||
i)
|
||||
export PLUGIN_IMAGE=$OPTARG
|
||||
;;
|
||||
I) export PLUGIN_IMAGE_VERSION=$OPTARG
|
||||
I)
|
||||
export PLUGIN_IMAGE_VERSION=$OPTARG
|
||||
;;
|
||||
m) export SERVICE_MEMORY=$OPTARG
|
||||
m)
|
||||
export SERVICE_MEMORY=$OPTARG
|
||||
;;
|
||||
p) export SERVICE_PASSWORD=$OPTARG
|
||||
p)
|
||||
export SERVICE_PASSWORD=$OPTARG
|
||||
;;
|
||||
q) export SERVICE_QUERYSTRING=${OPTARG#"?"}
|
||||
q)
|
||||
export SERVICE_QUERYSTRING=${OPTARG#"?"}
|
||||
;;
|
||||
R) export SERVICE_RESTART_APPS=$OPTARG
|
||||
R)
|
||||
export SERVICE_RESTART_APPS=$OPTARG
|
||||
;;
|
||||
r) export SERVICE_ROOT_PASSWORD=$OPTARG
|
||||
r)
|
||||
export SERVICE_ROOT_PASSWORD=$OPTARG
|
||||
;;
|
||||
u) export SERVICE_USER=$OPTARG
|
||||
u)
|
||||
export SERVICE_USER=$OPTARG
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -604,7 +657,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" svendowideit/ambassador > /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" dokku/ambassador:0.2.0 >/dev/null
|
||||
if [[ "$LOG_FAIL" == "true" ]]; then
|
||||
dokku_log_info1 "Service $SERVICE exposed on port(s) [container->host]: $(service_exposed_ports "$SERVICE")"
|
||||
fi
|
||||
@@ -669,7 +722,7 @@ service_status() {
|
||||
service_stop() {
|
||||
declare desc="Stops a running service"
|
||||
declare SERVICE="$1"
|
||||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE";
|
||||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||
local SERVICE_NAME="$(get_service_name "$SERVICE")"
|
||||
local ID=$(docker ps -aq --no-trunc --filter "name=^/$SERVICE_NAME$" --format '{{ .ID }}') || true
|
||||
[[ -z $ID ]] && dokku_log_warn "Service is already stopped" && return 0
|
||||
@@ -732,14 +785,12 @@ verify_service_name() {
|
||||
return 0
|
||||
}
|
||||
|
||||
is_valid_service_name() {
|
||||
declare desc="Validates a service name"
|
||||
write_database_name() {
|
||||
declare desc="Writes a sanitized database name"
|
||||
declare SERVICE="$1"
|
||||
[[ -z "$SERVICE" ]] && return 1
|
||||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||
|
||||
if [[ "$SERVICE" =~ ^[A-Za-z0-9_]+$ ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
# some datastores do not like special characters in database names
|
||||
# so we need to normalize them out
|
||||
echo "$SERVICE" | tr .- _ > "$SERVICE_ROOT/DATABASE_NAME"
|
||||
}
|
||||
|
||||
6
config
6
config
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
export POSTGRES_IMAGE=${POSTGRES_IMAGE:="postgres"}
|
||||
export POSTGRES_IMAGE_VERSION=${POSTGRES_IMAGE_VERSION:="10.4"}
|
||||
export POSTGRES_IMAGE_VERSION=${POSTGRES_IMAGE_VERSION:="11.2"}
|
||||
export POSTGRES_ROOT=${POSTGRES_ROOT:="$DOKKU_LIB_ROOT/services/postgres"}
|
||||
export POSTGRES_HOST_ROOT=${POSTGRES_HOST_ROOT:=$POSTGRES_ROOT}
|
||||
|
||||
@@ -24,7 +24,3 @@ export PLUGIN_BASE_PATH="$PLUGIN_PATH"
|
||||
if [[ -n $DOKKU_API_VERSION ]]; then
|
||||
export PLUGIN_BASE_PATH="$PLUGIN_ENABLED_PATH"
|
||||
fi
|
||||
|
||||
if [[ -d "$PLUGIN_DATA_ROOT/*" ]]; then
|
||||
rm -rf "${PLUGIN_DATA_ROOT:?}/*"
|
||||
fi
|
||||
|
||||
23
functions
23
functions
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common-functions"
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
@@ -24,7 +25,8 @@ service_create() {
|
||||
is_valid_service_name "$SERVICE" || dokku_log_fail "Please specify a valid name for the service. Valid characters are: [A-Za-z0-9_]+"
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
[[ ! -d "$PLUGIN_DATA_ROOT/$SERVICE" ]] || dokku_log_fail "$PLUGIN_SERVICE service $SERVICE already exists"
|
||||
SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"; LINKS_FILE="$SERVICE_ROOT/LINKS"
|
||||
SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||
LINKS_FILE="$SERVICE_ROOT/LINKS"
|
||||
|
||||
service_parse_args "${@:2}"
|
||||
|
||||
@@ -56,6 +58,8 @@ service_create() {
|
||||
else
|
||||
echo "" >"$SERVICE_ROOT/ENV"
|
||||
fi
|
||||
|
||||
write_database_name "$SERVICE"
|
||||
service_create_container "$SERVICE"
|
||||
}
|
||||
|
||||
@@ -65,23 +69,23 @@ service_create_container() {
|
||||
local SERVICE_HOST_ROOT="$PLUGIN_DATA_HOST_ROOT/$SERVICE"
|
||||
local SERVICE_NAME="$(get_service_name "$SERVICE")"
|
||||
local PASSWORD="$(cat "$SERVICE_ROOT/PASSWORD")"
|
||||
local DATABASE_NAME="$(get_database_name "$SERVICE")"
|
||||
local PREVIOUS_ID
|
||||
|
||||
ID=$(docker run --name "$SERVICE_NAME" -v "$SERVICE_HOST_ROOT/data:/var/lib/postgresql/data" -e "POSTGRES_PASSWORD=$PASSWORD" --env-file="$SERVICE_ROOT/ENV" -d --restart always --label dokku=service --label dokku.service=postgres "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION")
|
||||
echo "$ID" >"$SERVICE_ROOT/ID"
|
||||
|
||||
dokku_log_verbose_quiet "Waiting for container to be ready"
|
||||
docker run --rm --link "$SERVICE_NAME:$PLUGIN_COMMAND_PREFIX" dokkupaas/wait:0.2 -p "$PLUGIN_DATASTORE_WAIT_PORT" > /dev/null
|
||||
docker run --rm --link "$SERVICE_NAME:$PLUGIN_COMMAND_PREFIX" dokku/wait:0.3.0 -p "$PLUGIN_DATASTORE_WAIT_PORT" >/dev/null
|
||||
|
||||
dokku_log_verbose_quiet "Creating container database"
|
||||
DATABASE_NAME="$(get_database_name "$SERVICE")"
|
||||
docker exec "$SERVICE_NAME" su - postgres -c "createdb -E utf8 $DATABASE_NAME" 2>/dev/null || dokku_log_verbose_quiet 'Already exists'
|
||||
|
||||
dokku_log_verbose_quiet "Securing connection to database"
|
||||
service_stop "$SERVICE" >/dev/null
|
||||
docker run --rm -i -v "$SERVICE_HOST_ROOT/data:/var/lib/postgresql/data" "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION" bash -s <"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/scripts/enable_ssl.sh" &>/dev/null
|
||||
|
||||
PREVIOUS_ID=$(docker ps -f status=exited --no-trunc | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
||||
PREVIOUS_ID=$(docker ps -aq --no-trunc --filter "status=exited" --filter "name=^/$SERVICE_NAME$" --format '{{ .ID }}') || true
|
||||
docker start "$PREVIOUS_ID" >/dev/null
|
||||
service_port_unpause "$SERVICE"
|
||||
|
||||
@@ -122,14 +126,14 @@ service_start() {
|
||||
local QUIET="$2"
|
||||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||
local SERVICE_NAME="$(get_service_name "$SERVICE")"
|
||||
local ID=$(docker ps -f status=running --no-trunc | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
||||
local ID=$(docker ps -aq --no-trunc --filter "status=running" --filter "name=^/$SERVICE_NAME$" --format '{{ .ID }}') || true
|
||||
if [[ -n $ID ]]; then
|
||||
[[ -z $QUIET ]] && dokku_log_warn "Service is already started"
|
||||
return 0
|
||||
fi
|
||||
|
||||
dokku_log_info2_quiet "Starting container"
|
||||
local PREVIOUS_ID=$(docker ps -f status=exited --no-trunc | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
||||
local PREVIOUS_ID=$(docker ps -aq --no-trunc --filter "status=exited" --filter "name=^/$SERVICE_NAME$" --format '{{ .ID }}') || true
|
||||
local PASSWORD="$(cat "$SERVICE_ROOT/PASSWORD")"
|
||||
|
||||
if [[ -n $PREVIOUS_ID ]]; then
|
||||
@@ -146,9 +150,8 @@ service_start() {
|
||||
service_url() {
|
||||
local SERVICE="$1"
|
||||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||
|
||||
local PASSWORD="$(cat "$SERVICE_ROOT/PASSWORD")"
|
||||
local DATABASE_NAME="$(get_database_name "$SERVICE")"
|
||||
local SERVICE_DNS_HOSTNAME="$(service_dns_hostname "$SERVICE")"
|
||||
local DATABASE_NAME="$(get_database_name "$SERVICE")"
|
||||
local PASSWORD="$(cat "$SERVICE_ROOT/PASSWORD")"
|
||||
echo "$PLUGIN_SCHEME://postgres:$PASSWORD@$SERVICE_DNS_HOSTNAME:${PLUGIN_DATASTORE_PORTS[0]}/$DATABASE_NAME"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common-functions"
|
||||
export SUBCOMMAND_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/subcommands"
|
||||
|
||||
@@ -31,7 +32,7 @@ fn-help-all() {
|
||||
local CMD_OUTPUT BLUE BOLD FULL_OUTPUT NORMAL
|
||||
FULL_OUTPUT=true
|
||||
|
||||
if [[ "$CMD" = "$PLUGIN_COMMAND_PREFIX:help" ]] || [[ "$CMD" == "$PLUGIN_COMMAND_PREFIX" ]] || [[ "$CMD" == "$PLUGIN_COMMAND_PREFIX:default" ]] ; then
|
||||
if [[ "$CMD" == "$PLUGIN_COMMAND_PREFIX:help" ]] || [[ "$CMD" == "$PLUGIN_COMMAND_PREFIX" ]] || [[ "$CMD" == "$PLUGIN_COMMAND_PREFIX:default" ]]; then
|
||||
BOLD="$(fn-help-fancy-tput bold)"
|
||||
NORMAL="$(fn-help-fancy-color "\033[m")"
|
||||
BLUE="$(fn-help-fancy-color "\033[0;34m")"
|
||||
@@ -142,7 +143,7 @@ fn-help-contents-subcommand() {
|
||||
fn-help-fancy-tput() {
|
||||
declare desc="A wrapper around tput"
|
||||
|
||||
if [[ -n "$DOKKU_NO_COLOR" ]] || [[ "$TERM" = "unknown" ]] || [[ "$TERM" == "dumb" ]]; then
|
||||
if [[ -n "$DOKKU_NO_COLOR" ]] || [[ "$TERM" == "unknown" ]] || [[ "$TERM" == "dumb" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -152,7 +153,7 @@ fn-help-fancy-tput() {
|
||||
fn-help-fancy-color() {
|
||||
declare desc="A wrapper around colors"
|
||||
|
||||
if [[ -n "$DOKKU_NO_COLOR" ]] || [[ "$TERM" = "unknown" ]] || [[ "$TERM" == "dumb" ]]; then
|
||||
if [[ -n "$DOKKU_NO_COLOR" ]] || [[ "$TERM" == "unknown" ]] || [[ "$TERM" == "dumb" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
11
install
11
install
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
plugin-install() {
|
||||
pull-docker-image() {
|
||||
@@ -16,10 +17,10 @@ plugin-install() {
|
||||
}
|
||||
|
||||
pull-docker-image "${PLUGIN_IMAGE}:${PLUGIN_IMAGE_VERSION}"
|
||||
pull-docker-image "svendowideit/ambassador:latest"
|
||||
pull-docker-image "dokkupaas/wait:0.2"
|
||||
pull-docker-image "dokkupaas/s3backup:0.8.0"
|
||||
pull-docker-image "busybox:latest"
|
||||
pull-docker-image "dokku/ambassador:0.2.0"
|
||||
pull-docker-image "dokku/wait:0.3.0"
|
||||
pull-docker-image "dokku/s3backup:0.9.4"
|
||||
pull-docker-image "busybox:1.30.1-uclibc"
|
||||
|
||||
mkdir -p "$PLUGIN_DATA_ROOT" || echo "Failed to create $PLUGIN_SERVICE data directory"
|
||||
chown dokku:dokku "$PLUGIN_DATA_ROOT"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku postgres service plugin"
|
||||
version = "1.5.0"
|
||||
version = "1.8.0"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
PLUGIN_BASE_PATH="$PLUGIN_PATH"
|
||||
if [[ -n $DOKKU_API_VERSION ]]; then
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-app-links-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:app-links playground
|
||||
#A app, app to run command against
|
||||
declare desc="list all $PLUGIN_SERVICE service links for a given app"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:app-links" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:app-links" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
APP=${APP:="$DOKKU_APP_NAME"}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -11,7 +12,8 @@ service-backup-cmd() {
|
||||
#A service, service to run command against
|
||||
#A bucket-name, name of the s3 bucket to upload backups to
|
||||
declare desc="creates a backup of the $PLUGIN_SERVICE service to an existing s3 bucket"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" BUCKET_NAME="$2" USE_IAM_OPTIONAL_FLAG="$3"
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -20,7 +21,8 @@ service-backup-auth-cmd() {
|
||||
#A aws-signature-version, (optional) the AWS signature version to use when signing S3 requests
|
||||
#A endpoint-url, (optional) an aws endpoint to upload to
|
||||
declare desc="sets up authentication for backups on the $PLUGIN_SERVICE service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-auth" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-auth" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" AWS_ACCESS_KEY_ID="$2" AWS_SECRET_ACCESS_KEY="$3" AWS_DEFAULT_REGION="$4" AWS_SIGNATURE_VERSION="$5" ENDPOINT_URL="$6"
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-backup-deauth-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:backup-deauth lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="removes backup authentication for the $PLUGIN_SERVICE service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-deauth" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-deauth" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -15,7 +16,8 @@ service-backup-schedule-cmd() {
|
||||
#A schedule, a cron schedule to run backups on
|
||||
#A bucket-name, name of the s3 bucket to upload backups to
|
||||
declare desc="schedules a backup of the $PLUGIN_SERVICE service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-schedule" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-schedule" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" SCHEDULE="$2" BUCKET_NAME="$3" USE_IAM_OPTIONAL_FLAG="$4"
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-backup-schedule-cat-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:backup-schedule-cat lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="cat the contents of the configured backup cronfile for the service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-schedule-cat" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-schedule-cat" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -10,7 +11,8 @@ service-backup-set-encryption-cmd() {
|
||||
#A service, service to run command against
|
||||
#A passphrase, a GPG-compatible passphrase
|
||||
declare desc="sets encryption for all future backups of $PLUGIN_SERVICE service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-set-encryption" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-set-encryption" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" PASSPHRASE="$2"
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-backup-unschedule-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:backup-unschedule lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="unschedules the backup of the $PLUGIN_SERVICE service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-unschedule" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-unschedule" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-backup-unset-encryption-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:backup-unset-encryption lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="unsets encryption for future backups of the $PLUGIN_SERVICE service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-unset-encryption" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:backup-unset-encryption" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -15,7 +16,8 @@ service-clone-cmd() {
|
||||
#F -p|--password PASSWORD, override the user-level service password
|
||||
#F -r|--root-password PASSWORD, override the root-level service password
|
||||
declare desc="create container <new-name> then copy data from <name> into <new-name>"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:clone" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:clone" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" NEW_SERVICE="$2" CLONE_FLAGS_LIST=("${@:3}")
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-connect-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:connect lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="connect to the service via the $PLUGIN_COMMAND_PREFIX connection tool"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:connect" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:connect" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -23,7 +24,8 @@ service-create-cmd() {
|
||||
#F -p|--password PASSWORD, override the user-level service password
|
||||
#F -r|--root-password PASSWORD, override the root-level service password
|
||||
declare desc="create a $PLUGIN_SERVICE service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:create" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:create" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" CREATE_FLAGS_LIST=("${@:2}")
|
||||
|
||||
service_create "$SERVICE" "${@:2}"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -10,12 +11,14 @@ service-destroy-cmd() {
|
||||
#A service, service to run command against
|
||||
#F -f|--force, force destroy without asking for confirmation
|
||||
declare desc="delete the $PLUGIN_SERVICE service/data/container if there are no links left"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:destroy" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:destroy" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" FORCE_FLAG="$2"
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
verify_service_name "$SERVICE"
|
||||
SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"; LINKS_FILE="$SERVICE_ROOT/LINKS"
|
||||
SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||
LINKS_FILE="$SERVICE_ROOT/LINKS"
|
||||
SERVICE_HOST_ROOT="$PLUGIN_DATA_HOST_ROOT/$SERVICE"
|
||||
SERVICE_NAME="$(get_service_name "$SERVICE")"
|
||||
|
||||
@@ -42,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 chmod 777 -R /config /data
|
||||
docker run --rm -v "$SERVICE_HOST_ROOT/data:/data" -v "$SERVICE_HOST_ROOT/config:/config" busybox:1.30.1-uclibc chmod 777 -R /config /data
|
||||
rm -rf "$SERVICE_ROOT"
|
||||
|
||||
dokku_log_info2 "$PLUGIN_SERVICE container deleted: $SERVICE"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -13,7 +14,8 @@ service-enter-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:enter lolipop touch /tmp/test
|
||||
#A service, service to run command against
|
||||
declare desc="enter or run a command in a running $PLUGIN_SERVICE service container"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:enter" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:enter" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
|
||||
dokku_log_info1_quiet "Filesystem changes may not persist after container restarts"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-exists-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:exists lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="check if the $PLUGIN_SERVICE service exists"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:exists" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:exists" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -11,7 +12,8 @@ service-export-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:export lolipop > lolipop.dump
|
||||
#A service, service to run command against
|
||||
declare desc="export a dump of the $PLUGIN_SERVICE service database"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:export" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:export" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -10,7 +11,8 @@ service-expose-cmd() {
|
||||
#A service, service to run command against
|
||||
#A ports, a list of ports to run against
|
||||
declare desc="expose a $PLUGIN_SERVICE service on custom port if provided (random port otherwise)"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:expose" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:expose" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" PORTS_LIST=("${@:2}")
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-import-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:import lolipop < database.dump
|
||||
#A service, service to run command against
|
||||
declare desc="import a dump into the $PLUGIN_SERVICE service database"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:import" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:import" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -30,7 +31,8 @@ service-info-cmd() {
|
||||
#F --status, show the service running status
|
||||
#F --version, show the service image version
|
||||
declare desc="print the connection information"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:info" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:info" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" INFO_FLAG="$2"
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -42,7 +43,8 @@ service-link-cmd() {
|
||||
#F -a|--alias "BLUE_DATABASE", an alternative alias to use for linking to an app via environment variable
|
||||
#F -q|--querystring "pool=5", ampersand delimited querystring arguments to append to the service link
|
||||
declare desc="link the $PLUGIN_SERVICE service to the app"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:link" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:link" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" APP="$2" LINK_FLAGS_LIST=("${@:3}")
|
||||
APP=${APP:="$DOKKU_APP_NAME"}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -10,7 +11,8 @@ service-linked-cmd() {
|
||||
#A service, service to run command against
|
||||
#A app, app to run command against
|
||||
declare desc="check if the $PLUGIN_SERVICE service is linked to an app"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:linked" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:linked" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" APP="$2"
|
||||
APP=${APP:="$DOKKU_APP_NAME"}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -8,7 +9,8 @@ service-list-cmd() {
|
||||
#E list all services
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:list
|
||||
declare desc="list all $PLUGIN_SERVICE services"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:list" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:list" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
|
||||
service_list
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -12,7 +13,8 @@ service-logs-cmd() {
|
||||
#A service, service to run command against
|
||||
#F -t|--tail, do not stop when end of the logs are reached and wait for additional output
|
||||
declare desc="print the most recent log(s) for this service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:logs" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:logs" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" TAIL_FLAG="$2"
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -23,7 +24,8 @@ service-promote-cmd() {
|
||||
#A service, service to run command against
|
||||
#A app, app to run command against
|
||||
declare desc="promote service <service> as ${PLUGIN_DEFAULT_ALIAS}_URL in <app>"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:promote" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:promote" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" APP="$2"
|
||||
APP=${APP:="$DOKKU_APP_NAME"}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-restart-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:restart lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="graceful shutdown and restart of the $PLUGIN_SERVICE service container"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:restart" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:restart" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-start-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:start lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="start a previously stopped $PLUGIN_SERVICE service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:start" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:start" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-stop-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:stop lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="stop a running $PLUGIN_SERVICE service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:stop" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:stop" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -9,7 +10,8 @@ service-unexpose-cmd() {
|
||||
#E dokku $PLUGIN_COMMAND_PREFIX:unexpose lolipop
|
||||
#A service, service to run command against
|
||||
declare desc="unexpose a previously exposed $PLUGIN_SERVICE service"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:unexpose" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:unexpose" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1"
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
|
||||
@@ -11,7 +12,8 @@ service-unlink-cmd() {
|
||||
#A service, service to run command against
|
||||
#A app, app to run command against
|
||||
declare desc="unlink the $PLUGIN_SERVICE service from the app"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:unlink" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:unlink" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" APP="$2"
|
||||
APP=${APP:="$DOKKU_APP_NAME"}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_BASE_PATH/common/functions"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
@@ -14,7 +15,8 @@ service-upgrade-cmd() {
|
||||
#F -I|--image-version IMAGE_VERSION, the image version to start the service with
|
||||
#F -R|--restart-apps "true", whether to force an app restart
|
||||
declare desc="upgrade service <service> to the specified versions"
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:upgrade" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
local cmd="$PLUGIN_COMMAND_PREFIX:upgrade" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare SERVICE="$1" UPGRADE_FLAGS_LIST=("${@:2}")
|
||||
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
|
||||
@@ -7,6 +7,15 @@ load test_helper
|
||||
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:create) service with dashes" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:create" service-with-dashes
|
||||
assert_contains "${lines[*]}" "container created: service-with-dashes"
|
||||
assert_contains "${lines[*]}" "dokku-$PLUGIN_COMMAND_PREFIX-service-with-dashes"
|
||||
assert_contains "${lines[*]}" "service_with_dashes"
|
||||
|
||||
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" service-with-dashes
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:create) error when there are no arguments" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:create"
|
||||
assert_contains "${lines[*]}" "Please specify a valid name for the service"
|
||||
@@ -15,7 +24,4 @@ load test_helper
|
||||
@test "($PLUGIN_COMMAND_PREFIX:create) error when there is an invalid name specified" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:create" d.erp
|
||||
assert_failure
|
||||
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:create" d-erp
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@@ -3,14 +3,17 @@ load test_helper
|
||||
|
||||
setup() {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:create" l
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:create" m
|
||||
dokku apps:create my_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" m
|
||||
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l
|
||||
dokku --force apps:destroy my_app
|
||||
}
|
||||
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:link) error when there are no arguments" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:link"
|
||||
echo "output: $output"
|
||||
@@ -69,8 +72,14 @@ teardown() {
|
||||
dokku config:set my_app DATABASE_URL=postgres://user:pass@host:5432/db
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
||||
run dokku config my_app
|
||||
assert_contains "${lines[*]}" "DOKKU_POSTGRES_"
|
||||
assert_contains "${lines[*]}" "DOKKU_POSTGRES_AQUA_URL"
|
||||
assert_success
|
||||
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" m my_app
|
||||
run dokku config my_app
|
||||
assert_contains "${lines[*]}" "DOKKU_POSTGRES_BLACK_URL"
|
||||
assert_success
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" m my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
||||
}
|
||||
|
||||
|
||||
@@ -11,20 +11,20 @@ teardown() {
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:list) with no exposed ports, no linked apps" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:list"
|
||||
assert_contains "${lines[*]}" "l postgres:10.4 running - -"
|
||||
assert_contains "${lines[*]}" "l postgres:11.2 running - -"
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:list) with exposed ports" {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:expose" l 4242
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:list"
|
||||
assert_contains "${lines[*]}" "l postgres:10.4 running 5432->4242 -"
|
||||
assert_contains "${lines[*]}" "l postgres:11.2 running 5432->4242 -"
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:list) with linked app" {
|
||||
dokku apps:create my_app
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:list"
|
||||
assert_contains "${lines[*]}" "l postgres:10.4 running - my_app"
|
||||
assert_contains "${lines[*]}" "l postgres:11.2 running - my_app"
|
||||
dokku --force apps:destroy my_app
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $TRACE ]] && set -x
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/master/bootstrap.sh
|
||||
if [[ "$DOKKU_VERSION" == "master" ]]; then
|
||||
sudo bash bootstrap.sh
|
||||
|
||||
@@ -3,8 +3,11 @@ export DOKKU_LIB_ROOT="/var/lib/dokku"
|
||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||
|
||||
flunk() {
|
||||
{ if [ "$#" -eq 0 ]; then cat -
|
||||
else echo "$*"
|
||||
{
|
||||
if [ "$#" -eq 0 ]; then
|
||||
cat -
|
||||
else
|
||||
echo "$*"
|
||||
fi
|
||||
}
|
||||
return 1
|
||||
@@ -12,7 +15,8 @@ flunk() {
|
||||
|
||||
assert_equal() {
|
||||
if [ "$1" != "$2" ]; then
|
||||
{ echo "expected: $1"
|
||||
{
|
||||
echo "expected: $1"
|
||||
echo "actual: $2"
|
||||
} | flunk
|
||||
fi
|
||||
@@ -59,8 +63,10 @@ assert_contains() {
|
||||
# shellcheck disable=SC2154
|
||||
assert_output() {
|
||||
local expected
|
||||
if [ $# -eq 0 ]; then expected="$(cat -)"
|
||||
else expected="$1"
|
||||
if [ $# -eq 0 ]; then
|
||||
expected="$(cat -)"
|
||||
else
|
||||
expected="$1"
|
||||
fi
|
||||
assert_equal "$expected" "$output"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user