mirror of
https://github.com/dokku/dokku.git
synced 2025-12-16 03:57:43 +01:00
tests: run mvdan/shfmt on test runs
While I do not agree with _every_ style change, this will force Dokku to have consistent formatting across all shell scripts, which is arguably a Good Thing™. The command used to reprocess everything is: ```shell shfmt -l -bn -ci -i 2 -w . ```
This commit is contained in:
35
bootstrap.sh
35
bootstrap.sh
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $TRACE ]] && set -x
|
||||
|
||||
# A script to bootstrap dokku.
|
||||
# It expects to be run on Ubuntu 14.04 via 'sudo'
|
||||
@@ -15,7 +16,7 @@ ensure-environment() {
|
||||
local FREE_MEMORY
|
||||
echo "Preparing to install $DOKKU_TAG from $DOKKU_REPO..."
|
||||
|
||||
hostname -f > /dev/null 2>&1 || {
|
||||
hostname -f >/dev/null 2>&1 || {
|
||||
echo "This installation script requires that you have a hostname set for the instance. Please set a hostname for 127.0.0.1 in your /etc/hosts"
|
||||
exit 1
|
||||
}
|
||||
@@ -31,14 +32,14 @@ install-requirements() {
|
||||
echo "--> Ensuring we have the proper dependencies"
|
||||
|
||||
case "$DOKKU_DISTRO" in
|
||||
debian|ubuntu)
|
||||
debian | ubuntu)
|
||||
if ! dpkg -l | grep -q software-properties-common; then
|
||||
apt-get update -qq > /dev/null
|
||||
apt-get update -qq >/dev/null
|
||||
apt-get -qq -y install software-properties-common
|
||||
fi
|
||||
|
||||
add-apt-repository universe > /dev/null
|
||||
apt-get update -qq > /dev/null
|
||||
add-apt-repository universe >/dev/null
|
||||
apt-get update -qq >/dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -47,7 +48,7 @@ install-dokku() {
|
||||
if [[ -n $DOKKU_BRANCH ]]; then
|
||||
install-dokku-from-source "origin/$DOKKU_BRANCH"
|
||||
elif [[ -n $DOKKU_TAG ]]; then
|
||||
local DOKKU_SEMVER="${DOKKU_TAG//v}"
|
||||
local DOKKU_SEMVER="${DOKKU_TAG//v/}"
|
||||
major=$(echo "$DOKKU_SEMVER" | awk '{split($0,a,"."); print a[1]}')
|
||||
minor=$(echo "$DOKKU_SEMVER" | awk '{split($0,a,"."); print a[2]}')
|
||||
patch=$(echo "$DOKKU_SEMVER" | awk '{split($0,a,"."); print a[3]}')
|
||||
@@ -101,10 +102,10 @@ install-dokku-from-source() {
|
||||
|
||||
install-dokku-from-package() {
|
||||
case "$DOKKU_DISTRO" in
|
||||
debian|ubuntu)
|
||||
debian | ubuntu)
|
||||
install-dokku-from-deb-package "$@"
|
||||
;;
|
||||
centos|rhel)
|
||||
centos | rhel)
|
||||
install-dokku-from-rpm-package "$@"
|
||||
;;
|
||||
*)
|
||||
@@ -134,7 +135,7 @@ install-dokku-from-deb-package() {
|
||||
fi
|
||||
|
||||
echo "--> Initial apt-get update"
|
||||
apt-get update -qq > /dev/null
|
||||
apt-get update -qq >/dev/null
|
||||
apt-get -qq -y install apt-transport-https
|
||||
|
||||
echo "--> Installing docker"
|
||||
@@ -151,7 +152,7 @@ install-dokku-from-deb-package() {
|
||||
add-apt-repository -y ppa:nginx/stable
|
||||
fi
|
||||
|
||||
OS_ID="$(lsb_release -cs 2> /dev/null || echo "trusty")"
|
||||
OS_ID="$(lsb_release -cs 2>/dev/null || echo "trusty")"
|
||||
if ! in-array "$DOKKU_DISTRO" "debian" "ubuntu"; then
|
||||
DOKKU_DISTRO="ubuntu"
|
||||
OS_ID="trusty"
|
||||
@@ -172,14 +173,14 @@ install-dokku-from-deb-package() {
|
||||
echo "--> Installing dokku"
|
||||
wget -nv -O - https://packagecloud.io/gpg.key | apt-key add -
|
||||
echo "deb https://packagecloud.io/dokku/dokku/$DOKKU_DISTRO/ $OS_ID main" | tee /etc/apt/sources.list.d/dokku.list
|
||||
apt-get update -qq > /dev/null
|
||||
apt-get update -qq >/dev/null
|
||||
|
||||
[[ -n $DOKKU_VHOST_ENABLE ]] && echo "dokku dokku/vhost_enable boolean $DOKKU_VHOST_ENABLE" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_WEB_CONFIG ]] && echo "dokku dokku/web_config boolean $DOKKU_WEB_CONFIG" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_HOSTNAME ]] && echo "dokku dokku/hostname string $DOKKU_HOSTNAME" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_VHOST_ENABLE ]] && echo "dokku dokku/vhost_enable boolean $DOKKU_VHOST_ENABLE" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_WEB_CONFIG ]] && echo "dokku dokku/web_config boolean $DOKKU_WEB_CONFIG" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_HOSTNAME ]] && echo "dokku dokku/hostname string $DOKKU_HOSTNAME" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_SKIP_KEY_FILE ]] && echo "dokku dokku/skip_key_file boolean $DOKKU_SKIP_KEY_FILE" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_KEY_FILE ]] && echo "dokku dokku/key_file string $DOKKU_KEY_FILE" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_NGINX_ENABLE ]] && echo "dokku dokku/nginx_enable string $DOKKU_NGINX_ENABLE" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_KEY_FILE ]] && echo "dokku dokku/key_file string $DOKKU_KEY_FILE" | sudo debconf-set-selections
|
||||
[[ -n $DOKKU_NGINX_ENABLE ]] && echo "dokku dokku/nginx_enable string $DOKKU_NGINX_ENABLE" | sudo debconf-set-selections
|
||||
|
||||
if [[ -n $DOKKU_CHECKOUT ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
|
||||
@@ -79,11 +79,11 @@ main() {
|
||||
arch)
|
||||
yaourt -Syyua
|
||||
;;
|
||||
debian|ubuntu)
|
||||
apt-get update -qq > /dev/null
|
||||
debian | ubuntu)
|
||||
apt-get update -qq >/dev/null
|
||||
apt-get -qq -y --force-yes dist-upgrade
|
||||
;;
|
||||
centos|opensuse|rhel)
|
||||
centos | opensuse | rhel)
|
||||
dokku-log-warn "Updating this operating system is not supported"
|
||||
;;
|
||||
*)
|
||||
@@ -94,7 +94,7 @@ main() {
|
||||
|
||||
# update all plugins
|
||||
dokku-log-info "Updating all plugins"
|
||||
for PLUGIN_NAME in $(dokku plugin:list | grep enabled | awk '$1=$1' | cut -d' ' -f1); do
|
||||
for PLUGIN_NAME in $(dokku plugin:list | grep enabled | awk '$1=$1' | cut -d' ' -f1); do
|
||||
dokku-update-plugin "$PLUGIN_NAME"
|
||||
done
|
||||
dokku plugin:install
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
export DOKKU_PORT=${DOKKU_PORT:=22}
|
||||
export DOKKU_HOST=${DOKKU_HOST:=}
|
||||
|
||||
@@ -48,7 +49,7 @@ fn-dokku-host() {
|
||||
declare DOKKU_GIT_REMOTE="$1" DOKKU_HOST="$2"
|
||||
|
||||
if [[ -z "$DOKKU_HOST" ]]; then
|
||||
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
if [[ -d .git ]] || git rev-parse --git-dir >/dev/null 2>&1; then
|
||||
DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^${DOKKU_GIT_REMOTE}\s" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true)
|
||||
fi
|
||||
fi
|
||||
@@ -67,7 +68,7 @@ main() {
|
||||
|
||||
for arg in "$@"; do
|
||||
if [[ "$skip" == "true" ]]; then
|
||||
next_index=$(( next_index + 1 ))
|
||||
next_index=$((next_index + 1))
|
||||
skip=false
|
||||
continue
|
||||
fi
|
||||
@@ -92,13 +93,13 @@ main() {
|
||||
cmd_set=true
|
||||
fi
|
||||
fi
|
||||
next_index=$(( next_index + 1 ))
|
||||
next_index=$((next_index + 1))
|
||||
done
|
||||
|
||||
DOKKU_REMOTE_HOST="$(fn-dokku-host "$DOKKU_GIT_REMOTE" "$DOKKU_HOST")"
|
||||
|
||||
if [[ -z "$APP" ]]; then
|
||||
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
if [[ -d .git ]] || git rev-parse --git-dir >/dev/null 2>&1; then
|
||||
set +e
|
||||
APP=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_REMOTE_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
|
||||
set -e
|
||||
@@ -112,14 +113,14 @@ main() {
|
||||
if [[ -z "$APP_ARG" ]]; then
|
||||
APP=$(fn-random-name)
|
||||
counter=0
|
||||
while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps 2>/dev/null| grep -q "$APP"; do
|
||||
while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps 2>/dev/null | grep -q "$APP"; do
|
||||
if [[ $counter -ge 100 ]]; then
|
||||
echo "Error: could not reasonably generate a new app name. try cleaning up some apps..."
|
||||
ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps
|
||||
exit 1
|
||||
else
|
||||
APP=$(random_name)
|
||||
counter=$((counter+1))
|
||||
counter=$((counter + 1))
|
||||
fi
|
||||
done
|
||||
else
|
||||
|
||||
@@ -68,7 +68,7 @@ fn-extract-package() {
|
||||
[[ "$IS_RELEASE" == "true" ]] && NAME="dokku:build-release"
|
||||
|
||||
log-info "(extract-package) writing ${PACKAGE_NAME} to correct path"
|
||||
docker run --rm --entrypoint cat "$NAME" "/tmp/${PACKAGE_NAME}" > "${ROOT_DIR}/build/${PACKAGE_NAME}"
|
||||
docker run --rm --entrypoint cat "$NAME" "/tmp/${PACKAGE_NAME}" >"${ROOT_DIR}/build/${PACKAGE_NAME}"
|
||||
return "$?"
|
||||
}
|
||||
|
||||
@@ -366,8 +366,8 @@ main() {
|
||||
git checkout -- plugins/*/plugin.toml
|
||||
fi
|
||||
|
||||
echo "build/dokku_${NEXT_VERSION}_amd64.deb" > build/deb-filename
|
||||
echo "build/dokku-${NEXT_VERSION}-1.x86_64.rpm" > build/rpm-filename
|
||||
echo "build/dokku_${NEXT_VERSION}_amd64.deb" >build/deb-filename
|
||||
echo "build/dokku-${NEXT_VERSION}-1.x86_64.rpm" >build/rpm-filename
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -47,7 +47,7 @@ fn-extract-package() {
|
||||
fi
|
||||
|
||||
log-info "(extract-package) writing ${PACKAGE_NAME} to correct path"
|
||||
docker run --rm --entrypoint cat dokku-update:build "/tmp/${PACKAGE_NAME}" > "${ROOT_DIR}/build/${PACKAGE_NAME}"
|
||||
docker run --rm --entrypoint cat dokku-update:build "/tmp/${PACKAGE_NAME}" >"${ROOT_DIR}/build/${PACKAGE_NAME}"
|
||||
return "$?"
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ fn-publish-package() {
|
||||
EXIT_CODE="$ex"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
DIST=debian
|
||||
OS_IDS=("wheezy" "jessie" "stretch" "buster")
|
||||
for OS_ID in "${OS_IDS[@]}"; do
|
||||
|
||||
@@ -47,7 +47,7 @@ fn-extract-package() {
|
||||
fi
|
||||
|
||||
log-info "(extract-package) writing ${PACKAGE_NAME} to correct path"
|
||||
docker run --rm --entrypoint cat herokuish:build "/tmp/${PACKAGE_NAME}" > "${ROOT_DIR}/build/${PACKAGE_NAME}"
|
||||
docker run --rm --entrypoint cat herokuish:build "/tmp/${PACKAGE_NAME}" >"${ROOT_DIR}/build/${PACKAGE_NAME}"
|
||||
return "$?"
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ fn-publish-package() {
|
||||
EXIT_CODE="$ex"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
DIST=debian
|
||||
OS_IDS=("wheezy" "jessie" "stretch" "buster")
|
||||
for OS_ID in "${OS_IDS[@]}"; do
|
||||
|
||||
@@ -57,7 +57,7 @@ main() {
|
||||
local CURRENT_VERSION FILENAME NEXT_VERSION ORG_REPO_NAME REPO_NAME major minor patch
|
||||
|
||||
if [[ -z "$RELEASE" ]]; then
|
||||
cat<<'EOF'
|
||||
cat <<'EOF'
|
||||
requirements:
|
||||
|
||||
- this is run in a plugin folder
|
||||
@@ -97,9 +97,9 @@ EOF
|
||||
while true; do
|
||||
read -rp "Do you wish to continue? " yn
|
||||
case $yn in
|
||||
[Yy]* ) break;;
|
||||
[Nn]* ) exit;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
@@ -131,19 +131,19 @@ EOF
|
||||
patch=$(echo "$CURRENT_VERSION" | awk '{split($0,a,"."); print a[3]}')
|
||||
|
||||
if [[ "$RELEASE" == "major" ]]; then
|
||||
major=$((major + 1));
|
||||
major=$((major + 1))
|
||||
minor="0"
|
||||
patch="0"
|
||||
elif [[ "$RELEASE" == "minor" ]]; then
|
||||
minor=$((minor + 1));
|
||||
minor=$((minor + 1))
|
||||
patch="0"
|
||||
elif [[ "$RELEASE" == "patch" ]]; then
|
||||
patch=$((patch + 1));
|
||||
patch=$((patch + 1))
|
||||
else
|
||||
log-error "Invalid release type specified"
|
||||
return 1
|
||||
fi
|
||||
NEXT_VERSION="${major}.${minor}.${patch}"
|
||||
NEXT_VERSION="${major}.${minor}.${patch}"
|
||||
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" plugin.toml
|
||||
git add plugin.toml
|
||||
@@ -163,7 +163,7 @@ EOF
|
||||
DOKKU_PLUGIN_S3_PATH="${DOKKU_PLUGIN_S3_PATH}/"
|
||||
fi
|
||||
|
||||
fn-github-download-release "$ORG_REPO_NAME" "$NEXT_VERSION" > "${TMP_WORK_DIR}/${FILENAME}"
|
||||
fn-github-download-release "$ORG_REPO_NAME" "$NEXT_VERSION" >"${TMP_WORK_DIR}/${FILENAME}"
|
||||
aws s3 cp "${TMP_WORK_DIR}/${FILENAME}" "s3://${DOKKU_PLUGIN_S3_BUCKET}/${DOKKU_PLUGIN_S3_PATH}${FILENAME}" --acl public-read
|
||||
fi
|
||||
}
|
||||
|
||||
5
debian/config
vendored
5
debian/config
vendored
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $TRACE ]] && set -x
|
||||
|
||||
if [[ -e /usr/share/debconf/confmodule ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
@@ -14,7 +15,7 @@ db_go || true
|
||||
|
||||
db_get "dokku/web_config"
|
||||
if [ $RET = "true" ]; then
|
||||
exit 0
|
||||
exit 0
|
||||
fi
|
||||
|
||||
db_input "high" "dokku/nginx_enable" || true
|
||||
|
||||
29
debian/postinst
vendored
29
debian/postinst
vendored
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $TRACE ]] && set -x
|
||||
|
||||
if [[ -e /usr/share/debconf/confmodule ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
@@ -26,10 +27,10 @@ call-sshcommand() {
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
abort-upgrade | abort-remove | abort-deconfigure) ;;
|
||||
|
||||
configure)
|
||||
\
|
||||
configure)
|
||||
mandb
|
||||
[ ! -x /usr/bin/docker.io ] || ln -sf /usr/bin/docker.io /usr/local/bin/docker
|
||||
modprobe aufs || echo "WARNING: Restart server to finish installing dokku!"
|
||||
@@ -55,7 +56,7 @@ case "$1" in
|
||||
elif [ -f ${DOKKU_LIB_ROOT}/plugins/$plugin/.core ]; then
|
||||
rm -rf ${DOKKU_LIB_ROOT}/plugins/$plugin
|
||||
elif [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then
|
||||
mv ${DOKKU_LIB_ROOT}/plugins/$plugin ${DOKKU_LIB_ROOT}/plugins/available;
|
||||
mv ${DOKKU_LIB_ROOT}/plugins/$plugin ${DOKKU_LIB_ROOT}/plugins/available
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -66,7 +67,7 @@ case "$1" in
|
||||
echo "Skipping enable of nginx-vhosts plugin"
|
||||
continue
|
||||
elif [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then
|
||||
ln -s ${DOKKU_LIB_ROOT}/core-plugins/available/$plugin ${DOKKU_LIB_ROOT}/plugins/available/$plugin;
|
||||
ln -s ${DOKKU_LIB_ROOT}/core-plugins/available/$plugin ${DOKKU_LIB_ROOT}/plugins/available/$plugin
|
||||
PLUGIN_PATH=${DOKKU_LIB_ROOT}/core-plugins plugn enable $plugin
|
||||
PLUGIN_PATH=${DOKKU_LIB_ROOT}/plugins plugn enable $plugin
|
||||
fi
|
||||
@@ -75,7 +76,7 @@ case "$1" in
|
||||
chown dokku:dokku -R ${DOKKU_LIB_ROOT}/plugins ${DOKKU_LIB_ROOT}/core-plugins
|
||||
|
||||
echo "Ensure proper sshcommand path"
|
||||
echo '/usr/bin/dokku' > "${DOKKU_ROOT}/.sshcommand"
|
||||
echo '/usr/bin/dokku' >"${DOKKU_ROOT}/.sshcommand"
|
||||
if [[ -f .ssh/authorized_keys ]]; then
|
||||
sed -i.bak 's#/usr/local/bin/dokku#/usr/bin/dokku#' "${DOKKU_ROOT}/.ssh/authorized_keys"
|
||||
rm "${DOKKU_ROOT}/.ssh/authorized_keys"
|
||||
@@ -96,8 +97,8 @@ case "$1" in
|
||||
systemctl enable dokku-installer
|
||||
fi
|
||||
|
||||
installer_status="$(service dokku-installer status 2> /dev/null || true)"
|
||||
if echo $installer_status | grep -Eq "(inactive|waiting)" > /dev/null; then
|
||||
installer_status="$(service dokku-installer status 2>/dev/null || true)"
|
||||
if echo $installer_status | grep -Eq "(inactive|waiting)" >/dev/null; then
|
||||
echo "Starting dokku-installer"
|
||||
service dokku-installer start || echo "Unable to start dokku-installer"
|
||||
fi
|
||||
@@ -114,19 +115,19 @@ case "$1" in
|
||||
else
|
||||
db_get "dokku/vhost_enable"
|
||||
if [ "$RET" = "true" ]; then
|
||||
db_get "dokku/hostname"
|
||||
echo "Setting VHOST contents to $RET"
|
||||
echo "$RET" > "${DOKKU_ROOT}/VHOST"
|
||||
db_get "dokku/hostname"
|
||||
echo "Setting VHOST contents to $RET"
|
||||
echo "$RET" >"${DOKKU_ROOT}/VHOST"
|
||||
fi
|
||||
fi
|
||||
|
||||
db_get "dokku/hostname"
|
||||
echo "$RET" > "${DOKKU_ROOT}/HOSTNAME"
|
||||
echo "$RET" >"${DOKKU_ROOT}/HOSTNAME"
|
||||
|
||||
if [ -z "${DEBCONF_RECONFIGURE}" ]; then
|
||||
db_get "dokku/key_file"
|
||||
if [ -f "$RET" ]; then
|
||||
call-sshcommand acl-add dokku default < "$RET" || true
|
||||
call-sshcommand acl-add dokku default <"$RET" || true
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
3
debian/postrm
vendored
3
debian/postrm
vendored
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $TRACE ]] && set -x
|
||||
|
||||
if [[ -e /usr/share/debconf/confmodule ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
28
debian/preinst
vendored
28
debian/preinst
vendored
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $TRACE ]] && set -x
|
||||
|
||||
if [[ -e /usr/share/debconf/confmodule ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
@@ -23,10 +24,13 @@ case "$1" in
|
||||
echo ' proxy_pass http://dokku-installer;'
|
||||
echo ' }'
|
||||
echo '}'
|
||||
} >> $NGINX_CONF
|
||||
} >>$NGINX_CONF
|
||||
|
||||
rm -f /etc/nginx/sites-enabled/*
|
||||
DOKKU_DISTRO="$(. /etc/os-release > /dev/null 2>&1 || true ; echo "$ID")"
|
||||
DOKKU_DISTRO="$(
|
||||
. /etc/os-release >/dev/null 2>&1 || true
|
||||
echo "$ID"
|
||||
)"
|
||||
case "$DOKKU_DISTRO" in
|
||||
debian)
|
||||
NGINX_INIT="/usr/sbin/invoke-rc.d"
|
||||
@@ -44,21 +48,21 @@ case "$1" in
|
||||
if [ -z "${DEBCONF_RECONFIGURE}" ] && [ "$RET" != "true" ]; then
|
||||
db_get "dokku/key_file"
|
||||
if [ ! -f "$RET" ]; then
|
||||
echo "Error: keyfile '$RET' not found."
|
||||
echo " you can enter a new keyfile path when you restart the installation."
|
||||
db_reset "dokku/key_file"
|
||||
exit 1
|
||||
echo "Error: keyfile '$RET' not found."
|
||||
echo " you can enter a new keyfile path when you restart the installation."
|
||||
db_reset "dokku/key_file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
upgrade)
|
||||
;;
|
||||
upgrade) ;;
|
||||
|
||||
abort-upgrade)
|
||||
;;
|
||||
\
|
||||
abort-upgrade) ;;
|
||||
|
||||
*)
|
||||
\
|
||||
*)
|
||||
echo "preinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
|
||||
33
debian/prerm
vendored
33
debian/prerm
vendored
@@ -1,34 +1,35 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $TRACE ]] && set -x
|
||||
|
||||
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
|
||||
readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}"
|
||||
|
||||
ps_backtrace() {
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: $0 PID" > /dev/stderr
|
||||
echo "Usage: $0 PID" >/dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -i pid=$1;
|
||||
ppid=0;
|
||||
header_modifier="";
|
||||
while : ; do
|
||||
declare -i pid=$1
|
||||
ppid=0
|
||||
header_modifier=""
|
||||
while :; do
|
||||
if [ $ppid -ne 0 ]; then
|
||||
header_modifier=h;
|
||||
fi;
|
||||
ppid=$(ps -o ppid= $pid);
|
||||
ps uww $header_modifier -p $pid;
|
||||
header_modifier=h
|
||||
fi
|
||||
ppid=$(ps -o ppid= $pid)
|
||||
ps uww $header_modifier -p $pid
|
||||
if [ $pid -eq 1 ]; then
|
||||
break;
|
||||
fi;
|
||||
pid=$ppid;
|
||||
done;
|
||||
break
|
||||
fi
|
||||
pid=$ppid
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
# HACK: Ensure that we only delete data when purging dokku from the system
|
||||
if ps_backtrace $BASHPID 2> /dev/null | grep dpkg | grep -- "--purge" > /dev/null; then
|
||||
if ps_backtrace $BASHPID 2>/dev/null | grep dpkg | grep -- "--purge" >/dev/null; then
|
||||
echo "Processing purge"
|
||||
|
||||
echo "Destroying deployed applications"
|
||||
@@ -40,7 +41,7 @@ main() {
|
||||
echo "Disabling all core plugins"
|
||||
find ${DOKKU_LIB_ROOT}/core-plugins/available -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do
|
||||
if [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then
|
||||
rm ${DOKKU_LIB_ROOT}/plugins/available/$plugin;
|
||||
rm ${DOKKU_LIB_ROOT}/plugins/available/$plugin
|
||||
PLUGIN_PATH=${DOKKU_LIB_ROOT}/core-plugins plugn disable $plugin
|
||||
PLUGIN_PATH=${DOKKU_LIB_ROOT}/plugins plugn disable $plugin
|
||||
fi
|
||||
|
||||
39
dokku
39
dokku
@@ -31,7 +31,10 @@ export DOKKU_HOST_ROOT=${DOKKU_HOST_ROOT:=$DOKKU_ROOT}
|
||||
|
||||
export DOKKU_DISTRO
|
||||
# shellcheck disable=SC1091
|
||||
DOKKU_DISTRO=$(. /etc/os-release > /dev/null 2>&1 || true ; echo "$ID")
|
||||
DOKKU_DISTRO=$(
|
||||
. /etc/os-release >/dev/null 2>&1 || true
|
||||
echo "$ID"
|
||||
)
|
||||
|
||||
export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"}
|
||||
export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"}
|
||||
@@ -103,7 +106,7 @@ if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! dokku_auth "$@" ; then
|
||||
if ! dokku_auth "$@"; then
|
||||
dokku_log_fail "Access denied"
|
||||
exit 1
|
||||
fi
|
||||
@@ -112,25 +115,26 @@ execute_dokku_cmd() {
|
||||
declare desc="executes dokku sub-commands"
|
||||
local PLUGIN_NAME="$1"
|
||||
local PLUGIN_CMD=$PLUGIN_NAME
|
||||
local implemented=0; local script
|
||||
local implemented=0
|
||||
local script
|
||||
local argv=("$@")
|
||||
|
||||
case "$PLUGIN_NAME" in
|
||||
events|events:*)
|
||||
events | events:*)
|
||||
local PLUGIN_NAME=${PLUGIN_NAME/events/20_events}
|
||||
;;
|
||||
nginx|nginx:*)
|
||||
nginx | nginx:*)
|
||||
local PLUGIN_NAME=${PLUGIN_NAME/nginx/nginx-vhosts}
|
||||
;;
|
||||
deploy|delete|ls|run|cleanup)
|
||||
deploy | delete | ls | run | cleanup)
|
||||
local PLUGIN_NAME="00_dokku-standard"
|
||||
;;
|
||||
trace|url|urls|report|version)
|
||||
trace | url | urls | report | version)
|
||||
local PLUGIN_NAME="00_dokku-standard"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "$(readlink -f "$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}")" == *core-plugins* ]] ; then
|
||||
if [[ "$(readlink -f "$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}")" == *core-plugins* ]]; then
|
||||
[[ ${argv[0]} == "$PLUGIN_CMD" ]] && shift 1
|
||||
if [[ ! -z $DOKKU_APP_NAME ]]; then
|
||||
if [[ "$PLUGIN_CMD" == config* ]] && [[ ${argv[1]} == "--no-restart" ]]; then
|
||||
@@ -154,9 +158,12 @@ execute_dokku_cmd() {
|
||||
implemented=1
|
||||
fi
|
||||
|
||||
if [[ $implemented -eq 0 ]];then
|
||||
if [[ $implemented -eq 0 ]]; then
|
||||
for script in $PLUGIN_ENABLED_PATH/*/commands; do
|
||||
set +e; $script "$@" ; exit_code=$? ; set -e
|
||||
set +e
|
||||
$script "$@"
|
||||
exit_code=$?
|
||||
set -e
|
||||
if [[ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]]; then
|
||||
continue
|
||||
fi
|
||||
@@ -175,18 +182,18 @@ execute_dokku_cmd() {
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
help|'')
|
||||
help | '')
|
||||
export LC_ALL=C # so sort will respect non alpha characters
|
||||
ALL_PLUGIN_COMMANDS=$(find -L "$PLUGIN_PATH/enabled" -name commands 2> /dev/null || true)
|
||||
ALL_PLUGIN_COMMANDS=$(find -L "$PLUGIN_PATH/enabled" -name commands 2>/dev/null || true)
|
||||
|
||||
# build list of core plugin command files
|
||||
for plugin_command in $ALL_PLUGIN_COMMANDS;do
|
||||
for plugin_command in $ALL_PLUGIN_COMMANDS; do
|
||||
if [[ "$(readlink -f "$plugin_command")" == *core-plugins* ]]; then
|
||||
CORE_PLUGIN_COMMANDS+="$plugin_command "
|
||||
fi
|
||||
done
|
||||
# build list of non-core plugin command files
|
||||
for plugin_command in $ALL_PLUGIN_COMMANDS;do
|
||||
for plugin_command in $ALL_PLUGIN_COMMANDS; do
|
||||
if [[ "$(readlink -f "$plugin_command")" != *core-plugins* ]]; then
|
||||
COMMUNITY_PLUGIN_COMMANDS+="$plugin_command "
|
||||
fi
|
||||
@@ -200,7 +207,7 @@ case "$1" in
|
||||
dokku_log_quiet "Commands:"
|
||||
dokku_log_quiet ""
|
||||
|
||||
if [[ "$2" == "--all" ]] ; then
|
||||
if [[ "$2" == "--all" ]]; then
|
||||
for core_plugin_command in $CORE_PLUGIN_COMMANDS; do
|
||||
$core_plugin_command help
|
||||
done | sort | column -c2 -t -s,
|
||||
@@ -213,7 +220,7 @@ case "$1" in
|
||||
else
|
||||
for core_plugin_command in $CORE_PLUGIN_COMMANDS; do
|
||||
$core_plugin_command help
|
||||
# When done, sort, sed cuts arugments out of strings and colum make it pretty
|
||||
# When done, sort, sed cuts arugments out of strings and colum make it pretty
|
||||
done | sort | sed -e '/^.*:/d' -e 's/\s[\[\<\-\(].*,/,/' | column -c2 -t -s,
|
||||
if [[ -n "$COMMUNITY_PLUGIN_COMMANDS" ]]; then
|
||||
dokku_log_quiet ""
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help help:help run:help trace:help url:help urls:help version:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help|run:help|trace:help|url:help|urls:help|version:help)
|
||||
help | run:help | trace:help | url:help | urls:help | version:help)
|
||||
[[ $(echo "$1" | sed '/.*:help/!d') ]] && help_topic="${1%\:help}"
|
||||
help_content_func () {
|
||||
help_content_func() {
|
||||
declare desc="return standard plugin help content"
|
||||
cat<<help_content
|
||||
cat <<help_content
|
||||
run <app> <cmd>, Run a command in a new container using the current application image
|
||||
trace [on/off], Enable dokku tracing
|
||||
url <app>, Show the first URL for an application (compatibility)
|
||||
@@ -17,10 +18,10 @@ case "$1" in
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $help_topic ]] ; then
|
||||
help_content_func | sed "/^\s*$help_topic\s/!d" | sort | sed '/^.*:/d' | column -c2 -t -s,
|
||||
if [[ $help_topic ]]; then
|
||||
help_content_func | sed "/^\s*$help_topic\s/!d" | sort | sed '/^.*:/d' | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
help_content_func
|
||||
fi
|
||||
;;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
app_user_docker_args() {
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
get_phase_script() {
|
||||
declare desc="extracts app.json from app image and returns the appropriate json key/value"
|
||||
local IMAGE="$1"; local PHASE_SCRIPT_KEY="$2"
|
||||
local IMAGE="$1"
|
||||
local PHASE_SCRIPT_KEY="$2"
|
||||
local GET_PHASE_SCRIPT_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_get_phase_script.XXXX")
|
||||
local APP_JSON_FILE="$GET_PHASE_SCRIPT_TMP_WORK_DIR/app.json"
|
||||
trap 'rm -rf "$GET_PHASE_SCRIPT_TMP_WORK_DIR" > /dev/null' RETURN INT TERM
|
||||
|
||||
copy_from_image "$IMAGE" "app.json" "$GET_PHASE_SCRIPT_TMP_WORK_DIR" 2>/dev/null || true
|
||||
|
||||
if [[ -f "$APP_JSON_FILE" ]];then
|
||||
local VALUE=$(get_json_value "scripts.dokku.${PHASE_SCRIPT_KEY}" < "$APP_JSON_FILE")
|
||||
if [[ -f "$APP_JSON_FILE" ]]; then
|
||||
local VALUE=$(get_json_value "scripts.dokku.${PHASE_SCRIPT_KEY}" <"$APP_JSON_FILE")
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
@@ -23,12 +25,14 @@ get_phase_script() {
|
||||
|
||||
execute_script() {
|
||||
declare desc="executes appropriate phase script key from app.json"
|
||||
local APP="$1"; local IMAGE_TAG="$2"; local PHASE_SCRIPT_KEY="$3"
|
||||
local APP="$1"
|
||||
local IMAGE_TAG="$2"
|
||||
local PHASE_SCRIPT_KEY="$3"
|
||||
local IMAGE id
|
||||
|
||||
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
|
||||
local SCRIPT_CMD=$(get_phase_script "$IMAGE" "$PHASE_SCRIPT_KEY" 2>/dev/null)
|
||||
if [[ -n "$SCRIPT_CMD" ]];then
|
||||
if [[ -n "$SCRIPT_CMD" ]]; then
|
||||
dokku_log_info1 "Running '$SCRIPT_CMD' in app container"
|
||||
local COMMAND
|
||||
COMMAND="set -eo pipefail; [[ \$DOKKU_TRACE ]] && set -x ; "
|
||||
@@ -44,7 +48,7 @@ execute_script() {
|
||||
COMMAND+=" rm -rf /tmp/cache ; "
|
||||
COMMAND+=" ln -sf /cache /tmp/cache ; "
|
||||
COMMAND+=" fi ; "
|
||||
|
||||
|
||||
if [[ "$SCRIPT_CMD" == /* ]]; then
|
||||
local SCRIPT_BIN="$(echo "$SCRIPT_CMD" | cut -d' ' -f1)"
|
||||
COMMAND+=" if [[ ! -x \"$SCRIPT_BIN\" ]]; then "
|
||||
@@ -52,7 +56,7 @@ execute_script() {
|
||||
COMMAND+=" exit 1 ; "
|
||||
COMMAND+=" fi "
|
||||
fi
|
||||
|
||||
|
||||
COMMAND+=" $SCRIPT_CMD || exit 1;"
|
||||
COMMAND+=" if [[ -d '/cache' ]]; then "
|
||||
COMMAND+=" echo removing installation cache... ; "
|
||||
@@ -65,7 +69,7 @@ execute_script() {
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
|
||||
# strip --restart args from DOCKER_ARGS
|
||||
local DOCKER_ARGS=$(sed -e "s/--restart=[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS")
|
||||
local DOCKER_ARGS=$(sed -e "s/--restart=[[:graph:]]\+[[:blank:]]\?//g" <<<"$DOCKER_ARGS")
|
||||
|
||||
# eval args as array to respect escapes
|
||||
declare -a ARG_ARRAY
|
||||
@@ -79,7 +83,7 @@ execute_script() {
|
||||
id=$(docker run "$DOKKU_GLOBAL_RUN_ARGS" -e DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -d -v "$CACHE_HOST_DIR:/cache" "${ARG_ARRAY[@]}" "$IMAGE" "$DOKKU_APP_SHELL" -c "$COMMAND")
|
||||
if test "$(docker wait "$id")" -eq 0; then
|
||||
dokku_container_log_verbose_quiet "$id"
|
||||
if [[ "$PHASE_SCRIPT_KEY" != "postdeploy" ]];then
|
||||
if [[ "$PHASE_SCRIPT_KEY" != "postdeploy" ]]; then
|
||||
if ! is_image_herokuish_based "$IMAGE"; then
|
||||
local DOKKU_DOCKERFILE_ENTRYPOINT=$(config_get "$APP" DOKKU_DOCKERFILE_ENTRYPOINT)
|
||||
local DOKKU_DOCKERFILE_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_CMD)
|
||||
@@ -92,7 +96,7 @@ execute_script() {
|
||||
local DOCKER_COMMIT_ARGS="$DOCKER_COMMIT_ENTRYPOINT_CHANGE_ARG $DOCKER_COMMIT_CMD_CHANGE_ARG"
|
||||
fi
|
||||
# shellcheck disable=SC2086
|
||||
eval docker commit $DOCKER_COMMIT_ARGS "$id" "$IMAGE" > /dev/null
|
||||
eval docker commit $DOCKER_COMMIT_ARGS "$id" "$IMAGE" >/dev/null
|
||||
fi
|
||||
else
|
||||
dokku_container_log_verbose_quiet "$id"
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||
hostname -f > "$DOKKU_ROOT/HOSTNAME"
|
||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||
hostname -f >"$DOKKU_ROOT/HOSTNAME"
|
||||
fi
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
[[ $(dig +short "$(< "$DOKKU_ROOT/HOSTNAME")") ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
|
||||
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
[[ $(dig +short "$(<"$DOKKU_ROOT/HOSTNAME")") ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
|
||||
fi
|
||||
|
||||
dokku_path="$(which dokku)"
|
||||
|
||||
# temporary hack for https://github.com/dokku/dokku/issues/82
|
||||
# redeploys all apps after a reboot
|
||||
if [[ $(/sbin/init --version 2> /dev/null) =~ upstart ]]; then
|
||||
cat<<EOF > /etc/init/dokku-redeploy.conf
|
||||
if [[ $(/sbin/init --version 2>/dev/null) =~ upstart ]]; then
|
||||
cat <<EOF >/etc/init/dokku-redeploy.conf
|
||||
description "Dokku app redeploy service"
|
||||
|
||||
start on filesystem and started docker
|
||||
@@ -26,8 +27,8 @@ end script
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ $(systemctl 2> /dev/null) =~ -\.mount ]]; then
|
||||
cat<<EOF > /etc/systemd/system/dokku-redeploy.service
|
||||
if [[ $(systemctl 2>/dev/null) =~ -\.mount ]]; then
|
||||
cat <<EOF >/etc/systemd/system/dokku-redeploy.service
|
||||
[Unit]
|
||||
Description=Dokku app redeploy service
|
||||
Requires=docker.service
|
||||
@@ -47,7 +48,7 @@ EOF
|
||||
fi
|
||||
|
||||
mkdir -p /etc/update-motd.d
|
||||
cat<<EOF > /etc/update-motd.d/99-dokku
|
||||
cat <<EOF >/etc/update-motd.d/99-dokku
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f "/home/dokku/HOSTNAME" ]; then
|
||||
@@ -63,6 +64,6 @@ chmod +x /etc/update-motd.d/99-dokku
|
||||
|
||||
chown dokku:dokku "$DOKKU_ROOT/HOSTNAME"
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
chown dokku:dokku "$DOKKU_ROOT/VHOST"
|
||||
fi
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts"
|
||||
|
||||
exec_app_json_scripts() {
|
||||
declare desc="core app.json scripts execution"
|
||||
local trigger="post-deploy app_json_scripts"
|
||||
local APP="$1"; local IMAGE_TAG="$4"; local PHASE_SCRIPT_KEY="postdeploy"
|
||||
local APP="$1"
|
||||
local IMAGE_TAG="$4"
|
||||
local PHASE_SCRIPT_KEY="postdeploy"
|
||||
|
||||
dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)"
|
||||
execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY"
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts"
|
||||
|
||||
exec_app_json_scripts() {
|
||||
declare desc="core app.json scripts execution"
|
||||
local trigger="pre-deploy app_json_scripts"
|
||||
local APP="$1"; local IMAGE_TAG="$2"; local PHASE_SCRIPT_KEY="predeploy"
|
||||
local APP="$1"
|
||||
local IMAGE_TAG="$2"
|
||||
local PHASE_SCRIPT_KEY="predeploy"
|
||||
|
||||
dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)"
|
||||
execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
dokku_cleanup_cmd() {
|
||||
@@ -11,5 +12,4 @@ dokku_cleanup_cmd() {
|
||||
docker_cleanup "$APP" "true"
|
||||
}
|
||||
|
||||
|
||||
dokku_cleanup_cmd "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
shift 1
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
dokku_report_cmd() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
dokku_trace_cmd() {
|
||||
@@ -12,7 +13,7 @@ dokku_trace_cmd() {
|
||||
|
||||
if [[ "$2" == "on" ]]; then
|
||||
echo "Enabling dokku trace"
|
||||
echo "export DOKKU_TRACE=1" > "$DOKKU_ROOT/.dokkurc/DOKKU_TRACE"
|
||||
echo "export DOKKU_TRACE=1" >"$DOKKU_ROOT/.dokkurc/DOKKU_TRACE"
|
||||
fi
|
||||
|
||||
if [[ "$2" == "off" ]]; then
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
dokku_urls_cmd() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
dokku_version_cmd() {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help events:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | events:help)
|
||||
help_content_func () {
|
||||
help_content_func() {
|
||||
declare desc="return events plugin help content"
|
||||
cat<<help_content
|
||||
cat <<help_content
|
||||
events [-t], Show the last events (-t follows)
|
||||
events:list, List logged events
|
||||
events:on, Enable events logger
|
||||
@@ -14,15 +15,15 @@ case "$1" in
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "events:help" ]] ; then
|
||||
echo 'Usage: dokku events:COMMAND [-t]'
|
||||
echo ''
|
||||
echo 'Interact with Dokku event logger.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
if [[ $1 == "events:help" ]]; then
|
||||
echo 'Usage: dokku events:COMMAND [-t]'
|
||||
echo ''
|
||||
echo 'Interact with Dokku event logger.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
help_content_func
|
||||
fi
|
||||
;;
|
||||
|
||||
@@ -31,4 +32,3 @@ help_content
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename "$0")" "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
DOKKU_RSYSLOG_FILTER_DIR=/etc/rsyslog.d
|
||||
@@ -13,7 +14,7 @@ flag_rsyslog_needs_restart=n
|
||||
# shellcheck disable=SC2174
|
||||
mkdir -m 775 -p "$DOKKU_LOGS_DIR"
|
||||
case "$DOKKU_DISTRO" in
|
||||
arch|debian|centos|rhel)
|
||||
arch | debian | centos | rhel)
|
||||
chgrp dokku "$DOKKU_LOGS_DIR"
|
||||
;;
|
||||
*)
|
||||
@@ -21,10 +22,10 @@ case "$DOKKU_DISTRO" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
|
||||
if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
|
||||
touch "$DOKKU_EVENTS_LOGFILE"
|
||||
case "$DOKKU_DISTRO" in
|
||||
arch|debian|centos|rhel)
|
||||
arch | debian | centos | rhel)
|
||||
chgrp dokku "$DOKKU_EVENTS_LOGFILE"
|
||||
;;
|
||||
*)
|
||||
@@ -35,7 +36,7 @@ if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
|
||||
chmod 664 "$DOKKU_EVENTS_LOGFILE"
|
||||
fi
|
||||
|
||||
if [[ -d "$DOKKU_RSYSLOG_FILTER_DIR" && ! -f "$DOKKU_RSYSLOG_FILTER" ]]; then
|
||||
if [[ -d "$DOKKU_RSYSLOG_FILTER_DIR" && ! -f "$DOKKU_RSYSLOG_FILTER" ]]; then
|
||||
cat >"$DOKKU_RSYSLOG_FILTER" <<EOF
|
||||
:syslogtag, contains, "dokku" $DOKKU_EVENTS_LOGFILE
|
||||
EOF
|
||||
@@ -59,7 +60,7 @@ $DOKKU_LOGS_DIR/*.log {
|
||||
}
|
||||
EOF
|
||||
|
||||
if [[ "$DOKKU_DISTRO" = "debian" ]]; then
|
||||
if [[ "$DOKKU_DISTRO" == "debian" ]]; then
|
||||
sed -i 's/ syslog dokku$/ root dokku/g' $DOKKU_LOGROTATE_FILE
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
events_main_cmd() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
events_list_cmd() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
events_off_cmd() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
events_on_cmd() {
|
||||
@@ -7,7 +8,7 @@ events_on_cmd() {
|
||||
local cmd="events:on"
|
||||
echo "Enabling dokku events logger"
|
||||
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
|
||||
echo "export DOKKU_EVENTS=1" > "$DOKKU_ROOT/.dokkurc/DOKKU_EVENTS"
|
||||
echo "export DOKKU_EVENTS=1" >"$DOKKU_ROOT/.dokkurc/DOKKU_EVENTS"
|
||||
}
|
||||
|
||||
events_on_cmd "$@"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help apps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | apps:help)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
@@ -8,7 +9,7 @@ apps_create() {
|
||||
declare APP="$1"
|
||||
is_valid_app_name "$APP"
|
||||
|
||||
apps_exists "$APP" > /dev/null 2>&1 && dokku_log_fail "Name is already taken"
|
||||
apps_exists "$APP" >/dev/null 2>&1 && dokku_log_fail "Name is already taken"
|
||||
|
||||
mkdir -p "$DOKKU_ROOT/$APP"
|
||||
dokku_log_info1_quiet "Creating $APP... done"
|
||||
@@ -17,7 +18,7 @@ apps_create() {
|
||||
|
||||
apps_destroy() {
|
||||
declare desc="destroys an app"
|
||||
declare APP="$1";
|
||||
declare APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local IMAGE_TAG=$(get_running_image_tag "$APP")
|
||||
|
||||
@@ -54,7 +55,7 @@ apps_maybe_create() {
|
||||
declare desc="creates an app dir if allowed"
|
||||
declare APP="$1"
|
||||
|
||||
if ! apps_exists "$APP" > /dev/null 2>&1; then
|
||||
if ! apps_exists "$APP" >/dev/null 2>&1; then
|
||||
DOKKU_GLOBAL_DISABLE_AUTOCREATE="$(config_get --global DOKKU_DISABLE_APP_AUTOCREATION || true)"
|
||||
if [[ "$DOKKU_GLOBAL_DISABLE_AUTOCREATE" == "true" ]]; then
|
||||
dokku_log_warn "App auto-creation disabled."
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-apps-report() {
|
||||
declare desc="displays the app report for one or more apps"
|
||||
@@ -30,7 +31,7 @@ cmd-apps-report() {
|
||||
cmd-apps-report-single() {
|
||||
declare APP="$1" INFO_FLAG="$2"
|
||||
local APP_DIR="$DOKKU_ROOT/$APP"
|
||||
local use_echo;
|
||||
local use_echo
|
||||
if [[ "$INFO_FLAG" == "true" ]]; then
|
||||
use_echo=true
|
||||
INFO_FLAG=""
|
||||
@@ -38,7 +39,7 @@ cmd-apps-report-single() {
|
||||
verify_app_name "$APP"
|
||||
local flag_map=(
|
||||
"--app-dir: $APP_DIR"
|
||||
"--git-sha: $(GIT_DIR="$APP_DIR" git rev-parse --short HEAD 2> /dev/null || false)"
|
||||
"--git-sha: $(GIT_DIR="$APP_DIR" git rev-parse --short HEAD 2>/dev/null || false)"
|
||||
"--deploy-source: $(: | plugn trigger deploy-source "$APP")"
|
||||
"--locked: $(apps_is_locked "$APP")"
|
||||
)
|
||||
@@ -58,7 +59,8 @@ cmd-apps-report-single() {
|
||||
fi
|
||||
fi
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
local match=false
|
||||
local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
@@ -76,10 +78,9 @@ cmd-apps-report-single() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
apps_help_content_func() {
|
||||
declare desc="return apps plugin help content"
|
||||
cat<<help_content
|
||||
cat <<help_content
|
||||
apps, [DEPRECATED] Alias for apps:list
|
||||
apps:clone <old-app> <new-app>, Clones an app
|
||||
apps:create <app>, Create a new app
|
||||
@@ -94,7 +95,7 @@ help_content
|
||||
}
|
||||
|
||||
apps_help_cmd() {
|
||||
if [[ $1 = "apps:help" ]] ; then
|
||||
if [[ $1 == "apps:help" ]]; then
|
||||
echo -e 'Usage: dokku apps[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage Dokku apps'
|
||||
@@ -111,7 +112,7 @@ apps_help_cmd() {
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
apps_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
cat <<help_desc
|
||||
apps, Manage Dokku apps
|
||||
help_desc
|
||||
fi
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
app_post_delete() {
|
||||
declare desc="apps post-delete plugin trigger"
|
||||
local trigger="app_post_delete"
|
||||
local APP="$1"; local IMAGE_REPO=$(get_app_image_repo "$APP")
|
||||
local APP="$1"
|
||||
local IMAGE_REPO=$(get_app_image_repo "$APP")
|
||||
if [[ -n $APP ]]; then
|
||||
# remove contents for apps that are symlinks to other folders
|
||||
rm -rf "${DOKKU_ROOT:?}/$APP/" > /dev/null
|
||||
rm -rf "${DOKKU_ROOT:?}/$APP/" >/dev/null
|
||||
# then remove the folder and/or the symlink
|
||||
rm -rf "${DOKKU_ROOT:?}/$APP" > /dev/null
|
||||
rm -rf "${DOKKU_ROOT:?}/$APP" >/dev/null
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
apps_pre_delete() {
|
||||
declare desc="apps pre-delete plugin trigger"
|
||||
local trigger="apps_pre_delete"
|
||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG"); local CACHE_DIR="$DOKKU_ROOT/$APP/cache"; local CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$APP/cache"
|
||||
local APP="$1"
|
||||
local IMAGE_TAG="$2"
|
||||
local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
|
||||
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
local CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$APP/cache"
|
||||
verify_app_name "$APP"
|
||||
|
||||
if ! is_image_herokuish_based "$IMAGE"; then
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-apps-report-single "$@"
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
apps_clone_cmd() {
|
||||
declare desc="clones an app"
|
||||
declare cmd="apps:clone" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare cmd="apps:clone" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare OLD_APP="$1" NEW_APP="$2"
|
||||
local IGNORE_EXISTING=false
|
||||
local SKIP_REBUILD=false
|
||||
@@ -22,8 +24,8 @@ apps_clone_cmd() {
|
||||
|
||||
is_valid_app_name "$OLD_APP"
|
||||
is_valid_app_name "$NEW_APP"
|
||||
apps_exists "$OLD_APP" > /dev/null 2>&1 || dokku_log_fail "App does not exist"
|
||||
if apps_exists "$NEW_APP" > /dev/null 2>&1; then
|
||||
apps_exists "$OLD_APP" >/dev/null 2>&1 || dokku_log_fail "App does not exist"
|
||||
if apps_exists "$NEW_APP" >/dev/null 2>&1; then
|
||||
if [[ "$IGNORE_EXISTING" == true ]]; then
|
||||
dokku_log_warn "Name is already taken"
|
||||
return
|
||||
@@ -36,9 +38,9 @@ apps_clone_cmd() {
|
||||
local NEW_CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$NEW_APP/cache"
|
||||
|
||||
apps_create "$NEW_APP"
|
||||
pushd "$DOKKU_ROOT/$OLD_APP/." > /dev/null
|
||||
pushd "$DOKKU_ROOT/$OLD_APP/." >/dev/null
|
||||
find ./* -not \( -name .cache \) | grep -v "./cache" | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
|
||||
popd > /dev/null 2>&1 || pushd "/tmp" > /dev/null
|
||||
popd >/dev/null 2>&1 || pushd "/tmp" >/dev/null
|
||||
plugn trigger post-app-clone-setup "$OLD_APP" "$NEW_APP"
|
||||
|
||||
if [[ -d "$NEW_CACHE_DIR" ]] && ! rmdir "$NEW_CACHE_DIR"; then
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
|
||||
apps_create_cmd() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
|
||||
dokku_log_warn "Deprecated: Please use apps:list"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
|
||||
apps_exists_cmd() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
|
||||
apps_list_cmd "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
|
||||
@@ -7,7 +8,8 @@ apps_lock_cmd() {
|
||||
declare desc="locks an app for deployment"
|
||||
declare cmd="apps:lock"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"; verify_app_name "$APP"
|
||||
declare APP="$1"
|
||||
verify_app_name "$APP"
|
||||
|
||||
touch "$DOKKU_ROOT/$APP/.deploy.lock" || dokku_log_fail "Unable to create deploy lock"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
|
||||
@@ -7,10 +8,11 @@ apps_locked_cmd() {
|
||||
declare desc="checks if an app is locked for deployment"
|
||||
declare cmd="apps:locked"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"; verify_app_name "$APP"
|
||||
declare APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local LOCKED="$(apps_is_locked "$APP")"
|
||||
|
||||
if [[ "$LOCKED" != "true" ]] ; then
|
||||
if [[ "$LOCKED" != "true" ]]; then
|
||||
dokku_log_fail_quiet "Deploy lock does not exist"
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
@@ -14,7 +15,7 @@ apps_rename_cmd() {
|
||||
local OLD_CACHE_DIR="$DOKKU_ROOT/$OLD_APP/cache"
|
||||
local OLD_CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$OLD_APP/cache"
|
||||
|
||||
if [[ -d "$OLD_CACHE_DIR" ]] && ! rmdir "$OLD_CACHE_DIR" > /dev/null 2>&1; then
|
||||
if [[ -d "$OLD_CACHE_DIR" ]] && ! rmdir "$OLD_CACHE_DIR" >/dev/null 2>&1; then
|
||||
docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$OLD_CACHE_HOST_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache
|
||||
fi
|
||||
rm -rf "$OLD_CACHE_DIR"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-apps-report "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
|
||||
@@ -7,11 +8,12 @@ apps_unlock_cmd() {
|
||||
declare desc="unlocks an app for deployment"
|
||||
declare cmd="apps:unlock"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"; verify_app_name "$APP"
|
||||
declare APP="$1"
|
||||
verify_app_name "$APP"
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/.deploy.lock" ]]; then
|
||||
dokku_log_warn "A deploy may be in progress."
|
||||
dokku_log_warn "Removing the app lock will not stop in progress deploys."
|
||||
dokku_log_warn "A deploy may be in progress."
|
||||
dokku_log_warn "Removing the app lock will not stop in progress deploys."
|
||||
fi
|
||||
|
||||
rm -f "$DOKKU_ROOT/$APP/.deploy.lock" || dokku_log_fail "Unable to remove deploy lock"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
@@ -10,7 +11,7 @@ build_env_pre_build_buildpack() {
|
||||
local IMAGE id
|
||||
|
||||
verify_app_name "$APP"
|
||||
IMAGE=$(get_app_image_name "$APP");
|
||||
IMAGE=$(get_app_image_name "$APP")
|
||||
|
||||
[[ -z $(config_get --global CURL_CONNECT_TIMEOUT) ]] && config_set --global CURL_CONNECT_TIMEOUT=90
|
||||
[[ -z $(config_get --global CURL_TIMEOUT) ]] && config_set --global CURL_TIMEOUT=600
|
||||
@@ -20,12 +21,12 @@ build_env_pre_build_buildpack() {
|
||||
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
|
||||
id=$(config_bundle --merged "$APP" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /tmp/env; cat | tar -x -C /tmp/env")
|
||||
test "$(docker wait "$id")" -eq 0
|
||||
docker commit "$id" "$IMAGE" > /dev/null
|
||||
docker commit "$id" "$IMAGE" >/dev/null
|
||||
|
||||
# create build env for 'old style' buildpacks and dokku plugins
|
||||
id=$(config_export app "$APP" --format envfile --merged | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "cat >> /app/.env")
|
||||
test "$(docker wait "$id")" -eq 0
|
||||
docker commit "$id" "$IMAGE" > /dev/null
|
||||
docker commit "$id" "$IMAGE" >/dev/null
|
||||
}
|
||||
|
||||
build_env_pre_build_buildpack "$@"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help certs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | certs:help)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
is_ssl_enabled() {
|
||||
declare desc="returns 0 if ssl is enabled for given app"
|
||||
local APP=$1; verify_app_name "$APP"
|
||||
local APP=$1
|
||||
verify_app_name "$APP"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if [[ -e "$APP_SSL_PATH/server.crt" ]] && [[ -e "$APP_SSL_PATH/server.key" ]]; then
|
||||
@@ -16,11 +18,12 @@ is_ssl_enabled() {
|
||||
|
||||
get_ssl_hostnames() {
|
||||
declare desc="returns a string of ssl hostnames extracted from an app's ssl certificate"
|
||||
local APP=$1; verify_app_name "$APP"
|
||||
local APP=$1
|
||||
verify_app_name "$APP"
|
||||
local SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
local SSL_HOSTNAME=$(openssl x509 -in "$SSL_PATH/server.crt" -noout -subject | tr '/' '\n' | grep CN= | cut -c4-)
|
||||
local SSL_HOSTNAME_ALT=$(openssl x509 -in "$SSL_PATH/server.crt" -noout -text | grep --after-context=1 '509v3 Subject Alternative Name:' | tail -n 1 | sed -e "s/[[:space:]]*DNS://g" | tr ',' '\n' || true)
|
||||
local SSL_HOSTNAME_ALT=$(openssl x509 -in "$SSL_PATH/server.crt" -noout -text | grep --after-context=1 '509v3 Subject Alternative Name:' | tail -n 1 | sed -e "s/[[:space:]]*DNS://g" | tr ',' '\n' || true)
|
||||
if [[ -n "$SSL_HOSTNAME_ALT" ]]; then
|
||||
local SSL_HOSTNAMES="${SSL_HOSTNAME}\n${SSL_HOSTNAME_ALT}"
|
||||
else
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-certs-report() {
|
||||
declare desc="displays an ssl report for one or more apps"
|
||||
@@ -51,7 +52,8 @@ cmd-certs-report-single() {
|
||||
dokku_log_verbose "$(printf "%-30s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
local match=false
|
||||
local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
@@ -71,7 +73,7 @@ cmd-certs-report-single() {
|
||||
|
||||
certs_help_content_func() {
|
||||
declare desc="return certs plugin help content"
|
||||
cat<<help_content
|
||||
cat <<help_content
|
||||
certs <app>, [DEPRECATED] Alternative for certs:report
|
||||
certs:add <app> CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin
|
||||
certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate
|
||||
@@ -86,7 +88,7 @@ help_content
|
||||
}
|
||||
|
||||
certs_help_cmd() {
|
||||
if [[ $1 = "certs:help" ]] ; then
|
||||
if [[ $1 == "certs:help" ]]; then
|
||||
echo -e 'Usage: dokku certs[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage Dokku apps SSL (TLS) certs.'
|
||||
@@ -96,7 +98,7 @@ certs_help_cmd() {
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
certs_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
cat <<help_desc
|
||||
certs, Manage Dokku apps SSL (TLS) certs
|
||||
help_desc
|
||||
fi
|
||||
@@ -123,7 +125,7 @@ certs_info_cmd() {
|
||||
dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')"
|
||||
dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")"
|
||||
dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')"
|
||||
dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")"
|
||||
dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g" | sed -e "s:^/::g" | sed -e "s:/:; :g")"
|
||||
local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
|
||||
if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
|
||||
local SSL_SELF_SIGNED="verified by a certificate authority."
|
||||
@@ -143,12 +145,12 @@ fn-ssl-enabled() {
|
||||
if is_ssl_enabled "$APP"; then
|
||||
SSL_ENABLED=true
|
||||
fi
|
||||
echo "$SSL_ENABLED"
|
||||
echo "$SSL_ENABLED"
|
||||
}
|
||||
|
||||
fn-ssl-expires-at() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }'
|
||||
@@ -165,7 +167,7 @@ fn-ssl-hostnames() {
|
||||
|
||||
fn-ssl-issuer() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g"
|
||||
@@ -174,7 +176,7 @@ fn-ssl-issuer() {
|
||||
|
||||
fn-ssl-starts-at() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }'
|
||||
@@ -183,10 +185,10 @@ fn-ssl-starts-at() {
|
||||
|
||||
fn-ssl-subject() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g"
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g" | sed -e "s:^/::g" | sed -e "s:/:; :g"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
certs_post_app_clone_setup() {
|
||||
declare desc="removes cert file when setting up a clone"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-certs-report-single "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
|
||||
@@ -32,15 +33,17 @@ certs_set() {
|
||||
local cmd="$1"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
local APP="$2"; local CRT_FILE="$3"; local KEY_FILE="$4"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
local APP="$2"
|
||||
local CRT_FILE="$3"
|
||||
local KEY_FILE="$4"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_file_import "$CRT_FILE" "$KEY_FILE"; then
|
||||
# importing from file
|
||||
true
|
||||
elif is_tar_import; then
|
||||
local CERTS_SET_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_certs_set.XXXX")
|
||||
pushd "$CERTS_SET_TMP_WORK_DIR" &> /dev/null
|
||||
pushd "$CERTS_SET_TMP_WORK_DIR" &>/dev/null
|
||||
trap 'popd &> /dev/null || true; rm -rf $CERTS_SET_TMP_WORK_DIR > /dev/null' RETURN
|
||||
tar xvf - <&0
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
|
||||
dokku_log_warn "Deprecated: Please use certs:report"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
@@ -13,7 +14,7 @@ certs_generate_cmd() {
|
||||
|
||||
if [[ ! -f "$APP_SSL_PATH/server.key" ]] && [[ ! -f "$APP_SSL_PATH/server.crt" ]]; then
|
||||
local CERTS_GENERATE_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_certs.XXXXXXXXX")
|
||||
pushd "$CERTS_GENERATE_TMP_WORK_DIR" > /dev/null
|
||||
pushd "$CERTS_GENERATE_TMP_WORK_DIR" >/dev/null
|
||||
trap 'popd &> /dev/null || true; rm -rf "$CERTS_GENERATE_TMP_WORK_DIR" > /dev/null' INT TERM EXIT
|
||||
|
||||
openssl genrsa -out server.key 2048
|
||||
@@ -22,7 +23,7 @@ certs_generate_cmd() {
|
||||
|
||||
mkdir -p "$APP_SSL_PATH"
|
||||
dokku_log_info1 "Installing certificate and key..."
|
||||
mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$CERTS_GENERATE_TMP_WORK_DIR/server.csr" "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$APP_SSL_PATH"
|
||||
mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$CERTS_GENERATE_TMP_WORK_DIR/server.csr" "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$APP_SSL_PATH"
|
||||
chmod 750 "$APP_SSL_PATH"
|
||||
chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.csr" "$APP_SSL_PATH/server.key"
|
||||
plugn trigger post-certs-update "$APP"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
|
||||
dokku_log_warn "Deprecated: Please use certs:report"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
certs_remove_cmd() {
|
||||
@@ -7,7 +8,8 @@ certs_remove_cmd() {
|
||||
local cmd="certs:remove"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
local APP="$2"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
local APP="$2"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if [[ -d "$APP_SSL_PATH" ]]; then
|
||||
dokku_log_info1 "Removing SSL endpoint from $APP"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-certs-report "$@"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help checks:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | checks:help)
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
is_app_proctype_checks_disabled() {
|
||||
declare desc="return true if app's proctype(s) checks are disabled"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local PROCTYPE="$2" status=false
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
|
||||
|
||||
if [[ "$DOKKU_CHECKS_DISABLED" == "_all_" ]] || [[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "true" ]] ;then
|
||||
if [[ "$DOKKU_CHECKS_DISABLED" == "_all_" ]] || [[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "true" ]]; then
|
||||
status=true
|
||||
fi
|
||||
|
||||
@@ -18,11 +20,12 @@ is_app_proctype_checks_disabled() {
|
||||
|
||||
is_app_proctype_checks_skipped() {
|
||||
declare desc="return true if app's proctype(s) checks are skipped"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local PROCTYPE="$2" status=false
|
||||
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
|
||||
|
||||
if [[ "$DOKKU_CHECKS_SKIPPED" == "_all_" ]] || [[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "true" ]] ;then
|
||||
if [[ "$DOKKU_CHECKS_SKIPPED" == "_all_" ]] || [[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "true" ]]; then
|
||||
status=true
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-checks-report() {
|
||||
declare desc="shows reports for an app"
|
||||
@@ -45,7 +46,8 @@ cmd-checks-report-single() {
|
||||
dokku_log_verbose "$(printf "%-30s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
local match=false
|
||||
local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
@@ -65,7 +67,7 @@ cmd-checks-report-single() {
|
||||
|
||||
checks_help_content_func() {
|
||||
declare desc="return checks plugin help content"
|
||||
cat<<help_content
|
||||
cat <<help_content
|
||||
checks <app>, [DEPRECATED] Alternative for checks:report
|
||||
checks:disable <app> [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
||||
checks:enable <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
||||
@@ -76,7 +78,7 @@ help_content
|
||||
}
|
||||
|
||||
checks_help_cmd() {
|
||||
if [[ $1 = "checks:help" ]] ; then
|
||||
if [[ $1 == "checks:help" ]]; then
|
||||
echo -e 'Usage: dokku checks[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage zero-downtime settings.'
|
||||
@@ -86,7 +88,7 @@ checks_help_cmd() {
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
checks_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
cat <<help_desc
|
||||
checks, Manage zero-downtime settings
|
||||
help_desc
|
||||
fi
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-checks-report-single "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
@@ -7,7 +8,8 @@ checks_disable_cmd() {
|
||||
declare desc="disable zero-downtime checks for app/proctypes"
|
||||
local cmd="checks:disable"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local PROCTYPES="${2:-_all_}"
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
|
||||
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
|
||||
@@ -21,10 +23,10 @@ checks_disable_cmd() {
|
||||
local PROCTYPE OIFS="$IFS" IFS=,
|
||||
for PROCTYPE in $PROCTYPES; do
|
||||
IFS="$OIFS"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "false" ]] && \
|
||||
DOKKU_CHECKS_DISABLED="$(add_val_to_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "true" ]] && \
|
||||
DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "false" ]] \
|
||||
&& DOKKU_CHECKS_DISABLED="$(add_val_to_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "true" ]] \
|
||||
&& DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
|
||||
done
|
||||
DOKKU_CHECKS_DISABLED="$(remove_val_from_list "_all_" "$DOKKU_CHECKS_DISABLED")"
|
||||
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
@@ -7,7 +8,8 @@ checks_enable_cmd() {
|
||||
declare desc="enable zero-downtime checks for app/proctypes"
|
||||
local cmd="checks:enable"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local PROCTYPES="${2:-_all_}"
|
||||
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-checks-report "$@"
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
check_all_processes() {
|
||||
local APP="$1"; CHECK_PROC_TYPE="$2"
|
||||
local APP="$1"
|
||||
CHECK_PROC_TYPE="$2"
|
||||
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
local VALID_CHECK_PROC_TYPE=false
|
||||
|
||||
local line; local PROC_TYPE; local PROC_COUNT
|
||||
local line
|
||||
local PROC_TYPE
|
||||
local PROC_COUNT
|
||||
while read -r line || [[ -n "$line" ]]; do
|
||||
[[ "$line" =~ ^#.* ]] && continue
|
||||
line="$(strip_inline_comments "$line")"
|
||||
@@ -26,7 +30,7 @@ check_all_processes() {
|
||||
fi
|
||||
|
||||
check_process_type "$APP" "$PROC_TYPE" "$PROC_COUNT"
|
||||
done < "$DOKKU_SCALE_FILE"
|
||||
done <"$DOKKU_SCALE_FILE"
|
||||
|
||||
if [[ "$VALID_CHECK_PROC_TYPE" == "false" ]]; then
|
||||
dokku_log_fail "Invalid process type specified ($APP.$CHECK_PROC_TYPE)"
|
||||
@@ -39,7 +43,7 @@ check_process_type() {
|
||||
|
||||
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]]; do
|
||||
check_process "$APP" "$PROC_TYPE" "$CONTAINER_INDEX"
|
||||
local CONTAINER_INDEX=$(( CONTAINER_INDEX + 1 ))
|
||||
local CONTAINER_INDEX=$((CONTAINER_INDEX + 1))
|
||||
done
|
||||
}
|
||||
|
||||
@@ -57,7 +61,7 @@ check_process() {
|
||||
is_image_herokuish_based "$IMAGE" && IS_HEROKUISH_CONTAINER=true
|
||||
|
||||
dokku_log_info1 "Running checks for app ($APP.$PROC_TYPE.$CONTAINER_INDEX)"
|
||||
CONTAINER_ID=$(< "$DOKKU_CONTAINER_ID_FILE")
|
||||
CONTAINER_ID=$(<"$DOKKU_CONTAINER_ID_FILE")
|
||||
IP="$(plugn trigger network-get-ipaddr "$APP" "$PROC_TYPE" "$CONTAINER_ID")"
|
||||
PORT="$(plugn trigger network-get-port "$APP" "$PROC_TYPE" "$IS_HEROKUISH_CONTAINER" "$CONTAINER_ID")"
|
||||
plugn trigger check-deploy "$APP" "$CONTAINER_ID" "$PROC_TYPE" "$PORT" "$IP"
|
||||
@@ -67,7 +71,8 @@ checks_run_cmd() {
|
||||
declare desc="run zero-downtime checks for app/proctypes"
|
||||
local cmd="checks:run"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local PROCTYPES="${2:-_all_}"
|
||||
|
||||
dokku_log_info1 "Running pre-flight checks"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
@@ -7,7 +8,8 @@ checks_skip_cmd() {
|
||||
declare desc="skip zero-downtime checks for app/proctypes"
|
||||
local cmd="checks:skip"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local PROCTYPES="${2:-_all_}"
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
|
||||
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
|
||||
@@ -21,10 +23,10 @@ checks_skip_cmd() {
|
||||
local PROCTYPE OIFS="$IFS" IFS=,
|
||||
for PROCTYPE in $PROCTYPES; do
|
||||
IFS="$OIFS"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "false" ]] && \
|
||||
DOKKU_CHECKS_SKIPPED="$(add_val_to_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "true" ]] && \
|
||||
DOKKU_CHECKS_DISABLED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "false" ]] \
|
||||
&& DOKKU_CHECKS_SKIPPED="$(add_val_to_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "true" ]] \
|
||||
&& DOKKU_CHECKS_DISABLED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
|
||||
done
|
||||
DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "_all_" "$DOKKU_CHECKS_SKIPPED")"
|
||||
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
has_tty() {
|
||||
declare desc="return 0 if we have a tty"
|
||||
@@ -129,13 +130,14 @@ dokku_log_event() {
|
||||
dokku_log_plugn_trigger_call() {
|
||||
declare desc="log plugn trigger calls"
|
||||
|
||||
local l_hook="$1" ; shift
|
||||
local l_hook="$1"
|
||||
shift
|
||||
dokku_log_event "INVOKED: ${l_hook}( $* ) NAME=$NAME FINGERPRINT=$FINGERPRINT"
|
||||
}
|
||||
|
||||
dokku_container_log_verbose_quiet() {
|
||||
declare desc="log verbose container output (with quiet option)"
|
||||
local CID=$1;
|
||||
local CID=$1
|
||||
shift
|
||||
|
||||
OIFS=$IFS
|
||||
@@ -151,7 +153,7 @@ is_valid_app_name() {
|
||||
declare desc="verify app name format"
|
||||
local APP="$1"
|
||||
[[ ! -n "$APP" ]] && dokku_log_fail "APP must not be null"
|
||||
if [[ "$APP" =~ ^[a-z].* ]] || [[ "$APP" =~ ^[0-9].* ]]; then
|
||||
if [[ "$APP" =~ ^[a-z].* ]] || [[ "$APP" =~ ^[0-9].* ]]; then
|
||||
if [[ ! $APP =~ [A-Z] ]] && [[ ! $APP =~ [:] ]]; then
|
||||
return 0
|
||||
fi
|
||||
@@ -182,14 +184,17 @@ verify_image() {
|
||||
|
||||
get_app_image_repo() {
|
||||
declare desc="central definition of image repo pattern"
|
||||
local APP="$1"; local IMAGE_REPO="dokku/$APP"
|
||||
local APP="$1"
|
||||
local IMAGE_REPO="dokku/$APP"
|
||||
is_valid_app_name "$APP"
|
||||
echo "$IMAGE_REPO"
|
||||
}
|
||||
|
||||
get_deploying_app_image_name() {
|
||||
declare desc="return deploying image identifier for a given app, tag tuple. validate if tag is presented"
|
||||
local APP="$1"; local IMAGE_TAG="$2"; IMAGE_REPO="$3"
|
||||
local APP="$1"
|
||||
local IMAGE_TAG="$2"
|
||||
IMAGE_REPO="$3"
|
||||
is_valid_app_name "$APP"
|
||||
|
||||
local IMAGE_REMOTE_REPOSITORY=$(plugn trigger deployed-app-repository "$APP")
|
||||
@@ -208,7 +213,9 @@ get_deploying_app_image_name() {
|
||||
|
||||
get_app_image_name() {
|
||||
declare desc="return image identifier for a given app, tag tuple. validate if tag is presented"
|
||||
local APP="$1"; local IMAGE_TAG="$2"; IMAGE_REPO="$3"
|
||||
local APP="$1"
|
||||
local IMAGE_TAG="$2"
|
||||
IMAGE_REPO="$3"
|
||||
is_valid_app_name "$APP"
|
||||
|
||||
if [[ -z "$IMAGE_REPO" ]]; then
|
||||
@@ -245,7 +252,7 @@ get_running_image_tag() {
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
|
||||
local CIDS=( $(get_app_container_ids "$APP") )
|
||||
local CIDS=($(get_app_container_ids "$APP"))
|
||||
local RUNNING_IMAGE_TAG=$(docker inspect -f '{{ .Config.Image }}' "${CIDS[0]}" 2>/dev/null | awk -F: '{ print $2 }' || echo '')
|
||||
echo "$RUNNING_IMAGE_TAG"
|
||||
}
|
||||
@@ -254,7 +261,7 @@ is_image_herokuish_based() {
|
||||
declare desc="returns true if app image is based on herokuish"
|
||||
# circleci can't support --rm as they run lxc in lxc
|
||||
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
|
||||
docker run "$DOKKU_GLOBAL_RUN_ARGS" --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec" &> /dev/null
|
||||
docker run "$DOKKU_GLOBAL_RUN_ARGS" --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec" &>/dev/null
|
||||
}
|
||||
|
||||
get_docker_version() {
|
||||
@@ -264,7 +271,8 @@ get_docker_version() {
|
||||
|
||||
is_number() {
|
||||
declare desc="returns 0 if input is a number"
|
||||
local NUMBER=$1; local NUM_RE='^[0-9]+$'
|
||||
local NUMBER=$1
|
||||
local NUM_RE='^[0-9]+$'
|
||||
if [[ $NUMBER =~ $NUM_RE ]]; then
|
||||
return 0
|
||||
else
|
||||
@@ -276,18 +284,20 @@ is_abs_path() {
|
||||
declare desc="returns 0 if input path is absolute"
|
||||
local TEST_PATH=$1
|
||||
if [[ "$TEST_PATH" == /* ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
declare desc="top-level cli arg parser"
|
||||
local next_index=1; local skip=false; local args=("$@")
|
||||
local next_index=1
|
||||
local skip=false
|
||||
local args=("$@")
|
||||
for arg in "$@"; do
|
||||
if [[ "$skip" == "true" ]]; then
|
||||
next_index=$(( next_index + 1 ))
|
||||
next_index=$((next_index + 1))
|
||||
skip=false
|
||||
continue
|
||||
fi
|
||||
@@ -302,24 +312,27 @@ parse_args() {
|
||||
--trace)
|
||||
export DOKKU_TRACE=1
|
||||
;;
|
||||
--rm-container|--rm)
|
||||
--rm-container | --rm)
|
||||
export DOKKU_RM_CONTAINER=1
|
||||
;;
|
||||
--force)
|
||||
export DOKKU_APPS_FORCE_DELETE=1
|
||||
;;
|
||||
--app)
|
||||
export DOKKU_APP_NAME=${args[$next_index]}; skip=true
|
||||
export DOKKU_APP_NAME=${args[$next_index]}
|
||||
skip=true
|
||||
;;
|
||||
esac
|
||||
next_index=$(( next_index + 1 ))
|
||||
next_index=$((next_index + 1))
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
copy_from_image() {
|
||||
declare desc="copy file from named image to destination"
|
||||
local IMAGE="$1"; local SRC_FILE="$2"; local DST_DIR="$3"
|
||||
local IMAGE="$1"
|
||||
local SRC_FILE="$2"
|
||||
local DST_DIR="$3"
|
||||
verify_app_name "$APP"
|
||||
|
||||
if verify_image "$IMAGE"; then
|
||||
@@ -330,7 +343,7 @@ copy_from_image() {
|
||||
fi
|
||||
local CID=$(docker create "$DOKKU_GLOBAL_RUN_ARGS" "$IMAGE")
|
||||
docker cp "$CID:$SRC_FILE" "$DST_DIR"
|
||||
docker rm -f "$CID" &> /dev/null
|
||||
docker rm -f "$CID" &>/dev/null
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
@@ -338,9 +351,10 @@ copy_from_image() {
|
||||
|
||||
get_app_container_ids() {
|
||||
declare desc="returns list of docker container ids for given app and optional container_type"
|
||||
local APP="$1"; local CONTAINER_TYPE="$2"
|
||||
local APP="$1"
|
||||
local CONTAINER_TYPE="$2"
|
||||
verify_app_name "$APP"
|
||||
[[ -f $DOKKU_ROOT/$APP/CONTAINER ]] && DOKKU_CIDS+=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
[[ -f $DOKKU_ROOT/$APP/CONTAINER ]] && DOKKU_CIDS+=$(<"$DOKKU_ROOT/$APP/CONTAINER")
|
||||
|
||||
if [[ -n "$CONTAINER_TYPE" ]]; then
|
||||
local CONTAINER_PATTERN="$DOKKU_ROOT/$APP/CONTAINER.$CONTAINER_TYPE.*"
|
||||
@@ -356,7 +370,7 @@ get_app_container_ids() {
|
||||
local DOKKU_CID_FILE
|
||||
for DOKKU_CID_FILE in $CONTAINER_PATTERN; do
|
||||
local DOKKU_CIDS+=" "
|
||||
local DOKKU_CIDS+=$(< "$DOKKU_CID_FILE")
|
||||
local DOKKU_CIDS+=$(<"$DOKKU_CID_FILE")
|
||||
local DOKKU_CIDS+=" "
|
||||
done
|
||||
shopt -u nullglob
|
||||
@@ -389,7 +403,7 @@ get_app_running_container_types() {
|
||||
CONTAINER_TYPES="$(find "$DOKKU_ROOT/$APP" -maxdepth 1 -name "CONTAINER.*" -print0 2>/dev/null | xargs -0)"
|
||||
if [[ -n "$CONTAINER_TYPES" ]]; then
|
||||
CONTAINER_TYPES="${CONTAINER_TYPES//$DOKKU_ROOT\/$APP\//}"
|
||||
CONTAINER_TYPES="$(tr " " $'\n' <<< "$CONTAINER_TYPES" | awk -F. '{ print $2 }' | sort | uniq | xargs)"
|
||||
CONTAINER_TYPES="$(tr " " $'\n' <<<"$CONTAINER_TYPES" | awk -F. '{ print $2 }' | sort | uniq | xargs)"
|
||||
fi
|
||||
|
||||
echo "$CONTAINER_TYPES"
|
||||
@@ -398,7 +412,10 @@ get_app_running_container_types() {
|
||||
is_deployed() {
|
||||
declare desc="return 0 if given app has a running container"
|
||||
local APP="$1"
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(ls "$DOKKU_ROOT/$APP"/CONTAINER.* &> /dev/null; echo $?) -eq 0 ]]; then
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(
|
||||
ls "$DOKKU_ROOT/$APP"/CONTAINER.* &>/dev/null
|
||||
echo $?
|
||||
) -eq 0 ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@@ -425,7 +442,7 @@ is_container_status() {
|
||||
declare desc="return 0 if given docker container id is in given state"
|
||||
local CID=$1
|
||||
local TEMPLATE="{{.State.$2}}"
|
||||
local CONTAINER_STATUS=$(docker inspect -f "$TEMPLATE" "$CID" 2> /dev/null || true)
|
||||
local CONTAINER_STATUS=$(docker inspect -f "$TEMPLATE" "$CID" 2>/dev/null || true)
|
||||
|
||||
if [[ "$CONTAINER_STATUS" == "true" ]]; then
|
||||
return 0
|
||||
@@ -455,7 +472,10 @@ dokku_build() {
|
||||
declare desc="build phase"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"; local TMP_WORK_DIR="$3"; local IMAGE=$(get_app_image_name "$APP")
|
||||
local APP="$1"
|
||||
local IMAGE_SOURCE_TYPE="$2"
|
||||
local TMP_WORK_DIR="$3"
|
||||
local IMAGE=$(get_app_image_name "$APP")
|
||||
local cid
|
||||
verify_app_name "$APP"
|
||||
|
||||
@@ -463,14 +483,14 @@ dokku_build() {
|
||||
local DOKKU_APP_HOST_CACHE_DIR="$DOKKU_HOST_ROOT/$APP/cache"
|
||||
|
||||
eval "$(config_export app "$APP")"
|
||||
pushd "$TMP_WORK_DIR" &> /dev/null
|
||||
pushd "$TMP_WORK_DIR" &>/dev/null
|
||||
|
||||
case "$IMAGE_SOURCE_TYPE" in
|
||||
herokuish)
|
||||
DOKKU_IMAGE="$(config_get "$APP" DOKKU_IMAGE || echo "$DOKKU_IMAGE")"
|
||||
cid=$(tar -c . | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /app && tar -xC /app")
|
||||
test "$(docker wait "$cid")" -eq 0
|
||||
docker commit "$cid" "$IMAGE" > /dev/null
|
||||
docker commit "$cid" "$IMAGE" >/dev/null
|
||||
[[ -d $DOKKU_APP_CACHE_DIR ]] || mkdir -p "$DOKKU_APP_CACHE_DIR"
|
||||
plugn trigger pre-build-buildpack "$APP"
|
||||
|
||||
@@ -482,7 +502,7 @@ dokku_build() {
|
||||
cid=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -v $DOKKU_APP_HOST_CACHE_DIR:/cache -e CACHE_PATH=/cache "${ARG_ARRAY[@]}" $IMAGE /build)
|
||||
docker attach "$cid"
|
||||
test "$(docker wait "$cid")" -eq 0
|
||||
docker commit "$cid" "$IMAGE" > /dev/null
|
||||
docker commit "$cid" "$IMAGE" >/dev/null
|
||||
|
||||
plugn trigger post-build-buildpack "$APP"
|
||||
;;
|
||||
@@ -502,7 +522,7 @@ dokku_build() {
|
||||
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
|
||||
# strip --volume and -v args from DOCKER_ARGS
|
||||
local DOCKER_ARGS=$(sed -e "s/--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS")
|
||||
local DOCKER_ARGS=$(sed -e "s/--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<<"$DOCKER_ARGS")
|
||||
declare -a ARG_ARRAY
|
||||
eval "ARG_ARRAY=($DOCKER_ARGS)"
|
||||
|
||||
@@ -522,7 +542,10 @@ dokku_release() {
|
||||
declare desc="release phase"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"; local IMAGE_TAG="$3"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
local APP="$1"
|
||||
local IMAGE_SOURCE_TYPE="$2"
|
||||
local IMAGE_TAG="$3"
|
||||
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
local cid
|
||||
verify_app_name "$APP"
|
||||
|
||||
@@ -532,12 +555,12 @@ dokku_release() {
|
||||
if [[ -n $(config_export global) ]]; then
|
||||
cid=$(config_export global | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
|
||||
test "$(docker wait "$cid")" -eq 0
|
||||
docker commit "$cid" "$IMAGE" > /dev/null
|
||||
docker commit "$cid" "$IMAGE" >/dev/null
|
||||
fi
|
||||
if [[ -n $(config_export app "$APP") ]]; then
|
||||
cid=$(config_export app "$APP" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh")
|
||||
test "$(docker wait "$cid")" -eq 0
|
||||
docker commit "$cid" "$IMAGE" > /dev/null
|
||||
docker commit "$cid" "$IMAGE" >/dev/null
|
||||
fi
|
||||
plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
|
||||
;;
|
||||
@@ -567,7 +590,9 @@ release_and_deploy() {
|
||||
declare desc="main function for releasing and deploying an app"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
local APP="$1"
|
||||
local IMAGE_TAG="$2"
|
||||
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
local DOKKU_DOCKERFILE_PORTS
|
||||
|
||||
verify_app_name "$APP"
|
||||
@@ -609,11 +634,14 @@ dokku_receive() {
|
||||
declare desc="receives an app kicks off deploy process"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP="$1"; local IMAGE=$(get_app_image_name "$APP"); local IMAGE_SOURCE_TYPE="$2"; local TMP_WORK_DIR="$3"
|
||||
local APP="$1"
|
||||
local IMAGE=$(get_app_image_name "$APP")
|
||||
local IMAGE_SOURCE_TYPE="$2"
|
||||
local TMP_WORK_DIR="$3"
|
||||
local DOKKU_SKIP_CLEANUP="$(config_get "$APP" DOKKU_SKIP_CLEANUP || true)"
|
||||
docker_cleanup "$APP"
|
||||
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
|
||||
config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE" &> /dev/null
|
||||
config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE" &>/dev/null
|
||||
dokku_build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
|
||||
release_and_deploy "$APP"
|
||||
}
|
||||
@@ -638,15 +666,15 @@ docker_cleanup() {
|
||||
|
||||
# delete all non-running containers
|
||||
# shellcheck disable=SC2046
|
||||
docker rm $(docker ps -a -f "status=exited" -f "label=$DOKKU_CONTAINER_LABEL" -q) &> /dev/null || true
|
||||
docker rm $(docker ps -a -f "status=exited" -f "label=$DOKKU_CONTAINER_LABEL" -q) &>/dev/null || true
|
||||
|
||||
# delete all dead containers
|
||||
# shellcheck disable=SC2046
|
||||
docker rm $(docker ps -a -f "status=dead" -f "label=$DOKKU_CONTAINER_LABEL" -q) &> /dev/null || true
|
||||
docker rm $(docker ps -a -f "status=dead" -f "label=$DOKKU_CONTAINER_LABEL" -q) &>/dev/null || true
|
||||
|
||||
# delete unused images
|
||||
# shellcheck disable=SC2046
|
||||
docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null &
|
||||
docker rmi $(docker images -f 'dangling=true' -q) &>/dev/null &
|
||||
}
|
||||
|
||||
get_available_port() {
|
||||
@@ -666,7 +694,7 @@ dokku_auth() {
|
||||
declare desc="calls user-auth plugin trigger"
|
||||
export SSH_USER=${SSH_USER:=$USER}
|
||||
export SSH_NAME=${NAME:="default"}
|
||||
if ! plugn trigger user-auth "$SSH_USER" "$SSH_NAME" "$@" ; then
|
||||
if ! plugn trigger user-auth "$SSH_USER" "$SSH_NAME" "$@"; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
@@ -680,18 +708,18 @@ _ipv4_regex() {
|
||||
_ipv6_regex() {
|
||||
declare desc="ipv6 regex"
|
||||
local RE_IPV4="$(_ipv4_regex)"
|
||||
local RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
local RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
local RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
local RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
local RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
local RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
local RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
local RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
local RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
local RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
echo "$RE_IPV6"
|
||||
}
|
||||
|
||||
@@ -719,7 +747,8 @@ get_dockerfile_exposed_ports() {
|
||||
|
||||
get_exposed_ports_from_image() {
|
||||
declare desc="return all exposed ports from passed image name"
|
||||
local IMAGE="$1"; verify_image "$IMAGE"
|
||||
local IMAGE="$1"
|
||||
verify_image "$IMAGE"
|
||||
# shellcheck disable=SC2016
|
||||
local DOCKER_IMAGE_EXPOSED_PORTS="$(docker inspect -f '{{range $key, $value := .Config.ExposedPorts}}{{$key}} {{end}}' "$IMAGE")"
|
||||
echo "$DOCKER_IMAGE_EXPOSED_PORTS"
|
||||
@@ -727,14 +756,16 @@ get_exposed_ports_from_image() {
|
||||
|
||||
get_entrypoint_from_image() {
|
||||
declare desc="return .Config.Entrypoint from passed image name"
|
||||
local IMAGE="$1"; verify_image "$IMAGE"
|
||||
local IMAGE="$1"
|
||||
verify_image "$IMAGE"
|
||||
local DOCKER_IMAGE_ENTRYPOINT="$(docker inspect --format '{{range .Config.Entrypoint}}{{.}} {{end}}' "$IMAGE")"
|
||||
echo "ENTRYPOINT $DOCKER_IMAGE_ENTRYPOINT"
|
||||
}
|
||||
|
||||
get_cmd_from_image() {
|
||||
declare desc="return .Config.Cmd from passed image name"
|
||||
local IMAGE="$1"; verify_image "$IMAGE"
|
||||
local IMAGE="$1"
|
||||
verify_image "$IMAGE"
|
||||
local DOCKER_IMAGE_CMD="$(docker inspect --format '{{range .Config.Cmd}}{{.}} {{end}}' "$IMAGE")"
|
||||
DOCKER_IMAGE_CMD="${DOCKER_IMAGE_CMD/\/bin\/sh -c/}"
|
||||
echo "CMD $DOCKER_IMAGE_CMD"
|
||||
@@ -742,7 +773,8 @@ get_cmd_from_image() {
|
||||
|
||||
extract_directive_from_dockerfile() {
|
||||
declare desc="return requested directive from passed file path"
|
||||
local FILE_PATH="$1"; local SEARCH_STRING="$2"
|
||||
local FILE_PATH="$1"
|
||||
local SEARCH_STRING="$2"
|
||||
local FOUND_LINE=$(egrep "^${SEARCH_STRING} " "$FILE_PATH" | tail -n1) || true
|
||||
echo "$FOUND_LINE"
|
||||
}
|
||||
@@ -751,21 +783,23 @@ get_app_raw_tcp_ports() {
|
||||
declare desc="extracts raw tcp port numbers from DOCKERFILE_PORTS config variable"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local DOCKERFILE_PORTS="$(config_get "$APP" DOKKU_DOCKERFILE_PORTS)"
|
||||
for p in $DOCKERFILE_PORTS; do
|
||||
if [[ ! "$p" =~ .*udp.* ]]; then
|
||||
p=${p//\/tcp}
|
||||
p=${p//\/tcp/}
|
||||
raw_tcp_ports+="$p "
|
||||
fi
|
||||
done
|
||||
local raw_tcp_ports="$(echo "$raw_tcp_ports"| xargs)"
|
||||
local raw_tcp_ports="$(echo "$raw_tcp_ports" | xargs)"
|
||||
echo "$raw_tcp_ports"
|
||||
}
|
||||
|
||||
get_container_ports() {
|
||||
declare desc="returns published ports from app containers"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local APP_CIDS="$(get_app_container_ids "$APP")"
|
||||
local cid
|
||||
|
||||
@@ -808,8 +842,8 @@ internal_get_app_urls() {
|
||||
local port_map app_vhost
|
||||
local app_vhosts=$(get_app_domains "$APP")
|
||||
for port_map in $DOKKU_PROXY_PORT_MAP; do
|
||||
local scheme="$(awk -F ':' '{ print $1 }' <<< "$port_map")"
|
||||
local listen_port="$(awk -F ':' '{ print $2 }' <<< "$port_map")"
|
||||
local scheme="$(awk -F ':' '{ print $1 }' <<<"$port_map")"
|
||||
local listen_port="$(awk -F ':' '{ print $2 }' <<<"$port_map")"
|
||||
for app_vhost in $app_vhosts; do
|
||||
if [[ "$listen_port" != "80" ]] && [[ "$listen_port" != "443" ]]; then
|
||||
port_urls+=" $scheme://$app_vhost:$listen_port "
|
||||
@@ -819,7 +853,7 @@ internal_get_app_urls() {
|
||||
done
|
||||
done
|
||||
fi
|
||||
local port_urls="$(echo "$port_urls"| xargs)"
|
||||
local port_urls="$(echo "$port_urls" | xargs)"
|
||||
local URLS="$(merge_dedupe_list "$port_urls $app_urls" " ")"
|
||||
case "$1" in
|
||||
url)
|
||||
@@ -828,13 +862,14 @@ internal_get_app_urls() {
|
||||
else
|
||||
echo "$URLS" | tr ' ' '\n' | head -n1
|
||||
fi
|
||||
;;
|
||||
;;
|
||||
urls)
|
||||
echo "$URLS" | tr ' ' '\n' | sort
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
else
|
||||
local SCHEME="http"; local SSL="$DOKKU_ROOT/$APP/tls"
|
||||
local SCHEME="http"
|
||||
local SSL="$DOKKU_ROOT/$APP/tls"
|
||||
if [[ -e "$SSL/server.crt" && -e "$SSL/server.key" ]]; then
|
||||
local SCHEME="https"
|
||||
fi
|
||||
@@ -844,30 +879,30 @@ internal_get_app_urls() {
|
||||
local APP_CONTAINER_PORTS="$(get_container_ports "$APP")"
|
||||
local app_port
|
||||
for app_port in $APP_CONTAINER_PORTS; do
|
||||
echo "$(< "$DOKKU_ROOT/HOSTNAME"):$app_port (container)"
|
||||
echo "$(<"$DOKKU_ROOT/HOSTNAME"):$app_port (container)"
|
||||
done
|
||||
else
|
||||
local DOKKU_APP_LISTENERS PORT
|
||||
DOKKU_APP_LISTENERS="$(plugn trigger network-get-listeners "$APP" | xargs)"
|
||||
for DOKKU_APP_LISTENER in $DOKKU_APP_LISTENERS; do
|
||||
PORT="$(echo "$DOKKU_APP_LISTENER" | cut -d ':' -f2)"
|
||||
echo "$SCHEME://$(< "$DOKKU_ROOT/HOSTNAME"):$PORT (container)"
|
||||
echo "$SCHEME://$(<"$DOKKU_ROOT/HOSTNAME"):$PORT (container)"
|
||||
done
|
||||
shopt -u nullglob
|
||||
fi
|
||||
elif [[ -n "$DOKKU_PROXY_PORT_MAP" ]]; then
|
||||
local port_map
|
||||
for port_map in $DOKKU_PROXY_PORT_MAP; do
|
||||
local scheme="$(awk -F ':' '{ print $1 }' <<< "$port_map")"
|
||||
local listen_port="$(awk -F ':' '{ print $2 }' <<< "$port_map")"
|
||||
echo "$scheme://$(< "$DOKKU_ROOT/HOSTNAME"):$listen_port"
|
||||
local scheme="$(awk -F ':' '{ print $1 }' <<<"$port_map")"
|
||||
local listen_port="$(awk -F ':' '{ print $2 }' <<<"$port_map")"
|
||||
echo "$scheme://$(<"$DOKKU_ROOT/HOSTNAME"):$listen_port"
|
||||
done
|
||||
elif [[ -n "$RAW_TCP_PORTS" ]]; then
|
||||
for p in $RAW_TCP_PORTS; do
|
||||
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$p"
|
||||
echo "http://$(<"$DOKKU_ROOT/HOSTNAME"):$p"
|
||||
done
|
||||
else
|
||||
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
|
||||
echo "$SCHEME://$(<"$DOKKU_ROOT/VHOST")"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -879,7 +914,7 @@ get_json_value() {
|
||||
local JSON_NODE="$1"
|
||||
local JSON_NODE=${JSON_NODE//\./\"][\"}
|
||||
local JSON_NODE="[\"${JSON_NODE}\"]"
|
||||
cat | python2.7 -c 'import json,sys;obj=json.load(sys.stdin);print json.dumps(obj'"${JSON_NODE}"').strip("\"")';
|
||||
cat | python2.7 -c 'import json,sys;obj=json.load(sys.stdin);print json.dumps(obj'"${JSON_NODE}"').strip("\"")'
|
||||
}
|
||||
|
||||
get_json_keys() {
|
||||
@@ -889,9 +924,9 @@ get_json_keys() {
|
||||
local JSON_NODE=${JSON_NODE//\./\"][\"}
|
||||
local JSON_NODE="[\"${JSON_NODE}\"]"
|
||||
if [[ "$JSON_NODE" == "[\"\"]" ]]; then
|
||||
cat | python2.7 -c 'import json,sys;obj=json.load(sys.stdin);print " ".join(obj.keys())';
|
||||
cat | python2.7 -c 'import json,sys;obj=json.load(sys.stdin);print " ".join(obj.keys())'
|
||||
else
|
||||
cat | python2.7 -c 'import json,sys;obj=json.load(sys.stdin);print " ".join(obj'"${JSON_NODE}"'.keys())';
|
||||
cat | python2.7 -c 'import json,sys;obj=json.load(sys.stdin);print " ".join(obj'"${JSON_NODE}"'.keys())'
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -938,13 +973,14 @@ merge_dedupe_list() {
|
||||
declare desc="combine lists ($1) separated by delimiter ($2) (delimiter defaults to comma), dedupe and return list"
|
||||
local input_lists="$1" delimiter="${2:-,}"
|
||||
|
||||
local merged_list="$(tr "$delimiter" $'\n' <<< "$input_lists" | sort | uniq | xargs)"
|
||||
local merged_list="$(tr "$delimiter" $'\n' <<<"$input_lists" | sort | uniq | xargs)"
|
||||
echo "$merged_list"
|
||||
}
|
||||
|
||||
acquire_app_deploy_lock() {
|
||||
declare desc="acquire advisory lock for use in git/tar deploys"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local LOCK_TYPE="${2:-waiting}"
|
||||
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
|
||||
local LOCK_WAITING_MSG="$APP currently has a deploy lock in place. Waiting..."
|
||||
@@ -955,7 +991,8 @@ acquire_app_deploy_lock() {
|
||||
|
||||
release_app_deploy_lock() {
|
||||
declare desc="release advisory lock used in git/tar deploys"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
|
||||
|
||||
release_advisory_lock "$APP_DEPLOY_LOCK_FILE"
|
||||
@@ -969,7 +1006,10 @@ acquire_advisory_lock() {
|
||||
|
||||
eval "exec $LOCK_FD>$LOCK_FILE"
|
||||
if [[ "$LOCK_TYPE" == "waiting" ]]; then
|
||||
while [[ $(flock -n "$LOCK_FD" &>/dev/null ; echo $?) -ne 0 ]]; do
|
||||
while [[ $(
|
||||
flock -n "$LOCK_FD" &>/dev/null
|
||||
echo $?
|
||||
) -ne 0 ]]; do
|
||||
if [[ "$SHOW_MSG" == "true" ]]; then
|
||||
echo "$LOCK_WAITING_MSG"
|
||||
SHOW_MSG=false
|
||||
@@ -986,7 +1026,7 @@ release_advisory_lock() {
|
||||
local LOCK_FILE="$1"
|
||||
local LOCK_FD="200"
|
||||
|
||||
flock -u "$LOCK_FD" && rm -f "$LOCK_FILE" &> /dev/null
|
||||
flock -u "$LOCK_FD" && rm -f "$LOCK_FILE" &>/dev/null
|
||||
}
|
||||
|
||||
suppress_output() {
|
||||
@@ -995,7 +1035,7 @@ suppress_output() {
|
||||
TMP_COMMAND_OUTPUT=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX")
|
||||
trap 'rm -rf "$TMP_COMMAND_OUTPUT" > /dev/null' RETURN INT TERM EXIT
|
||||
|
||||
"$@" > "$TMP_COMMAND_OUTPUT" 2>&1 || {
|
||||
"$@" >"$TMP_COMMAND_OUTPUT" 2>&1 || {
|
||||
local exit_code="$?"
|
||||
cat "$TMP_COMMAND_OUTPUT"
|
||||
return "$exit_code"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
fn-plugin-property-delete() {
|
||||
declare desc="delete a key from the property store for an app"
|
||||
@@ -97,6 +98,6 @@ fn-plugin-property-write() {
|
||||
fi
|
||||
|
||||
mkdir -p "${DOKKU_LIB_ROOT}/config/${PLUGIN}/${APP}"
|
||||
echo "$VALUE" > "${DOKKU_LIB_ROOT}/config/${PLUGIN}/${APP}/${KEY}"
|
||||
echo "$VALUE" >"${DOKKU_LIB_ROOT}/config/${PLUGIN}/${APP}/${KEY}"
|
||||
chmod 600 "${DOKKU_LIB_ROOT}/config/${PLUGIN}/${APP}/${KEY}"
|
||||
}
|
||||
|
||||
2
plugins/common/vendor/github.com/codegangsta/inject/update_readme.sh
generated
vendored
2
plugins/common/vendor/github.com/codegangsta/inject/update_readme.sh
generated
vendored
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
go get github.com/robertkrimen/godocdown/godocdown
|
||||
godocdown > README.md
|
||||
godocdown >README.md
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
@@ -9,7 +10,7 @@ config_docker_args() {
|
||||
local ENV_ARGS IMAGE STDIN trigger
|
||||
|
||||
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
|
||||
STDIN=$(cat);
|
||||
STDIN=$(cat)
|
||||
trigger="$0 config_docker_args"
|
||||
verify_app_name "$APP"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
config_sub() {
|
||||
@@ -23,7 +24,6 @@ config_export() {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
config_all() {
|
||||
declare desc="Backwards compatible function for plugin use"
|
||||
[[ "$1" == "config" ]] || set -- "config" "$@"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help docker-options:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
docker_options_help_content_func() {
|
||||
declare desc="return docker-options plugin help content"
|
||||
cat<<help_content
|
||||
declare desc="return docker-options plugin help content"
|
||||
cat <<help_content
|
||||
docker-options <app> [phase(s)], [DEPRECATED] Alternative for docker-options:report
|
||||
docker-options:add <app> <phase(s)> OPTION, Add Docker option to app for phase (comma separated phase list)
|
||||
docker-options:remove <app> <phase(s)> OPTION, Remove Docker option from app for phase (comma separated phase list)
|
||||
@@ -13,7 +14,7 @@ help_content
|
||||
}
|
||||
|
||||
docker_options_help_cmd() {
|
||||
if [[ $1 = "docker-options:help" ]] ; then
|
||||
if [[ $1 == "docker-options:help" ]]; then
|
||||
echo -e 'Usage: dokku docker-options[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Display app'"'"'s Docker options for all phases.'
|
||||
@@ -23,7 +24,7 @@ docker_options_help_cmd() {
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
docker_options_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
cat <<help_desc
|
||||
docker-options, Pass options to Docker the various stages of an app
|
||||
help_desc
|
||||
fi
|
||||
@@ -32,10 +33,10 @@ help_desc
|
||||
case "$1" in
|
||||
help | docker-options:help)
|
||||
docker_options_help_cmd "$@"
|
||||
;;
|
||||
;;
|
||||
|
||||
*)
|
||||
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
;;
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
docker_args() {
|
||||
declare desc="docker args plugin trigger"
|
||||
local trigger="$0"
|
||||
local STDIN=$(cat)
|
||||
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"
|
||||
local APP="$1"
|
||||
local IMAGE_SOURCE_TYPE="$2"
|
||||
|
||||
case "$0" in
|
||||
*docker-args-build)
|
||||
@@ -41,26 +43,26 @@ docker_args() {
|
||||
case "$IMAGE_SOURCE_TYPE" in
|
||||
dockerfile)
|
||||
case "$line" in
|
||||
--link*|-v*)
|
||||
--link* | -v*)
|
||||
continue
|
||||
;;
|
||||
|
||||
*)
|
||||
local output="$output $line"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
;;
|
||||
|
||||
herokuish)
|
||||
case "$line" in
|
||||
--file*|--build-args*)
|
||||
--file* | --build-args*)
|
||||
continue
|
||||
;;
|
||||
|
||||
*)
|
||||
local output="$output $line"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
;;
|
||||
|
||||
*)
|
||||
@@ -69,7 +71,7 @@ docker_args() {
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done < "$PHASE_FILE_PATH"
|
||||
done <"$PHASE_FILE_PATH"
|
||||
fi
|
||||
|
||||
echo -n "$STDIN$output"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
AVAILABLE_PHASES=(build deploy run)
|
||||
@@ -22,15 +23,16 @@ get_phase_file_path() {
|
||||
get_phases() {
|
||||
declare desc="returns array of passed passes if all are in allowed array"
|
||||
local passed_phases_list="$1"
|
||||
local -r phases_allowed=$(sed -e 's/ /\|/g' <<< "${AVAILABLE_PHASES[@]}")
|
||||
local -r phases_allowed=$(sed -e 's/ /\|/g' <<<"${AVAILABLE_PHASES[@]}")
|
||||
local phase
|
||||
local passed_phases
|
||||
if [[ -n "$passed_phases_list" ]]; then
|
||||
OIFS=$IFS; IFS=','
|
||||
read -ra passed_phases <<< "$passed_phases_list"
|
||||
OIFS=$IFS
|
||||
IFS=','
|
||||
read -ra passed_phases <<<"$passed_phases_list"
|
||||
IFS=$OIFS
|
||||
for phase in "${passed_phases[@]}"; do
|
||||
[[ "$phase" = @($phases_allowed) ]] || dokku_log_fail "Phase(s) must be one of [${AVAILABLE_PHASES[*]}]"
|
||||
[[ "$phase" == @($phases_allowed) ]] || dokku_log_fail "Phase(s) must be one of [${AVAILABLE_PHASES[*]}]"
|
||||
done
|
||||
echo "${passed_phases[@]}"
|
||||
fi
|
||||
@@ -58,7 +60,7 @@ display_all_phases_options() {
|
||||
for phase in "${phases[@]}"; do
|
||||
local phase_file_path="$(get_phase_file_path "$phase")"
|
||||
if [[ -s "$phase_file_path" ]]; then
|
||||
display_phase_options "$phase" "$phase_file_path"
|
||||
display_phase_options "$phase" "$phase_file_path"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -86,9 +88,9 @@ add_passed_docker_option() {
|
||||
for phase in "${passed_phases[@]}"; do
|
||||
local phase_file_path="$(get_phase_file_path "$phase")"
|
||||
create_phase_file_if_required "$phase_file_path"
|
||||
echo "${passed_option_string}" >> "$phase_file_path"
|
||||
local all_phase_options="$(< "$phase_file_path")"
|
||||
echo -e "${all_phase_options}" | sed '/^$/d' | sort -u > "$phase_file_path"
|
||||
echo "${passed_option_string}" >>"$phase_file_path"
|
||||
local all_phase_options="$(<"$phase_file_path")"
|
||||
echo -e "${all_phase_options}" | sed '/^$/d' | sort -u >"$phase_file_path"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -101,9 +103,9 @@ remove_passed_docker_option() {
|
||||
for phase in "${passed_phases[@]}"; do
|
||||
local phase_file_path="$(get_phase_file_path "$phase")"
|
||||
[[ ! -s "$phase_file_path" ]] || {
|
||||
local all_phase_options="$(< "$phase_file_path")"
|
||||
local all_phase_options="$(<"$phase_file_path")"
|
||||
local all_phase_options=$(echo -e "${all_phase_options}" | sed "s#^${passed_option_string}\$##")
|
||||
echo -e "${all_phase_options}" | sed '/^$/d' | sort -u > "$phase_file_path"
|
||||
echo -e "${all_phase_options}" | sed '/^$/d' | sort -u >"$phase_file_path"
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-docker-options-report() {
|
||||
declare desc="displays a docker options report for one or more apps"
|
||||
@@ -46,7 +47,8 @@ cmd-docker-options-report-single() {
|
||||
dokku_log_verbose "$(printf "%-30s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
local match=false
|
||||
local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
@@ -68,6 +70,6 @@ fn-docker-options() {
|
||||
declare APP="$1" PHASE="$2"
|
||||
local PHASE_FILE="$(fn-get-phase-file-path "$APP" "$PHASE")"
|
||||
if [[ -r "$PHASE_FILE" ]]; then
|
||||
tr '\n' ' ' < "$PHASE_FILE"
|
||||
tr '\n' ' ' <"$PHASE_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/docker-options/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-docker-options-report-single "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
|
||||
|
||||
@@ -8,7 +9,7 @@ docker_options_add_cmd() {
|
||||
local cmd="docker-options:add"
|
||||
|
||||
verify_app_name "$2" && local APP="$2"
|
||||
read -ra passed_phases <<< "$(get_phases "$3")"
|
||||
read -ra passed_phases <<<"$(get_phases "$3")"
|
||||
shift 3 # everything else passed is the docker option
|
||||
local passed_docker_option="$*"
|
||||
[[ -z "$passed_docker_option" ]] && dokku_log_fail "Please specify docker options to add to the phase"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
|
||||
|
||||
@@ -9,7 +10,7 @@ docker_options_main_cmd() {
|
||||
dokku_log_warn "Deprecated: Please use docker-options:report"
|
||||
|
||||
verify_app_name "$2" && local APP="$2"
|
||||
read -ra passed_phases <<< "$(get_phases "$3")"
|
||||
read -ra passed_phases <<<"$(get_phases "$3")"
|
||||
if [[ ! "${passed_phases[@]}" ]]; then
|
||||
display_all_phases_options
|
||||
else
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
|
||||
|
||||
@@ -8,7 +9,7 @@ docker_options_remove_cmd() {
|
||||
local cmd="docker-options:remove"
|
||||
|
||||
verify_app_name "$2" && local APP="$2"
|
||||
read -ra passed_phases <<< "$(get_phases "$3")"
|
||||
read -ra passed_phases <<<"$(get_phases "$3")"
|
||||
shift 3 # everything else passed is the docker option
|
||||
# shellcheck disable=SC2154
|
||||
[[ -z ${passed_docker_option="$@"} ]] && dokku_log_fail "Please specify docker options to remove from the phase"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/docker-options/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-docker-options-report "$@"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help domains:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | domains:help)
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
disable_app_vhost() {
|
||||
declare desc="disable vhost support for given application"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP=$1; verify_app_name "$APP"
|
||||
local APP=$1
|
||||
verify_app_name "$APP"
|
||||
local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||
local APP_URLS_FILE="$DOKKU_ROOT/$APP/URLS"
|
||||
|
||||
@@ -28,14 +30,17 @@ disable_app_vhost() {
|
||||
domains_setup() {
|
||||
declare desc="setup domains to default state"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"; local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
||||
local RE_IPV4="$(get_ipv4_regex)"; local RE_IPV6="$(get_ipv6_regex)"
|
||||
local APP="$1"
|
||||
local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
||||
local RE_IPV4="$(get_ipv4_regex)"
|
||||
local RE_IPV6="$(get_ipv6_regex)"
|
||||
local DEFAULT_VHOSTS="$(get_default_vhosts "$APP")"
|
||||
|
||||
if [[ ! -f $APP_VHOST_PATH ]]; then
|
||||
if [[ -n "$DEFAULT_VHOSTS" ]]; then
|
||||
dokku_log_info1 "Creating new $APP_VHOST_PATH..."
|
||||
echo "$DEFAULT_VHOSTS" > "$APP_VHOST_PATH"
|
||||
echo "$DEFAULT_VHOSTS" >"$APP_VHOST_PATH"
|
||||
else
|
||||
dokku_log_info2 "no global VHOST set. disabling vhost support"
|
||||
disable_app_vhost "$APP" --no-restart
|
||||
@@ -46,7 +51,8 @@ domains_setup() {
|
||||
domains_add() {
|
||||
declare desc="add list of domains to app"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
local APP="$1"
|
||||
local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
|
||||
shift 1
|
||||
for DOMAIN in "$@"; do
|
||||
@@ -56,10 +62,13 @@ domains_add() {
|
||||
done
|
||||
|
||||
for DOMAIN in "$@"; do
|
||||
if [[ $(egrep -w "^$DOMAIN$" "$APP_VHOST_PATH" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
|
||||
if [[ $(
|
||||
egrep -w "^$DOMAIN$" "$APP_VHOST_PATH" >/dev/null 2>&1
|
||||
echo $?
|
||||
) -eq 0 ]]; then
|
||||
dokku_log_info1 "Skipping: $DOMAIN already added to $APP"
|
||||
else
|
||||
echo "$DOMAIN" >> "$APP_VHOST_PATH"
|
||||
echo "$DOMAIN" >>"$APP_VHOST_PATH"
|
||||
dokku_log_info1 "Added $DOMAIN to $APP"
|
||||
fi
|
||||
done
|
||||
@@ -74,7 +83,8 @@ domains_add() {
|
||||
domains_remove() {
|
||||
declare desc="remove list of app domains"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
local APP="$1"
|
||||
local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
shift 1
|
||||
|
||||
touch "$APP_VHOST_PATH"
|
||||
@@ -88,7 +98,8 @@ domains_remove() {
|
||||
domains_set() {
|
||||
declare desc="set list of domains for app"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
local APP="$1"
|
||||
local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
|
||||
shift 1
|
||||
touch "$APP_VHOST_PATH"
|
||||
@@ -98,7 +109,7 @@ domains_set() {
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$*" | tr " " "\n" > "$APP_VHOST_PATH"
|
||||
echo "$*" | tr " " "\n" >"$APP_VHOST_PATH"
|
||||
dokku_log_info1 "Set $* for $APP"
|
||||
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then
|
||||
@@ -111,7 +122,8 @@ domains_set() {
|
||||
domains_disable() {
|
||||
declare desc="disable domains/VHOST support"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
local APP="$1"
|
||||
local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
|
||||
touch "$APP_VHOST_PATH"
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "true" ]]; then
|
||||
@@ -124,13 +136,14 @@ domains_disable() {
|
||||
domains_enable() {
|
||||
declare desc="enable domains/VHOST support"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
local APP="$1"
|
||||
local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
local DEFAULT_VHOSTS="$(get_default_vhosts "$APP")"
|
||||
|
||||
touch "$APP_VHOST_PATH"
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then
|
||||
if [[ -n "$DEFAULT_VHOSTS" ]]; then
|
||||
echo "$DEFAULT_VHOSTS" > "$APP_VHOST_PATH"
|
||||
echo "$DEFAULT_VHOSTS" >"$APP_VHOST_PATH"
|
||||
fi
|
||||
[[ "$2" == "--no-restart" ]] && local ENABLE_APP_VHOST_ARGS=$2
|
||||
enable_app_vhost "$APP" "$ENABLE_APP_VHOST_ARGS"
|
||||
@@ -151,7 +164,10 @@ domains_add_global() {
|
||||
done
|
||||
|
||||
for DOMAIN in "$@"; do
|
||||
if [[ $(egrep -w "^$DOMAIN$" "$GLOBAL_VHOST_PATH" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
|
||||
if [[ $(
|
||||
egrep -w "^$DOMAIN$" "$GLOBAL_VHOST_PATH" >/dev/null 2>&1
|
||||
echo $?
|
||||
) -eq 0 ]]; then
|
||||
dokku_log_info1 "Skipping: $DOMAIN already added"
|
||||
else
|
||||
sed -i -e "\$a\\$DOMAIN" "$GLOBAL_VHOST_PATH"
|
||||
@@ -182,7 +198,7 @@ domains_set_global() {
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$*" | tr " " "\n" > "$GLOBAL_VHOST_PATH"
|
||||
echo "$*" | tr " " "\n" >"$GLOBAL_VHOST_PATH"
|
||||
dokku_log_info1 "Set $*"
|
||||
}
|
||||
|
||||
@@ -190,7 +206,8 @@ enable_app_vhost() {
|
||||
declare desc="enable vhost support for given application"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP=$1; verify_app_name "$APP"
|
||||
local APP=$1
|
||||
verify_app_name "$APP"
|
||||
|
||||
plugn trigger pre-enable-vhost "$APP"
|
||||
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
|
||||
@@ -201,7 +218,8 @@ enable_app_vhost() {
|
||||
get_app_domains() {
|
||||
declare desc="return app domains"
|
||||
verify_app_name "$1"
|
||||
local APP=$1; local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||
local APP=$1
|
||||
local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||
local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
||||
local GLOBAL_HOSTNAME_PATH="$DOKKU_ROOT/HOSTNAME"
|
||||
|
||||
@@ -219,8 +237,9 @@ get_app_domains() {
|
||||
get_default_vhosts() {
|
||||
declare desc="return default vhosts"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local RE_IPV4="$(get_ipv4_regex)"; local RE_IPV6="$(get_ipv6_regex)"
|
||||
|
||||
local APP="$1"
|
||||
local RE_IPV4="$(get_ipv4_regex)"
|
||||
local RE_IPV6="$(get_ipv6_regex)"
|
||||
|
||||
if [[ "$(is_global_vhost_enabled)" == "true" ]]; then
|
||||
local VHOSTS=$(get_global_vhosts)
|
||||
@@ -238,14 +257,14 @@ get_default_vhosts() {
|
||||
fi
|
||||
echo "$hostname"
|
||||
fi
|
||||
done <<< "$VHOSTS"
|
||||
done <<<"$VHOSTS"
|
||||
fi
|
||||
}
|
||||
|
||||
get_global_vhosts() {
|
||||
declare desc="return global vhosts"
|
||||
local GLOBAL_VHOST_FILE="$DOKKU_ROOT/VHOST"
|
||||
[[ -f "$GLOBAL_VHOST_FILE" ]] && local GLOBAL_VHOSTS=$(< "$GLOBAL_VHOST_FILE")
|
||||
[[ -f "$GLOBAL_VHOST_FILE" ]] && local GLOBAL_VHOSTS=$(<"$GLOBAL_VHOST_FILE")
|
||||
echo "$GLOBAL_VHOSTS"
|
||||
}
|
||||
|
||||
@@ -253,7 +272,8 @@ is_app_vhost_enabled() {
|
||||
declare desc="returns true or false if vhost support is enabled for a given application"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP=$1; verify_app_name "$APP"
|
||||
local APP=$1
|
||||
verify_app_name "$APP"
|
||||
local NO_VHOST=$(config_get "$APP" NO_VHOST)
|
||||
local APP_VHOST_ENABLED=true
|
||||
|
||||
@@ -276,14 +296,15 @@ is_global_vhost_enabled() {
|
||||
local GLOBAL_VHOSTS_ENABLED=true
|
||||
break
|
||||
fi
|
||||
done <<< "$GLOBAL_VHOSTS"
|
||||
done <<<"$GLOBAL_VHOSTS"
|
||||
|
||||
echo $GLOBAL_VHOSTS_ENABLED
|
||||
}
|
||||
|
||||
is_valid_hostname() {
|
||||
declare desc="return 0 if argument is a valid hostname; else return 1"
|
||||
local hostname_string="${1,,}"; local hostname_regex='^([a-z0-9\*-]+\.)*[a-z0-9\*-]+$'
|
||||
local hostname_string="${1,,}"
|
||||
local hostname_regex='^([a-z0-9\*-]+\.)*[a-z0-9\*-]+$'
|
||||
if [[ $hostname_string =~ $hostname_regex ]]; then
|
||||
return 0
|
||||
else
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
shopt -s nullglob
|
||||
|
||||
for app in $DOKKU_ROOT/*/CONTAINER; do
|
||||
APP=$(basename "$(dirname "$app")");
|
||||
APP=$(basename "$(dirname "$app")")
|
||||
domains_setup "$APP"
|
||||
done
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-domains-report() {
|
||||
declare desc="displays a domains report for one or more apps"
|
||||
@@ -47,7 +48,8 @@ cmd-domains-report-single() {
|
||||
dokku_log_verbose "$(printf "%-30s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
local match=false
|
||||
local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
@@ -65,9 +67,9 @@ cmd-domains-report-single() {
|
||||
fi
|
||||
}
|
||||
|
||||
domains_help_content_func () {
|
||||
declare desc="return domains plugin help content"
|
||||
cat<<help_content
|
||||
domains_help_content_func() {
|
||||
declare desc="return domains plugin help content"
|
||||
cat <<help_content
|
||||
domains [<app>], [DEPRECATED] Alternative for domains:report
|
||||
domains:add <app> <domain> [<domain> ...], Add domains to app
|
||||
domains:add-global <domain> [<domain> ...], Add global domain names
|
||||
@@ -83,7 +85,7 @@ help_content
|
||||
}
|
||||
|
||||
domains_help_cmd() {
|
||||
if [[ $1 = "domains:help" ]] ; then
|
||||
if [[ $1 == "domains:help" ]]; then
|
||||
echo -e 'Usage: dokku domains[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage vhost domains used by the Dokku proxy.'
|
||||
@@ -93,7 +95,7 @@ domains_help_cmd() {
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
domains_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
cat <<help_desc
|
||||
domains, Manage vhost domains used by the Dokku proxy
|
||||
help_desc
|
||||
fi
|
||||
@@ -112,7 +114,7 @@ fn-domains-app-vhosts() {
|
||||
declare APP="$1"
|
||||
local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||
if [[ -f "$APP_VHOST_FILE" ]]; then
|
||||
tr '\n' ' ' < "$APP_VHOST_FILE"
|
||||
tr '\n' ' ' <"$APP_VHOST_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
domains_post_app_clone_setup() {
|
||||
declare desc="removes domain files when setting up a clone"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cmd-domains-report-single "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
@@ -8,7 +9,8 @@ domains_clear_cmd() {
|
||||
local cmd="domains:clear"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
local APP="$2"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
local APP="$2"
|
||||
local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
|
||||
rm -f "$APP_VHOST_PATH"
|
||||
domains_setup "$APP"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user