Merge pull request #751 from webhippie/feature/improvements
Partial openSUSE support
This commit is contained in:
6
dokku
6
dokku
@@ -1,6 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
|
||||||
|
export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"}
|
||||||
export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"}
|
export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"}
|
||||||
|
|
||||||
export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
|
export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
|
||||||
|
|
||||||
[[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc
|
[[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc
|
||||||
@@ -36,7 +40,7 @@ case "$1" in
|
|||||||
|
|
||||||
build)
|
build)
|
||||||
APP="$2"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
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_DISTRO /bin/bash -c "mkdir -p /app && tar -xC /app")
|
||||||
test $(docker wait $id) -eq 0
|
test $(docker wait $id) -eq 0
|
||||||
docker commit $id $IMAGE > /dev/null
|
docker commit $id $IMAGE > /dev/null
|
||||||
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
|
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ fi
|
|||||||
|
|
||||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||||
# redeploys all apps after a reboot
|
# 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"
|
description "Dokku app redeploy service"
|
||||||
|
|
||||||
start on (started docker)
|
start on (started docker)
|
||||||
@@ -17,3 +19,21 @@ script
|
|||||||
sudo -i -u dokku /usr/local/bin/dokku deploy:all
|
sudo -i -u dokku /usr/local/bin/dokku deploy:all
|
||||||
end script
|
end script
|
||||||
EOF
|
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
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
# latest stable NGINX 1.4.x with websocket support
|
case "$DOKKU_DISTRO" in
|
||||||
apt-get install -qq -y software-properties-common python-software-properties
|
ubuntu)
|
||||||
add-apt-repository -y ppa:nginx/stable
|
apt-get install -qq -y software-properties-common python-software-properties
|
||||||
apt-get update
|
add-apt-repository -y ppa:nginx/stable
|
||||||
apt-get install -qq -y nginx dnsutils
|
apt-get update
|
||||||
|
apt-get install -qq -y nginx dnsutils
|
||||||
|
;;
|
||||||
|
|
||||||
|
opensuse)
|
||||||
|
zypper -q in -y nginx bind-utils
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
if ! grep -q dokku-nginx-reload "/etc/sudoers"; then
|
if [[ ! -f /etc/sudoers.d/dokku-nginx ]]; then
|
||||||
touch /etc/sudoers.tmp
|
case "$DOKKU_DISTRO" in
|
||||||
cp /etc/sudoers /tmp/sudoers.new
|
ubuntu)
|
||||||
echo "%dokku ALL=(ALL)NOPASSWD:/etc/init.d/nginx reload # dokku-nginx-reload" >> /tmp/sudoers.new
|
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload" >> /etc/sudoers.d/dokku-nginx
|
||||||
EDITOR="cp /tmp/sudoers.new" visudo
|
;;
|
||||||
rm /tmp/sudoers.new
|
|
||||||
|
opensuse)
|
||||||
|
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload" >> /etc/sudoers.d/dokku-nginx
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
chmod 0440 /etc/sudoers.d/dokku-nginx
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if dokku.conf has not been created, create it
|
# 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;
|
#ssl_certificate_key $DOKKU_ROOT/tls/server.key;
|
||||||
EOF
|
EOF
|
||||||
fi
|
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
|
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||||
[[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
|
[[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/etc/init.d/nginx start
|
case "$DOKKU_DISTRO" in
|
||||||
|
ubuntu)
|
||||||
|
/etc/init.d/nginx start
|
||||||
|
;;
|
||||||
|
|
||||||
|
opensuse)
|
||||||
|
/sbin/service nginx start
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
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
|
||||||
|
|||||||
@@ -101,8 +101,17 @@ EOF
|
|||||||
|
|
||||||
echo "-----> Running nginx-pre-reload"
|
echo "-----> Running nginx-pre-reload"
|
||||||
pluginhook nginx-pre-reload $APP $PORT
|
pluginhook nginx-pre-reload $APP $PORT
|
||||||
|
|
||||||
echo " Reloading nginx"
|
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
|
else
|
||||||
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
|
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
|
||||||
echo "------> NO_VHOST set, deleting $APP/URL"
|
echo "------> NO_VHOST set, deleting $APP/URL"
|
||||||
@@ -112,6 +121,15 @@ else
|
|||||||
echo "------> NO_VHOST set, deleting $APP/nginx.conf"
|
echo "------> NO_VHOST set, deleting $APP/nginx.conf"
|
||||||
rm "$DOKKU_ROOT/$APP/nginx.conf"
|
rm "$DOKKU_ROOT/$APP/nginx.conf"
|
||||||
echo "------> NO_VHOST set, reloading nginx after nginx.conf deletion"
|
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
|
sudo /etc/init.d/nginx reload > /dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user