Introduce URL for app. Plugins can override this.

fixes #242
This commit is contained in:
Alexander
2013-10-24 13:43:11 +02:00
parent c0a2683744
commit 85f14baad5
4 changed files with 18 additions and 18 deletions

2
dokku
View File

@@ -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")

View File

@@ -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<<EOF
logs <app> Show the last logs for an application
run <app> <cmd> Run a command in the environment of an application
url <app> Show the URL for an application
EOF
;;

View File

@@ -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<<EOF
url <app> Show the URL for an application
EOF
;;
esac
cat

View File

@@ -53,6 +53,8 @@ server {
}
}
EOF
echo "https://$hostname" > "$HOME/$APP/URL"
else
# default nginx.conf
cat<<EOF > $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