2024-01-10 17:56:40 +03:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# TODO:
|
|
|
|
|
# - cleanup/destroy
|
|
|
|
|
# - update
|
|
|
|
|
# - backup
|
|
|
|
|
# - pull config
|
|
|
|
|
#
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
2024-01-20 18:37:20 +03:00
|
|
|
EDITOR ?= vim
|
2024-01-20 18:36:57 +03:00
|
|
|
|
|
|
|
|
|
2024-01-10 17:56:40 +03:00
|
|
|
# NOTE: The order here is important:
|
|
|
|
|
# - to avoid bootstrapping network connections gate must be the
|
|
|
|
|
# first CT to get built to route the rest of CT's to the WAN
|
|
|
|
|
# connection during the build process.
|
|
|
|
|
# - ns should be the second to be built to provide the rest of the
|
|
|
|
|
# CT's with DHCP network configuration.
|
|
|
|
|
# - the rest of the CT's are created in order of importance, strting
|
|
|
|
|
# from CT's needed for access and ending with services.
|
2024-01-13 00:04:09 +03:00
|
|
|
CORE_CTs := \
|
|
|
|
|
gate ns
|
|
|
|
|
MINIMAL_CTs := \
|
|
|
|
|
ssh wireguard
|
|
|
|
|
APP_CTs := \
|
|
|
|
|
syncthing nextcloud #gitea
|
|
|
|
|
DEV_CTs := \
|
|
|
|
|
gitea
|
2024-01-10 17:56:40 +03:00
|
|
|
|
|
|
|
|
|
2024-01-12 17:11:38 +03:00
|
|
|
DEPENDENCIES = make git dig pct
|
2024-01-12 17:10:43 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
# dependency checking...
|
|
|
|
|
|
|
|
|
|
require(%):
|
|
|
|
|
@printf "%-20s %s\n" \
|
|
|
|
|
"$*" \
|
|
|
|
|
"`which $* &> /dev/null && echo '- OK' || echo '- FAIL'`"
|
|
|
|
|
|
|
|
|
|
.PHONY: check-message
|
|
|
|
|
check-message:
|
|
|
|
|
|
|
|
|
|
.PHONY: check
|
|
|
|
|
check: check-message $(foreach dep,$(DEPENDENCIES),require($(dep)))
|
|
|
|
|
|
|
|
|
|
|
2024-01-10 17:56:40 +03:00
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
.PHONY: FORCE
|
|
|
|
|
FORCE:
|
|
|
|
|
|
|
|
|
|
|
2024-01-15 01:06:15 +03:00
|
|
|
%: config %/make.sh FORCE
|
|
|
|
|
$*/make.sh
|
2024-01-10 16:14:59 +03:00
|
|
|
|
2024-01-06 18:31:13 +03:00
|
|
|
|
2024-01-13 00:04:09 +03:00
|
|
|
%.config: %/config.example
|
|
|
|
|
|
|
|
|
|
|
2024-01-06 18:31:13 +03:00
|
|
|
config.global: config.global.example
|
2024-01-12 17:10:43 +03:00
|
|
|
@ [ ! -e "$@" ] \
|
|
|
|
|
&& cat "$<" > "$@" \
|
|
|
|
|
&& $(EDITOR) "$@" \
|
|
|
|
|
|| true
|
2024-01-06 18:31:13 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-10 17:56:40 +03:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
# Shorthands...
|
2024-01-06 18:31:13 +03:00
|
|
|
|
2024-01-10 17:56:40 +03:00
|
|
|
.PHONY: config
|
|
|
|
|
config: config.global
|
2024-01-06 18:31:13 +03:00
|
|
|
|
|
|
|
|
|
2024-01-10 17:56:40 +03:00
|
|
|
.PHONY: gate
|
|
|
|
|
gate: gate-traefik
|
2024-01-06 18:31:13 +03:00
|
|
|
|
2024-01-07 16:18:27 +03:00
|
|
|
|
|
|
|
|
|
2024-01-10 17:56:40 +03:00
|
|
|
#----------------------------------------------------------------------
|
2024-01-06 18:31:13 +03:00
|
|
|
|
2024-01-13 00:04:09 +03:00
|
|
|
|
|
|
|
|
.PHONY: core
|
2024-01-18 16:21:51 +03:00
|
|
|
core: config $(CORE_CTs)
|
2024-01-13 00:04:09 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: minimal
|
2024-01-18 16:46:27 +03:00
|
|
|
minimal: core $(MINIMAL_CTs)
|
2024-01-13 00:04:09 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: dev
|
|
|
|
|
dev: minimal $(DEV_CTs)
|
|
|
|
|
|
|
|
|
|
|
2024-01-06 18:31:13 +03:00
|
|
|
.PHONY: all
|
2024-01-13 00:04:09 +03:00
|
|
|
all: minimal $(APP_CTs)
|
2024-01-10 17:56:40 +03:00
|
|
|
|
2024-01-06 18:31:13 +03:00
|
|
|
|
|
|
|
|
|
2024-01-20 19:00:22 +03:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
clean:
|
|
|
|
|
-rm -rf */staging
|
|
|
|
|
|
2024-01-06 18:31:13 +03:00
|
|
|
|
2024-01-17 15:07:18 +03:00
|
|
|
|
2024-01-10 17:56:40 +03:00
|
|
|
#----------------------------------------------------------------------
|