Merge pull request #1959 from dokku/1942-dokku-port

Allow customizing ssh port for the default client
This commit is contained in:
Jose Diaz-Gonzalez
2016-03-03 17:24:38 -05:00
2 changed files with 8 additions and 4 deletions

View File

@@ -41,6 +41,8 @@ if [[ -z $DOKKU_HOST ]]; then
fi fi
fi fi
export DOKKU_PORT=${DOKKU_PORT:=22}
if [[ ! -z $DOKKU_HOST ]]; then if [[ ! -z $DOKKU_HOST ]]; then
_dokku() { _dokku() {
appname="" appname=""
@@ -72,10 +74,10 @@ if [[ ! -z $DOKKU_HOST ]]; then
if [[ -z "$2" ]]; then if [[ -z "$2" ]]; then
appname=$(random_name) appname=$(random_name)
counter=0 counter=0
while ssh "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do
if [[ $counter -ge 100 ]]; then if [[ $counter -ge 100 ]]; then
echo "Error: could not reasonably generate a new app name. try cleaning up some apps..." echo "Error: could not reasonably generate a new app name. try cleaning up some apps..."
ssh "dokku@$DOKKU_HOST" apps ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps
exit 1 exit 1
else else
appname=$(random_name) appname=$(random_name)
@@ -98,7 +100,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
if [[ -z "$donotshift" ]]; then if [[ -z "$donotshift" ]]; then
# shellcheck disable=SC2029 # shellcheck disable=SC2029
ssh -o LogLevel=QUIET -t "dokku@$DOKKU_HOST" "$@" ssh -o LogLevel=QUIET -p "$DOKKU_PORT" -t "dokku@$DOKKU_HOST" "$@"
exit $? exit $?
fi fi
@@ -125,7 +127,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
fi fi
fi fi
# shellcheck disable=SC2086,SC2029 # shellcheck disable=SC2086,SC2029
ssh -o LogLevel=QUIET -t "dokku@$DOKKU_HOST" $long_args "$verb" "$appname" "${args[@]}" ssh -o LogLevel=QUIET -p "$DOKKU_PORT" -t "dokku@$DOKKU_HOST" $long_args "$verb" "$appname" "${args[@]}"
} }
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then

View File

@@ -33,6 +33,8 @@ alias dokku 'bash $HOME/.dokku/contrib/dokku_client.sh'
Configure the `DOKKU_HOST` environment variable or run `dokku` from a repository with a git remote named dokku pointed at your dokku host in order to use the script as normal. Configure the `DOKKU_HOST` environment variable or run `dokku` from a repository with a git remote named dokku pointed at your dokku host in order to use the script as normal.
You can also configure a `DOKKU_PORT` environment variable if you are running ssh on a non-standard port. This defaults to `22`.
## (nodejs) dokku-toolbelt ## (nodejs) dokku-toolbelt
Dokku-toolbelt is a node-based cli wrapper that proxies requests to the dokku command running on remote hosts. You can install it via the following shell command (assuming you have nodejs and npm installed): Dokku-toolbelt is a node-based cli wrapper that proxies requests to the dokku command running on remote hosts. You can install it via the following shell command (assuming you have nodejs and npm installed):