Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
463f725872 | ||
|
|
aa1c7f6fa4 | ||
|
|
5f6f73ff22 | ||
|
|
ad497191df | ||
|
|
53c58ec8b9 | ||
|
|
9eab9ed1e1 | ||
|
|
3faa37b2e1 | ||
|
|
fd55e8d41b | ||
|
|
303bc18265 | ||
|
|
2141435ce1 | ||
|
|
03e5248256 | ||
|
|
1e5a904747 | ||
|
|
a46582225a | ||
|
|
8bc3d372ec | ||
|
|
14b1743c2a | ||
|
|
2d776292c3 | ||
|
|
f0fe32a9c6 | ||
|
|
c4f5b3e219 | ||
|
|
939a876348 |
11
Makefile
11
Makefile
@@ -5,6 +5,7 @@ PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_
|
|||||||
STACK_URL ?= https://github.com/progrium/buildstep.git
|
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
|
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-03-08/2014-03-08_429d4a9deb.tar.gz
|
||||||
DOKKU_ROOT ?= /home/dokku
|
DOKKU_ROOT ?= /home/dokku
|
||||||
|
PLUGINS_PATH ?= /var/lib/dokku/plugins
|
||||||
|
|
||||||
# If the first argument is "vagrant-dokku"...
|
# If the first argument is "vagrant-dokku"...
|
||||||
ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
|
ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
|
||||||
@@ -23,12 +24,12 @@ install: dependencies stack copyfiles plugin-dependencies plugins version
|
|||||||
|
|
||||||
copyfiles: addman
|
copyfiles: addman
|
||||||
cp dokku /usr/local/bin/dokku
|
cp dokku /usr/local/bin/dokku
|
||||||
mkdir -p /var/lib/dokku/plugins
|
mkdir -p ${PLUGINS_PATH}
|
||||||
find /var/lib/dokku/plugins -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf
|
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 \
|
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \
|
||||||
rm -Rf /var/lib/dokku/plugins/$$plugin && \
|
rm -Rf ${PLUGINS_PATH}/$$plugin && \
|
||||||
cp -R plugins/$$plugin /var/lib/dokku/plugins && \
|
cp -R plugins/$$plugin ${PLUGINS_PATH} && \
|
||||||
touch /var/lib/dokku/plugins/$$plugin/.core; \
|
touch ${PLUGINS_PATH}/$$plugin/.core; \
|
||||||
done
|
done
|
||||||
|
|
||||||
addman:
|
addman:
|
||||||
|
|||||||
32
contrib/dokku_client.sh
Executable file
32
contrib/dokku_client.sh
Executable 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
|
||||||
15
dokku
15
dokku
@@ -1,14 +1,18 @@
|
|||||||
#!/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
|
||||||
|
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
if [[ $(id -un) != "dokku" && $1 != plugins-install* ]]; then
|
if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then
|
||||||
sudo -u dokku -H $0 "$@"
|
sudo -u dokku -E -H $0 "$@"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -130,6 +134,10 @@ case "$1" in
|
|||||||
pluginhook dependencies
|
pluginhook dependencies
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
plugins-update)
|
||||||
|
pluginhook update
|
||||||
|
;;
|
||||||
|
|
||||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||||
deploy:all)
|
deploy:all)
|
||||||
for app in $(ls -d $DOKKU_ROOT/*/CONTAINER); do
|
for app in $(ls -d $DOKKU_ROOT/*/CONTAINER); do
|
||||||
@@ -143,6 +151,7 @@ case "$1" in
|
|||||||
help Print the list of commands
|
help Print the list of commands
|
||||||
plugins Print active plugins
|
plugins Print active plugins
|
||||||
plugins-install Install active plugins
|
plugins-install Install active plugins
|
||||||
|
plugins-update Update active plugins
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
21
dokku.1
21
dokku.1
@@ -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!
|
.\"Make sure to change that date when you commit a change!
|
||||||
.\"
|
.\"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
@@ -15,6 +15,15 @@ work with plugins and inspect the current state of your server.
|
|||||||
.\"
|
.\"
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.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"
|
.BI backup:import " file"
|
||||||
Import dokku config files.
|
Import dokku config files.
|
||||||
.TP
|
.TP
|
||||||
@@ -33,18 +42,22 @@ Set one or more config vars for an app.
|
|||||||
.BI config:unset " <app> KEY1" \fR\ (KEY2\ \.\.\.)
|
.BI config:unset " <app> KEY1" \fR\ (KEY2\ \.\.\.)
|
||||||
Remove one or more config vars from an app.
|
Remove one or more config vars from an app.
|
||||||
.TP
|
.TP
|
||||||
.BI delete " <app>"
|
|
||||||
Delete an application.
|
|
||||||
.TP
|
|
||||||
.B help
|
.B help
|
||||||
Print the list of commands.
|
Print the list of commands.
|
||||||
.TP
|
.TP
|
||||||
.B logs \ \fI<app> \fR[\fI-t\fR]
|
.B logs \ \fI<app> \fR[\fI-t\fR]
|
||||||
Show the last logs for an application (-t follows)
|
Show the last logs for an application (-t follows)
|
||||||
.TP
|
.TP
|
||||||
|
.BI nginx:import-ssl " <app>"
|
||||||
|
Imports a tarball from stdin which should contain
|
||||||
|
server\.crt and server\.key
|
||||||
|
.TP
|
||||||
.B plugins-install
|
.B plugins-install
|
||||||
Install active plugins.
|
Install active plugins.
|
||||||
.TP
|
.TP
|
||||||
|
.B plugins-update
|
||||||
|
Update active plugins.
|
||||||
|
.TP
|
||||||
.B plugins
|
.B plugins
|
||||||
Print active plugins.
|
Print active plugins.
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ git_archive_all() {
|
|||||||
TMP_WORK_DIR=$(mktemp -d)
|
TMP_WORK_DIR=$(mktemp -d)
|
||||||
chmod 755 $TMP_WORK_DIR
|
chmod 755 $TMP_WORK_DIR
|
||||||
unset GIT_DIR GIT_WORK_TREE
|
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
|
pushd $TMP_WORK_DIR > /dev/null
|
||||||
git config advice.detachedHead false
|
git config advice.detachedHead false
|
||||||
git checkout $REV &> /dev/null
|
git checkout $REV &> /dev/null
|
||||||
@@ -34,6 +34,13 @@ case "$1" in
|
|||||||
done
|
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-*)
|
git-*)
|
||||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||||
APP_PATH=$DOKKU_ROOT/$APP
|
APP_PATH=$DOKKU_ROOT/$APP
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ case "$1" in
|
|||||||
mv "$TEMP_DIR/server.key" "$DOKKU_ROOT/$APP/tls/server.key"
|
mv "$TEMP_DIR/server.key" "$DOKKU_ROOT/$APP/tls/server.key"
|
||||||
rm -rf $TEMP_DIR
|
rm -rf $TEMP_DIR
|
||||||
;;
|
;;
|
||||||
|
|
||||||
help | nginx:help)
|
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
|
nginx:import-ssl <app> Imports a tarball from stdin; should contain server.crt and server.key
|
||||||
|
|||||||
@@ -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"
|
||||||
|
case "$DOKKU_DISTRO" in
|
||||||
|
ubuntu)
|
||||||
sudo /etc/init.d/nginx reload > /dev/null
|
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