Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a4ddba4d6 | ||
|
|
57db31f4ed | ||
|
|
8fffd08c9d | ||
|
|
90cd95c1b1 | ||
|
|
d9078421f3 | ||
|
|
723a6cd98d |
12
README.md
12
README.md
@@ -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: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:links <service> # list all apps linked to the mysql service
|
||||||
mysql:list # list all mysql services
|
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:promote <service> <app> # promote service <service> as DATABASE_URL in <app>
|
||||||
mysql:restart <service> # graceful shutdown and restart of the mysql service container
|
mysql:restart <service> # graceful shutdown and restart of the mysql service container
|
||||||
mysql:start <service> # start a previously stopped mysql service
|
mysql:start <service> # start a previously stopped mysql service
|
||||||
@@ -153,12 +153,12 @@ dokku mysql:list
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
# usage
|
# usage
|
||||||
dokku mysql:logs <service> [-t|--tail]
|
dokku mysql:logs <service> [-t|--tail] <tail-num-optional>
|
||||||
```
|
```
|
||||||
|
|
||||||
flags:
|
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:
|
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
|
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
|
### link the mysql service to the app
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ service_info() {
|
|||||||
|
|
||||||
local flag_map=(
|
local flag_map=(
|
||||||
"--config-dir: ${SERVICE_ROOT}/${PLUGIN_CONFIG_SUFFIX}"
|
"--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"
|
"--data-dir: ${SERVICE_ROOT}/data"
|
||||||
"--dsn: ${SERVICE_URL}"
|
"--dsn: ${SERVICE_URL}"
|
||||||
"--exposed-ports: $(service_exposed_ports "$SERVICE")"
|
"--exposed-ports: $(service_exposed_ports "$SERVICE")"
|
||||||
@@ -533,7 +533,11 @@ service_link() {
|
|||||||
fi
|
fi
|
||||||
[[ -n "$SERVICE_QUERYSTRING" ]] && SERVICE_URL="${SERVICE_URL}?${SERVICE_QUERYSTRING}"
|
[[ -n "$SERVICE_QUERYSTRING" ]] && SERVICE_URL="${SERVICE_URL}?${SERVICE_QUERYSTRING}"
|
||||||
plugn trigger service-action post-link "$SERVICE" "$APP"
|
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"
|
plugn trigger service-action post-link-complete "$SERVICE" "$APP"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,14 +582,14 @@ service_list() {
|
|||||||
|
|
||||||
service_logs() {
|
service_logs() {
|
||||||
declare desc="display logs for a service"
|
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 SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||||
local ID=$(cat "$SERVICE_ROOT/ID")
|
local ID=$(cat "$SERVICE_ROOT/ID")
|
||||||
local RE_INTEGER='^[0-9]+$'
|
local RE_INTEGER='^[0-9]+$'
|
||||||
|
|
||||||
DOKKU_LOGS_ARGS="--tail 100"
|
DOKKU_LOGS_ARGS="--tail $TAIL_COUNT"
|
||||||
if [[ "$TAIL_FLAG" == "-t" ]] || [[ "$TAIL_FLAG" == "--tail" ]]; then
|
if [[ "$TAIL_FLAG" == "-t" ]] || [[ "$TAIL_FLAG" == "--tail" ]]; then
|
||||||
DOKKU_LOGS_ARGS="--follow"
|
DOKKU_LOGS_ARGS+=" --follow"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker inspect "$ID" &>/dev/null || dokku_log_fail "Service container does not exist"
|
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"
|
[[ -z ${LINK[*]} ]] && dokku_log_fail "Not linked to app $APP"
|
||||||
plugn trigger service-action post-unlink "$SERVICE" "$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"
|
plugn trigger service-action post-unlink-complete "$SERVICE" "$APP"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -202,6 +202,9 @@ fn-help-subcommand-args() {
|
|||||||
elif [[ "$arg" == *_LIST ]]; then
|
elif [[ "$arg" == *_LIST ]]; then
|
||||||
arg=${arg%_*}
|
arg=${arg%_*}
|
||||||
args+=" <${arg//_/-}...>"
|
args+=" <${arg//_/-}...>"
|
||||||
|
elif [[ "$arg" == *_OPTIONAL ]]; then
|
||||||
|
argName="${arg/_OPTIONAL/}"
|
||||||
|
args+=" [<${argName//_/-}>]"
|
||||||
else
|
else
|
||||||
args+=" <${arg//_/-}>"
|
args+=" <${arg//_/-}>"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[plugin]
|
[plugin]
|
||||||
description = "dokku mysql service plugin"
|
description = "dokku mysql service plugin"
|
||||||
version = "1.17.0"
|
version = "1.19.0"
|
||||||
[plugin.config]
|
[plugin.config]
|
||||||
|
|||||||
@@ -10,16 +10,18 @@ service-logs-cmd() {
|
|||||||
#E dokku $PLUGIN_COMMAND_PREFIX:logs lollipop
|
#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 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 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
|
#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"
|
declare desc="print the most recent log(s) for this service"
|
||||||
local cmd="$PLUGIN_COMMAND_PREFIX:logs" argv=("$@")
|
local cmd="$PLUGIN_COMMAND_PREFIX:logs" argv=("$@")
|
||||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
[[ ${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"
|
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
|
||||||
verify_service_name "$SERVICE"
|
verify_service_name "$SERVICE"
|
||||||
service_logs "$SERVICE" "$TAIL_FLAG"
|
service_logs "$SERVICE" "$TAIL_FLAG" "$TAIL_NUM_OPTIONAL"
|
||||||
}
|
}
|
||||||
|
|
||||||
service-logs-cmd "$@"
|
service-logs-cmd "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user