2013-11-21 00:15:22 +00:00
|
|
|
DOKKU_VERSION = master
|
|
|
|
|
|
2013-07-02 23:20:45 +02:00
|
|
|
SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand
|
|
|
|
|
PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb
|
2015-04-20 16:32:18 -07:00
|
|
|
STACK_URL ?= https://github.com/gliderlabs/herokuish.git
|
|
|
|
|
PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest
|
2014-11-13 16:52:39 +01:00
|
|
|
PLUGINS_PATH ?= /var/lib/dokku/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-09-04 12:52:15 -04:00
|
|
|
.PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand pluginhook 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
|
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
|
|
|
|
|
package_cloud push dokku/dokku/ubuntu/trusty pluginhook*.deb
|
|
|
|
|
package_cloud push dokku/dokku/ubuntu/trusty rubygem*.deb
|
|
|
|
|
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
|
2014-11-13 16:52:39 +01:00
|
|
|
mkdir -p ${PLUGINS_PATH}
|
|
|
|
|
find ${PLUGINS_PATH} -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf
|
2013-11-29 20:31:22 +00:00
|
|
|
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \
|
2014-12-13 18:56:31 -08:00
|
|
|
rm -Rf ${PLUGINS_PATH}/$$plugin && \
|
|
|
|
|
cp -R plugins/$$plugin ${PLUGINS_PATH} && \
|
|
|
|
|
touch ${PLUGINS_PATH}/$$plugin/.core; \
|
|
|
|
|
done
|
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
|
|
|
|
2013-10-29 14:44:48 -06:00
|
|
|
plugin-dependencies: pluginhook
|
|
|
|
|
dokku plugins-install-dependencies
|
|
|
|
|
|
2013-07-02 23:06:35 +02:00
|
|
|
plugins: pluginhook docker
|
2013-07-02 23:02:42 +02:00
|
|
|
dokku plugins-install
|
2013-07-02 03:12:43 -05:00
|
|
|
|
2015-03-25 02:50:27 -04:00
|
|
|
dependencies: apt-update sshcommand pluginhook docker help2man man-db
|
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
|
|
|
|
2013-06-30 10:37:32 -05:00
|
|
|
pluginhook:
|
2013-06-30 10:41:47 -05:00
|
|
|
wget -qO /tmp/pluginhook_0.1.0_amd64.deb ${PLUGINHOOK_URL}
|
2013-07-02 03:12:43 -05:00
|
|
|
dpkg -i /tmp/pluginhook_0.1.0_amd64.deb
|
|
|
|
|
|
|
|
|
|
docker: aufs
|
2014-10-04 07:49:32 -04: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-05-12 15:47:12 -04:00
|
|
|
curl -sSL https://get.docker.com/gpg | apt-key add -
|
2015-08-19 20:23:06 -04:00
|
|
|
echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
|
2013-08-05 13:47:44 -07:00
|
|
|
apt-get update
|
2014-01-07 00:21:58 +09:00
|
|
|
ifdef DOCKER_VERSION
|
2014-10-04 07:48:08 -04:00
|
|
|
apt-get install -qq -y lxc-docker-${DOCKER_VERSION}
|
2014-01-07 00:21:58 +09:00
|
|
|
else
|
2015-06-30 15:52:21 -04:00
|
|
|
apt-get install -qq -y lxc-docker-1.6.2
|
2014-01-07 00:21:58 +09:00
|
|
|
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-04-20 16:32:18 -07:00
|
|
|
ifeq ($(shell echo ${PREBUILT_STACK_URL} | egrep -q 'http.*://' && echo $$?),0)
|
2015-07-06 17:15:07 -07:00
|
|
|
@echo "Start importing herokuish from ${PREBUILT_STACK_URL}"
|
|
|
|
|
docker images | grep gliderlabs/herokuish || curl --silent -L ${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:
|
2014-12-08 21:33:29 -05:00
|
|
|
apt-get install -qq -y ruby
|
2014-11-15 20:09:57 -05:00
|
|
|
test -f /var/lib/dokku/.dokku-installer-created || gem install rack -v 1.5.2 --no-rdoc --no-ri
|
|
|
|
|
test -f /var/lib/dokku/.dokku-installer-created || gem install rack-protection -v 1.5.3 --no-rdoc --no-ri
|
|
|
|
|
test -f /var/lib/dokku/.dokku-installer-created || gem install sinatra -v 1.4.5 --no-rdoc --no-ri
|
|
|
|
|
test -f /var/lib/dokku/.dokku-installer-created || gem install tilt -v 1.4.1 --no-rdoc --no-ri
|
2015-03-16 18:29:38 +00:00
|
|
|
test -f /var/lib/dokku/.dokku-installer-created || ruby contrib/dokku-installer.rb 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)'"
|
2014-12-13 18:56:31 -08:00
|
|
|
|