From 0cd1839ce857ffe83d369238968f48f2e6a99ded Mon Sep 17 00:00:00 2001 From: Arthur Neves Date: Thu, 14 Aug 2014 14:29:04 -0400 Subject: [PATCH] Add CNAME option When a repo have a CNAME file, it will use the URL on it to map the server_name on ngnix --- dokku | 6 ++++++ plugins/nginx-vhosts/post-deploy | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/dokku b/dokku index e0b61ba63..ef4c67a86 100755 --- a/dokku +++ b/dokku @@ -63,6 +63,12 @@ case "$1" in docker inspect $oldid &> /dev/null && docker kill $oldid > /dev/null fi + # CNAME + CNAME=$(docker run -i $IMAGE /bin/bash -c "if [[ -f /app/CNAME ]];then cat /app/CNAME; fi") + if [[ -n "$CNAME" ]]; then + echo "$CNAME" > "$DOKKU_ROOT/$APP/CNAME" + fi + # start the app DOCKER_ARGS=$(: | pluginhook docker-args $APP) id=$(docker run -d -p 5000 -e PORT=5000 $DOCKER_ARGS $IMAGE /bin/bash -c "/start web") diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index be7fd2007..0591c6691 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -25,6 +25,10 @@ EOF SSL_DIRECTIVES="" fi + if [[ -f "$DOKKU_ROOT/$APP/CNAME" ]]; then + hostname=$(< "$DOKKU_ROOT/$APP/CNAME" ) + fi + # ssl based nginx.conf if [[ -n "$SSL_INUSE" ]]; then cat< $DOKKU_ROOT/$APP/nginx.conf