khuedoan-homelab/Makefile
2024-11-22 15:26:43 +07:00

67 lines
1.5 KiB
Makefile

.POSIX:
.PHONY: *
.EXPORT_ALL_VARIABLES:
KUBECONFIG = $(shell pwd)/metal/kubeconfig.yaml
KUBE_CONFIG_PATH = $(KUBECONFIG)
default: metal system external smoke-test post-install clean
configure:
./scripts/configure
git status
metal:
make -C metal
system:
make -C system
external:
make -C external
smoke-test:
make -C test filter=Smoke
post-install:
@./scripts/hacks
tools:
@docker run \
--rm \
--interactive \
--tty \
--network host \
--env "KUBECONFIG=${KUBECONFIG}" \
--volume "/var/run/docker.sock:/var/run/docker.sock" \
--volume $(shell pwd):$(shell pwd) \
--volume ${HOME}/.ssh:/root/.ssh \
--volume ${HOME}/.terraform.d:/root/.terraform.d \
--volume homelab-tools-cache:/root/.cache \
--volume homelab-tools-nix:/nix \
--workdir $(shell pwd) \
docker.io/nixos/nix nix --experimental-features 'nix-command flakes' develop
# TODO maybe there's a better way to manage backup with GitOps?
backup:
./scripts/backup --action setup --namespace=actualbudget --pvc=actualbudget-data
./scripts/backup --action setup --namespace=wireguard --pvc=wireguard-data
./scripts/backup --action setup --namespace=jellyfin --pvc=jellyfin-data
restore:
./scripts/backup --action restore --namespace=actualbudget --pvc=actualbudget-data
./scripts/backup --action restore --namespace=wireguard --pvc=wireguard-data
./scripts/backup --action restore --namespace=jellyfin --pvc=jellyfin-data
test:
make -C test
clean:
docker compose --project-directory ./metal/roles/pxe_server/files down
docs:
mkdocs serve
git-hooks:
pre-commit install