From 455be29249664101262a788a8c8a945d65c7339a Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Fri, 22 Nov 2013 15:22:23 +0000 Subject: [PATCH 1/4] Fix commands, the easy way. Don't use pluginhook to run the commands hook, just run all the scripts in a loop. --- dokku | 4 +++- plugins/00_dokku-standard/commands | 2 +- plugins/backup/commands | 2 +- plugins/config/commands | 2 +- plugins/git/commands | 4 +++- plugins/nginx-vhosts/commands | 1 - 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dokku b/dokku index 8b95f9b9e..956631a57 100755 --- a/dokku +++ b/dokku @@ -100,7 +100,9 @@ EOF ;; *) - pluginhook commands "$@" + for script in $(ls -d /var/lib/dokku/plugins/*/commands); do + $script "$@" + done ;; esac diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 5dd309c57..7ebf92703 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -84,4 +84,4 @@ EOF ;; esac -cat + diff --git a/plugins/backup/commands b/plugins/backup/commands index 7386d7ed1..4f2713be1 100755 --- a/plugins/backup/commands +++ b/plugins/backup/commands @@ -75,4 +75,4 @@ EOF ;; esac -cat + diff --git a/plugins/config/commands b/plugins/config/commands index 5b1dbccad..5996891ed 100755 --- a/plugins/config/commands +++ b/plugins/config/commands @@ -173,4 +173,4 @@ EOF ;; esac -cat + diff --git a/plugins/git/commands b/plugins/git/commands index 22290bab5..af6c8ff31 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -35,6 +35,8 @@ EOF git-shell -c "$args" ;; + help) + cat + ;; esac -cat diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 99e5dbeff..7c878d672 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -1,3 +1,2 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -cat From e126da0db2084a94e5e76bf7e1d4967838d58fa9 Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Fri, 22 Nov 2013 21:40:59 +0000 Subject: [PATCH 2/4] Don't explicitly specify streams to docker run. Now that "docker run" always has an stdin, we don't need to explicitly specify stdout and stderr. --- plugins/00_dokku-standard/commands | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 7ebf92703..9502b30e9 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -51,7 +51,7 @@ case "$1" in exit 1 fi shift 2 - docker run -i -t -a stdout -a stderr $IMAGE /exec "$@" + docker run -i -t $IMAGE /exec "$@" ;; url) From 99e0a43f8134e1ad1163600182a5e81e227a7f4e Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Fri, 22 Nov 2013 22:22:20 +0000 Subject: [PATCH 3/4] Remove known issues and add note about ForceTTY These issues are fixed by this PR. --- README.md | 16 +++++++++------- tests/run_vagrant | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 33dc30115..b3b2929ab 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,15 @@ You're done! Right now Buildstep supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/progrium/buildstep#supported-buildpacks). It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)! Please check the documentation for your particular build pack as you may need to include configuration files (such as a Procfile) in your project root. +## Remote commands + +Dokku commands can be run over ssh. Anywhere you would run `dokku `, just run `ssh -t dokku@progriumapp.com ` +The `-t` is used to request a pty. It is highly recommended to do so. +To avoid the need to type the `-t` option each time, simply create/modify a section in the `.ssh/config`, on the client side, as follows : + + Host progriumapp.com + RequestTTY yes + ## Run a command in the app environment It's possible to run commands in the environment of the deployed application: @@ -119,13 +128,6 @@ eventually replace the Docker image for buildstep. You can use [Github Issues](https://github.com/progrium/dokku/issues), check [Troubleshooting](https://github.com/progrium/dokku/wiki/Troubleshooting) on the wiki, or join us on Freenode in #dokku -## Known Issues - -The issues are known and should be fixed soon : - - * #236: "dokku run" cannot run interactive commands over ssh - * #272: Most commands hang at the end over ssh. CTRL-D is required to end them. As a workaround for now, run ssh using the `-t` flag. - ## Components * [Docker](https://github.com/dotcloud/docker) - Container runtime and manager diff --git a/tests/run_vagrant b/tests/run_vagrant index 0a505692d..2e91c8651 100755 --- a/tests/run_vagrant +++ b/tests/run_vagrant @@ -10,6 +10,7 @@ if [[ ! $(cat ~/.ssh/config 2>/dev/null | grep dokku.me) ]]; then touch ~/.ssh/config echo "Host dokku.me" >> ~/.ssh/config echo " Port $VAGRANT_SSH_PORT" >> ~/.ssh/config + echo " RequestTTY yes" >> ~/.ssh/config fi echo "-----> Ensuring Vagrant is running..." cd "$(dirname $SELF)/.." && vagrant up | indent From 7ed57b285cd98ab95cbb684431135aa041cf2fee Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Fri, 22 Nov 2013 22:46:54 +0000 Subject: [PATCH 4/4] Close stdin before running the backup-export hooks. This avoids hanging when we're not in a pty. --- plugins/backup/commands | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/backup/commands b/plugins/backup/commands index 4f2713be1..a4e406e79 100755 --- a/plugins/backup/commands +++ b/plugins/backup/commands @@ -9,7 +9,7 @@ set -e; case "$1" in BACKUP_TMP_DIR=$(mktemp -d) BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar" - pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from - + : | pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from - pushd $BACKUP_DIR > /dev/null ls -d */ | grep -oE '[^/]+' > "$BACKUP_TMP_DIR/.dokku_backup_apps"