Plugin triggers (formerly pluginhooks) are a good way to jack into existing Dokku infrastructure. You can use them to modify the output of various Dokku commands or override internal configuration.
Plugin triggers are simply scripts that are executed by the system. You can use any language you want, so long as the script:
For instance, if you wanted to write a plugin trigger in PHP, you would need to have php
installed and available on the CLI prior to plugin trigger invocation.
The following is an example for the nginx-hostname
plugin trigger. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named nginx-hostname
with the following code in your plugin trigger, it would be invoked by Dokku during the normal app deployment process:
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; SUBDOMAIN="$2"; VHOST="$3"
NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev`
echo "$NEW_SUBDOMAIN.$VHOST"
There are a number of plugin-related triggers. These can be optionally implemented by plugins and allow integration into the standard Dokku setup/teardown process.
The following plugin triggers describe those available to a Dokku installation. As well, there is an example for each trigger that you can use as templates for your own plugin development.
The example plugin trigger code is not guaranteed to be implemented as in within dokku, and are merely simplified examples. Please look at the Dokku source for larger, more in-depth examples.
post-config-update
dokku config:set
, dokku config:unset
$APP
set|unset
key1=VALUE1 key2=VALUE2
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
bind-external-ip
dokku deploy
$APP
#!/usr/bin/env bash
# Force always binding to the docker ip, no matter
# what the settings are for a given app.
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
echo false
check-deploy
dokku deploy
$APP $CONTAINER_ID $PROC_TYPE $PORT $IP
#!/usr/bin/env bash
# Disables deploys of containers based on whether the
# `DOKKU_DISABLE_DEPLOY` env var is set to `true` for an app
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/config/functions"
APP="$1"; CONTAINERID="$2"; PROC_TYPE="$3"; PORT="$4" ; IP="$5"
eval "$(config_export app $APP)"
DOKKU_DISABLE_DEPLOY="${DOKKU_DISABLE_DEPLOY:-false}"
if [[ "$DOKKU_DISABLE_DEPLOY" = "true" ]]; then
echo -e "\033[31m\033[1mDeploys disabled, sorry.\033[0m"
exit 1
fi
comands help
and commands <PLUGIN_NAME>:help
help
command in your commands
file to take advantage of this plugin trigger. commands help
is used by dokku help
to aggregate all plugins abbreviated help
output. Implementing <PLUGIN_NAME>:help
in your commands
file gives users looking for help, a more detailed output. 'commands help' must be implemented inside the commands
plugin file. It's recommended that PLUGIN_NAME:help
be added to the commands file to ensure consistency among community plugins and give you a new avenue to share rich help content with your user.dokku help
and commands <PLUGIN_NAME>:help
#!/usr/bin/env bash
# Outputs help for the derp plugin
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | hello:help)
help_content_func () {
declare desc="return help_content string"
cat<<help_content
hello <app>, Says "Hello <app>"
hello:world, Says "Hello world"
help_content
}
if [[ $1 = "hello:help" ]] ; then
echo -e 'Usage: dokku hello[:world] [<app>]'
echo ''
echo 'Say Hello World.'
echo ''
echo 'Example:'
echo ''
echo '$ dokku hello:world'
echo 'Hello world'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac
core-post-deploy
To avoid issues with community plugins, this plugin trigger should be used only for core plugins. Please avoid using this trigger in your own plugins.
dokku deploy
$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS $IMAGE_TAG
#!/usr/bin/env bash
# Notify an external service that a successful deploy has occurred.
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
curl "http://httpstat.us/200"
dependencies
plugin:install-dependencies
.dokku plugin:install-dependencies
#!/usr/bin/env bash
# Installs nginx for the current plugin
# Supports both opensuse and ubuntu
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
export DEBIAN_FRONTEND=noninteractive
case "$DOKKU_DISTRO" in
debian|ubuntu)
apt-get install --force-yes -qq -y nginx
;;
opensuse)
zypper -q in -y nginx
;;
esac
deployed-app-image-tag
internal function dokku_deploy_cmd() (deploy phase)
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# customize the tag version
echo 'not-latest'
deployed-app-image-repo
dokku/$APP
internal function dokku_deploy_cmd() (deploy phase)
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"
# change the repo from dokku/APP to dokkupaas/APP
echo "dokkupaas/$APP"
deployed-app-repository
internal function dokku_deploy_cmd() (deploy phase)
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
echo 'derp.dkr.ecr.us-east-1.amazonaws.com'
docker-args-build
internal function dokku_build() (build phase)
$APP $IMAGE_SOURCE_TYPE
#!/usr/bin/env bash
# Sets a docker build-arg called CACHEBUST which can be used
# to bust cache at any arbitrary point in a Dockerfile build
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cache-bust-build-arg() {
declare desc="dockerfile cache busting plugin trigger"
local STDIN=$(cat)
local APP="$1" IMAGE_SOURCE_TYPE="$2"
local output=""
if [[ "$IMAGE_SOURCE_TYPE" == "dockerfile" ]]; then
output=" --build-arg CACHEBUST=$(date +%s)"
fi
echo -n "$STDIN$output"
}
cache-bust-build-arg "$@"
docker-args-deploy
dokku deploy
$APP $IMAGE_TAG [$PROC_TYPE $CONTAINER_INDEX]
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
# TODO
docker-args-run
dokku run
$APP $IMAGE_TAG
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
# TODO
git-post-pull
dokku git-upload-pack
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
git-pre-pull
dokku git-upload-pack
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
WARNING: The
git-pre-pull
trigger should not be used for authentication since it does not get called for commands that usegit-upload-archive
such asgit archive
. Instead, use theuser-auth
trigger.
install
dokku plugin:install
.#!/usr/bin/env bash
# Sets the hostname of the Dokku server
# based on the output of `hostname -f`
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
hostname -f > $DOKKU_ROOT/HOSTNAME
fi
network-build-config
internally triggered by proxy-build-config within proxy implementations
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
network-compute-ports
internally triggered by proxy-build-config within proxy implementations
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
network-config-exists
internally triggered by core-post-deploy within proxy implementations
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
network-get-ipaddr
internally triggered by a deploy
$APP $PROC_TYPE $CONTAINER_ID
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
network-get-listeners
internally triggered by a deploy
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
network-get-property
internally triggered by a deploy
$APP $KEY
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
network-get-port
internally triggered by a deploy
$APP $PROC_TYPE $CONTAINER_ID $IS_HEROKUISH_CONTAINER
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
network-write-ipaddr
internally triggered by a deploy
$APP $PROC_TYPE $CONTAINER_INDEX $IP_ADDRESS
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
network-write-port
internally triggered by a deploy
$APP $PROC_TYPE $CONTAINER_INDEX $PORT
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
nginx-hostname
dokku domains:setup
$APP $SUBDOMAIN $VHOST
#!/usr/bin/env bash
# Reverses the hostname for the application
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; SUBDOMAIN="$2"; VHOST="$3"
NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev`
echo "$NEW_SUBDOMAIN.$VHOST"
nginx-pre-reload
dokku nginx:build-config
$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS
#!/usr/bin/env bash
# Runs a check against all nginx conf files
# to ensure they are valid
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
nginx -t
post-build-buildpack
internal function dokku_build() (build phase)
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
post-build-dockerfile
internal function dokku_build() (build phase)
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
post-certs-remove
dokku certs:remove
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
post-certs-update
dokku certs:add
, dokku certs:update
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
post-create
dokku apps:create
$APP
#!/usr/bin/env bash
# Runs a command to ensure that an app
# has a postgres database when it is starting
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1";
POSTGRES="$1"
dokku postgres:create $POSTGRES
dokku postgres:link $POSTGRES $APP
post-delete
dokku apps:destroy
$APP $IMAGE_TAG
#!/usr/bin/env bash
# Runs a command to ensure that an app's
# postgres installation is removed
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1";
dokku postgres:destroy $APP
post-deploy
Please see core-post-deploy if contributing a core plugin with the
post-deploy
hook.
core-post-deploy
. Deployment Tasks are also invoked by this plugin trigger.dokku deploy
$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS $IMAGE_TAG
#!/usr/bin/env bash
# Notify an external service that a successful deploy has occurred.
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
curl "http://httpstat.us/200"
post-domains-update
dokku domains:add
, dokku domains:clear
, dokku domains:remove
, dokku domains:set
$APP
action name
domains
#!/usr/bin/env bash
# Reloads haproxy for our imaginary haproxy plugin
# that replaces the nginx-vhosts plugin
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
sudo service haproxy reload
post-extract
dokku tar:in
, dokku tar:from
and the receive-app
plugin trigger$APP
$TMP_WORK_DIR
$REV
#!/usr/bin/env bash
# Adds a clock process to an app's Procfile
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
TMP_WORK_DIR="$2"
REV="$3" # optional, may not be sent for tar-based builds
pushd "$TMP_WORK_DIR" > /dev/null
touch Procfile
echo "clock: some-command" >> Procfile
post-proxy-ports-update
dokku proxy:ports-add
, dokku proxy:ports-clear
, dokku proxy:ports-remove
$APP
action name
#!/usr/bin/env bash
# Rebuilds haproxy config for our imaginary haproxy plugin
# that replaces the nginx-vhosts plugin
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/haproxy/functions"
APP="$1"; verify_app_name "$APP"
haproxy-build-config "$APP"
post-release-buildpack
internal function dokku_release() (release phase)
$APP $IMAGE_TAG
#!/usr/bin/env bash
# Installs a package specified by the `CONTAINER_PACKAGE` env var
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
dokku_log_info1 "Installing $CONTAINER_PACKAGE..."
CMD="cat > gm && \
dpkg -s CONTAINER_PACKAGE > /dev/null 2>&1 || \
(apt-get update && apt-get install -y CONTAINER_PACKAGE && apt-get clean)"
ID=$(docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "$CMD")
test $(docker wait $ID) -eq 0
docker commit $ID $IMAGE > /dev/null
post-release-dockerfile
internal function dokku_release() (release phase)
$APP $IMAGE_TAG
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
# TODO
post-stop
dokku ps:stop
$APP
#!/usr/bin/env bash
# Marks an application as manually stopped
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1";
dokku config:set --no-restart $APP MANUALLY_STOPPED=1
pre-build-buildpack
internal function dokku_build() (build phase)
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
pre-build-dockerfile
internal function dokku_build() (build phase)
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
pre-delete
dokku apps:destroy
$APP $IMAGE_TAG
#!/usr/bin/env bash
# Clears out the gulp asset build cache for applications
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
if [[ -d $GULP_CACHE_DIR ]]; then
docker run $DOKKU_GLOBAL_RUN_ARGS --rm -v "$GULP_CACHE_DIR:/gulp" "$IMAGE" find /gulp -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
fi
pre-deploy
dokku deploy
$APP $IMAGE_TAG
#!/usr/bin/env bash
# Runs gulp in our container
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
dokku_log_info1 "Running gulp"
id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $IMAGE /bin/bash -c "cd /app && gulp default")
test $(docker wait $id) -eq 0
docker commit $id $IMAGE > /dev/null
dokku_log_info1 "Building UI Complete"
pre-receive-app
IMAGE_SOURCE_TYPE
can be any of [herokuish, dockerfile]
dokku git-hook
, dokku tar-build-locked
$APP $IMAGE_SOURCE_TYPE $TMP_WORK_DIR $REV
#!/usr/bin/env bash
# Adds a file called `dokku-is-awesome` to the repository
# the contents will be the application name
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; IMAGE_SOURCE_TYPE="$2"; TMP_WORK_DIR="$3"; REV="$4"
echo "$APP" > "$TMP_WORK_DIR/dokku-is-awesome"
pre-release-buildpack
internal function dokku_release() (release phase)
$APP $IMAGE_TAG
#!/usr/bin/env bash
# Installs the graphicsmagick package into the container
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
dokku_log_info1 "Installing GraphicsMagick..."
CMD="cat > gm && \
dpkg -s graphicsmagick > /dev/null 2>&1 || \
(apt-get update && apt-get install -y graphicsmagick && apt-get clean)"
ID=$(docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "$CMD")
test $(docker wait $ID) -eq 0
docker commit $ID $IMAGE > /dev/null
pre-release-dockerfile
internal function dokku_release() (release phase)
$APP $IMAGE_TAG
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
# TODO
pre-disable-vhost
dokku domains:disable
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
pre-enable-vhost
dokku domains:enable
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
proxy-build-config
internally triggered by ps:restore
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
proxy-enable
internally triggered by ps:restore
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
proxy-disable
internally triggered by ps:restore
$APP
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
receive-app
dokku git-hook
, dokku ps:rebuild
$APP $REV
($REV
may not be included in cases where a repository is not pushed)#!/usr/bin/env bash
# For our imaginary mercurial plugin, triggers a rebuild
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; REV="$2"
dokku hg-build $APP $REV
receive-branch
dokku git-hook
, dokku ps:rebuild
$APP $REV $REFNAME
#!/bin/bash
# Gives Dokku the ability to support multiple branches for a given service
# Allowing you to have multiple staging environments on a per-branch basis
reference_app=$1
refname=$3
newrev=$2
APP=${refname/*\//}.$reference_app
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
REFERENCE_REPO="$DOKKU_ROOT/$reference_app
git clone --bare --shared --reference "$REFERENCE_REPO" "$REFERENCE_REPO" "$DOKKU_ROOT/$APP" > /dev/null
fi
plugn trigger receive-app $APP $newrev
retire-container-failed
dokku deploy
$APP
#!/usr/bin/env bash
# Send an email when a container failed to retire
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; HOSTNAME=$(hostname -s)
mail -s "$APP containers on $HOSTNAME failed to retire" ops@example.com
tags-create
dokku tags:create
$APP $IMAGE_TAG
#!/usr/bin/env bash
# Upload an application image to docker hub
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
IMAGE_ID=$(docker inspect --format '{{ .Id }}' $IMAGE)
docker tag -f $IMAGE_ID $DOCKER_HUB_USER/$APP:$IMAGE_TAG
docker push $DOCKER_HUB_USER/$APP:$IMAGE_TAG
tags-destroy
dokku tags:destroy
$APP $IMAGE_TAG
#!/usr/bin/env bash
# Remove an image tag from docker hub
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; IMAGE_TAG="$2"
some code to remove a docker hub tag because it's not implemented in the CLI....
uninstall
dokku plugin:uninstall
$PLUGIN
#!/usr/bin/env bash
# Cleanup up extra containers created
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
PLUGIN="$1"
[[ "$PLUGIN" = "my-plugin" ]] && docker rmi -f "${PLUGIN_IMAGE_DEPENDENCY}"
To avoid uninstalling other plugins make sure to check the plugin name like shown in the example.
update
dokku plugin:update
.#!/usr/bin/env bash
# Update the herokuish image from git source
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cd /root/dokku
sudo BUILD_STACK=true make install
user-auth
This is a special plugin trigger that is executed on every command run. As Dokku sometimes internally invokes the dokku
command, special care should be taken to properly handle internal command redirects.
Note that the trigger should exit as follows:
0
to continue running as normal1
to halt execution of the commandThe SSH_USER
is the original ssh user. If you are running remote commands, this user will typically be dokku
, and as such should not be trusted when checking permissions. If you are connected via ssh as a different user who then invokes dokku
, the value of this variable will be that user's name (root
, myuser
, etc.).
The SSH_NAME
is the NAME
variable set via the sshcommand acl-add
command. If you have set a user via the dokku-installer
, this value will be set to admin
. For installs via debian package, this value may be default
. For reference, the following command can be run as the root user to specify a specific NAME
for a given ssh key:
sshcommand acl-add dokku NAME < $PATH_TO_SSH_KEY
Note that the NAME
value is set at the first ssh key match. If an ssh key is set in the /home/dokku/.ssh/authorized_keys
multiple times, the first match will decide the value.
dokku
$SSH_USER $SSH_NAME $DOKKU_COMMAND
#!/usr/bin/env bash
# Allow root/admin users to do everything
# Deny plugin access to default users
# Allow access to all other commands
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
SSH_USER=$1
SSH_NAME=$2
shift 2
[[ "$SSH_USER" == "root" ]] && exit 0
[[ "$SSH_NAME" == "admin" ]] && exit 0
[[ "$SSH_NAME" == "default" && $1 == plugin:* ]] && exit 1
exit 0