2013-11-21 00:15:22 +00:00
|
|
|
DOKKU_VERSION = master
|
|
|
|
|
|
2016-04-03 20:22:03 -04:00
|
|
|
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v0.4.0/sshcommand
|
2015-12-24 10:41:09 -08:00
|
|
|
PLUGN_URL ?= https://github.com/dokku/plugn/releases/download/v0.2.1/plugn_0.2.1_linux_x86_64.tgz
|
2016-03-26 17:03:14 -04:00
|
|
|
SIGIL_URL ?= https://github.com/gliderlabs/sigil/releases/download/v0.4.0/sigil_0.4.0_Linux_x86_64.tgz
|
2015-04-20 16:32:18 -07:00
|
|
|
STACK_URL ?= https://github.com/gliderlabs/herokuish.git
|
|
|
|
|
PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest
|
2015-08-26 22:53:00 +02:00
|
|
|
DOKKU_LIB_ROOT ?= /var/lib/dokku
|
|
|
|
|
PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/plugins
|
|
|
|
|
CORE_PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/core-plugins
|
2013-06-09 23:26:56 -07:00
|
|
|
|
2014-10-06 18:31:17 -04:00
|
|
|
# If the first argument is "vagrant-dokku"...
|
|
|
|
|
ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
|
|
|
|
|
# use the rest as arguments for "vagrant-dokku"
|
2014-10-04 18:38:37 -04:00
|
|
|
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
|
|
|
|
# ...and turn them into do-nothing targets
|
|
|
|
|
$(eval $(RUN_ARGS):;@:)
|
|
|
|
|
endif
|
|
|
|
|
|
2015-07-06 17:15:07 -07:00
|
|
|
ifeq ($(CIRCLECI),true)
|
|
|
|
|
BUILD_STACK_TARGETS = circleci deps build
|
|
|
|
|
else
|
|
|
|
|
BUILD_STACK_TARGETS = build-in-docker
|
|
|
|
|
endif
|
|
|
|
|
|
2015-06-12 18:07:08 -07:00
|
|
|
.PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
|
2013-11-15 00:43:38 +00:00
|
|
|
|
2014-12-13 18:56:31 -08:00
|
|
|
include tests.mk
|
2015-01-11 18:38:51 -05:00
|
|
|
include deb.mk
|
2016-02-15 14:59:14 +01:00
|
|
|
include arch.mk
|
2014-12-13 18:56:31 -08:00
|
|
|
|
2013-09-20 15:47:50 +02:00
|
|
|
all:
|
|
|
|
|
# Type "make install" to install.
|
2013-07-01 11:38:38 +02:00
|
|
|
|
2015-09-04 12:52:15 -04:00
|
|
|
install: dependencies version copyfiles plugin-dependencies plugins
|
2013-09-20 15:47:50 +02:00
|
|
|
|
2015-01-16 17:05:35 -05:00
|
|
|
release: deb-all package_cloud packer
|
|
|
|
|
|
|
|
|
|
package_cloud:
|
2015-04-20 16:32:18 -07:00
|
|
|
package_cloud push dokku/dokku/ubuntu/trusty herokuish*.deb
|
2015-01-16 16:56:16 -05:00
|
|
|
package_cloud push dokku/dokku/ubuntu/trusty sshcommand*.deb
|
2015-09-08 12:31:30 -07:00
|
|
|
package_cloud push dokku/dokku/ubuntu/trusty plugn*.deb
|
2015-01-16 16:56:16 -05:00
|
|
|
package_cloud push dokku/dokku/ubuntu/trusty dokku*.deb
|
2015-01-16 17:05:35 -05:00
|
|
|
|
|
|
|
|
packer:
|
2015-01-16 16:56:16 -05:00
|
|
|
packer build contrib/packer.json
|
|
|
|
|
|
2015-01-16 12:38:37 -08:00
|
|
|
copyfiles:
|
2013-06-15 15:02:44 -07:00
|
|
|
cp dokku /usr/local/bin/dokku
|
2015-09-09 18:27:42 -07:00
|
|
|
mkdir -p ${CORE_PLUGINS_PATH} ${PLUGINS_PATH}
|
2015-08-26 22:53:00 +02:00
|
|
|
rm -rf ${CORE_PLUGINS_PATH}/*
|
2015-09-09 18:27:42 -07:00
|
|
|
test -d ${CORE_PLUGINS_PATH}/enabled || PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn init
|
2015-06-13 09:52:56 -07:00
|
|
|
test -d ${PLUGINS_PATH}/enabled || PLUGIN_PATH=${PLUGINS_PATH} plugn init
|
2013-11-29 20:31:22 +00:00
|
|
|
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \
|
2015-09-09 18:27:42 -07:00
|
|
|
rm -Rf ${CORE_PLUGINS_PATH}/available/$$plugin && \
|
2015-06-12 18:07:08 -07:00
|
|
|
rm -Rf ${PLUGINS_PATH}/available/$$plugin && \
|
2015-09-09 18:27:42 -07:00
|
|
|
rm -rf ${CORE_PLUGINS_PATH}/$$plugin && \
|
2015-08-26 22:53:00 +02:00
|
|
|
rm -rf ${PLUGINS_PATH}/$$plugin && \
|
2015-09-09 18:27:42 -07:00
|
|
|
cp -R plugins/$$plugin ${CORE_PLUGINS_PATH}/available && \
|
|
|
|
|
ln -s ${CORE_PLUGINS_PATH}/available/$$plugin ${PLUGINS_PATH}/available; \
|
2016-01-26 18:52:31 -08:00
|
|
|
find /var/lib/dokku/ -xtype l -delete;\
|
2015-09-09 18:27:42 -07:00
|
|
|
PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn enable $$plugin ;\
|
2015-06-13 09:52:56 -07:00
|
|
|
PLUGIN_PATH=${PLUGINS_PATH} plugn enable $$plugin ;\
|
2014-12-13 18:56:31 -08:00
|
|
|
done
|
2015-09-09 18:27:42 -07:00
|
|
|
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH}
|
2015-01-16 12:38:37 -08:00
|
|
|
$(MAKE) addman
|
2014-03-08 11:46:46 -05:00
|
|
|
|
2014-03-08 12:23:22 -05:00
|
|
|
addman:
|
2014-03-08 11:46:46 -05:00
|
|
|
mkdir -p /usr/local/share/man/man1
|
2015-01-15 11:28:28 -05:00
|
|
|
help2man -Nh help -v version -n "configure and get information from your dokku installation" -o /usr/local/share/man/man1/dokku.1 dokku
|
2014-03-08 11:46:46 -05:00
|
|
|
mandb
|
2013-07-02 23:06:35 +02:00
|
|
|
|
2013-11-21 00:01:38 +00:00
|
|
|
version:
|
2015-01-01 15:50:46 -05:00
|
|
|
git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION
|
2013-11-21 00:01:38 +00:00
|
|
|
|
2015-06-12 18:07:08 -07:00
|
|
|
plugin-dependencies: plugn
|
2015-12-22 11:10:49 -08:00
|
|
|
sudo -E dokku plugin:install-dependencies --core
|
2013-10-29 14:44:48 -06:00
|
|
|
|
2015-06-12 18:07:08 -07:00
|
|
|
plugins: plugn docker
|
2015-12-22 11:10:49 -08:00
|
|
|
sudo -E dokku plugin:install --core
|
2013-07-02 03:12:43 -05:00
|
|
|
|
2016-02-14 18:43:40 -08:00
|
|
|
dependencies: apt-update sshcommand plugn docker help2man man-db sigil
|
2015-03-27 14:26:21 -07:00
|
|
|
$(MAKE) -e stack
|
2015-01-16 12:38:37 -08:00
|
|
|
|
2015-03-25 02:50:27 -04:00
|
|
|
apt-update:
|
|
|
|
|
apt-get update
|
|
|
|
|
|
2015-01-16 12:38:37 -08:00
|
|
|
help2man:
|
|
|
|
|
apt-get install -qq -y help2man
|
2013-06-11 20:16:07 -07:00
|
|
|
|
2015-03-25 02:48:17 -04:00
|
|
|
man-db:
|
|
|
|
|
apt-get install -qq -y man-db
|
|
|
|
|
|
2013-06-11 20:16:07 -07:00
|
|
|
sshcommand:
|
2013-06-11 20:40:48 -07:00
|
|
|
wget -qO /usr/local/bin/sshcommand ${SSHCOMMAND_URL}
|
2013-06-11 20:16:07 -07:00
|
|
|
chmod +x /usr/local/bin/sshcommand
|
2013-06-23 01:04:56 -07:00
|
|
|
sshcommand create dokku /usr/local/bin/dokku
|
2013-06-11 20:16:07 -07:00
|
|
|
|
2015-06-12 18:07:08 -07:00
|
|
|
plugn:
|
|
|
|
|
wget -qO /tmp/plugn_latest.tgz ${PLUGN_URL}
|
|
|
|
|
tar xzf /tmp/plugn_latest.tgz -C /usr/local/bin
|
2013-07-02 03:12:43 -05:00
|
|
|
|
2016-02-14 18:43:40 -08:00
|
|
|
sigil:
|
|
|
|
|
wget -qO /tmp/sigil_latest.tgz ${SIGIL_URL}
|
|
|
|
|
tar xzf /tmp/sigil_latest.tgz -C /usr/local/bin
|
|
|
|
|
|
2013-07-02 03:12:43 -05:00
|
|
|
docker: aufs
|
2015-11-19 08:51:31 +00:00
|
|
|
apt-get install -qq -y curl
|
2013-08-13 20:23:29 -07:00
|
|
|
egrep -i "^docker" /etc/group || groupadd docker
|
|
|
|
|
usermod -aG docker dokku
|
2015-05-27 13:19:28 -07:00
|
|
|
ifndef CI
|
2015-11-09 22:52:58 -06:00
|
|
|
wget -nv -O - https://get.docker.com/ | sh
|
2015-09-16 15:21:09 -07:00
|
|
|
ifdef DOCKER_VERSION
|
|
|
|
|
apt-get install -qq -y docker-engine=${DOCKER_VERSION} || (apt-cache madison docker-engine ; exit 1)
|
|
|
|
|
endif
|
2013-07-16 02:05:34 -05:00
|
|
|
sleep 2 # give docker a moment i guess
|
2015-05-27 13:19:28 -07:00
|
|
|
endif
|
2013-07-02 03:12:43 -05:00
|
|
|
|
|
|
|
|
aufs:
|
2014-12-13 18:56:31 -08:00
|
|
|
ifndef CI
|
2014-10-04 07:48:08 -04:00
|
|
|
lsmod | grep aufs || modprobe aufs || apt-get install -qq -y linux-image-extra-`uname -r` > /dev/null
|
2014-12-13 18:56:31 -08:00
|
|
|
endif
|
2013-07-02 03:12:43 -05:00
|
|
|
|
|
|
|
|
stack:
|
2015-07-06 17:15:07 -07:00
|
|
|
ifeq ($(shell test -e /var/run/docker.sock && touch -c /var/run/docker.sock && echo $$?),0)
|
2013-09-30 22:48:27 +02:00
|
|
|
ifdef BUILD_STACK
|
2015-07-06 17:15:07 -07:00
|
|
|
@echo "Start building herokuish from source"
|
|
|
|
|
docker images | grep gliderlabs/herokuish || (git clone ${STACK_URL} /tmp/herokuish && cd /tmp/herokuish && IMAGE_NAME=gliderlabs/herokuish BUILD_TAG=latest VERSION=master make -e ${BUILD_STACK_TARGETS} && rm -rf /tmp/herokuish)
|
2013-09-30 22:48:27 +02:00
|
|
|
else
|
2015-09-29 13:31:18 -03:00
|
|
|
ifeq ($(shell echo ${PREBUILT_STACK_URL} | egrep -q 'http.*://|file://' && echo $$?),0)
|
2015-07-06 17:15:07 -07:00
|
|
|
@echo "Start importing herokuish from ${PREBUILT_STACK_URL}"
|
2015-11-09 22:52:58 -06:00
|
|
|
docker images | grep gliderlabs/herokuish || wget -nv -O - ${PREBUILT_STACK_URL} | gunzip -cd | docker import - gliderlabs/herokuish
|
2015-04-20 16:32:18 -07:00
|
|
|
else
|
2015-07-06 17:15:07 -07:00
|
|
|
@echo "Start pulling herokuish from ${PREBUILT_STACK_URL}"
|
|
|
|
|
docker images | grep gliderlabs/herokuish || docker pull ${PREBUILT_STACK_URL}
|
2015-04-20 16:32:18 -07:00
|
|
|
endif
|
2013-09-30 22:48:27 +02:00
|
|
|
endif
|
2015-02-02 15:46:57 -08:00
|
|
|
endif
|
2013-06-30 10:37:32 -05:00
|
|
|
|
2013-06-10 23:37:23 -07:00
|
|
|
count:
|
2013-06-30 17:56:02 -05:00
|
|
|
@echo "Core lines:"
|
2015-08-24 09:05:27 -07:00
|
|
|
@cat dokku bootstrap.sh | sed 's/^$$//g' | wc -l
|
2013-06-30 17:56:02 -05:00
|
|
|
@echo "Plugin lines:"
|
2015-08-24 09:05:27 -07:00
|
|
|
@find plugins -type f -not -name .DS_Store | xargs cat | sed 's/^$$//g' | wc -l
|
2013-06-30 17:56:02 -05:00
|
|
|
@echo "Test lines:"
|
2015-08-24 09:05:27 -07:00
|
|
|
@find tests -type f -not -name .DS_Store | xargs cat | sed 's/^$$//g' | wc -l
|
2014-10-04 18:37:23 -04:00
|
|
|
|
2014-11-15 20:09:57 -05:00
|
|
|
dokku-installer:
|
2015-12-22 00:57:58 -05:00
|
|
|
test -f /var/lib/dokku/.dokku-installer-created || python contrib/dokku-installer.py onboot
|
2014-11-15 20:09:57 -05:00
|
|
|
test -f /var/lib/dokku/.dokku-installer-created || service dokku-installer start
|
|
|
|
|
test -f /var/lib/dokku/.dokku-installer-created || service nginx reload
|
|
|
|
|
test -f /var/lib/dokku/.dokku-installer-created || touch /var/lib/dokku/.dokku-installer-created
|
|
|
|
|
|
2014-10-06 18:31:17 -04:00
|
|
|
vagrant-acl-add:
|
2014-10-04 18:37:23 -04:00
|
|
|
vagrant ssh -- sudo sshcommand acl-add dokku $(USER)
|
|
|
|
|
|
2014-10-06 18:31:17 -04:00
|
|
|
vagrant-dokku:
|
2014-10-04 18:38:37 -04:00
|
|
|
vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'"
|