Compare commits

..

18 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
33d6f2dc7b Release 1.19.2 2022-01-22 04:12:12 -05:00
Jose Diaz-Gonzalez
f4f2ed9961 Release 1.19.1 2022-01-22 03:53:46 -05:00
Jose Diaz-Gonzalez
ef34f5ba55 Merge pull request #137 from dokku/dependabot/docker/mysql-8.0.28
chore(deps): bump mysql from 8.0.27 to 8.0.28
2022-01-22 03:53:31 -05:00
dependabot[bot]
474b39cf3c chore(deps): bump mysql from 8.0.27 to 8.0.28
Bumps mysql from 8.0.27 to 8.0.28.

---
updated-dependencies:
- dependency-name: mysql
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-21 03:09:01 +00:00
Jose Diaz-Gonzalez
0a4ddba4d6 Release 1.19.0 2021-12-25 16:49:57 -05:00
Jose Diaz-Gonzalez
57db31f4ed feat: add ability to skip restarts when linking datastores
This allows multiple datastores to be linked at a given time, thus decreasing provisioning times.
2021-12-25 16:44:15 -05:00
Jose Diaz-Gonzalez
8fffd08c9d Release 1.18.0 2021-10-26 22:27:50 -04:00
Jose Diaz-Gonzalez
90cd95c1b1 feat: allow tailing a specific number of log lines 2021-10-26 22:27:13 -04:00
Jose Diaz-Gonzalez
d9078421f3 Release 1.17.1 2021-10-24 05:17:35 -04:00
Jose Diaz-Gonzalez
723a6cd98d fix: silence config-options error when there are no config-options set 2021-10-24 05:08:26 -04:00
Jose Diaz-Gonzalez
17f91e1682 Release 1.17.0 2021-10-23 19:33:56 -04:00
Jose Diaz-Gonzalez
6b0964bf9b feat: allow quiet header for :info command 2021-10-23 19:33:17 -04:00
Jose Diaz-Gonzalez
79622cb417 Release 1.16.2 2021-10-23 19:30:53 -04:00
Jose Diaz-Gonzalez
9530412ce6 Release 1.16.1 2021-10-19 10:28:57 -04:00
Jose Diaz-Gonzalez
571d475f01 Merge pull request #135 from dokku/dependabot/docker/mysql-8.0.27
chore(deps): bump mysql from 8.0.26 to 8.0.27
2021-10-19 10:26:50 -04:00
dependabot[bot]
fa31179041 chore(deps): bump mysql from 8.0.26 to 8.0.27
Bumps mysql from 8.0.26 to 8.0.27.

---
updated-dependencies:
- dependency-name: mysql
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-19 03:09:07 +00:00
Jose Diaz-Gonzalez
a02cf18df3 Release 1.16.0 2021-10-07 12:05:33 -04:00
Jose Diaz-Gonzalez
bab79e8ef8 fix: start linked datastores when an app is started or restored
This won't _also_ fix issues when an app is deployed as there isn't an exposed hook for it, but it should fix many other issues.

For the app deployment problem, we'll need a new hook upstream.

Refs dokku/dokku-redis#138
2021-09-13 04:54:58 -04:00
8 changed files with 103 additions and 16 deletions

View File

@@ -1 +1 @@
FROM mysql:8.0.26
FROM mysql:8.0.28

View File

@@ -1,6 +1,6 @@
# dokku mysql [![Build Status](https://img.shields.io/github/workflow/status/dokku/dokku-mysql/CI/master?style=flat-square "Build Status")](https://github.com/dokku/dokku-mysql/actions/workflows/ci.yml?query=branch%3Amaster) [![IRC Network](https://img.shields.io/badge/irc-libera-blue.svg?style=flat-square "IRC Libera")](https://webchat.libera.chat/?channels=dokku)
Official mysql plugin for dokku. Currently defaults to installing [mysql 8.0.26](https://hub.docker.com/_/mysql/).
Official mysql plugin for dokku. Currently defaults to installing [mysql 8.0.28](https://hub.docker.com/_/mysql/).
## Requirements
@@ -40,7 +40,7 @@ mysql:link <service> <app> [--link-flags...] # link the mysql service to t
mysql:linked <service> <app> # check if the mysql service is linked to an app
mysql:links <service> # list all apps linked to the mysql service
mysql:list # list all mysql services
mysql:logs <service> [-t|--tail] # print the most recent log(s) for this service
mysql:logs <service> [-t|--tail] <tail-num-optional> # print the most recent log(s) for this service
mysql:promote <service> <app> # promote service <service> as DATABASE_URL in <app>
mysql:restart <service> # graceful shutdown and restart of the mysql service container
mysql:start <service> # start a previously stopped mysql service
@@ -153,12 +153,12 @@ dokku mysql:list
```shell
# usage
dokku mysql:logs <service> [-t|--tail]
dokku mysql:logs <service> [-t|--tail] <tail-num-optional>
```
flags:
- `-t|--tail`: do not stop when end of the logs are reached and wait for additional output
- `-t|--tail [<tail-num>]`: do not stop when end of the logs are reached and wait for additional output
You can tail logs for a particular service:
@@ -172,6 +172,12 @@ By default, logs will not be tailed, but you can do this with the --tail flag:
dokku mysql:logs lollipop --tail
```
The default tail setting is to show all logs, but an initial count can also be specified:
```shell
dokku mysql:logs lollipop --tail 5
```
### link the mysql service to the app
```shell

View File

@@ -451,7 +451,7 @@ service_info() {
local flag_map=(
"--config-dir: ${SERVICE_ROOT}/${PLUGIN_CONFIG_SUFFIX}"
"--config-options: $(cat "$SERVICE_ROOT/CONFIG_OPTIONS")"
"--config-options: $(cat "$SERVICE_ROOT/CONFIG_OPTIONS" 2>/dev/null || true)"
"--data-dir: ${SERVICE_ROOT}/data"
"--dsn: ${SERVICE_URL}"
"--exposed-ports: $(service_exposed_ports "$SERVICE")"
@@ -463,7 +463,7 @@ service_info() {
"--version: $(service_version "$SERVICE")"
)
if [[ -z "$INFO_FLAG" ]]; then
dokku_log_info2 "$SERVICE $PLUGIN_COMMAND_PREFIX service information"
dokku_log_info2_quiet "$SERVICE $PLUGIN_COMMAND_PREFIX service information"
for flag in "${flag_map[@]}"; do
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")"
@@ -533,7 +533,11 @@ service_link() {
fi
[[ -n "$SERVICE_QUERYSTRING" ]] && SERVICE_URL="${SERVICE_URL}?${SERVICE_QUERYSTRING}"
plugn trigger service-action post-link "$SERVICE" "$APP"
config_set "$APP" "${ALIAS}_URL=$SERVICE_URL"
if [[ "$DOKKU_GLOBAL_FLAGS" == *"--no-restart"* ]]; then
config_set --no-restart "$APP" "${ALIAS}_URL=$SERVICE_URL"
else
config_set "$APP" "${ALIAS}_URL=$SERVICE_URL"
fi
plugn trigger service-action post-link-complete "$SERVICE" "$APP"
}
@@ -578,14 +582,14 @@ service_list() {
service_logs() {
declare desc="display logs for a service"
declare SERVICE="$1" TAIL_FLAG="$2"
declare SERVICE="$1" TAIL_FLAG="$2" TAIL_COUNT="$3"
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
local ID=$(cat "$SERVICE_ROOT/ID")
local RE_INTEGER='^[0-9]+$'
DOKKU_LOGS_ARGS="--tail 100"
DOKKU_LOGS_ARGS="--tail $TAIL_COUNT"
if [[ "$TAIL_FLAG" == "-t" ]] || [[ "$TAIL_FLAG" == "--tail" ]]; then
DOKKU_LOGS_ARGS="--follow"
DOKKU_LOGS_ARGS+=" --follow"
fi
docker inspect "$ID" &>/dev/null || dokku_log_fail "Service container does not exist"
@@ -857,7 +861,11 @@ service_unlink() {
[[ -z ${LINK[*]} ]] && dokku_log_fail "Not linked to app $APP"
plugn trigger service-action post-unlink "$SERVICE" "$APP"
config_unset "$APP" "${LINK[@]}"
if [[ "$DOKKU_GLOBAL_FLAGS" == *"--no-restart"* ]]; then
config_unset --no-restart "$APP" "${LINK[@]}"
else
config_unset "$APP" "${LINK[@]}"
fi
plugn trigger service-action post-unlink-complete "$SERVICE" "$APP"
}

View File

@@ -202,6 +202,9 @@ fn-help-subcommand-args() {
elif [[ "$arg" == *_LIST ]]; then
arg=${arg%_*}
args+=" <${arg//_/-}...>"
elif [[ "$arg" == *_OPTIONAL ]]; then
argName="${arg/_OPTIONAL/}"
args+=" [<${argName//_/-}>]"
else
args+=" <${arg//_/-}>"
fi

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku mysql service plugin"
version = "1.15.1"
version = "1.19.2"
[plugin.config]

36
pre-restore Executable file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common-functions"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
plugin-pre-restore() {
declare SCHEDULER="$1" APP="$2"
if [[ "$SCHEDULER" != "docker-local" ]]; then
return
fi
local SERVICES=$(ls "$PLUGIN_DATA_ROOT" 2>/dev/null)
for SERVICE in $SERVICES; do
if ! in_links_file "$SERVICE" "$APP"; then
continue
fi
local status="$(service_status "$SERVICE")"
if [[ "$status" == "running" ]]; then
continue
fi
if [[ "$status" == "restarting" ]]; then
dokku_log_warn "$PLUGIN_SERVICE service $SERVICE is restarting and may cause issues with linked app $APP"
continue
fi
dokku_log_warn "$PLUGIN_SERVICE service $SERVICE is not running, issuing service start"
service_start "$SERVICE"
done
}
plugin-pre-restore "$@"

32
pre-start Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common-functions"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
plugin-pre-start() {
declare APP="$1"
local SERVICES=$(ls "$PLUGIN_DATA_ROOT" 2>/dev/null)
for SERVICE in $SERVICES; do
if ! in_links_file "$SERVICE" "$APP"; then
continue
fi
local status="$(service_status "$SERVICE")"
if [[ "$status" == "running" ]]; then
continue
fi
if [[ "$status" == "restarting" ]]; then
dokku_log_warn "$PLUGIN_SERVICE service $SERVICE is restarting and may cause issues with linked app $APP"
continue
fi
dokku_log_warn "$PLUGIN_SERVICE service $SERVICE is not running, issuing service start"
service_start "$SERVICE"
done
}
plugin-pre-start "$@"

View File

@@ -10,16 +10,18 @@ service-logs-cmd() {
#E dokku $PLUGIN_COMMAND_PREFIX:logs lollipop
#E by default, logs will not be tailed, but you can do this with the --tail flag:
#E dokku $PLUGIN_COMMAND_PREFIX:logs lollipop --tail
#E the default tail setting is to show all logs, but an initial count can also be specified
#E dokku $PLUGIN_COMMAND_PREFIX:logs lollipop --tail 5
#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
#F -t|--tail [<tail-num>], 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
declare SERVICE="$1" TAIL_FLAG="$2"
declare SERVICE="$1" TAIL_FLAG="$2" TAIL_NUM_OPTIONAL="${3:-all}"
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
verify_service_name "$SERVICE"
service_logs "$SERVICE" "$TAIL_FLAG"
service_logs "$SERVICE" "$TAIL_FLAG" "$TAIL_NUM_OPTIONAL"
}
service-logs-cmd "$@"