initial attempt at plugins
This commit is contained in:
10
Makefile
10
Makefile
@@ -1,14 +1,14 @@
|
|||||||
GITRECEIVE_URL = https://raw.github.com/progrium/gitreceive/master/gitreceive
|
GITRECEIVE_URL = https://raw.github.com/progrium/gitreceive/master/gitreceive
|
||||||
SSHCOMMAND_URL = https://raw.github.com/progrium/sshcommand/master/sshcommand
|
SSHCOMMAND_URL = https://raw.github.com/progrium/sshcommand/master/sshcommand
|
||||||
|
PLUGINHOOK_URL = https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb
|
||||||
|
|
||||||
all: install
|
all: install
|
||||||
|
|
||||||
install: gitreceive sshcommand
|
install: gitreceive sshcommand pluginhook
|
||||||
cp dokku /usr/local/bin/dokku
|
cp dokku /usr/local/bin/dokku
|
||||||
cp receiver /home/git/receiver
|
cp receiver /home/git/receiver
|
||||||
cp nginx-app-conf /home/git/nginx-app-conf
|
cp nginx-app-conf /home/git/nginx-app-conf
|
||||||
cp nginx-reloader.conf /etc/init/nginx-reloader.conf
|
cp -r plugins /home/git/.plugins
|
||||||
echo "include /home/git/*/nginx.conf;" > /etc/nginx/conf.d/dokku.conf
|
|
||||||
|
|
||||||
gitreceive:
|
gitreceive:
|
||||||
wget -qO /usr/local/bin/gitreceive ${GITRECEIVE_URL}
|
wget -qO /usr/local/bin/gitreceive ${GITRECEIVE_URL}
|
||||||
@@ -20,5 +20,9 @@ sshcommand:
|
|||||||
chmod +x /usr/local/bin/sshcommand
|
chmod +x /usr/local/bin/sshcommand
|
||||||
sshcommand create dokku /usr/local/bin/dokku
|
sshcommand create dokku /usr/local/bin/dokku
|
||||||
|
|
||||||
|
pluginhook:
|
||||||
|
wget -qO ${PLUGINHOOK_URL} /tmp/pluginhook_0.1.0_amd64.deb
|
||||||
|
cd /tmp && dpkg -i pluginhook_0.1.0_amd64.deb
|
||||||
|
|
||||||
count:
|
count:
|
||||||
cat receiver dokku bootstrap.sh nginx-app-conf nginx-reloader.conf | wc -l
|
cat receiver dokku bootstrap.sh nginx-app-conf nginx-reloader.conf | wc -l
|
||||||
12
bootstrap.sh
12
bootstrap.sh
@@ -4,7 +4,7 @@ DOCKER_PKG=${DOCKER_PKG:-"https://launchpad.net/~dotcloud/+archive/lxc-docker/+f
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y linux-image-extra-`uname -r`
|
DEBIAN_FRONTEND=noninteractive apt-get install -y linux-image-extra-`uname -r`
|
||||||
apt-get update && apt-get install -y git nginx make curl dnsutils
|
apt-get update && apt-get install -y git make curl
|
||||||
|
|
||||||
wget -qO- "$DOCKER_PKG" > /tmp/lxc-docker_0.4.2-1_amd64.deb
|
wget -qO- "$DOCKER_PKG" > /tmp/lxc-docker_0.4.2-1_amd64.deb
|
||||||
dpkg --force-depends -i /tmp/lxc-docker_0.4.2-1_amd64.deb && apt-get install -f -y
|
dpkg --force-depends -i /tmp/lxc-docker_0.4.2-1_amd64.deb && apt-get install -f -y
|
||||||
@@ -15,14 +15,8 @@ cd dokku && make install
|
|||||||
|
|
||||||
curl "$DOKKU_STACK" | gunzip -cd | docker import - progrium/buildstep
|
curl "$DOKKU_STACK" | gunzip -cd | docker import - progrium/buildstep
|
||||||
|
|
||||||
sed -i 's/docker -d/docker -d -r=true/' /etc/init/docker.conf
|
PLUGINPATH=/home/git/.plugins
|
||||||
sed -i 's/# server_names_hash_bucket_size/server_names_hash_bucket_size/' /etc/nginx/nginx.conf
|
pluginhook install
|
||||||
|
|
||||||
[[ $(dig +short $HOSTNAME) ]] && hostfile="DOMAIN" || hostfile="HOSTNAME"
|
|
||||||
echo $HOSTNAME > /home/git/$hostfile
|
|
||||||
|
|
||||||
/etc/init.d/nginx start
|
|
||||||
start nginx-reloader
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Be sure to upload a public key for your user:"
|
echo "Be sure to upload a public key for your user:"
|
||||||
|
|||||||
12
dokku
12
dokku
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
PLUGIN_PATH="$HOME/.plugins"
|
||||||
set -e; case "$1" in
|
set -e; case "$1" in
|
||||||
receive)
|
receive)
|
||||||
APP="$2"; IMAGE="app/$APP"
|
APP="$2"; IMAGE="app/$APP"
|
||||||
@@ -51,15 +52,8 @@ set -e; case "$1" in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
###
|
*)
|
||||||
|
pluginhook commands "$@"
|
||||||
logs)
|
|
||||||
CONTAINER=$(</home/git/$2/CONTAINER)
|
|
||||||
docker logs $CONTAINER | tail -n 100
|
|
||||||
;;
|
|
||||||
|
|
||||||
url)
|
|
||||||
echo "http://$(< "/home/git/$2/HOSTNAME")"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
17
plugins/00_dokku-standard/commands
Executable file
17
plugins/00_dokku-standard/commands
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e; case "$1" in
|
||||||
|
logs)
|
||||||
|
CONTAINER=$(</home/git/$2/CONTAINER)
|
||||||
|
docker logs $CONTAINER | tail -n 100
|
||||||
|
;;
|
||||||
|
|
||||||
|
url)
|
||||||
|
echo "http://$(< "/home/git/$2/HOSTNAME")"
|
||||||
|
;;
|
||||||
|
|
||||||
|
test)
|
||||||
|
echo "Hello"
|
||||||
|
echo $2 $3 $4
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
5
plugins/00_dokku-standard/install
Executable file
5
plugins/00_dokku-standard/install
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
sed -i 's/docker -d/docker -d -r=true/' /etc/init/docker.conf
|
||||||
|
|
||||||
|
echo $HOSTNAME > /home/git/HOSTNAME
|
||||||
2
plugins/WARNING
Normal file
2
plugins/WARNING
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
Please note that the hooks in Dokku are experimental and are likely to change quite a bit.
|
||||||
18
plugins/nginx-vhosts/install
Executable file
18
plugins/nginx-vhosts/install
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
apt-get install -y nginx dnsutils
|
||||||
|
|
||||||
|
cat<<EOF > /etc/init/nginx-reloader.conf
|
||||||
|
script
|
||||||
|
echo | sudo -u git nc -l -U /home/git/reload-nginx && /etc/init.d/nginx reload
|
||||||
|
end script
|
||||||
|
respawn
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "include /home/git/*/nginx.conf;" > /etc/nginx/conf.d/dokku.conf
|
||||||
|
|
||||||
|
sed -i 's/# server_names_hash_bucket_size/server_names_hash_bucket_size/' /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME > /home/git/VHOST
|
||||||
|
|
||||||
|
/etc/init.d/nginx start
|
||||||
|
start nginx-reloader
|
||||||
Reference in New Issue
Block a user