diff options
Diffstat (limited to 'make')
| -rw-r--r-- | make/container.mk | 28 | ||||
| -rw-r--r-- | make/crontab.mk | 13 | ||||
| -rw-r--r-- | make/openrc.mk | 74 | ||||
| -rw-r--r-- | make/vars.mk | 58 |
4 files changed, 0 insertions, 173 deletions
diff --git a/make/container.mk b/make/container.mk deleted file mode 100644 index 4c6702a..0000000 --- a/make/container.mk +++ /dev/null @@ -1,28 +0,0 @@ -REGISTRY_DOMAIN := git.joeac.net -REGISTRY_USER := joeac - -container_image_name = $(shell $(COMPOSE_CMD) config | yq ".services.$(module).image") -is_containerised = $(filter $(COMPOSE_SERVICES),$(module)) -is_own_image = $(filter git.joeac.net/%,$(container_image_name)) -has_dockerfile = $(shell test -f $(module).Dockerfile) - -define build_module_rule = -.PHONY: build_$(module) -build_$(module): $(if $(is_containerised),make_$(module) $(if $(has_dockerfile),$(module).Dockerfile)) - $(if $(is_containerised),\ - $(COMPOSE_CMD) build $(module)) -endef - -define push_module_rule = -.PHONY: push_$(module) -push_$(module): $(if $(is_containerised),login_registry) - $(if $(is_containerised),$(if $(is_own_image),\ - podman push $(container_image_name))) -endef - -$(foreach module,$(MODULES),$(eval $(call build_module_rule))) -$(foreach module,$(MODULES),$(eval $(call push_module_rule))) - -.PHONY: login_registry -login_registry: - podman login $(REGISTRY_DOMAIN) diff --git a/make/crontab.mk b/make/crontab.mk deleted file mode 100644 index 8d801a9..0000000 --- a/make/crontab.mk +++ /dev/null @@ -1,13 +0,0 @@ -.PHONY: install_crontab -install_crontab: /etc/periodic/daily/joeac.net - -.PHONY: reinstall_crontab -reinstall_crontab: /etc/periodic/daily/joeac.net - -.PHONY: uninstall_crontab -uninstall_crontab: - sudo rm -f /etc/periodic/daily/joeac.net - -/etc/periodic/daily/joeac.net: update.sh - sudo cp update.sh /etc/periodic/daily/joeac.net - sudo chmod +x /etc/periodic/daily/joeac.net diff --git a/make/openrc.mk b/make/openrc.mk deleted file mode 100644 index 207c71b..0000000 --- a/make/openrc.mk +++ /dev/null @@ -1,74 +0,0 @@ -is_openrc_module = $(filter $(COMPOSE_SERVICES),$(module)) -openrc_module_target = $(if $(is_openrc_module),~/.config/rc/init.d/joeac.net.$(module)) - -define install_openrc_module_rule = -.PHONY: install_openrc_$(module) -install_openrc_$(module): $(if $(is_openrc_module),$(openrc_module_target) openrc_add_$(module) openrc_start_$(module)) - -~/.config/rc/init.d/joeac.net.$(module): ~/.config/rc/init.d/joeac.net ~/.config/rc/runlevels/default - rm -f ~/.config/rc/init.d/joeac.net.$(module) - ln -s $(shell realpath ~)/.config/rc/init.d/joeac.net ~/.config/rc/init.d/joeac.net.$(module) -endef - -define reinstall_openrc_module_rule = -.PHONY: reinstall_openrc_$(module) -reinstall_openrc_$(module): $(if $(is_openrc_module),$(openrc_module_target) openrc_restart_$(module)) -endef - -define uninstall_openrc_module_rule = -.PHONY: uninstall_openrc_$(module) -uninstall_openrc_$(module): - $(if $(is_openrc_module),\ - rc-service -U joeac.net.$(module) stop; \ - rc-update -U del joeac.net.$(module) default; \ - rm -f ~/.config/rc/init.d/joeac.net.$(module); \ - ) -endef - -define openrc_add_rule = -.PHONY: openrc_add_$(module) -openrc_add_$(module): - rc-update -U add joeac.net.$(module) default -endef - -define openrc_start_rule = -.PHONY: openrc_start_$(module) -openrc_start_$(module): - rc-service -U joeac.net.$(module) start -endef - -define openrc_restart_rule = -.PHONY: openrc_restart_$(module) -openrc_restart_$(module): - rc-service -U joeac.net.$(module) restart -endef - -$(foreach module,$(ALL_MODULES),$(eval $(install_openrc_module_rule))) -$(foreach module,$(ALL_MODULES),$(eval $(reinstall_openrc_module_rule))) -$(foreach module,$(ALL_MODULES),$(eval $(uninstall_openrc_module_rule))) -$(foreach module,$(ALL_MODULES),$(eval $(openrc_add_rule))) -$(foreach module,$(ALL_MODULES),$(eval $(openrc_start_rule))) -$(foreach module,$(MODULES),$(eval $(openrc_restart_rule))) - -~/.config/rc/init.d/joeac.net: openrc/init.d/joeac.net.template ~/.config/rc/init.d ~/.config/rc/runlevels/default /etc/init.d/user.$(USER) /etc/conf.d/user.$(USER) - rm -f ~/.config/rc/init.d/joeac.net; \ - mkdir -p ~/.config/rc/init.d; \ - COMPOSECMD="$(COMPOSE_CMD)" envsubst -i openrc/init.d/joeac.net.template -o ~/.config/rc/init.d/joeac.net - chmod +x ~/.config/rc/init.d/joeac.net - -~/.config/rc/init.d: - mkdir -p ~/.config/rc/init.d - -~/.config/rc/runlevels/default: - mkdir -p ~/.config/rc/runlevels/default - -/etc/init.d/user.$(USER): - sudo ln -s /etc/init.d/user /etc/init.d/user.$(USER) - -/etc/conf.d/user.$(USER): openrc/conf.d/user.template - USER=$(USER) envsubst -i openrc/conf.d/user.template -o openrc/conf.d/user.$(USER) - sudo mv openrc/conf.d/user.$(USER) /etc/conf.d/user.$(USER) - sudo rc-update add user.$(USER) default - -.PHONY: uninstall_joeac.net_service - rm ~/.config/rc/joeac.net diff --git a/make/vars.mk b/make/vars.mk deleted file mode 100644 index f09ffd7..0000000 --- a/make/vars.mk +++ /dev/null @@ -1,58 +0,0 @@ -capitalise = $(shell echo "$(1)" | tr '[:lower:]' '[:upper:]') - -USER := $(shell whoami) -HOSTNAME := $(shell cat /etc/hostname) -HOSTNAMES := pi-broughton blade-canongate -IP_ADDR_pi-broughton := 192.168.178.91 -IP_ADDR_blade-canongate := 192.168.178.75 -MASTER_NODE := blade-canongate -IS_MASTER_NODE := $(filter $(MASTER_NODE),$(HOSTNAME)) -MODULES_pi-broughton := -MODULES_blade-canongate := gemini -ALL_NGINX_MODULES := -NGINX_MODULES := $(if $(IS_MASTER_NODE),$(ALL_NGINX_MODULES)) -MODULES := $(MODULES_$(HOSTNAME)) -ALL_MODULES := $(sort $(foreach hostname,$(HOSTNAMES),$(MODULES_$(hostname)))) -COMPOSE_SERVICES := $(shell podman-compose config \ - | yq ".services | keys" --output-format csv --csv-separator " ") -MAKE_MODULES := $(foreach module,$(MODULES),\ - $(shell [ -f $(module)/Makefile ] && echo $(module))) - -SUBDOMAIN_actualbudget := budget - -PORT_gemini := 1965 -PORT_smtp := 2500 - -export GEMINI_CERTIFICATES_DIR := /var/joeac.net-gemini/certificates -export GEMINI_COMITIUM_DATA_DIR := /var/joeac.net-gemini/comitium-data - -ALPINE_VERSION := 3.23 - -$(foreach module,$(ALL_MODULES),$(if $(PORT_$(module)),$(eval \ - export $(call capitalise,$(module))_PORT := $(PORT_$(module))))) -$(foreach hostname,$(HOSTNAMES),$(foreach module,$(MODULES_$(hostname)),$(eval \ - export HOST_$(module) := $(if $(filter $(HOSTNAME),$(hostname)),127.0.0.1,$(IP_ADDR_$(hostname)))))) - -ALL_SUBDOMAINS := $(foreach module,$(ALL_MODULES),$(SUBDOMAIN_$(module))) -SUBDOMAINS := $(if $(IS_MASTER_NODE),$(ALL_SUBDOMAINS)) - -ENV_RULES := $(foreach module,$(MODULES),$(if $(shell test -d $(module) && echo 1),$(module)/.env)) -MAKE_RULES := $(foreach module,$(MAKE_MODULES),make_$(module)) -BUILD_RULES := $(foreach module,$(filter $(COMPOSE_SERVICES),$(MODULES)),build_$(module)) -PUSH_RULES := $(foreach module,$(filter $(COMPOSE_SERVICES),$(MODULES)),push_$(module)) -INSTALL_RULES := $(foreach module,$(MODULES),install_$(module)) -REINSTALL_RULES := $(foreach module,$(MODULES),reinstall_$(module)) -UNINSTALL_RULES := $(foreach module,$(MODULES),uninstall_$(module)) - -CPU_ARCH := $(if $(shell which arch 2>/dev/null),\ - $(shell arch),\ - $(shell lscpu | grep ^Architecture: | sed "s/^Architecture:[[:space:]]*\([[:alnum:][:punct:]]\+\).*/\1/")) -IMAGE_PREFIX := $(if $(filter armv7%,$(CPU_ARCH)),armv7/) -COMPOSE_CMD := \ - ACTUALBUDGET_DATA_DIR="$(ACTUALBUDGET_DATA_DIR)" \ - ALPINE_VERSION="$(ALPINE_VERSION)" \ - IMAGE_PREFIX="$(IMAGE_PREFIX)" \ - GEMINI_CERTIFICATES_DIR="$(GEMINI_CERTIFICATES_DIR)" \ - GEMINI_COMITIUM_DATA_DIR="$(GEMINI_COMITIUM_DATA_DIR)" \ - $(foreach module,$(ALL_MODULES),$(call capitalise,$(module))_PORT=$(PORT_$(module))) \ - podman-compose |
