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
|
2014-01-06 00:35:04 -06:00
|
|
|
STACK_URL ?= https://github.com/progrium/buildstep.git
|
2014-12-16 14:23:15 -08:00
|
|
|
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-12-16/2014-12-16_42bd9f4aab.tar.gz
|
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
|
|
|
|
|
|
2014-11-15 20:09:57 -05:00
|
|
|
.PHONY: all install copyfiles version 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
|
|
|
|
2013-10-29 14:44:48 -06:00
|
|
|
install: dependencies stack copyfiles plugin-dependencies plugins version
|
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-01-16 16:56:16 -05:00
|
|
|
package_cloud push dokku/dokku/ubuntu/trusty buildstep*.deb
|
|
|
|
|
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-01-16 12:38:37 -08:00
|
|
|
dependencies: sshcommand pluginhook docker stack help2man
|
|
|
|
|
|
|
|
|
|
help2man:
|
|
|
|
|
apt-get install -qq -y help2man
|
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
|
2014-10-04 07:48:26 -04:00
|
|
|
curl --silent https://get.docker.io/gpg | apt-key add -
|
2013-10-17 21:30:07 +02:00
|
|
|
echo deb http://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
|
2014-10-04 07:48:08 -04:00
|
|
|
apt-get install -qq -y lxc-docker
|
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
|
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:
|
2014-10-20 10:34:34 -05:00
|
|
|
@echo "Start building buildstep"
|
2013-09-30 22:48:27 +02:00
|
|
|
ifdef BUILD_STACK
|
2014-01-06 00:35:04 -06:00
|
|
|
@docker images | grep progrium/buildstep || (git clone ${STACK_URL} /tmp/buildstep && docker build -t progrium/buildstep /tmp/buildstep && rm -rf /tmp/buildstep)
|
2013-09-30 22:48:27 +02:00
|
|
|
else
|
2014-10-04 07:48:26 -04:00
|
|
|
@docker images | grep progrium/buildstep || curl --silent -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - progrium/buildstep
|
2013-09-30 22:48:27 +02: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:"
|
2013-11-11 11:42:15 -08:00
|
|
|
@cat dokku bootstrap.sh | wc -l
|
2013-06-30 17:56:02 -05:00
|
|
|
@echo "Plugin lines:"
|
|
|
|
|
@find plugins -type f | xargs cat | wc -l
|
|
|
|
|
@echo "Test lines:"
|
2013-07-02 23:02:42 +02:00
|
|
|
@find tests -type f | xargs cat | 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
|
|
|
|
|
test -f /var/lib/dokku/.dokku-installer-created || ruby /root/dokku/contrib/dokku-installer.rb onboot
|
|
|
|
|
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
|
|
|
|