Merge pull request #1144 from protonet/master

Allow git-remote with different port
This commit is contained in:
Michael Hobbs committed 2015-04-26 11:00:50 -07:00
commit 379ee525a8
4 files changed
+26 -4

No files matched your search

+6 -2
View File
@@ -72,7 +72,7 @@ case "$1" in
;; ;;
git-*) git-*)
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')" APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
APP_PATH=$DOKKU_ROOT/$APP APP_PATH=$DOKKU_ROOT/$APP
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
@@ -87,7 +87,11 @@ EOF
chmod +x $PRERECEIVE_HOOK chmod +x $PRERECEIVE_HOOK
fi fi
args=$* if [[ $1 == "git-receive-pack" ]]; then
args="$1 '$APP_PATH'"
else
args=$*
fi
git-shell -c "$args" git-shell -c "$args"
;; ;;
+8
View File
@@ -28,8 +28,15 @@ endif
@echo "-----> Setting up ssh config..." @echo "-----> Setting up ssh config..."
ifneq ($(shell ls /root/.ssh/config > /dev/null 2>&1 ; echo $$?),0) ifneq ($(shell ls /root/.ssh/config > /dev/null 2>&1 ; echo $$?),0)
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
else ifeq ($(shell grep dokku.me /root/.ssh/config),) else ifeq ($(shell grep dokku.me /root/.ssh/config),)
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
endif
ifeq ($(shell grep 22333 /etc/ssh/sshd_config),)
sed --in-place "s:^Port 22:Port 22 \\nPort 22333:g" /etc/ssh/sshd_config
restart ssh
endif endif
@echo "-----> Installing SSH public key..." @echo "-----> Installing SSH public key..."
@@ -38,6 +45,7 @@ endif
@echo "-----> Intitial SSH connection to populate known_hosts..." @echo "-----> Intitial SSH connection to populate known_hosts..."
ssh -o StrictHostKeyChecking=no dokku@dokku.me help > /dev/null ssh -o StrictHostKeyChecking=no dokku@dokku.me help > /dev/null
ssh -o StrictHostKeyChecking=no dokku@127.0.0.1 help > /dev/null
ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),) ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),)
@echo "-----> Setting default VHOST to dokku.me..." @echo "-----> Setting default VHOST to dokku.me..."
+6
View File
@@ -115,3 +115,9 @@ build_nginx_config() {
assert_urls "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://dokku.example.com" assert_urls "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://dokku.example.com"
} }
@test "(core) git-remote (off-port)" {
run deploy_app nodejs-express ssh://dokku@127.0.0.1:22333/$TEST_APP
echo "output: "$output
echo "status: "$status
assert_success
}
+6 -2
View File
@@ -89,7 +89,9 @@ create_app() {
} }
destroy_app() { destroy_app() {
RC="$1"; RC=${RC:=0}
echo $TEST_APP | dokku apps:destroy $TEST_APP echo $TEST_APP | dokku apps:destroy $TEST_APP
return $RC
} }
add_domain() { add_domain() {
@@ -98,18 +100,20 @@ add_domain() {
deploy_app() { deploy_app() {
APP_TYPE="$1"; APP_TYPE=${APP_TYPE:="nodejs-express"} APP_TYPE="$1"; APP_TYPE=${APP_TYPE:="nodejs-express"}
GIT_REMOTE="$2"; GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"}
TMP=$(mktemp -d -t "$TARGET.XXXXX") TMP=$(mktemp -d -t "$TARGET.XXXXX")
rmdir $TMP && cp -r ./tests/apps/$APP_TYPE $TMP rmdir $TMP && cp -r ./tests/apps/$APP_TYPE $TMP
cd $TMP cd $TMP
git init git init
git config user.email "robot@example.com" git config user.email "robot@example.com"
git config user.name "Test Robot" git config user.name "Test Robot"
git remote add target dokku@dokku.me:$TEST_APP echo "setting up remote: $GIT_REMOTE"
git remote add target $GIT_REMOTE
[[ -f gitignore ]] && mv gitignore .gitignore [[ -f gitignore ]] && mv gitignore .gitignore
git add . git add .
git commit -m 'initial commit' git commit -m 'initial commit'
git push target master || destroy_app git push target master || destroy_app $?
} }
setup_client_repo() { setup_client_repo() {