Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c21b534d4 | ||
|
|
f1d60d6f4b | ||
|
|
32fdea93fd | ||
|
|
42f07d10a8 | ||
|
|
5e3cf5fab4 | ||
|
|
4174b7e617 |
@@ -561,7 +561,7 @@ dokku postgres:export lollipop > data.dump
|
||||
Note that the export will result in a file containing the binary postgres export data. It can be converted to plain text using `pg_restore` as follows
|
||||
|
||||
```shell
|
||||
pg_restore data.dump -f plain.sql.
|
||||
pg_restore data.dump -f plain.sql
|
||||
```
|
||||
|
||||
### Backups
|
||||
|
||||
@@ -4,6 +4,18 @@ set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
add_to_links_file() {
|
||||
declare desc="add an app to the service link file"
|
||||
declare SERVICE="$1" APP="$2"
|
||||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||
local LINKS_FILE="$SERVICE_ROOT/LINKS"
|
||||
|
||||
touch "$LINKS_FILE"
|
||||
sed -i.bak "/^$APP\$/d" "$LINKS_FILE" && rm "$LINKS_FILE.bak"
|
||||
echo "$APP" >>"$LINKS_FILE"
|
||||
sort "$LINKS_FILE" -u -o "$LINKS_FILE"
|
||||
}
|
||||
|
||||
docker_ports_options() {
|
||||
declare desc="export a list of exposed ports"
|
||||
declare PORTS=("$@")
|
||||
@@ -61,6 +73,15 @@ get_url_from_config() {
|
||||
echo "$EXISTING_CONFIG" | grep "$CONFIG_VAR" | sed "s/$CONFIG_VAR:\s*//" | xargs
|
||||
}
|
||||
|
||||
in_links_file() {
|
||||
declare desc="check if a service LINKS file contains an app"
|
||||
declare SERVICE="$1" APP="$2"
|
||||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||
local LINKS_FILE="$SERVICE_ROOT/LINKS"
|
||||
|
||||
grep -qE "^$APP\$" "$LINKS_FILE"
|
||||
}
|
||||
|
||||
is_container_status() {
|
||||
declare desc="return 0 or 1 depending upon whether a given container has a certain status"
|
||||
declare CID="$1" STATUS="$2"
|
||||
@@ -501,9 +522,7 @@ service_link() {
|
||||
|
||||
[[ -n $LINK ]] && dokku_log_fail "Already linked as $LINK"
|
||||
plugn trigger service-action pre-link "$SERVICE" "$APP"
|
||||
touch "$LINKS_FILE"
|
||||
echo "$APP" >>"$LINKS_FILE"
|
||||
sort "$LINKS_FILE" -u -o "$LINKS_FILE"
|
||||
add_to_links_file "$SERVICE" "$APP"
|
||||
|
||||
if declare -f -F add_passed_docker_option >/dev/null; then
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Note that the export will result in a file containing the binary postgres export data. It can be converted to plain text using `pg_restore` as follows
|
||||
|
||||
```shell
|
||||
pg_restore data.dump -f plain.sql.
|
||||
pg_restore data.dump -f plain.sql
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku postgres service plugin"
|
||||
version = "1.14.0"
|
||||
version = "1.15.0"
|
||||
[plugin.config]
|
||||
|
||||
19
post-app-clone-setup
Executable file
19
post-app-clone-setup
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/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-post-app-clone-setup() {
|
||||
declare OLD_APP_NAME="$1" NEW_APP_NAME="$2"
|
||||
|
||||
local SERVICES=$(ls "$PLUGIN_DATA_ROOT" 2>/dev/null)
|
||||
for SERVICE in $SERVICES; do
|
||||
if in_links_file "$SERVICE" "$OLD_APP_NAME"; then
|
||||
add_to_links_file "$SERVICE" "$NEW_APP_NAME"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
plugin-post-app-clone-setup "$@"
|
||||
19
post-app-rename-setup
Executable file
19
post-app-rename-setup
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/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-post-app-rename-setup() {
|
||||
declare OLD_APP_NAME="$1" NEW_APP_NAME="$2"
|
||||
|
||||
local SERVICES=$(ls "$PLUGIN_DATA_ROOT" 2>/dev/null)
|
||||
for SERVICE in $SERVICES; do
|
||||
if in_links_file "$SERVICE" "$OLD_APP_NAME"; then
|
||||
add_to_links_file "$SERVICE" "$NEW_APP_NAME"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
plugin-post-app-rename-setup "$@"
|
||||
36
pre-restore
Executable file
36
pre-restore
Executable 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
32
pre-start
Executable 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 "$@"
|
||||
Reference in New Issue
Block a user