Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c94658ea09 | ||
|
|
6ed6db2b3f | ||
|
|
354309feec | ||
|
|
26a1948e50 | ||
|
|
28a8a0f84e | ||
|
|
11435f7452 | ||
|
|
f2a802819f | ||
|
|
1465f6f3ca | ||
|
|
c276507d3b | ||
|
|
98edfb9bb2 | ||
|
|
c32f4e92a1 | ||
|
|
1542a9556f | ||
|
|
4948e2b91d | ||
|
|
621e018999 | ||
|
|
3641c2dc76 | ||
|
|
86a032a32f | ||
|
|
b68ae2d0bd | ||
|
|
30b033ee9d | ||
|
|
9fac5a4ad4 | ||
|
|
73a8ccc085 | ||
|
|
c05aa74a3e | ||
|
|
d112144293 | ||
|
|
30de0727ab | ||
|
|
8823baf480 | ||
|
|
d470ade7a7 | ||
|
|
66e8279dca | ||
|
|
969a9cdcb0 | ||
|
|
5620147f89 | ||
|
|
dda9ed6d55 | ||
|
|
76e0d5fd87 | ||
|
|
7382058ecb | ||
|
|
0a8d599965 | ||
|
|
21cc07bd48 | ||
|
|
902545bdb4 | ||
|
|
ea3cd5ef30 | ||
|
|
9010e1551f | ||
|
|
c05c47187a | ||
|
|
9ee6c3c5cf | ||
|
|
a391fa88dc | ||
|
|
59d285f2f1 | ||
|
|
e6810fa7e0 | ||
|
|
3eaa1dc5cd | ||
|
|
6de1077806 | ||
|
|
eb8ea7d8a6 | ||
|
|
b94af2bf3a | ||
|
|
d143bb48b0 | ||
|
|
e78cc9bd36 |
19
README.md
19
README.md
@@ -1,6 +1,6 @@
|
|||||||
# dokku postgres [](https://travis-ci.org/dokku/dokku-postgres) [](https://webchat.freenode.net/?channels=dokku)
|
# 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.2](https://hub.docker.com/_/postgres/).
|
Official postgres plugin for dokku. Currently defaults to installing [postgres 10.4](https://hub.docker.com/_/postgres/).
|
||||||
|
|
||||||
## requirements
|
## requirements
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ postgres:backup-auth <name> <aws_access_key_id> <aws_secret_access_key> (<aws_de
|
|||||||
postgres:backup-deauth <name> Removes backup authentication for the postgres service
|
postgres:backup-deauth <name> Removes backup authentication for the postgres service
|
||||||
postgres:backup-schedule <name> <schedule> <bucket> Schedules a backup of the postgres service
|
postgres:backup-schedule <name> <schedule> <bucket> Schedules a backup of the postgres service
|
||||||
postgres:backup-schedule-cat <name> Show the backup schedule for the service
|
postgres:backup-schedule-cat <name> Show the backup schedule for the service
|
||||||
postgres:backup-set-encryption <name> <encryption_key> Sets up GPG encryption for future backups of the postgres service
|
postgres:backup-set-encryption <name> <passphrase> Set a GPG passphrase for backups
|
||||||
postgres:backup-unschedule <name> Unschedules the backup of the postgres service
|
postgres:backup-unschedule <name> Unschedules the backup of the postgres service
|
||||||
postgres:backup-unset-encryption <name> Removes backup encryption for future backups of the postgres service
|
postgres:backup-unset-encryption <name> Removes backup encryption for future backups of the postgres service
|
||||||
postgres:clone <name> <new-name> Create container <new-name> then copy data from <name> into <new-name>
|
postgres:clone <name> <new-name> Create container <new-name> then copy data from <name> into <new-name>
|
||||||
@@ -46,6 +46,7 @@ postgres:start <name> Start a previously stopped postgres service
|
|||||||
postgres:stop <name> Stop a running postgres service
|
postgres:stop <name> Stop a running postgres service
|
||||||
postgres:unexpose <name> Unexpose a previously exposed postgres service
|
postgres:unexpose <name> Unexpose a previously exposed postgres service
|
||||||
postgres:unlink <name> <app> Unlink the postgres service from the app
|
postgres:unlink <name> <app> Unlink the postgres service from the app
|
||||||
|
postgres:upgrade <name> Upgrade service <service> to the specified version
|
||||||
```
|
```
|
||||||
|
|
||||||
## usage
|
## usage
|
||||||
@@ -59,7 +60,7 @@ dokku postgres:create lolipop
|
|||||||
# it *must* be compatible with the
|
# it *must* be compatible with the
|
||||||
# official postgres image
|
# official postgres image
|
||||||
export POSTGRES_IMAGE="postgres"
|
export POSTGRES_IMAGE="postgres"
|
||||||
export POSTGRES_IMAGE_VERSION="10.2"
|
export POSTGRES_IMAGE_VERSION="10.4"
|
||||||
dokku postgres:create lolipop
|
dokku postgres:create lolipop
|
||||||
|
|
||||||
# you can also specify custom environment
|
# you can also specify custom environment
|
||||||
@@ -184,7 +185,7 @@ OR
|
|||||||
|
|
||||||
## upgrade/downgrade
|
## upgrade/downgrade
|
||||||
|
|
||||||
At the moment a database can’t be upgraded (or downgraded) inplace. Instead a clone has to be made, like this:
|
At the moment a database can’t be upgraded (or downgraded) inplace. Instead a clone has to be made, like this:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Our original DB using PG 9.5
|
# Our original DB using PG 9.5
|
||||||
@@ -207,7 +208,7 @@ $ dokku postgres:destroy db9.5
|
|||||||
If you wish to tune the postgres instances various .conf files, you can find them by using the postgres:info command.
|
If you wish to tune the postgres instances various .conf files, you can find them by using the postgres:info command.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
dokku postgres:info lolipop
|
dokku postgres:info lolipop
|
||||||
# or
|
# or
|
||||||
dokku postgres:info lolipop --data-dir
|
dokku postgres:info lolipop --data-dir
|
||||||
```
|
```
|
||||||
@@ -244,14 +245,14 @@ dokku postgres:backup-unschedule lolipop
|
|||||||
```
|
```
|
||||||
|
|
||||||
Backup auth can also be set up for different regions, signature versions and endpoints (e.g. for minio):
|
Backup auth can also be set up for different regions, signature versions and endpoints (e.g. for minio):
|
||||||
|
|
||||||
```
|
```
|
||||||
# setup s3 backup authentication with different region
|
# setup s3 backup authentication with different region
|
||||||
dokku postgres:backup-auth lolipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION
|
dokku postgres:backup-auth lolipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION
|
||||||
|
|
||||||
# setup s3 backup authentication with different signature version and endpoint
|
# setup s3 backup authentication with different signature version and endpoint
|
||||||
dokku postgres:backup-auth lolipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION AWS_SIGNATURE_VERSION ENDPOINT_URL
|
dokku postgres:backup-auth lolipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION AWS_SIGNATURE_VERSION ENDPOINT_URL
|
||||||
|
|
||||||
# more specific example for minio auth
|
# more specific example for minio auth
|
||||||
dokku postgres:backup-auth lolipop MINIO_ACCESS_KEY_ID MINIO_SECRET_ACCESS_KEY us-east-1 s3v4 https://YOURMINIOSERVICE
|
dokku postgres:backup-auth lolipop MINIO_ACCESS_KEY_ID MINIO_SECRET_ACCESS_KEY us-east-1 s3v4 https://YOURMINIOSERVICE
|
||||||
```
|
```
|
||||||
@@ -267,7 +268,7 @@ dokku postgres:connect db < ./dump.sql
|
|||||||
## Security
|
## Security
|
||||||
|
|
||||||
The connection to the database is done over SSL. A self-signed certificate is
|
The connection to the database is done over SSL. A self-signed certificate is
|
||||||
automatically generated when creating the service. It can be replaced by a
|
automatically generated when creating the service. It can be replaced by a
|
||||||
custom certificate by overwriting the `server.crt` and `server.key` files in
|
custom certificate by overwriting the `server.crt` and `server.key` files in
|
||||||
`/var/lib/dokku/services/postgres/<DB_NAME>/data`.
|
`/var/lib/dokku/services/postgres/<DB_NAME>/data`.
|
||||||
The `server.key` must be chmoded to 600 and must be owned by the postgres user
|
The `server.key` must be chmoded to 600 and must be owned by the postgres user
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ service_backup() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
docker run $BACKUP_PARAMETERS dokkupaas/s3backup:0.8.0
|
docker run --rm $BACKUP_PARAMETERS dokkupaas/s3backup:0.8.0
|
||||||
}
|
}
|
||||||
|
|
||||||
service_backup_auth() {
|
service_backup_auth() {
|
||||||
@@ -273,6 +273,22 @@ service_backup_unset_encryption() {
|
|||||||
rm -rf "$SERVICE_BACKUP_ENCRYPTION_ROOT"
|
rm -rf "$SERVICE_BACKUP_ENCRYPTION_ROOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service_container_rm() {
|
||||||
|
declare desc="Stops a service and removes the running container"
|
||||||
|
declare SERVICE="$1"
|
||||||
|
local SERVICE_NAME="$(get_service_name "$SERVICE")"
|
||||||
|
|
||||||
|
service_stop "$SERVICE"
|
||||||
|
local ID=$(docker inspect "$SERVICE_NAME" -f '{{ .ID }}' 2> /dev/null || true)
|
||||||
|
[[ -z "$ID" ]] && return 0
|
||||||
|
|
||||||
|
dokku_log_verbose_quiet "Removing container"
|
||||||
|
docker update --restart=no "$SERVICE_NAME" > /dev/null 2>&1
|
||||||
|
if ! docker rm "$SERVICE_NAME" > /dev/null 2>&1; then
|
||||||
|
dokku_log_fail "Unable to remove container for service $SERVICE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
service_enter() {
|
service_enter() {
|
||||||
declare desc="enters running app container of specified proc type"
|
declare desc="enters running app container of specified proc type"
|
||||||
declare SERVICE="$1" && shift 1
|
declare SERVICE="$1" && shift 1
|
||||||
@@ -300,6 +316,17 @@ service_exposed_ports() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service_image_exists() {
|
||||||
|
declare desc="Checks if the current image exists"
|
||||||
|
local IMAGE="$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION"
|
||||||
|
|
||||||
|
if [[ "$(docker images -q "$IMAGE" 2> /dev/null)" == "" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
service_info() {
|
service_info() {
|
||||||
declare desc="Retrieves information about a given service"
|
declare desc="Retrieves information about a given service"
|
||||||
declare SERVICE="$1" INFO_FLAG="$2"
|
declare SERVICE="$1" INFO_FLAG="$2"
|
||||||
@@ -414,7 +441,11 @@ service_list() {
|
|||||||
if [[ -z $SERVICES ]]; then
|
if [[ -z $SERVICES ]]; then
|
||||||
dokku_log_warn "There are no $PLUGIN_SERVICE services"
|
dokku_log_warn "There are no $PLUGIN_SERVICE services"
|
||||||
else
|
else
|
||||||
LIST="NAME,VERSION,STATUS,EXPOSED PORTS,LINKS\n"
|
LIST=""
|
||||||
|
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||||
|
LIST="NAME,VERSION,STATUS,EXPOSED PORTS,LINKS\n"
|
||||||
|
fi
|
||||||
|
|
||||||
for SERVICE in $SERVICES; do
|
for SERVICE in $SERVICES; do
|
||||||
LIST+="$SERVICE,$(service_version "$SERVICE"),$(service_status "$SERVICE"),$(service_exposed_ports "$SERVICE"),$(service_linked_apps "$SERVICE")\n"
|
LIST+="$SERVICE,$(service_version "$SERVICE"),$(service_status "$SERVICE"),$(service_exposed_ports "$SERVICE"),$(service_linked_apps "$SERVICE")\n"
|
||||||
done
|
done
|
||||||
@@ -448,24 +479,24 @@ service_parse_args() {
|
|||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
shift
|
shift
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
"--config-options") set -- "$@" "-c" ;;
|
"--alias") set -- "$@" "-a" ;;
|
||||||
"--custom-env") set -- "$@" "-C" ;;
|
"--config-options") set -- "$@" "-c" ;;
|
||||||
"--image") set -- "$@" "-i" ;;
|
"--custom-env") set -- "$@" "-C" ;;
|
||||||
"--image-version") set -- "$@" "-I" ;;
|
"--database") set -- "$@" "-d" ;;
|
||||||
"--password") set -- "$@" "-p" ;;
|
"--image-version") set -- "$@" "-I" ;;
|
||||||
"--root-password") set -- "$@" "-r" ;;
|
"--image") set -- "$@" "-i" ;;
|
||||||
|
"--memory") set -- "$@" "-m" ;;
|
||||||
"--alias") set -- "$@" "-a" ;;
|
"--password") set -- "$@" "-p" ;;
|
||||||
"--database") set -- "$@" "-d" ;;
|
"--querystring") set -- "$@" "-q" ;;
|
||||||
"--memory") set -- "$@" "-m" ;;
|
"--restart-apps") set -- "$@" "-R" ;;
|
||||||
"--querystring") set -- "$@" "-q" ;;
|
"--root-password") set -- "$@" "-r" ;;
|
||||||
"--user") set -- "$@" "-u" ;;
|
"--user") set -- "$@" "-u" ;;
|
||||||
*) set -- "$@" "$arg"
|
*) set -- "$@" "$arg"
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
OPTIND=1
|
OPTIND=1
|
||||||
while getopts "a:c:C:d:i:I:m:p:q:r:u:" opt; do
|
while getopts "a:c:C:d:i:I:m:p:q:R:r:u:" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
a)
|
a)
|
||||||
SERVICE_ALIAS="${OPTARG^^}"; export SERVICE_ALIAS="${SERVICE_ALIAS%_URL}"
|
SERVICE_ALIAS="${OPTARG^^}"; export SERVICE_ALIAS="${SERVICE_ALIAS%_URL}"
|
||||||
@@ -486,6 +517,8 @@ service_parse_args() {
|
|||||||
;;
|
;;
|
||||||
q) export SERVICE_QUERYSTRING=${OPTARG#"?"}
|
q) export SERVICE_QUERYSTRING=${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
|
||||||
@@ -634,7 +667,7 @@ service_stop() {
|
|||||||
declare SERVICE="$1"
|
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 SERVICE_NAME="$(get_service_name "$SERVICE")"
|
||||||
local ID=$(docker ps -f status=running | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
local ID=$(docker ps -f status=running --no-trunc | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
||||||
[[ -z $ID ]] && dokku_log_warn "Service is already stopped" && return 0
|
[[ -z $ID ]] && dokku_log_warn "Service is already stopped" && return 0
|
||||||
|
|
||||||
if [[ -n $ID ]]; then
|
if [[ -n $ID ]]; then
|
||||||
|
|||||||
2
config
2
config
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
export POSTGRES_IMAGE=${POSTGRES_IMAGE:="postgres"}
|
export POSTGRES_IMAGE=${POSTGRES_IMAGE:="postgres"}
|
||||||
export POSTGRES_IMAGE_VERSION=${POSTGRES_IMAGE_VERSION:="10.2"}
|
export POSTGRES_IMAGE_VERSION=${POSTGRES_IMAGE_VERSION:="10.4"}
|
||||||
export POSTGRES_ROOT=${POSTGRES_ROOT:="/var/lib/dokku/services/postgres"}
|
export POSTGRES_ROOT=${POSTGRES_ROOT:="/var/lib/dokku/services/postgres"}
|
||||||
export POSTGRES_HOST_ROOT=${POSTGRES_HOST_ROOT:=$POSTGRES_ROOT}
|
export POSTGRES_HOST_ROOT=${POSTGRES_HOST_ROOT:=$POSTGRES_ROOT}
|
||||||
|
|
||||||
|
|||||||
13
functions
13
functions
@@ -29,7 +29,7 @@ service_create() {
|
|||||||
|
|
||||||
service_parse_args "${@:2}"
|
service_parse_args "${@:2}"
|
||||||
|
|
||||||
if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q " $PLUGIN_IMAGE_VERSION " ; then
|
if ! service_image_exists "$SERVICE"; then
|
||||||
if [[ "$PLUGIN_DISABLE_PULL" == "true" ]]; then
|
if [[ "$PLUGIN_DISABLE_PULL" == "true" ]]; then
|
||||||
dokku_log_warn "${PLUGIN_DISABLE_PULL_VARIABLE} environment variable detected. Not running pull command." 1>&2
|
dokku_log_warn "${PLUGIN_DISABLE_PULL_VARIABLE} environment variable detected. Not running pull command." 1>&2
|
||||||
dokku_log_warn " docker pull ${IMAGE}" 1>&2
|
dokku_log_warn " docker pull ${IMAGE}" 1>&2
|
||||||
@@ -81,7 +81,7 @@ service_create_container() {
|
|||||||
service_stop "$SERVICE" > /dev/null
|
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
|
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 | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
PREVIOUS_ID=$(docker ps -f status=exited --no-trunc | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
||||||
docker start "$PREVIOUS_ID" > /dev/null
|
docker start "$PREVIOUS_ID" > /dev/null
|
||||||
service_port_unpause "$SERVICE"
|
service_port_unpause "$SERVICE"
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ service_import() {
|
|||||||
if [[ -t 0 ]]; then
|
if [[ -t 0 ]]; then
|
||||||
dokku_log_fail "No data provided on stdin."
|
dokku_log_fail "No data provided on stdin."
|
||||||
fi
|
fi
|
||||||
docker exec -i "$SERVICE_NAME" env PGPASSWORD="$PASSWORD" pg_restore -h localhost -cO -d "$DATABASE_NAME" -U postgres -w
|
docker exec -i "$SERVICE_NAME" env PGPASSWORD="$PASSWORD" pg_restore -h localhost -cO --if-exists -d "$DATABASE_NAME" -U postgres -w
|
||||||
}
|
}
|
||||||
|
|
||||||
service_start() {
|
service_start() {
|
||||||
@@ -122,22 +122,21 @@ service_start() {
|
|||||||
local QUIET="$2"
|
local QUIET="$2"
|
||||||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||||
local SERVICE_NAME="$(get_service_name "$SERVICE")"
|
local SERVICE_NAME="$(get_service_name "$SERVICE")"
|
||||||
local ID=$(docker ps -f status=running | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
local ID=$(docker ps -f status=running --no-trunc | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
||||||
if [[ -n $ID ]]; then
|
if [[ -n $ID ]]; then
|
||||||
[[ -z $QUIET ]] && dokku_log_warn "Service is already started"
|
[[ -z $QUIET ]] && dokku_log_warn "Service is already started"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dokku_log_info2_quiet "Starting container"
|
dokku_log_info2_quiet "Starting container"
|
||||||
local PREVIOUS_ID=$(docker ps -f status=exited | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
local PREVIOUS_ID=$(docker ps -f status=exited --no-trunc | grep -e "$SERVICE_NAME$" | awk '{print $1}') || true
|
||||||
local IMAGE_EXISTS=$(docker images | grep -e "^$PLUGIN_IMAGE " | grep -q " $PLUGIN_IMAGE_VERSION " && true)
|
|
||||||
local PASSWORD="$(cat "$SERVICE_ROOT/PASSWORD")"
|
local PASSWORD="$(cat "$SERVICE_ROOT/PASSWORD")"
|
||||||
|
|
||||||
if [[ -n $PREVIOUS_ID ]]; then
|
if [[ -n $PREVIOUS_ID ]]; then
|
||||||
docker start "$PREVIOUS_ID" > /dev/null
|
docker start "$PREVIOUS_ID" > /dev/null
|
||||||
service_port_unpause "$SERVICE"
|
service_port_unpause "$SERVICE"
|
||||||
dokku_log_info2 "Container started"
|
dokku_log_info2 "Container started"
|
||||||
elif $IMAGE_EXISTS && [[ -n "$PASSWORD" ]]; then
|
elif service_image_exists "$SERVICE" && [[ -n "$PASSWORD" ]]; then
|
||||||
service_create_container "$SERVICE"
|
service_create_container "$SERVICE"
|
||||||
else
|
else
|
||||||
dokku_log_verbose_quiet "Neither container nor valid configuration exists for $SERVICE"
|
dokku_log_verbose_quiet "Neither container nor valid configuration exists for $SERVICE"
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ fn-help() {
|
|||||||
|
|
||||||
fn-help-all() {
|
fn-help-all() {
|
||||||
declare CMD="$1" SUBCOMMAND="$2"
|
declare CMD="$1" SUBCOMMAND="$2"
|
||||||
local CMD_OUTPUT BLUE BOLD FULL_OUTPUT NORMAL
|
local CMD_OUTPUT BLUE BOLD FULL_OUTPUT NORMAL
|
||||||
FULL_OUTPUT=true
|
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="$(tput bold)"
|
BOLD="$(fn-help-fancy-tput bold)"
|
||||||
NORMAL="\033[m"
|
NORMAL="$(fn-help-fancy-color "\033[m")"
|
||||||
BLUE="\033[0;34m"
|
BLUE="$(fn-help-fancy-color "\033[0;34m")"
|
||||||
CYAN="\033[1;36m"
|
CYAN="$(fn-help-fancy-color "\033[1;36m")"
|
||||||
if [[ -n "$SUBCOMMAND" ]] && [[ "$SUBCOMMAND" != "--all" ]]; then
|
if [[ -n "$SUBCOMMAND" ]] && [[ "$SUBCOMMAND" != "--all" ]]; then
|
||||||
fn-help-contents-subcommand "$SUBCOMMAND" "$FULL_OUTPUT"
|
fn-help-contents-subcommand "$SUBCOMMAND" "$FULL_OUTPUT"
|
||||||
return "$?"
|
return "$?"
|
||||||
@@ -76,7 +76,7 @@ fn-help-contents() {
|
|||||||
fn-help-contents-subcommand() {
|
fn-help-contents-subcommand() {
|
||||||
declare SUBCOMMAND="$1" FULL_OUTPUT="$2"
|
declare SUBCOMMAND="$1" FULL_OUTPUT="$2"
|
||||||
local TMPDIR=$(mktemp -d)
|
local TMPDIR=$(mktemp -d)
|
||||||
local UNCLEAN_FILE="${TMPDIR}cmd-unclean" CLEAN_FILE="${TMPDIR}cmd-clean"
|
local UNCLEAN_FILE="${TMPDIR}/cmd-unclean" CLEAN_FILE="${TMPDIR}/cmd-clean"
|
||||||
local BOLD CMD_OUTPUT CYAN EXAMPLE LIGHT_GRAY NORMAL
|
local BOLD CMD_OUTPUT CYAN EXAMPLE LIGHT_GRAY NORMAL
|
||||||
trap 'rm -rf "$TMPDIR" > /dev/null' RETURN INT TERM EXIT
|
trap 'rm -rf "$TMPDIR" > /dev/null' RETURN INT TERM EXIT
|
||||||
|
|
||||||
@@ -95,12 +95,12 @@ fn-help-contents-subcommand() {
|
|||||||
desc="$(grep desc "$CLEAN_FILE" | head -1)"
|
desc="$(grep desc "$CLEAN_FILE" | head -1)"
|
||||||
eval "$desc"
|
eval "$desc"
|
||||||
|
|
||||||
BLUE="\033[0;34m"
|
BLUE="$(fn-help-fancy-color "\033[0;34m")"
|
||||||
BOLD="$(tput bold)"
|
BOLD="$(fn-help-fancy-tput bold)"
|
||||||
CYAN="\033[1;36m"
|
CYAN="$(fn-help-fancy-color "\033[1;36m")"
|
||||||
NORMAL="\033[m"
|
NORMAL="$(fn-help-fancy-color "\033[m")"
|
||||||
LIGHT_GRAY="\033[2;37m"
|
LIGHT_GRAY="$(fn-help-fancy-color "\033[2;37m")"
|
||||||
LIGHT_RED="\033[1;31m"
|
LIGHT_RED="$(fn-help-fancy-color "\033[1;31m")"
|
||||||
CMD_OUTPUT="$(echo -e " ${PLUGIN_COMMAND_PREFIX}${cmd_line}, ${LIGHT_GRAY}${desc}${NORMAL}")"
|
CMD_OUTPUT="$(echo -e " ${PLUGIN_COMMAND_PREFIX}${cmd_line}, ${LIGHT_GRAY}${desc}${NORMAL}")"
|
||||||
if [[ "$FULL_OUTPUT" != "true" ]]; then
|
if [[ "$FULL_OUTPUT" != "true" ]]; then
|
||||||
echo "$CMD_OUTPUT"
|
echo "$CMD_OUTPUT"
|
||||||
@@ -139,6 +139,26 @@ fn-help-contents-subcommand() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn-help-fancy-tput() {
|
||||||
|
declare desc="A wrapper around tput"
|
||||||
|
|
||||||
|
if [[ -n "$DOKKU_NO_COLOR" ]] || [[ "$TERM" = "unknown" ]] || [[ "$TERM" == "dumb" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
tput "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn-help-fancy-color() {
|
||||||
|
declare desc="A wrapper around colors"
|
||||||
|
|
||||||
|
if [[ -n "$DOKKU_NO_COLOR" ]] || [[ "$TERM" = "unknown" ]] || [[ "$TERM" == "dumb" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$@"
|
||||||
|
}
|
||||||
|
|
||||||
fn-help-list-example() {
|
fn-help-list-example() {
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
declare desc="return $PLUGIN_COMMAND_PREFIX plugin help content"
|
declare desc="return $PLUGIN_COMMAND_PREFIX plugin help content"
|
||||||
@@ -153,8 +173,8 @@ fn-help-subcommand-args() {
|
|||||||
local argline arglist args argpos BLUE NORMAL
|
local argline arglist args argpos BLUE NORMAL
|
||||||
|
|
||||||
if [[ "$FULL_OUTPUT" == "true" ]]; then
|
if [[ "$FULL_OUTPUT" == "true" ]]; then
|
||||||
BLUE="\033[0;34m"
|
BLUE="$(fn-help-fancy-color "\033[0;34m")"
|
||||||
NORMAL="\033[m"
|
NORMAL="$(fn-help-fancy-color "\033[m")"
|
||||||
fi
|
fi
|
||||||
argline=$(grep declare "$FUNC_FILE" | grep -v "declare desc" | head -1 || true)
|
argline=$(grep declare "$FUNC_FILE" | grep -v "declare desc" | head -1 || true)
|
||||||
arglist=($(echo -e "${argline// /"\n"}" | awk -F= '/=/{print ""$1""}'))
|
arglist=($(echo -e "${argline// /"\n"}" | awk -F= '/=/{print ""$1""}'))
|
||||||
@@ -199,12 +219,12 @@ fn-help-subcommand-example() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BOLD="$(tput bold)"
|
BOLD="$(fn-help-fancy-tput bold)"
|
||||||
LAST_LINE=""
|
LAST_LINE=""
|
||||||
LIGHT_GRAY="\033[2;37m"
|
LIGHT_GRAY="$(fn-help-fancy-color "\033[2;37m")"
|
||||||
OTHER_GRAY="\033[7;37m"
|
OTHER_GRAY="$(fn-help-fancy-color "\033[7;37m")"
|
||||||
NEWLINE=""
|
NEWLINE=""
|
||||||
NORMAL="\033[m"
|
NORMAL="$(fn-help-fancy-color "\033[m")"
|
||||||
_fn-help-apply-shell-expansion "$EXAMPLE" | while read -r line; do
|
_fn-help-apply-shell-expansion "$EXAMPLE" | while read -r line; do
|
||||||
line="$(echo "$line" | cut -c 4-)"
|
line="$(echo "$line" | cut -c 4-)"
|
||||||
if [[ "$line" == export* ]] || [[ "$line" == dokku* ]]; then
|
if [[ "$line" == export* ]] || [[ "$line" == dokku* ]]; then
|
||||||
@@ -234,10 +254,10 @@ fn-help-subcommand-list-args() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NORMAL="\033[m"
|
NORMAL="$(fn-help-fancy-color "\033[m")"
|
||||||
LIGHT_GRAY="\033[2;37m"
|
LIGHT_GRAY="$(fn-help-fancy-color "\033[2;37m")"
|
||||||
|
|
||||||
_fn-help-apply-shell-expansion "$FLAGS" | while read -r line; do
|
_fn-help-apply-shell-expansion "$FLAGS" | while read -r line; do
|
||||||
echo -e "$(echo "$line" | cut -d',' -f1),${LIGHT_GRAY}$(echo "$line" | cut -d',' -f2-)${NORMAL}"
|
echo -e "$(echo "$line" | cut -d',' -f1),${LIGHT_GRAY}$(echo "$line" | cut -d',' -f2-)${NORMAL}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -251,10 +271,10 @@ fn-help-subcommand-list-flags() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NORMAL="\033[m"
|
NORMAL="$(fn-help-fancy-color "\033[m")"
|
||||||
LIGHT_GRAY="\033[2;37m"
|
LIGHT_GRAY="$(fn-help-fancy-color "\033[2;37m")"
|
||||||
|
|
||||||
_fn-help-apply-shell-expansion "$FLAGS" | while read -r line; do
|
_fn-help-apply-shell-expansion "$FLAGS" | while read -r line; do
|
||||||
echo -e "$(echo "$line" | cut -d',' -f1),${LIGHT_GRAY}$(echo "$line" | cut -d',' -f2-)${NORMAL}"
|
echo -e "$(echo "$line" | cut -d',' -f1),${LIGHT_GRAY}$(echo "$line" | cut -d',' -f2-)${NORMAL}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[plugin]
|
[plugin]
|
||||||
description = "dokku postgres service plugin"
|
description = "dokku postgres service plugin"
|
||||||
version = "1.3.0"
|
version = "1.4.12"
|
||||||
[plugin.config]
|
[plugin.config]
|
||||||
|
|||||||
@@ -5,19 +5,19 @@ source "$PLUGIN_BASE_PATH/common/functions"
|
|||||||
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
|
||||||
|
|
||||||
service-backup-set-encryption-cmd() {
|
service-backup-set-encryption-cmd() {
|
||||||
#E set a GPG encryption key for backups
|
#E set a GPG passphrase for backups
|
||||||
#E dokku $PLUGIN_COMMAND_PREFIX:backup-set-encryption lolipop
|
#E dokku $PLUGIN_COMMAND_PREFIX:backup-set-encryption lolipop
|
||||||
#A service, service to run command against
|
#A service, service to run command against
|
||||||
#A encryption-key, a GPG encryption key
|
#A passphrase, a GPG-compatible passphrase
|
||||||
declare desc="sets encryption for all future backups of $PLUGIN_SERVICE service"
|
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" ENCRYPTION_KEY="$2"
|
declare SERVICE="$1" PASSPHRASE="$2"
|
||||||
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
|
||||||
|
|
||||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
|
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
|
||||||
[[ -z "$ENCRYPTION_KEY" ]] && dokku_log_fail "Please specify a GPG encryption key"
|
[[ -z "$PASSPHRASE" ]] && dokku_log_fail "Please specify a GPG backup passphrase"
|
||||||
verify_service_name "$SERVICE"
|
verify_service_name "$SERVICE"
|
||||||
service_backup_set_encryption "$SERVICE" "$ENCRYPTION_KEY"
|
service_backup_set_encryption "$SERVICE" "$PASSPHRASE"
|
||||||
}
|
}
|
||||||
|
|
||||||
service-backup-set-encryption-cmd "$@"
|
service-backup-set-encryption-cmd "$@"
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ service-clone-cmd() {
|
|||||||
#E dokku $PLUGIN_COMMAND_PREFIX:clone lolipop lolipop-2
|
#E dokku $PLUGIN_COMMAND_PREFIX:clone lolipop lolipop-2
|
||||||
#A service, service to run command against
|
#A service, service to run command against
|
||||||
#A new-service, name of new service
|
#A new-service, name of new service
|
||||||
#F -c|--custom-env "USER=alpha;HOST=beta", semi-colon delimited environment variables to start the service with
|
#F -C|--custom-env "USER=alpha;HOST=beta", semi-colon delimited environment variables to start the service with
|
||||||
#F -i|--image IMAGE, the image name to start the service with
|
#F -i|--image IMAGE, the image name to start the service with
|
||||||
#F -i|--image-version IMAGE_VERSION, the image version to start the service with
|
#F -I|--image-version IMAGE_VERSION, the image version to start the service with
|
||||||
#F -p|--password PASSWORD, override the user-level service password
|
#F -p|--password PASSWORD, override the user-level service password
|
||||||
#F -r|--root-password PASSWORD, override the root-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>"
|
declare desc="create container <new-name> then copy data from <name> into <new-name>"
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ service-create-cmd() {
|
|||||||
#E export ${PLUGIN_DEFAULT_ALIAS}_CUSTOM_ENV="USER=alpha;HOST=beta"
|
#E export ${PLUGIN_DEFAULT_ALIAS}_CUSTOM_ENV="USER=alpha;HOST=beta"
|
||||||
#E dokku $PLUGIN_COMMAND_PREFIX:create lolipop
|
#E dokku $PLUGIN_COMMAND_PREFIX:create lolipop
|
||||||
#A service, service to run command against
|
#A service, service to run command against
|
||||||
#F -c|--custom-env "USER=alpha;HOST=beta", semi-colon delimited environment variables to start the service with
|
#F -C|--custom-env "USER=alpha;HOST=beta", semi-colon delimited environment variables to start the service with
|
||||||
#F -i|--image IMAGE, the image name to start the service with
|
#F -i|--image IMAGE, the image name to start the service with
|
||||||
#F -i|--image-version IMAGE_VERSION, the image version to start the service with
|
#F -I|--image-version IMAGE_VERSION, the image version to start the service with
|
||||||
#F -p|--password PASSWORD, override the user-level service password
|
#F -p|--password PASSWORD, override the user-level service password
|
||||||
#F -r|--root-password PASSWORD, override the root-level service password
|
#F -r|--root-password PASSWORD, override the root-level service password
|
||||||
declare desc="create a $PLUGIN_SERVICE service"
|
declare desc="create a $PLUGIN_SERVICE service"
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ service-destroy-cmd() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
dokku_log_info2_quiet "Deleting $SERVICE"
|
dokku_log_info2_quiet "Deleting $SERVICE"
|
||||||
|
service_backup_unschedule "$SERVICE"
|
||||||
if [[ -n $(docker ps -aq -f name="$SERVICE_NAME") ]]; then
|
if [[ -n $(docker ps -aq -f name="$SERVICE_NAME") ]]; then
|
||||||
dokku_log_verbose_quiet "Deleting container data"
|
dokku_log_verbose_quiet "Deleting container data"
|
||||||
service_stop "$SERVICE"
|
service_stop "$SERVICE"
|
||||||
|
|||||||
61
subcommands/upgrade
Executable file
61
subcommands/upgrade
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
|
||||||
|
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"
|
||||||
|
|
||||||
|
service-upgrade-cmd() {
|
||||||
|
#E you can upgrade an existing service to a new image or image-version
|
||||||
|
#E dokku $PLUGIN_COMMAND_PREFIX:upgrade lolipop
|
||||||
|
#A service, service to run command against
|
||||||
|
#F -C|--custom-env "USER=alpha;HOST=beta", semi-colon delimited environment variables to start the service with
|
||||||
|
#F -i|--image IMAGE, the image name to start the service with
|
||||||
|
#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
|
||||||
|
declare SERVICE="$1" UPGRADE_FLAGS_LIST="${@:2}"
|
||||||
|
|
||||||
|
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
|
||||||
|
verify_service_name "$SERVICE"
|
||||||
|
|
||||||
|
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||||
|
|
||||||
|
service_parse_args "${@:2}"
|
||||||
|
|
||||||
|
if ! service_image_exists "$SERVICE"; then
|
||||||
|
dokku_log_fail "Unable to proceed with upgrade, image ${PLUGIN_IMAGE}:${PLUGIN_IMAGE_VERSION} does not exist"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local NEW_PLUGIN_IMAGE_TAG="$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION"
|
||||||
|
if [[ "$(service_version "$SERVICE")" == "$NEW_PLUGIN_IMAGE_TAG" ]]; then
|
||||||
|
dokku_log_info1 "Service $SERVICE already running $NEW_PLUGIN_IMAGE_TAG"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
dokku_log_info2 "Upgrading $SERVICE to $NEW_PLUGIN_IMAGE_TAG"
|
||||||
|
if [[ "$SERVICE_RESTART_APPS" == "true" ]]; then
|
||||||
|
dokku_log_info2 "Stopping all linked services"
|
||||||
|
for app in $(service_linked_apps "$SERVICE"); do
|
||||||
|
[[ "$app" == "-" ]] && continue
|
||||||
|
ps_stop "$app"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
dokku_log_info2 "Stopping $SERVICE"
|
||||||
|
service_container_rm "$SERVICE"
|
||||||
|
service_start "$SERVICE" "${@:2}"
|
||||||
|
|
||||||
|
if [[ "$SERVICE_RESTART_APPS" == "true" ]]; then
|
||||||
|
dokku_log_info2 "Starting all linked services"
|
||||||
|
for app in $(service_linked_apps "$SERVICE"); do
|
||||||
|
[[ "$app" == "-" ]] && continue
|
||||||
|
ps_start "$app"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
dokku_log_info2 "Done"
|
||||||
|
}
|
||||||
|
|
||||||
|
service-upgrade-cmd "$@"
|
||||||
@@ -22,7 +22,7 @@ case "$1" in
|
|||||||
echo "mongo 3.2.9 12eadb136159 2 days ago 291.1 MB"
|
echo "mongo 3.2.9 12eadb136159 2 days ago 291.1 MB"
|
||||||
echo "mysql 5.7.12 57d56ac47bed 2 days ago 321.3 MB"
|
echo "mysql 5.7.12 57d56ac47bed 2 days ago 321.3 MB"
|
||||||
echo "nats 0.9.4 9216d5a4eec8 2 days ago 109.3 MB"
|
echo "nats 0.9.4 9216d5a4eec8 2 days ago 109.3 MB"
|
||||||
echo "postgres 10.2 6412eb70175e 2 days ago 265.7 MB"
|
echo "postgres 10.4 6412eb70175e 2 days ago 265.7 MB"
|
||||||
echo "rabbitmq 3.6.5-management 327b803301e9 2 days ago 143.5 MB"
|
echo "rabbitmq 3.6.5-management 327b803301e9 2 days ago 143.5 MB"
|
||||||
echo "redis 3.2.3 9216d5a4eec8 2 days ago 109.3 MB"
|
echo "redis 3.2.3 9216d5a4eec8 2 days ago 109.3 MB"
|
||||||
echo "rethinkdb 2.3.4 f27010a550ec 2 days ago 196.3 MB"
|
echo "rethinkdb 2.3.4 f27010a550ec 2 days ago 196.3 MB"
|
||||||
@@ -71,7 +71,7 @@ case "$1" in
|
|||||||
echo 'c0f74fc90377 mongo:3.2.9 "/entrypoint.sh mong" 11 seconds ago Up 10 seconds 27017/tcp dokku.mongo.l'
|
echo 'c0f74fc90377 mongo:3.2.9 "/entrypoint.sh mong" 11 seconds ago Up 10 seconds 27017/tcp dokku.mongo.l'
|
||||||
echo '0f33b1c86da9 mysql:5.7.12 "/entrypoint.sh mysq" 11 seconds ago Up 10 seconds 3306/tcp dokku.mysql.l'
|
echo '0f33b1c86da9 mysql:5.7.12 "/entrypoint.sh mysq" 11 seconds ago Up 10 seconds 3306/tcp dokku.mysql.l'
|
||||||
echo '9f10b6dc12d5 nats:0.9.4 "/entrypoint.sh redi" 11 seconds ago Up 10 seconds 4222/tcp dokku.nats.l'
|
echo '9f10b6dc12d5 nats:0.9.4 "/entrypoint.sh redi" 11 seconds ago Up 10 seconds 4222/tcp dokku.nats.l'
|
||||||
echo '7f899b723c08 postgres:10.2 "/docker-entrypoint." 11 seconds ago Up 10 seconds 5432/tcp dokku.postgres.l'
|
echo '7f899b723c08 postgres:10.4 "/docker-entrypoint." 11 seconds ago Up 10 seconds 5432/tcp dokku.postgres.l'
|
||||||
echo '5e50a462661e rabbitmq:3.6.5-management "/docker-entrypoint." 11 seconds ago Up 10 seconds 5672/tcp, 15672/tcp dokku.rabbitmq.l'
|
echo '5e50a462661e rabbitmq:3.6.5-management "/docker-entrypoint." 11 seconds ago Up 10 seconds 5672/tcp, 15672/tcp dokku.rabbitmq.l'
|
||||||
echo 'c39ca00fa3c6 redis:3.2.3 "/entrypoint.sh redi" 11 seconds ago Up 10 seconds 6379/tcp dokku.redis.l'
|
echo 'c39ca00fa3c6 redis:3.2.3 "/entrypoint.sh redi" 11 seconds ago Up 10 seconds 6379/tcp dokku.redis.l'
|
||||||
echo 'dc98c2939a80 rethinkdb:2.3.4 "rethinkdb --bind al" 11 seconds ago Up 10 seconds 8080/tcp, 28015/tcp, 29015/tcp dokku.rethinkdb.l'
|
echo 'dc98c2939a80 rethinkdb:2.3.4 "rethinkdb --bind al" 11 seconds ago Up 10 seconds 8080/tcp, 28015/tcp, 29015/tcp dokku.rethinkdb.l'
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ teardown() {
|
|||||||
export ECHO_DOCKER_COMMAND="true"
|
export ECHO_DOCKER_COMMAND="true"
|
||||||
run dokku "$PLUGIN_COMMAND_PREFIX:import" l < "$PLUGIN_DATA_ROOT/fake.dump"
|
run dokku "$PLUGIN_COMMAND_PREFIX:import" l < "$PLUGIN_DATA_ROOT/fake.dump"
|
||||||
password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
||||||
assert_output "docker exec -i dokku.postgres.l env PGPASSWORD=$password pg_restore -h localhost -cO -d l -U postgres -w"
|
assert_output "docker exec -i dokku.postgres.l env PGPASSWORD=$password pg_restore -h localhost -cO --if-exists -d l -U postgres -w"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,20 +11,20 @@ teardown() {
|
|||||||
|
|
||||||
@test "($PLUGIN_COMMAND_PREFIX:list) with no exposed ports, no linked apps" {
|
@test "($PLUGIN_COMMAND_PREFIX:list) with no exposed ports, no linked apps" {
|
||||||
run dokku "$PLUGIN_COMMAND_PREFIX:list"
|
run dokku "$PLUGIN_COMMAND_PREFIX:list"
|
||||||
assert_contains "${lines[*]}" "l postgres:10.2 running - -"
|
assert_contains "${lines[*]}" "l postgres:10.4 running - -"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "($PLUGIN_COMMAND_PREFIX:list) with exposed ports" {
|
@test "($PLUGIN_COMMAND_PREFIX:list) with exposed ports" {
|
||||||
dokku "$PLUGIN_COMMAND_PREFIX:expose" l 4242
|
dokku "$PLUGIN_COMMAND_PREFIX:expose" l 4242
|
||||||
run dokku "$PLUGIN_COMMAND_PREFIX:list"
|
run dokku "$PLUGIN_COMMAND_PREFIX:list"
|
||||||
assert_contains "${lines[*]}" "l postgres:10.2 running 5432->4242 -"
|
assert_contains "${lines[*]}" "l postgres:10.4 running 5432->4242 -"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "($PLUGIN_COMMAND_PREFIX:list) with linked app" {
|
@test "($PLUGIN_COMMAND_PREFIX:list) with linked app" {
|
||||||
dokku apps:create my_app
|
dokku apps:create my_app
|
||||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
|
||||||
run dokku "$PLUGIN_COMMAND_PREFIX:list"
|
run dokku "$PLUGIN_COMMAND_PREFIX:list"
|
||||||
assert_contains "${lines[*]}" "l postgres:10.2 running - my_app"
|
assert_contains "${lines[*]}" "l postgres:10.4 running - my_app"
|
||||||
dokku --force apps:destroy my_app
|
dokku --force apps:destroy my_app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1
tests/test_helper.bash
Normal file → Executable file
1
tests/test_helper.bash
Normal file → Executable file
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
export DOKKU_QUIET_OUTPUT=1
|
|
||||||
export DOKKU_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/dokku"
|
export DOKKU_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/dokku"
|
||||||
export DOKKU_VERSION=${DOKKU_VERSION:-"master"}
|
export DOKKU_VERSION=${DOKKU_VERSION:-"master"}
|
||||||
export PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/bin:$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/dokku:$PATH"
|
export PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/bin:$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/dokku:$PATH"
|
||||||
|
|||||||
Reference in New Issue
Block a user