From 85f14baad5446cf4e6f9ca6abc6ead1c18c0347d Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 24 Oct 2013 13:43:11 +0200 Subject: [PATCH] Introduce URL for app. Plugins can override this. fixes #242 --- dokku | 2 +- plugins/00_dokku-standard/commands | 13 +++++++++++++ plugins/nginx-vhosts/commands | 16 ---------------- plugins/nginx-vhosts/post-deploy | 5 ++++- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dokku b/dokku index 8af772955..8b353b1b3 100755 --- a/dokku +++ b/dokku @@ -54,7 +54,7 @@ case "$1" in echo $id > "$HOME/$APP/CONTAINER" port=$(docker port $id 5000) echo $port > "$HOME/$APP/PORT" - echo "$(< "$HOME/HOSTNAME"):$port" > "$HOME/$APP/ADDRESS" + echo "http://$(< "$HOME/HOSTNAME"):$port" > "$HOME/$APP/URL" else # Regular deploy oldid=$(< "$HOME/$APP/CONTAINER") diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index c03d343ac..a644e514b 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -19,10 +19,23 @@ set -e; case "$1" in docker run -i -t $IMAGE /exec "$@" ;; + url) + APP="$2"; + if [[ ! -d "/home/git/$APP" ]]; then + echo "App $APP does not exist" + exit 1 + fi + + if [[ -f "/home/git/$APP/URL" ]]; then + echo $(< "/home/git/$APP/URL") + fi + ;; + help) cat && cat< Show the last logs for an application run Run a command in the environment of an application + url Show the URL for an application EOF ;; diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 180cd344e..2cebdbd59 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -1,18 +1,2 @@ #!/bin/bash -set -e; case "$1" in - - url) - if [[ -f "/home/git/$2/VHOST" ]]; then - echo "http://$(< "/home/git/$2/VHOST")" - else - cat - fi - ;; - - help) cat && cat< Show the URL for an application -EOF - ;; - -esac cat diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index b1d8bde8c..79f77b907 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -53,6 +53,8 @@ server { } } EOF + + echo "https://$hostname" > "$HOME/$APP/URL" else # default nginx.conf cat< $HOME/$APP/nginx.conf @@ -73,8 +75,9 @@ server { } } EOF + + echo "http://$hostname" > "$HOME/$APP/URL" fi pluginhook nginx-pre-reload $APP nc -U $HOME/reload-nginx - echo "$hostname" > "$HOME/$APP/VHOST" fi