Compare commits

..

31 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
a1bbc1ec4d Release 0.3.5 2014-11-24 02:17:50 -05:00
Jose Diaz-Gonzalez
793f1b6058 Merge pull request #784 from progrium/no-vhost-hotfix
Fix NO_VHOST check
2014-11-24 02:16:39 -05:00
Jose Diaz-Gonzalez
20977fc2a2 Fix NO_VHOST check
It used to check if NO_VHOST is unset or set to the empty string
It now checks if NO_VHOST is set to a non-empty string
2014-11-24 02:16:21 -05:00
Jose Diaz-Gonzalez
6cad7ef8f4 Release 0.3.4 2014-11-23 23:37:18 -05:00
Jose Diaz-Gonzalez
c6f80bcf55 Merge pull request #781 from expa/master
use DOKKU_IMAGE (i.e. progrium/buildstep)
2014-11-23 23:27:34 -05:00
Michael Hobbs
4d8c7033a9 use DOKKU_IMAGE (i.e. progrium/buildstep) 2014-11-23 19:58:12 -08:00
Michael Hobbs
d2547c4233 Merge pull request #3 from progrium/master
merge from upstream v0.3.2
2014-11-23 19:56:41 -08:00
Jose Diaz-Gonzalez
4fa567dbe3 Merge pull request #780 from progrium/778-better-error-message
Output error message when a command is not found. Closes #778
2014-11-23 21:05:08 -05:00
Jose Diaz-Gonzalez
463f725872 Use git-* as a pluginhook prefix 2014-11-23 21:02:40 -05:00
Jose Diaz-Gonzalez
aa1c7f6fa4 Move git-upload-pack command to git plugin
Also use the same APP escaping as used for other git commands.
2014-11-23 20:47:15 -05:00
Jose Diaz-Gonzalez
5f6f73ff22 Merge pull request #722 from wrboyce-git-pull 2014-11-23 20:40:08 -05:00
Will Boyce
ad497191df Add git pull support 2014-11-23 20:39:57 -05:00
Jose Diaz-Gonzalez
53c58ec8b9 Merge pull request #777 from feature/improve-core 2014-11-23 20:32:21 -05:00
Thomas Boerger
9eab9ed1e1 Replaced hard coded plugins path
To be able to switch the plugin path i have removed the hard coded
plugin path from the catch all section of the switch within the main
dokku executable.
2014-11-23 20:32:13 -05:00
Thomas Boerger
3faa37b2e1 Keep environment for sudo
To be able to set some other environment variables even if dokku gets
called from a different user we have to keep the environment with sudo
intact, so i added the -E option.
2014-11-23 20:32:13 -05:00
Jose Diaz-Gonzalez
fd55e8d41b Merge pull request #669 from ohardy/master 2014-11-23 20:29:12 -05:00
Olivier Hardy
303bc18265 Handle dokku plugins-update command 2014-11-23 20:22:26 -05:00
Jose Diaz-Gonzalez
2141435ce1 Rename DOKKU_CONTROLLER to DOKKU_HOST 2014-11-23 19:54:10 -05:00
Jose Diaz-Gonzalez
03e5248256 Merge pull request #659 from Xe/client
contrib: add dokku client shell script
2014-11-23 19:53:26 -05:00
Jose Diaz-Gonzalez
d307a5b8ec Output error message when a command is not found. Closes #778
Plugins with commands will need to implement a catch-all command that exits with the `DOKKU_NOT_IMPLEMENTED_EXIT`` code (10). This signals to dokku that a given plugin has indeed not executed anything for a plugin (which may not always be the case).

Using plugins that do not implement this pattern will result in those plugins silencing the error message.
2014-11-23 18:09:11 -05:00
Jose Diaz-Gonzalez
1e5a904747 Merge pull request #779 from progrium/minor-formatting
Minor bash formatting changes
2014-11-23 16:49:21 -05:00
Jose Diaz-Gonzalez
a46582225a Merge pull request #751 from webhippie/feature/improvements
Partial openSUSE support
2014-11-23 16:47:36 -05:00
Jose Diaz-Gonzalez
8bc3d372ec Minor bash formatting changes 2014-11-23 16:42:21 -05:00
Thomas Boerger
14b1743c2a Added openSUSE support
I have done the first steps to get dokku running for other distros like
openSUSE. I have simply replaced the important places within the core
plugins with a check for DOKKU_DISTRO that gets exported by dokku
itself. It just replaces the apt-get and service start/restart/reload
functionality with the openSUSE counterparts.
2014-11-23 11:37:58 +01:00
Thomas Boerger
2d776292c3 Added environment variable for base container
In order to be able to use a different base image i have added another
environment variable where everybody can switch the used base container
for the applications directly through the environment variable
DOKKU_IMAGE or with the help of the dokkurc configuration.
2014-11-23 11:34:29 +01:00
Jose Diaz-Gonzalez
f0fe32a9c6 Merge pull request #776 from joliv/master
Update man page for new commands
2014-11-22 23:21:25 -05:00
joliv
c4f5b3e219 Update man page for new commands 2014-11-22 22:09:11 -05:00
Michael Hobbs
fd0bafa7d9 Merge pull request #2 from progrium/master
merge from upstream
2014-11-22 10:25:33 -08:00
Michael Hobbs
09df79cd8b Merge pull request #1 from expa/mh-merge-upstream
merge from upstream
2014-10-09 11:32:18 -07:00
Michael Hobbs
9c0667c51a Merge remote-tracking branch 'upstream/master' into mh-merge-upstream 2014-10-09 11:29:48 -07:00
Sam Dodrill
939a876348 contrib: add dokku client shell script
This is adapted from the one I use in my shell profile scripts. This
kinda-sorta-maybe acts like the `heroku` or `deis` commands and does
some clever reorganization of data before sending it to the server.

To use the app name generator, install the `elfs` rock from Moonrocks.
2014-08-16 19:05:20 -07:00
20 changed files with 283 additions and 46 deletions

View File

@@ -1,5 +1,24 @@
# History
## 0.3.5
- #784: @josegonzalez Fix NO_VHOST check
## 0.3.4
- #780: @josegonzalez Output error message when a command is not found. Closes #778
- #781: @michaelhobbs use DOKKU_IMAGE (i.e. progrium/buildstep)
## 0.3.3
- #659: @Xe contrib: add dokku client shell script
- #669 @ohardy Handle dokku plugins-update command
- #722: @wrboyce Add `git pull` support with git-pre-pull and git-post-pull hooks
- #751: @tboerger Partial openSUSE support
- #776: @joliv Update man page for new commands
- #777: @tboerger Use PLUGINS_PATH env var and persist environment when running dokku with sudo
- #779: @josegonzalez Minor bash formatting changes
## 0.3.2
- #675: @michaelhobbs port wait-to-retire from broadly/dokku

View File

@@ -5,6 +5,7 @@ PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_
STACK_URL ?= https://github.com/progrium/buildstep.git
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-03-08/2014-03-08_429d4a9deb.tar.gz
DOKKU_ROOT ?= /home/dokku
PLUGINS_PATH ?= /var/lib/dokku/plugins
# If the first argument is "vagrant-dokku"...
ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
@@ -23,12 +24,12 @@ install: dependencies stack copyfiles plugin-dependencies plugins version
copyfiles: addman
cp dokku /usr/local/bin/dokku
mkdir -p /var/lib/dokku/plugins
find /var/lib/dokku/plugins -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf
mkdir -p ${PLUGINS_PATH}
find ${PLUGINS_PATH} -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \
rm -Rf /var/lib/dokku/plugins/$$plugin && \
cp -R plugins/$$plugin /var/lib/dokku/plugins && \
touch /var/lib/dokku/plugins/$$plugin/.core; \
rm -Rf ${PLUGINS_PATH}/$$plugin && \
cp -R plugins/$$plugin ${PLUGINS_PATH} && \
touch ${PLUGINS_PATH}/$$plugin/.core; \
done
addman:

View File

@@ -10,7 +10,7 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
To install the latest stable version of dokku, you can run the following bootstrapper command:
$ wget -qO- https://raw.github.com/progrium/dokku/v0.3.2/bootstrap.sh | sudo DOKKU_TAG=v0.3.2 bash
$ wget -qO- https://raw.github.com/progrium/dokku/v0.3.5/bootstrap.sh | sudo DOKKU_TAG=v0.3.5 bash
## Documentation

View File

@@ -21,7 +21,7 @@ if ARGV[0] == "onboot"
exit
end
version = "v0.3.2"
version = "v0.3.5"
dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku"
admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first
hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip

32
contrib/dokku_client.sh Executable file
View File

@@ -0,0 +1,32 @@
if [ -z "$DOKKU_HOST" ]
then
function dokku {
appname=$(git remote -v 2>/dev/null | grep dokku | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
if [ "$?" != "0" ]
then
donotshift="YES"
fi
if [ "$1" = "create" ]
then
appname=$(echo "print(elfs.GenName())" | lua -l elfs)
if git remote add dokku dokku@$DOKKU_HOST:$appname
then
echo "-----> Dokku remote added at $DOKKU_HOST"
echo "-----> Application name is $appname"
else
echo "! Dokku remote not added! Do you already have a dokku remote?"
return
fi
git push dokku master
else
if [ -z "$donotshift" ]
then
ssh dokku@$DOKKU_HOST $*
exit
fi
verb=$1
shift
ssh dokku@$DOKKU_HOST "$verb" "$appname" $@
fi
}
fi

View File

@@ -11,7 +11,7 @@ Ubuntu 14.04 x64 x64. Ideally have a domain ready to point to your host. It's de
To install the latest stable version of dokku, you can run the following bootstrapper command:
```bash
wget -qO- https://raw.github.com/progrium/dokku/v0.3.2/bootstrap.sh | sudo DOKKU_TAG=v0.3.2 bash
wget -qO- https://raw.github.com/progrium/dokku/v0.3.5/bootstrap.sh | sudo DOKKU_TAG=v0.3.5 bash
```
## Configuring

View File

@@ -28,6 +28,49 @@ If you create your own plugin:
3. edit this page and add a link to it below!
4. subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
### Sample plugin
The below plugin is a dummy `dokku hello` plugin. If your plugin exposes commands, this is a good template for your `commands` file:
```bash
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
hello)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
[[ ! -d "$DOKKU_ROOT/$APP" ]] && echo "App $APP does not exist" && exit 1
APP="$2";
echo "Hello $APP"
;;
hello:world)
echo "Hello world"
;;
help)
cat && cat<<EOF
hello <app> Says "Hello <app>"
hello:world Says "Hello world"
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac
```
A few notes:
- You should always support `DOKKU_TRACE` as specified on the 2nd line of the plugin.
- If your command requires that an application exists, ensure you check for it's existence in the manner prescribed above.
- A `help` command is required, though it is allowed to be empty.
- Commands *should* be namespaced.
- As of 0.3.3, a catch-all should be implemented which exits with a `DOKKU_NOT_IMPLEMENTED_EXIT` code. This allows dokku to output a `command not found` message.
## Community plugins
Note: The following plugins have been supplied by our community and may not have been tested by dokku maintainers.

37
dokku
View File

@@ -1,14 +1,20 @@
#!/usr/bin/env bash
set -eo pipefail
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"}
export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"}
export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
export DOKKU_NOT_IMPLEMENTED_EXIT=10
export DOKKU_VALID_EXIT=0
[[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc
[[ $DOKKU_TRACE ]] && set -x
if [[ $(id -un) != "dokku" && $1 != plugins-install* ]]; then
sudo -u dokku -H $0 "$@"
if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then
sudo -u dokku -E -H $0 "$@"
exit
fi
@@ -36,7 +42,7 @@ case "$1" in
build)
APP="$2"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
id=$(cat | docker run -i -a stdin progrium/buildstep /bin/bash -c "mkdir -p /app && tar -xC /app")
id=$(cat | docker run -i -a stdin $DOKKU_IMAGE /bin/bash -c "mkdir -p /app && tar -xC /app")
test $(docker wait $id) -eq 0
docker commit $id $IMAGE > /dev/null
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
@@ -130,6 +136,10 @@ case "$1" in
pluginhook dependencies
;;
plugins-update)
pluginhook update
;;
# temporary hack for https://github.com/progrium/dokku/issues/82
deploy:all)
for app in $(ls -d $DOKKU_ROOT/*/CONTAINER); do
@@ -139,17 +149,36 @@ case "$1" in
;;
help|'')
echo "Usage: dokku COMMAND <app> [command-specific-options]"
echo ""
cat<<EOF | pluginhook commands help | sort
help Print the list of commands
plugins Print active plugins
plugins-install Install active plugins
plugins-update Update active plugins
EOF
;;
*)
implemented=0
for script in $(ls -d $PLUGIN_PATH/*/commands); do
$script "$@"
set +e; $script "$@" ; exit_code=$? ; set -e
if [ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]; then
continue
fi
implemented=1
if [ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]; then
exit $exit_code
fi
done
if [ "$implemented" -eq 0 ]; then
echo " ! \`$@\` is not a dokku command."
echo " ! See \`dokku help\` for a list of available commands."
exit 1
fi
;;
esac

21
dokku.1
View File

@@ -1,4 +1,4 @@
.TH DOKKU 1 2014-05-10
.TH DOKKU 1 2014-11-22
.\"Make sure to change that date when you commit a change!
.\"
.SH NAME
@@ -15,6 +15,15 @@ work with plugins and inspect the current state of your server.
.\"
.SH OPTIONS
.TP
.BI apps:create " <app>"
Create a new app.
.TP
.BI apps:destroy " <app>"
Permanantly destroy an app.
.TP
.B apps
List your apps.
.TP
.BI backup:import " file"
Import dokku config files.
.TP
@@ -33,18 +42,22 @@ Set one or more config vars for an app.
.BI config:unset " <app> KEY1" \fR\ (KEY2\ \.\.\.)
Remove one or more config vars from an app.
.TP
.BI delete " <app>"
Delete an application.
.TP
.B help
Print the list of commands.
.TP
.B logs \ \fI<app> \fR[\fI-t\fR]
Show the last logs for an application (-t follows)
.TP
.BI nginx:import-ssl " <app>"
Imports a tarball from stdin which should contain
server\.crt and server\.key
.TP
.B plugins-install
Install active plugins.
.TP
.B plugins-update
Update active plugins.
.TP
.B plugins
Print active plugins.
.TP

View File

@@ -8,13 +8,13 @@ case "$1" in
logs)
if [[ -z $2 ]]; then
echo "Please specify an app to run the command on"
exit 1
echo "Please specify an app to run the command on"
exit 1
fi
APP="$2";
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist"
exit 1
echo "App $APP does not exist"
exit 1
fi
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
@@ -55,7 +55,7 @@ case "$1" in
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
echo $(< "$DOKKU_ROOT/$APP/URL")
fi
;;
;;
version)
cat "$DOKKU_ROOT/VERSION" || {
@@ -73,4 +73,8 @@ case "$1" in
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

View File

@@ -7,7 +7,9 @@ fi
# temporary hack for https://github.com/progrium/dokku/issues/82
# redeploys all apps after a reboot
cat<<EOF > /etc/init/dokku-redeploy.conf
case "$DOKKU_DISTRO" in
ubuntu)
cat<<EOF > /etc/init/dokku-redeploy.conf
description "Dokku app redeploy service"
start on (started docker)
@@ -17,3 +19,21 @@ script
sudo -i -u dokku /usr/local/bin/dokku deploy:all
end script
EOF
;;
opensuse)
cat<<EOF > /etc/systemd/system/dokku-redeploy.service
[Unit]
Description=Dokku app redeploy service
After=docker.target
[Service]
Type=simple
User=dokku
ExecStart=/usr/local/bin/dokku deploy:all
[Install]
WantedBy=multi-user.target
EOF
;;
esac

View File

@@ -72,4 +72,8 @@ case "$1" in
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

View File

@@ -92,4 +92,8 @@ case "$1" in
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

View File

@@ -94,7 +94,7 @@ case "$1" in
echo "=== $APP config vars ==="
config_styled_hash "$VARS"
;;
;;
config:get)
if [[ -z $3 ]]; then
@@ -110,7 +110,7 @@ case "$1" in
KEY="$3"
cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
;;
;;
config:set)
if [[ -z "${*:3}" ]]; then
@@ -154,7 +154,7 @@ ${var}"
config_write "$ENV_TEMP"
fi
;;
;;
config:unset)
if [[ -z $3 ]]; then
@@ -173,7 +173,7 @@ ${var}"
config_write "$ENV_TEMP"
done
;;
;;
help | config:help)
cat && cat<<EOF
@@ -182,6 +182,10 @@ ${var}"
config:set <app> KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars
config:unset <app> KEY1 [KEY2 ...] Unset one or more config vars
EOF
;;
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

View File

@@ -6,7 +6,7 @@ git_archive_all() {
TMP_WORK_DIR=$(mktemp -d)
chmod 755 $TMP_WORK_DIR
unset GIT_DIR GIT_WORK_TREE
git clone $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null
git clone -q $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null
pushd $TMP_WORK_DIR > /dev/null
git config advice.detachedHead false
git checkout $REV &> /dev/null
@@ -34,6 +34,13 @@ case "$1" in
done
;;
git-upload-pack)
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
pluginhook git-pre-pull $APP
cat | git-upload-pack "$DOKKU_ROOT/$APP"
pluginhook git-post-pull $APP
;;
git-*)
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
APP_PATH=$DOKKU_ROOT/$APP
@@ -58,4 +65,8 @@ EOF
cat
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

View File

@@ -34,10 +34,15 @@ case "$1" in
mv "$TEMP_DIR/server.key" "$DOKKU_ROOT/$APP/tls/server.key"
rm -rf $TEMP_DIR
;;
help | nginx:help)
cat && cat<<EOF
cat && cat<<EOF
nginx:import-ssl <app> Imports a tarball from stdin; should contain server.crt and server.key
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

View File

@@ -1,8 +1,15 @@
#!/bin/bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# latest stable NGINX 1.4.x with websocket support
apt-get install -qq -y software-properties-common python-software-properties
add-apt-repository -y ppa:nginx/stable
apt-get update
apt-get install -qq -y nginx dnsutils
case "$DOKKU_DISTRO" in
ubuntu)
apt-get install -qq -y software-properties-common python-software-properties
add-apt-repository -y ppa:nginx/stable
apt-get update
apt-get install -qq -y nginx dnsutils
;;
opensuse)
zypper -q in -y nginx bind-utils
;;
esac

View File

@@ -1,12 +1,18 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
if ! grep -q dokku-nginx-reload "/etc/sudoers"; then
touch /etc/sudoers.tmp
cp /etc/sudoers /tmp/sudoers.new
echo "%dokku ALL=(ALL)NOPASSWD:/etc/init.d/nginx reload # dokku-nginx-reload" >> /tmp/sudoers.new
EDITOR="cp /tmp/sudoers.new" visudo
rm /tmp/sudoers.new
if [[ ! -f /etc/sudoers.d/dokku-nginx ]]; then
case "$DOKKU_DISTRO" in
ubuntu)
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload" >> /etc/sudoers.d/dokku-nginx
;;
opensuse)
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload" >> /etc/sudoers.d/dokku-nginx
;;
esac
chmod 0440 /etc/sudoers.d/dokku-nginx
fi
# if dokku.conf has not been created, create it
@@ -25,10 +31,19 @@ ssl_prefer_server_ciphers on;
#ssl_certificate_key $DOKKU_ROOT/tls/server.key;
EOF
fi
sed -i 's/# server_names_hash_bucket_size/server_names_hash_bucket_size/' /etc/nginx/nginx.conf
echo 'server_names_hash_bucket_size 64' >| /etc/nginx/conf.d/server_names_hash_bucket_size.conf
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
fi
/etc/init.d/nginx start
case "$DOKKU_DISTRO" in
ubuntu)
/etc/init.d/nginx start
;;
opensuse)
/sbin/service nginx start
;;
esac

View File

@@ -1,4 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
sudo /etc/init.d/nginx reload > /dev/null
case "$DOKKU_DISTRO" in
ubuntu)
sudo /etc/init.d/nginx reload > /dev/null
;;
opensuse)
sudo /sbin/service nginx reload > /dev/null
;;
esac

View File

@@ -9,11 +9,11 @@ set +e
NO_VHOST=$(dokku config:get $APP NO_VHOST)
set -e
if [[ -z "$NO_VHOST" ]]; then
if [[ -n "$NO_VHOST" ]]; then
echo "-----> NO_VHOST config detected"
fi
if [[ -f "$DOKKU_ROOT/VHOST" && ! -z "$NO_VHOST" ]]; then
if [[ -f "$DOKKU_ROOT/VHOST" && ! -n "$NO_VHOST" ]]; then
VHOST=$(< "$DOKKU_ROOT/VHOST")
SUBDOMAIN=${APP/%\.${VHOST}/}
hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST)
@@ -101,8 +101,17 @@ EOF
echo "-----> Running nginx-pre-reload"
pluginhook nginx-pre-reload $APP $PORT
echo " Reloading nginx"
sudo /etc/init.d/nginx reload > /dev/null
case "$DOKKU_DISTRO" in
ubuntu)
sudo /etc/init.d/nginx reload > /dev/null
;;
opensuse)
sudo /sbin/service nginx reload > /dev/null
;;
esac
else
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
echo "------> NO_VHOST set, deleting $APP/URL"
@@ -112,6 +121,15 @@ else
echo "------> NO_VHOST set, deleting $APP/nginx.conf"
rm "$DOKKU_ROOT/$APP/nginx.conf"
echo "------> NO_VHOST set, reloading nginx after nginx.conf deletion"
case "$DOKKU_DISTRO" in
ubuntu)
sudo /etc/init.d/nginx reload > /dev/null
;;
opensuse)
sudo /sbin/service nginx reload > /dev/null
;;
esac
sudo /etc/init.d/nginx reload > /dev/null
fi
fi