Compare commits

..

8 Commits
1.1.1 ... 1.2.3

Author SHA1 Message Date
Jose Diaz-Gonzalez
4d6105d61b Release 1.2.3 2018-04-23 17:36:58 -04:00
Jose Diaz-Gonzalez
fe9cd93736 chore: standardize on single method of setting backup root. Refs dokku/dokku-redis#91 2018-04-23 17:36:58 -04:00
Jose Diaz-Gonzalez
059fdc7589 Release 1.2.2 2018-04-23 17:11:50 -04:00
Jose Diaz-Gonzalez
6a32161049 fix: properly handle use-iam flag. Closes dokku/dokku-redis#88 2018-04-23 17:11:50 -04:00
Jose Diaz-Gonzalez
ba523dc5ac Release 1.2.1 2018-04-23 15:52:17 -04:00
Jose Diaz-Gonzalez
a29039ecd2 fix: silence errors when a container does not exist. Closes dokku/dokku-redis#85 2018-04-23 15:52:17 -04:00
Jose Diaz-Gonzalez
68e552f143 Release 1.2.0 2018-04-23 14:46:01 -04:00
Jimmy Lin
537667c722 Add backup-schedule-info to cat the CRONFILE 2018-04-23 08:58:38 -04:00
7 changed files with 86 additions and 34 deletions

View File

@@ -21,9 +21,10 @@ postgres:backup <name> <bucket> (--use-iam) Create a backup of the postgres serv
postgres:backup-auth <name> <aws_access_key_id> <aws_secret_access_key> (<aws_default_region>) (<aws_signature_version>) (<endpoint_url>) Sets up authentication for backups on the postgres service postgres:backup-auth <name> <aws_access_key_id> <aws_secret_access_key> (<aws_default_region>) (<aws_signature_version>) (<endpoint_url>) Sets up authentication for backups on the postgres service
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-set-encryption <name> <encryption_key>, Sets up GPG encryption for future backups of the postgres 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-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>
postgres:connect <name> Connect via psql to a postgres service postgres:connect <name> Connect via psql to a postgres service
postgres:create <name> Create a postgres service with environment variables postgres:create <name> Create a postgres service with environment variables
@@ -234,6 +235,9 @@ dokku postgres:backup lolipop BUCKET_NAME
# CRON_SCHEDULE is a crontab expression, eg. "0 3 * * *" for each day at 3am # CRON_SCHEDULE is a crontab expression, eg. "0 3 * * *" for each day at 3am
dokku postgres:backup-schedule lolipop CRON_SCHEDULE BUCKET_NAME dokku postgres:backup-schedule lolipop CRON_SCHEDULE BUCKET_NAME
# cat the contents of the configured backup cronfile for the service
dokku postgres:backup-schedule-cat lolipop
# remove the scheduled backup from cron # remove the scheduled backup from cron
dokku postgres:backup-unschedule lolipop dokku postgres:backup-unschedule lolipop
``` ```

View File

@@ -59,7 +59,7 @@ is_container_status() {
declare desc="Returns 0 or 1 depending upon whether a given container has a certain status" declare desc="Returns 0 or 1 depending upon whether a given container has a certain status"
declare CID="$1" STATUS="$2" declare CID="$1" STATUS="$2"
local TEMPLATE="{{.State.$STATUS}}" local TEMPLATE="{{.State.$STATUS}}"
local CONTAINER_STATUS=$(docker inspect -f "$TEMPLATE" "$CID" || true) local CONTAINER_STATUS=$(docker inspect -f "$TEMPLATE" "$CID" 2> /dev/null || true)
if [[ "$CONTAINER_STATUS" == "true" ]]; then if [[ "$CONTAINER_STATUS" == "true" ]]; then
return 0 return 0
@@ -107,23 +107,26 @@ service_alternative_alias() {
service_backup() { service_backup() {
declare desc="Creates a backup of a service to an existing s3 bucket" declare desc="Creates a backup of a service to an existing s3 bucket"
declare SERVICE="$1" BUCKET_NAME="$2" USE_IAM_OPTIONAL_FLAG="$3" declare SERVICE="$1" BUCKET_NAME="$2" USE_IAM_OPTIONAL_FLAG="$3"
local BACKUP_CONFIG_ROOT="$PLUGIN_DATA_ROOT/$SERVICE/backup" local SERVICE_BACKUP_ROOT="$PLUGIN_DATA_ROOT/$SERVICE/backup"
local BACKUP_ENCRYPTION_CONFIG_ROOT="$PLUGIN_DATA_ROOT/$SERVICE/backup-encryption" local BACKUP_ENCRYPTION_CONFIG_ROOT="$PLUGIN_DATA_ROOT/$SERVICE/backup-encryption"
local AWS_ACCESS_KEY_ID_FILE="$BACKUP_CONFIG_ROOT/AWS_ACCESS_KEY_ID" local AWS_ACCESS_KEY_ID_FILE="$SERVICE_BACKUP_ROOT/AWS_ACCESS_KEY_ID"
local AWS_SECRET_ACCESS_KEY_FILE="$BACKUP_CONFIG_ROOT/AWS_SECRET_ACCESS_KEY" local AWS_SECRET_ACCESS_KEY_FILE="$SERVICE_BACKUP_ROOT/AWS_SECRET_ACCESS_KEY"
local BACKUP_PARAMETERS="" local BACKUP_PARAMETERS=""
if [[ "$USE_IAM_OPTIONAL_FLAG" != "--use-iam" ]] && [[ "$USE_IAM_OPTIONAL_FLAG" != "-u" ]]; then if [[ -z "$USE_IAM_OPTIONAL_FLAG" ]]; then
[[ ! -f "$AWS_ACCESS_KEY_ID_FILE" ]] && dokku_log_fail "Missing AWS_ACCESS_KEY_ID file" [[ ! -f "$AWS_ACCESS_KEY_ID_FILE" ]] && dokku_log_fail "Missing AWS_ACCESS_KEY_ID file"
[[ ! -f "$AWS_SECRET_ACCESS_KEY_FILE" ]] && dokku_log_fail "Missing AWS_SECRET_ACCESS_KEY file" [[ ! -f "$AWS_SECRET_ACCESS_KEY_FILE" ]] && dokku_log_fail "Missing AWS_SECRET_ACCESS_KEY file"
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e AWS_ACCESS_KEY_ID=$(cat "$AWS_ACCESS_KEY_ID_FILE") -e AWS_SECRET_ACCESS_KEY=$(cat "$AWS_SECRET_ACCESS_KEY_FILE")" BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e AWS_ACCESS_KEY_ID=$(cat "$AWS_ACCESS_KEY_ID_FILE") -e AWS_SECRET_ACCESS_KEY=$(cat "$AWS_SECRET_ACCESS_KEY_FILE")"
else elif [[ "$USE_IAM_OPTIONAL_FLAG" != "--use-iam" ]] && [[ "$USE_IAM_OPTIONAL_FLAG" != "-u" ]]; then
dokku_log_fail "Provide AWS credentials or use the --use-iam flag" dokku_log_fail "Provide AWS credentials or use the --use-iam flag"
fi fi
TMPDIR=$(mktemp -d) TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR" > /dev/null' RETURN INT TERM EXIT trap 'rm -rf "$TMPDIR" > /dev/null' RETURN INT TERM EXIT
docker inspect "$ID" &> /dev/null || dokku_log_fail "Service container does not exist"
is_container_status "$ID" "Running" || dokku_log_fail "Service container is not running"
(service_export "$SERVICE" > "${TMPDIR}/export") (service_export "$SERVICE" > "${TMPDIR}/export")
# Build parameter list for s3backup tool # Build parameter list for s3backup tool
@@ -131,16 +134,16 @@ service_backup() {
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e BACKUP_NAME=${PLUGIN_COMMAND_PREFIX}-${SERVICE}" BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e BACKUP_NAME=${PLUGIN_COMMAND_PREFIX}-${SERVICE}"
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -v ${TMPDIR}:/backup" BACKUP_PARAMETERS="$BACKUP_PARAMETERS -v ${TMPDIR}:/backup"
if [[ -f "$BACKUP_CONFIG_ROOT/AWS_DEFAULT_REGION" ]]; then if [[ -f "$SERVICE_BACKUP_ROOT/AWS_DEFAULT_REGION" ]]; then
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e AWS_DEFAULT_REGION=$(cat "$BACKUP_CONFIG_ROOT/AWS_DEFAULT_REGION")" BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e AWS_DEFAULT_REGION=$(cat "$SERVICE_BACKUP_ROOT/AWS_DEFAULT_REGION")"
fi fi
if [[ -f "$BACKUP_CONFIG_ROOT/AWS_SIGNATURE_VERSION" ]]; then if [[ -f "$SERVICE_BACKUP_ROOT/AWS_SIGNATURE_VERSION" ]]; then
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e AWS_SIGNATURE_VERSION=$(cat "$BACKUP_CONFIG_ROOT/AWS_SIGNATURE_VERSION")" BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e AWS_SIGNATURE_VERSION=$(cat "$SERVICE_BACKUP_ROOT/AWS_SIGNATURE_VERSION")"
fi fi
if [[ -f "$BACKUP_CONFIG_ROOT/ENDPOINT_URL" ]]; then if [[ -f "$SERVICE_BACKUP_ROOT/ENDPOINT_URL" ]]; then
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e ENDPOINT_URL=$(cat "$BACKUP_CONFIG_ROOT/ENDPOINT_URL")" BACKUP_PARAMETERS="$BACKUP_PARAMETERS -e ENDPOINT_URL=$(cat "$SERVICE_BACKUP_ROOT/ENDPOINT_URL")"
fi fi
if [[ -f "$BACKUP_ENCRYPTION_CONFIG_ROOT/ENCRYPTION_KEY" ]]; then if [[ -f "$BACKUP_ENCRYPTION_CONFIG_ROOT/ENCRYPTION_KEY" ]]; then
@@ -154,23 +157,22 @@ service_backup() {
service_backup_auth() { service_backup_auth() {
declare desc="Sets up authentication" declare desc="Sets up authentication"
declare SERVICE="$1" AWS_ACCESS_KEY_ID="$2" AWS_SECRET_ACCESS_KEY="$3" AWS_DEFAULT_REGION="$4" AWS_SIGNATURE_VERSION="$5" ENDPOINT_URL="$6" declare SERVICE="$1" AWS_ACCESS_KEY_ID="$2" AWS_SECRET_ACCESS_KEY="$3" AWS_DEFAULT_REGION="$4" AWS_SIGNATURE_VERSION="$5" ENDPOINT_URL="$6"
local SERVICE_ROOT="${PLUGIN_DATA_ROOT}/${SERVICE}" local SERVICE_BACKUP_ROOT="$PLUGIN_DATA_ROOT/$SERVICE/backup"
local SERVICE_BACKUP_ROOT="${SERVICE_ROOT}/backup/"
mkdir -p "$SERVICE_BACKUP_ROOT" mkdir -p "$SERVICE_BACKUP_ROOT"
echo "$AWS_ACCESS_KEY_ID" > "${SERVICE_BACKUP_ROOT}/AWS_ACCESS_KEY_ID" echo "$AWS_ACCESS_KEY_ID" > "$SERVICE_BACKUP_ROOT/AWS_ACCESS_KEY_ID"
echo "$AWS_SECRET_ACCESS_KEY" > "${SERVICE_BACKUP_ROOT}/AWS_SECRET_ACCESS_KEY" echo "$AWS_SECRET_ACCESS_KEY" > "$SERVICE_BACKUP_ROOT/AWS_SECRET_ACCESS_KEY"
if [[ -n "$AWS_DEFAULT_REGION" ]]; then if [[ -n "$AWS_DEFAULT_REGION" ]]; then
echo "$AWS_DEFAULT_REGION" > "${SERVICE_BACKUP_ROOT}/AWS_DEFAULT_REGION" echo "$AWS_DEFAULT_REGION" > "$SERVICE_BACKUP_ROOT/AWS_DEFAULT_REGION"
fi fi
if [[ -n "$AWS_SIGNATURE_VERSION" ]]; then if [[ -n "$AWS_SIGNATURE_VERSION" ]]; then
echo "$AWS_SIGNATURE_VERSION" > "${SERVICE_BACKUP_ROOT}/AWS_SIGNATURE_VERSION" echo "$AWS_SIGNATURE_VERSION" > "$SERVICE_BACKUP_ROOT/AWS_SIGNATURE_VERSION"
fi fi
if [[ -n "$ENDPOINT_URL" ]]; then if [[ -n "$ENDPOINT_URL" ]]; then
echo "$ENDPOINT_URL" > "${SERVICE_BACKUP_ROOT}/ENDPOINT_URL" echo "$ENDPOINT_URL" > "$SERVICE_BACKUP_ROOT/ENDPOINT_URL"
fi fi
} }
@@ -185,17 +187,33 @@ service_backup_deauth() {
service_backup_schedule() { service_backup_schedule() {
declare desc="schedules a backup of the service" declare desc="schedules a backup of the service"
declare SERVICE="$1" SCHEDULE="$2" BUCKET_NAME="$3" declare SERVICE="$1" SCHEDULE="$2" BUCKET_NAME="$3" USE_IAM_OPTIONAL_FLAG="$4"
local DOKKU_BIN="$(which dokku)" local DOKKU_BIN="$(which dokku)"
local CRON_FILE="/etc/cron.d/dokku-${PLUGIN_COMMAND_PREFIX}-${SERVICE}" local CRON_FILE="/etc/cron.d/dokku-${PLUGIN_COMMAND_PREFIX}-${SERVICE}"
local TMP_CRON_FILE="${PLUGIN_DATA_ROOT}/.TMP_CRON_FILE" local TMP_CRON_FILE="${PLUGIN_DATA_ROOT}/.TMP_CRON_FILE"
echo "${SCHEDULE} dokku ${DOKKU_BIN} ${PLUGIN_COMMAND_PREFIX}:backup ${SERVICE} ${BUCKET_NAME}" > "$TMP_CRON_FILE" if [[ -n "$USE_IAM_OPTIONAL_FLAG" ]] && [[ "$USE_IAM_OPTIONAL_FLAG" != "--use-iam" ]] && [[ "$USE_IAM_OPTIONAL_FLAG" != "-u" ]]; then
dokku_log_fail "Invalid flag provided, only '--use-iam' allowed"
fi
echo "${SCHEDULE} dokku ${DOKKU_BIN} ${PLUGIN_COMMAND_PREFIX}:backup ${SERVICE} ${BUCKET_NAME} ${USE_IAM_OPTIONAL_FLAG}" > "$TMP_CRON_FILE"
sudo /bin/mv "$TMP_CRON_FILE" "$CRON_FILE" sudo /bin/mv "$TMP_CRON_FILE" "$CRON_FILE"
sudo /bin/chown root:root "$CRON_FILE" sudo /bin/chown root:root "$CRON_FILE"
sudo /bin/chmod 644 "$CRON_FILE" sudo /bin/chmod 644 "$CRON_FILE"
} }
service_backup_schedule_cat() {
declare desc="cat the contents of the configured backup cronfile for the service"
declare SERVICE="$1"
local CRON_FILE="/etc/cron.d/dokku-${PLUGIN_COMMAND_PREFIX}-${SERVICE}"
if [[ ! -f "$CRON_FILE" ]]; then
dokku_log_fail "There is no scheduled backup for ${SERVICE}."
fi
cat "$CRON_FILE"
}
service_backup_unschedule() { service_backup_unschedule() {
declare desc="unschedules the backup of the service" declare desc="unschedules the backup of the service"
declare SERVICE="$1" declare SERVICE="$1"
@@ -229,8 +247,8 @@ service_enter() {
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE" local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
local ID="$(cat "$SERVICE_ROOT/ID")" local ID="$(cat "$SERVICE_ROOT/ID")"
docker inspect "$ID" &> /dev/null || dokku_log_fail "Container does not exist" docker inspect "$ID" &> /dev/null || dokku_log_fail "Service container does not exist"
is_container_status "$ID" "Running" || dokku_log_fail "Container is not running" is_container_status "$ID" "Running" || dokku_log_fail "Service container is not running"
local EXEC_CMD="" local EXEC_CMD=""
has_tty && local DOKKU_RUN_OPTS+=" -i -t" has_tty && local DOKKU_RUN_OPTS+=" -i -t"
@@ -375,8 +393,11 @@ service_logs() {
DOKKU_LOGS_ARGS="--follow" DOKKU_LOGS_ARGS="--follow"
fi fi
docker inspect "$ID" &> /dev/null || dokku_log_fail "Service container does not exist"
is_container_status "$ID" "Running" || dokku_log_warn "Service logs may not be output as service is not running"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
docker logs $DOKKU_LOGS_ARGS "$ID" docker logs $DOKKU_LOGS_ARGS "$ID" 2> /dev/null
} }
service_parse_args() { service_parse_args() {
@@ -553,13 +574,17 @@ service_status() {
declare SERVICE="$1" declare SERVICE="$1"
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE" local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
local ID="$(cat "$SERVICE_ROOT/ID")" local ID="$(cat "$SERVICE_ROOT/ID")"
local CONTAINER_STATUS
is_container_status "$ID" "Dead" && echo "dead" && return 0 is_container_status "$ID" "Dead" && echo "dead" && return 0
is_container_status "$ID" "OOMKilled" && echo "oomkilled" && return 0 is_container_status "$ID" "OOMKilled" && echo "oomkilled" && return 0
is_container_status "$ID" "Paused" && echo "paused" && return 0 is_container_status "$ID" "Paused" && echo "paused" && return 0
is_container_status "$ID" "Restarting" && echo "restarting" && return 0 is_container_status "$ID" "Restarting" && echo "restarting" && return 0
is_container_status "$ID" "Running" && echo "running" && return 0 is_container_status "$ID" "Running" && echo "running" && return 0
echo "stopped" && return 0
CONTAINER_STATUS=$(docker inspect -f "{{.State.Status}}" "$CID" 2> /dev/null || true)
[[ -n "$CONTAINER_STATUS" ]] && echo "$CONTAINER_STATUS" && return 0
echo "missing" && return 0
} }
service_stop() { service_stop() {
@@ -608,7 +633,7 @@ service_version() {
declare desc="Displays the running version for an image" declare desc="Displays the running version for an image"
declare SERVICE="$1" declare SERVICE="$1"
local SERVICE_NAME="$(get_service_name "$SERVICE")" local SERVICE_NAME="$(get_service_name "$SERVICE")"
docker inspect -f '{{.Config.Image}}' "$SERVICE_NAME" docker inspect -f '{{.Config.Image}}' "$SERVICE_NAME" 2> /dev/null || true
} }
update_plugin_scheme_for_app() { update_plugin_scheme_for_app() {

View File

@@ -75,7 +75,7 @@ service_create_container() {
dokku_log_verbose_quiet "Creating container database" dokku_log_verbose_quiet "Creating container database"
DATABASE_NAME="$(get_database_name "$SERVICE")" DATABASE_NAME="$(get_database_name "$SERVICE")"
docker exec "$SERVICE_NAME" su - postgres -c "createdb -E utf8 $DATABASE_NAME" 2> /dev/null || echo 'Already exists' 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" dokku_log_verbose_quiet "Securing connection to database"
service_stop "$SERVICE" > /dev/null service_stop "$SERVICE" > /dev/null

View File

@@ -1,4 +1,4 @@
[plugin] [plugin]
description = "dokku postgres service plugin" description = "dokku postgres service plugin"
version = "1.1.1" version = "1.2.3"
[plugin.config] [plugin.config]

View File

@@ -7,7 +7,7 @@ source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
service-backup-cmd() { service-backup-cmd() {
#E backup the 'lolipop' service to the 'my-s3-bucket' bucket on AWS #E backup the 'lolipop' service to the 'my-s3-bucket' bucket on AWS
#E dokku $PLUGIN_COMMAND_PREFIX:backup lolipop my-s3-bucket --use-iam #E dokku $PLUGIN_COMMAND_PREFIX:backup lolipop my-s3-bucket --use-iam
#F -i|--use-iam, use the IAM profile associated with the current server #F -u|--use-iam, use the IAM profile associated with the current server
#A service, service to run command against #A service, service to run command against
#A bucket-name, name of the s3 bucket to upload backups to #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" declare desc="creates a backup of the $PLUGIN_SERVICE service to an existing s3 bucket"

View File

@@ -7,19 +7,22 @@ source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
service-backup-schedule-cmd() { service-backup-schedule-cmd() {
#E schedule a backup #E schedule a backup
#E > 'schedule' is a crontab expression, eg. "0 3 * * *" for each day at 3am #E > 'schedule' is a crontab expression, eg. "0 3 * * *" for each day at 3am
#E dokku $PLUGIN_COMMAND_PREFIX:backup-deauth lolipop "0 3 * * *" my-s3-bucket #E dokku $PLUGIN_COMMAND_PREFIX:backup-schedule lolipop "0 3 * * *" my-s3-bucket
#E schedule a backup and authenticate via iam
#E dokku $PLUGIN_COMMAND_PREFIX:backup-schedule lolipop "0 3 * * *" my-s3-bucket --use-iam
#F -u|--use-iam, use the IAM profile associated with the current server
#A service, service to run command against #A service, service to run command against
#A schedule, a cron schedule to run backups on #A schedule, a cron schedule to run backups on
#A bucket-name, name of the s3 bucket to upload backups to #A bucket-name, name of the s3 bucket to upload backups to
declare desc="schedules a backup of the $PLUGIN_SERVICE service" 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" declare SERVICE="$1" SCHEDULE="$2" BUCKET_NAME="$3" USE_IAM_OPTIONAL_FLAG="$4"
[[ -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 "$SCHEDULE" ]] && dokku_log_fail "Please specify a schedule for the backup" [[ -z "$SCHEDULE" ]] && dokku_log_fail "Please specify a schedule for the backup"
[[ -z "$BUCKET_NAME" ]] && dokku_log_fail "Please specify an aws bucket for the backup" [[ -z "$BUCKET_NAME" ]] && dokku_log_fail "Please specify an aws bucket for the backup"
verify_service_name "$SERVICE" verify_service_name "$SERVICE"
service_backup_schedule "$SERVICE" "$SCHEDULE" "$BUCKET_NAME" service_backup_schedule "$SERVICE" "$SCHEDULE" "$BUCKET_NAME" "$USE_IAM_OPTIONAL_FLAG"
} }
service-backup-schedule-cmd "$@" service-backup-schedule-cmd "$@"

20
subcommands/backup-schedule-cat Executable file
View File

@@ -0,0 +1,20 @@
#!/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"
service-backup-schedule-cat-cmd() {
#E cat the contents of the configured backup cronfile for the service
#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
declare SERVICE="$1"
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
verify_service_name "$SERVICE"
service_backup_schedule_cat "$SERVICE"
}
service-backup-schedule-cat-cmd "$@"