Files
dokku/Makefile

159 lines
5.6 KiB
Makefile
Raw Normal View History

DOKKU_VERSION = master
SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand
2015-06-12 18:07:08 -07:00
PLUGN_URL ?= https://github.com/progrium/plugn/releases/download/v0.1.0/plugn_0.1.0_linux_x86_64.tgz
STACK_URL ?= https://github.com/gliderlabs/herokuish.git
PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest
DOKKU_LIB_ROOT ?= /var/lib/dokku
PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/plugins
CORE_PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/core-plugins
DISABLED_PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/disabled-plugins
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"
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
2014-12-13 18:56:31 -08:00
include tests.mk
include deb.mk
2014-12-13 18:56:31 -08:00
all:
# Type "make install" to install.
install: dependencies version copyfiles plugin-dependencies plugins
release: deb-all package_cloud packer
package_cloud:
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
packer:
2015-01-16 16:56:16 -05:00
packer build contrib/packer.json
copyfiles:
2013-06-15 15:02:44 -07:00
cp dokku /usr/local/bin/dokku
mkdir -p ${CORE_PLUGINS_PATH} ${PLUGINS_PATH} ${DISABLED_PLUGINS_PATH}
rm -rf ${CORE_PLUGINS_PATH}/*
2013-11-29 20:31:22 +00:00
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \
2015-06-12 18:07:08 -07:00
rm -Rf ${PLUGINS_PATH}/available/$$plugin && \
rm -Rf ${CORE_PLUGINS_PATH}/$$plugin && \
rm -rf ${PLUGINS_PATH}/$$plugin && \
cp -R plugins/$$plugin ${CORE_PLUGINS_PATH} && \
2015-06-12 18:07:08 -07:00
ln -s ${CORE_PLUGINS_PATH}/$$plugin ${PLUGINS_PATH}/available; \
2014-12-13 18:56:31 -08:00
done
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} ${DISABLED_PLUGINS_PATH}
$(MAKE) addman
2014-03-08 11:46:46 -05:00
addman:
2014-03-08 11:46:46 -05:00
mkdir -p /usr/local/share/man/man1
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
version:
git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION
2015-06-12 18:07:08 -07:00
plugin-dependencies: plugn
dokku plugins-install-dependencies --core
2015-06-12 18:07:08 -07:00
plugins: plugn docker
dokku plugins-install --core
2015-06-12 18:07:08 -07:00
dependencies: apt-update sshcommand plugn docker help2man man-db
2015-03-27 14:26:21 -07:00
$(MAKE) -e stack
apt-update:
apt-get update
help2man:
apt-get install -qq -y help2man
man-db:
apt-get install -qq -y man-db
sshcommand:
2013-06-11 20:40:48 -07:00
wget -qO /usr/local/bin/sshcommand ${SSHCOMMAND_URL}
chmod +x /usr/local/bin/sshcommand
sshcommand create dokku /usr/local/bin/dokku
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
docker: aufs
apt-get install -qq -y curl
egrep -i "^docker" /etc/group || groupadd docker
usermod -aG docker dokku
2015-05-27 13:19:28 -07:00
ifndef CI
curl -sSL https://get.docker.com/gpg | apt-key add -
echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
apt-get update
ifdef DOCKER_VERSION
apt-get install -qq -y lxc-docker-${DOCKER_VERSION}
else
apt-get install -qq -y lxc-docker-1.6.2
endif
sleep 2 # give docker a moment i guess
2015-05-27 13:19:28 -07:00
endif
aufs:
2014-12-13 18:56:31 -08:00
ifndef CI
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
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)
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)
else
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
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}
endif
endif
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
dokku-installer:
apt-get install -qq -y ruby
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 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:
vagrant ssh -- sudo sshcommand acl-add dokku $(USER)
2014-10-06 18:31:17 -04:00
vagrant-dokku:
vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'"
2014-12-13 18:56:31 -08:00