Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc8001df6e | ||
|
|
ebf18d0506 | ||
|
|
e2e0f1ce3f | ||
|
|
aabc7aeb24 | ||
|
|
4074970748 | ||
|
|
05513fe247 | ||
|
|
8632f05449 | ||
|
|
415c46a1b0 | ||
|
|
bb4ebfd74b | ||
|
|
54e172dc6b | ||
|
|
d81a1bed26 | ||
|
|
f31800ffa7 | ||
|
|
1ddb84f358 | ||
|
|
aa8e145d9b | ||
|
|
33d6f2dc7b | ||
|
|
f4f2ed9961 | ||
|
|
ef34f5ba55 | ||
|
|
474b39cf3c | ||
|
|
0a4ddba4d6 | ||
|
|
57db31f4ed | ||
|
|
8fffd08c9d | ||
|
|
90cd95c1b1 | ||
|
|
d9078421f3 | ||
|
|
723a6cd98d | ||
|
|
17f91e1682 | ||
|
|
6b0964bf9b | ||
|
|
79622cb417 | ||
|
|
9530412ce6 | ||
|
|
571d475f01 | ||
|
|
fa31179041 |
@@ -1 +1 @@
|
||||
FROM mysql:8.0.26
|
||||
FROM mysql:8.0.29
|
||||
|
||||
18
README.md
18
README.md
@@ -1,6 +1,6 @@
|
||||
# dokku mysql [](https://github.com/dokku/dokku-mysql/actions/workflows/ci.yml?query=branch%3Amaster) [](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.29](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
|
||||
@@ -69,7 +69,7 @@ flags:
|
||||
- `-C|--custom-env "USER=alpha;HOST=beta"`: semi-colon delimited environment variables to start the service with
|
||||
- `-i|--image IMAGE`: the image name to start the service with
|
||||
- `-I|--image-version IMAGE_VERSION`: the image version to start the service with
|
||||
- `-m|--memory MEMORY`: container memory limit (default: unlimited)
|
||||
- `-m|--memory MEMORY`: container memory limit in megabytes (default: unlimited)
|
||||
- `-p|--password PASSWORD`: override the user-level service password
|
||||
- `-r|--root-password PASSWORD`: override the root-level service password
|
||||
- `-s|--shm-size SHM_SIZE`: override shared memory size for mysql docker container
|
||||
@@ -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
|
||||
@@ -435,7 +441,7 @@ flags:
|
||||
- `-C|--custom-env "USER=alpha;HOST=beta"`: semi-colon delimited environment variables to start the service with
|
||||
- `-i|--image IMAGE`: the image name to start the service with
|
||||
- `-I|--image-version IMAGE_VERSION`: the image version to start the service with
|
||||
- `-m|--memory MEMORY`: container memory limit (default: unlimited)
|
||||
- `-m|--memory MEMORY`: container memory limit in megabytes (default: unlimited)
|
||||
- `-p|--password PASSWORD`: override the user-level service password
|
||||
- `-r|--root-password PASSWORD`: override the root-level service password
|
||||
- `-s|--shm-size SHM_SIZE`: override shared memory size for mysql docker container
|
||||
|
||||
@@ -411,6 +411,14 @@ service_enter() {
|
||||
docker exec $DOKKU_RUN_OPTS $ID $EXEC_CMD "${@:-/bin/bash}"
|
||||
}
|
||||
|
||||
service_exists() {
|
||||
declare desc="returns 0 or 1 depending on whether service exists or not"
|
||||
declare SERVICE="$1"
|
||||
[[ -z "$SERVICE" ]] && return 1
|
||||
[[ -d "$PLUGIN_DATA_ROOT/$SERVICE" ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
service_exposed_ports() {
|
||||
declare desc="list exposed ports for a service"
|
||||
declare SERVICE="$1"
|
||||
@@ -451,7 +459,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 +471,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 +541,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 +590,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 +869,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"
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
7
install
7
install
@@ -24,10 +24,10 @@ plugin-install() {
|
||||
pull-docker-image "$PLUGIN_WAIT_IMAGE"
|
||||
|
||||
mkdir -p "$PLUGIN_DATA_ROOT" || echo "Failed to create $PLUGIN_SERVICE data directory"
|
||||
chown dokku:dokku "$PLUGIN_DATA_ROOT"
|
||||
chown "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "$PLUGIN_DATA_ROOT"
|
||||
|
||||
mkdir -p "$PLUGIN_CONFIG_ROOT" || echo "Failed to create $PLUGIN_SERVICE config directory"
|
||||
chown dokku:dokku "$PLUGIN_CONFIG_ROOT"
|
||||
chown "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "$PLUGIN_CONFIG_ROOT"
|
||||
|
||||
rm -f "/etc/sudoers.d/dokku-${PLUGIN_COMMAND_PREFIX}*"
|
||||
_SUDOERS_FILE="/etc/sudoers.d/dokku-${PLUGIN_COMMAND_PREFIX}"
|
||||
@@ -56,8 +56,11 @@ EOL
|
||||
fi
|
||||
fi
|
||||
|
||||
chown "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "$SERVICE_ROOT/IMAGE" "$SERVICE_ROOT/IMAGE_VERSION"
|
||||
|
||||
if [[ -f "$SERVICE_ROOT/${PLUGIN_VARIABLE}_CONFIG_OPTIONS" ]]; then
|
||||
mv "$SERVICE_ROOT/${PLUGIN_VARIABLE}_CONFIG_OPTIONS" "$SERVICE_ROOT/CONFIG_OPTIONS"
|
||||
chown "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "$SERVICE_ROOT/CONFIG_OPTIONS"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku mysql service plugin"
|
||||
version = "1.16.0"
|
||||
version = "1.19.9"
|
||||
[plugin.config]
|
||||
|
||||
@@ -14,7 +14,7 @@ service-clone-cmd() {
|
||||
#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 -m|--memory MEMORY, container memory limit (default: unlimited)
|
||||
#F -m|--memory MEMORY, container memory limit in megabytes (default: unlimited)
|
||||
#F -p|--password PASSWORD, override the user-level service password
|
||||
#F -r|--root-password PASSWORD, override the root-level service password
|
||||
#F -s|--shm-size SHM_SIZE, override shared memory size for $PLUGIN_COMMAND_PREFIX docker container
|
||||
@@ -27,6 +27,9 @@ service-clone-cmd() {
|
||||
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||
[[ -z "$NEW_SERVICE" ]] && dokku_log_fail "Please specify a name for the new service"
|
||||
verify_service_name "$SERVICE"
|
||||
if service_exists "$NEW_SERVICE"; then
|
||||
dokku_log_fail "Invalid service name $NEW_SERVICE. Verify the service name is not already in use."
|
||||
fi
|
||||
|
||||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||
local ID="$(cat "$SERVICE_ROOT/ID")"
|
||||
|
||||
@@ -22,7 +22,7 @@ service-create-cmd() {
|
||||
#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 -m|--memory MEMORY, container memory limit (default: unlimited)
|
||||
#F -m|--memory MEMORY, container memory limit in megabytes (default: unlimited)
|
||||
#F -p|--password PASSWORD, override the user-level service password
|
||||
#F -r|--root-password PASSWORD, override the root-level service password
|
||||
#F -s|--shm-size SHM_SIZE, override shared memory size for $PLUGIN_COMMAND_PREFIX docker container
|
||||
|
||||
@@ -20,6 +20,7 @@ service-enter-cmd() {
|
||||
declare SERVICE="$1"
|
||||
|
||||
dokku_log_info1_quiet "Filesystem changes may not persist after container restarts"
|
||||
verify_service_name "$SERVICE"
|
||||
service_enter "$SERVICE" "${@:2}"
|
||||
}
|
||||
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
Reference in New Issue
Block a user