2017-01-08 16:41:05 -07:00
|
|
|
DOKKU_VERSION ?= master
|
2013-11-21 00:15:22 +00:00
|
|
|
|
2022-10-12 21:53:11 -04:00
|
|
|
TARGETARCH ?= amd64
|
|
|
|
|
|
2023-10-08 22:17:04 -04:00
|
|
|
DOCKER_IMAGE_LABELER_URL ?= $(shell jq -r --arg name docker-image-labeler --arg arch $(TARGETARCH) '.dependencies[] | select(.name == $$name) | .urls[$$arch]' contrib/dependencies.json)
|
|
|
|
|
DOCKER_CONTAINER_HEALTHCHECKER_URL ?= $(shell jq -r --arg name docker-container-healthchecker --arg arch $(TARGETARCH) '.dependencies[] | select(.name == $$name) | .urls[$$arch]' contrib/dependencies.json)
|
|
|
|
|
LAMBDA_BUILDER_URL ?= $(shell jq -r --arg name lambda-builder --arg arch $(TARGETARCH) '.dependencies[] | select(.name == $$name) | .urls[$$arch]' contrib/dependencies.json)
|
|
|
|
|
NETRC_URL ?= $(shell jq -r --arg name netrc --arg arch $(TARGETARCH) '.dependencies[] | select(.name == $$name) | .urls[$$arch]' contrib/dependencies.json)
|
|
|
|
|
PLUGN_URL ?= $(shell jq -r --arg name plugn --arg arch $(TARGETARCH) '.predependencies[] | select(.name == $$name) | .urls[$$arch]' contrib/dependencies.json)
|
|
|
|
|
PROCFILE_UTIL_URL ?= $(shell jq -r --arg name procfile-util --arg arch $(TARGETARCH) '.dependencies[] | select(.name == $$name) | .urls[$$arch]' contrib/dependencies.json)
|
|
|
|
|
SIGIL_URL ?= $(shell jq -r --arg name gliderlabs-sigil --arg arch $(TARGETARCH) '.predependencies[] | select(.name == $$name) | .urls[$$arch]' contrib/dependencies.json)
|
|
|
|
|
SSHCOMMAND_URL ?= $(shell jq -r --arg name sshcommand --arg arch $(TARGETARCH) '.dependencies[] | select(.name == $$name) | .urls[$$arch]' contrib/dependencies.json)
|
2015-04-20 16:32:18 -07:00
|
|
|
STACK_URL ?= https://github.com/gliderlabs/herokuish.git
|
2024-08-26 04:20:52 -04:00
|
|
|
PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest-24
|
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
|
2017-03-25 17:37:26 -06:00
|
|
|
PLUGIN_MAKE_TARGET ?= build-in-docker
|
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
|
|
|
|
|
|
2017-01-17 11:06:53 -08:00
|
|
|
include common.mk
|
|
|
|
|
|
2022-07-05 15:24:48 -04:00
|
|
|
.PHONY: all apt-update install version copyfiles copyplugin man-db plugins dependencies docker-image-labeler lambda-builder netrc sshcommand procfile-util plugn docker aufs stack count vagrant-acl-add vagrant-dokku go-build
|
2013-11-15 00:43:38 +00:00
|
|
|
|
2022-09-05 14:46:55 -04:00
|
|
|
include docs.mk
|
2014-12-13 18:56:31 -08:00
|
|
|
include tests.mk
|
2019-04-08 12:41:06 -04:00
|
|
|
include package.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
|
|
|
|
|
|
|
|
packer:
|
2015-01-16 16:56:16 -05:00
|
|
|
packer build contrib/packer.json
|
|
|
|
|
|
2017-01-14 20:22:37 -08:00
|
|
|
go-build:
|
2017-01-03 22:27:20 -08:00
|
|
|
basedir=$(PWD); \
|
|
|
|
|
for dir in plugins/*; do \
|
|
|
|
|
if [ -e $$dir/Makefile ]; then \
|
2024-09-23 02:54:48 -04:00
|
|
|
GO_ARGS='$(GO_ARGS)' CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) GOWORK=off $(MAKE) -e -C $$dir $(PLUGIN_MAKE_TARGET) || exit $$? ;\
|
2017-01-03 22:27:20 -08:00
|
|
|
fi ;\
|
|
|
|
|
done
|
|
|
|
|
|
2018-04-07 04:49:21 -04:00
|
|
|
|
|
|
|
|
go-build-plugin:
|
|
|
|
|
ifndef PLUGIN_NAME
|
|
|
|
|
$(error PLUGIN_NAME not specified)
|
|
|
|
|
endif
|
|
|
|
|
if [ -e plugins/$(PLUGIN_NAME)/Makefile ]; then \
|
2024-09-23 02:54:48 -04:00
|
|
|
GO_ARGS='$(GO_ARGS)' CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) GOWORK=off $(MAKE) -e -C plugins/$(PLUGIN_NAME) $(PLUGIN_MAKE_TARGET) || exit $$? ;\
|
2018-04-07 04:49:21 -04:00
|
|
|
fi
|
|
|
|
|
|
2017-01-14 20:22:37 -08:00
|
|
|
go-clean:
|
|
|
|
|
basedir=$(PWD); \
|
|
|
|
|
for dir in plugins/*; do \
|
|
|
|
|
if [ -e $$dir/Makefile ]; then \
|
2017-01-17 11:06:53 -08:00
|
|
|
$(MAKE) -e -C $$dir clean ;\
|
2017-01-14 20:22:37 -08:00
|
|
|
fi ;\
|
|
|
|
|
done
|
|
|
|
|
|
2024-03-14 08:05:50 -04:00
|
|
|
copydokku:
|
2013-06-15 15:02:44 -07:00
|
|
|
cp dokku /usr/local/bin/dokku
|
2024-03-14 08:05:50 -04:00
|
|
|
chmod 0755 /usr/local/bin/dokku
|
|
|
|
|
|
|
|
|
|
copyfiles: copydokku
|
|
|
|
|
$(MAKE) go-build || exit 1
|
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
|
2018-02-12 02:46:46 -05:00
|
|
|
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do $(MAKE) copyplugin PLUGIN_NAME=$$plugin; done
|
2017-03-31 17:50:16 -06:00
|
|
|
ifndef SKIP_GO_CLEAN
|
2017-01-14 20:22:37 -08:00
|
|
|
$(MAKE) go-clean
|
2017-03-31 17:50:16 -06:00
|
|
|
endif
|
2016-06-09 14:29:06 -04:00
|
|
|
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} || true
|
2015-01-16 12:38:37 -08:00
|
|
|
$(MAKE) addman
|
2014-03-08 11:46:46 -05:00
|
|
|
|
2018-02-12 02:46:46 -05:00
|
|
|
copyplugin:
|
|
|
|
|
ifndef PLUGIN_NAME
|
|
|
|
|
$(error PLUGIN_NAME not specified)
|
|
|
|
|
endif
|
|
|
|
|
rm -Rf ${CORE_PLUGINS_PATH}/available/$(PLUGIN_NAME) && \
|
|
|
|
|
rm -Rf ${PLUGINS_PATH}/available/$(PLUGIN_NAME) && \
|
|
|
|
|
rm -rf ${CORE_PLUGINS_PATH}/$(PLUGIN_NAME) && \
|
|
|
|
|
rm -rf ${PLUGINS_PATH}/$(PLUGIN_NAME) && \
|
|
|
|
|
cp -R plugins/$(PLUGIN_NAME) ${CORE_PLUGINS_PATH}/available && \
|
|
|
|
|
rm -rf ${CORE_PLUGINS_PATH}/available/$(PLUGIN_NAME)/src && \
|
|
|
|
|
ln -s ${CORE_PLUGINS_PATH}/available/$(PLUGIN_NAME) ${PLUGINS_PATH}/available; \
|
|
|
|
|
find /var/lib/dokku/ -xtype l -delete;\
|
|
|
|
|
PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn enable $(PLUGIN_NAME) ;\
|
|
|
|
|
PLUGIN_PATH=${PLUGINS_PATH} plugn enable $(PLUGIN_NAME)
|
|
|
|
|
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} || true
|
|
|
|
|
|
2017-01-08 05:24:34 -07:00
|
|
|
addman: help2man man-db
|
2014-03-08 11:46:46 -05:00
|
|
|
mkdir -p /usr/local/share/man/man1
|
2021-10-27 12:07:35 -04:00
|
|
|
ifneq ("$(wildcard /usr/local/share/man/man1/dokku.1-generated)","")
|
|
|
|
|
cp /usr/local/share/man/man1/dokku.1-generated /usr/local/share/man/man1/dokku.1
|
|
|
|
|
else
|
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
|
2021-10-27 12:07:35 -04:00
|
|
|
endif
|
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:
|
2019-08-13 00:53:49 -04:00
|
|
|
mkdir -p ${DOKKU_LIB_ROOT}
|
2017-01-08 16:41:05 -07:00
|
|
|
ifeq ($(DOKKU_VERSION),master)
|
2019-08-13 00:53:49 -04:00
|
|
|
git describe --tags > ${DOKKU_LIB_ROOT}/VERSION 2>/dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ${DOKKU_LIB_ROOT}/VERSION
|
2017-01-08 16:41:05 -07:00
|
|
|
else
|
2019-08-13 00:53:49 -04:00
|
|
|
echo $(DOKKU_VERSION) > ${DOKKU_LIB_ROOT}/STABLE_VERSION
|
2017-01-08 16:41:05 -07:00
|
|
|
endif
|
2013-11-21 00:01:38 +00:00
|
|
|
|
2018-07-29 12:38:30 -04:00
|
|
|
plugin-dependencies: plugn procfile-util
|
2015-12-22 11:10:49 -08:00
|
|
|
sudo -E dokku plugin:install-dependencies --core
|
2013-10-29 14:44:48 -06:00
|
|
|
|
2018-07-29 12:38:30 -04:00
|
|
|
plugins: plugn procfile-util docker
|
2015-12-22 11:10:49 -08:00
|
|
|
sudo -E dokku plugin:install --core
|
2013-07-02 03:12:43 -05:00
|
|
|
|
2024-09-18 14:10:14 +02:00
|
|
|
dependencies: apt-update jq docker-image-labeler docker-container-healthchecker lambda-builder netrc sshcommand plugn procfile-util docker help2man man-db sigil dos2unix parallel
|
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:
|
2017-08-29 10:14:33 -07:00
|
|
|
apt-get update -qq
|
2015-03-25 02:50:27 -04:00
|
|
|
|
2021-10-09 15:59:31 -04:00
|
|
|
parallel:
|
|
|
|
|
apt-get -qq -y --no-install-recommends install parallel
|
|
|
|
|
|
2020-02-22 21:16:26 -05:00
|
|
|
jq:
|
2021-01-17 16:09:58 -05:00
|
|
|
apt-get -qq -y --no-install-recommends install jq
|
2020-02-22 21:16:26 -05:00
|
|
|
|
2019-08-05 12:09:53 -04:00
|
|
|
dos2unix:
|
2021-01-17 16:09:58 -05:00
|
|
|
apt-get -qq -y --no-install-recommends install dos2unix
|
2019-08-05 12:09:53 -04:00
|
|
|
|
2015-01-16 12:38:37 -08:00
|
|
|
help2man:
|
2021-01-17 16:09:58 -05:00
|
|
|
apt-get -qq -y --no-install-recommends install help2man
|
2013-06-11 20:16:07 -07:00
|
|
|
|
2015-03-25 02:48:17 -04:00
|
|
|
man-db:
|
2021-01-17 16:09:58 -05:00
|
|
|
apt-get -qq -y --no-install-recommends install man-db
|
2015-03-25 02:48:17 -04:00
|
|
|
|
2021-01-23 23:00:22 -05:00
|
|
|
docker-image-labeler:
|
2024-05-19 00:05:14 -04:00
|
|
|
wget -qO /usr/local/bin/docker-image-labeler ${DOCKER_IMAGE_LABELER_URL}
|
|
|
|
|
chmod +x /usr/local/bin/docker-image-labeler
|
2021-01-23 23:00:22 -05:00
|
|
|
|
2023-08-05 12:28:11 -04:00
|
|
|
docker-container-healthchecker:
|
2024-05-19 00:05:14 -04:00
|
|
|
wget -qO /usr/local/bin/docker-container-healthchecker ${DOCKER_CONTAINER_HEALTHCHECKER_URL}
|
|
|
|
|
chmod +x /usr/local/bin/docker-container-healthchecker
|
2023-08-05 12:28:11 -04:00
|
|
|
|
2022-07-05 15:24:48 -04:00
|
|
|
lambda-builder:
|
2024-05-19 00:05:14 -04:00
|
|
|
wget -qO /usr/local/bin/lambda-builder ${LAMBDA_BUILDER_URL}
|
|
|
|
|
chmod +x /usr/local/bin/lambda-builder
|
2022-07-05 15:24:48 -04:00
|
|
|
|
2021-02-21 03:31:05 -05:00
|
|
|
netrc:
|
2024-05-19 00:05:14 -04:00
|
|
|
wget -qO /usr/local/bin/netrc ${NETRC_URL}
|
|
|
|
|
chmod +x /usr/local/bin/netrc
|
2013-06-11 20:16:07 -07:00
|
|
|
|
2018-07-29 12:38:30 -04:00
|
|
|
procfile-util:
|
2024-05-19 00:05:14 -04:00
|
|
|
wget -qO /usr/local/bin/procfile-util ${PROCFILE_UTIL_URL}
|
|
|
|
|
chmod +x /usr/local/bin/procfile-util
|
2018-07-29 12:38:30 -04:00
|
|
|
|
2015-06-12 18:07:08 -07:00
|
|
|
plugn:
|
2024-05-19 00:05:14 -04:00
|
|
|
wget -qO /usr/local/bin/plugn ${PLUGN_URL}
|
|
|
|
|
chmod +x /usr/local/bin/plugn
|
2013-07-02 03:12:43 -05:00
|
|
|
|
2016-02-14 18:43:40 -08:00
|
|
|
sigil:
|
2024-05-19 00:05:14 -04:00
|
|
|
wget -qO /usr/local/bin/sigil ${SIGIL_URL}
|
|
|
|
|
chmod +x /usr/local/bin/sigil
|
2016-02-14 18:43:40 -08:00
|
|
|
|
2021-02-21 03:31:05 -05:00
|
|
|
sshcommand:
|
2024-05-19 00:05:14 -04:00
|
|
|
wget -qO /usr/local/bin/sshcommand ${SSHCOMMAND_URL}
|
|
|
|
|
chmod +x /usr/local/bin/sshcommand
|
2021-02-21 03:31:05 -05:00
|
|
|
sshcommand create dokku /usr/local/bin/dokku
|
|
|
|
|
|
2017-06-19 21:42:40 -07:00
|
|
|
docker:
|
2021-01-17 16:09:58 -05:00
|
|
|
apt-get -qq -y --no-install-recommends install curl
|
2020-02-17 05:59:52 -05:00
|
|
|
grep -i -E "^docker" /etc/group || groupadd docker
|
2013-08-13 20:23:29 -07:00
|
|
|
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
|
2021-01-17 16:09:58 -05:00
|
|
|
apt-get -qq -y --no-install-recommends install docker-engine=${DOCKER_VERSION} || (apt-cache madison docker-engine ; exit 1)
|
2015-09-16 15:21:09 -07: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
|
|
|
|
|
|
|
|
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
|
2020-02-17 05:59:52 -05:00
|
|
|
ifeq ($(shell echo ${PREBUILT_STACK_URL} | grep -q -E '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-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)'"
|