homelab/Makefile
Gonçalo Rodrigues 464bde2ee6 chore: update Makefiles for Skaffold-based workflow
Root Makefile:
- Replace deploy-*/deploy-all/restart-all with skaffold dev/run
- Add dev-<service> targets for per-service watch mode
- Rename dev → skaffold dev (was: up+infra+deploy-all)
- Rename to bootstrap for the full first-time setup
- Add test-integration target

service.mk:
- Remove REGISTRY variable (image is now homelab/<svc>, no registry prefix)
- Remove skaffold-gen (skaffold.yaml files are committed)
- Update skaffold-dev/run to pass -p local
- Keep build-deploy as a manual fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 16:34:08 +01:00

74 lines
2.9 KiB
Makefile

SHELL := /bin/zsh
.DEFAULT_GOAL := help
K3D_SCRIPT := infrastructure/k3d/k3d.sh
TERRAFORM := terraform
# ── Cluster ───────────────────────────────────────────────────────────────────
.PHONY: up
up: ## Create the k3d dev cluster
$(K3D_SCRIPT) homelab
.PHONY: down
down: ## Delete the k3d dev cluster
$(K3D_SCRIPT) homelab delete
# ── Infrastructure ────────────────────────────────────────────────────────────
.PHONY: infra
infra: ## Deploy shared infrastructure (MongoDB, monitoring, Traefik)
$(TERRAFORM) -chdir=infrastructure/terraform/ apply
# ── Services (Skaffold) ───────────────────────────────────────────────────────
.PHONY: dev
dev: ## Watch all services — rebuild and redeploy on file change
skaffold dev
.PHONY: run
run: ## Build and deploy all services once
skaffold run
.PHONY: dev-finance
dev-finance: ## Watch finance API only
skaffold dev -f apps/finance/services/api/skaffold.yaml -p local
.PHONY: dev-gateway
dev-gateway: ## Watch auth gateway only
skaffold dev -f apps/auth/services/gateway/skaffold.yaml -p local
.PHONY: dev-users
dev-users: ## Watch auth users only
skaffold dev -f apps/auth/services/users/skaffold.yaml -p local
.PHONY: dev-example
dev-example: ## Watch test example-service only
skaffold dev -f apps/test/services/example-service/skaffold.yaml -p local
# ── Tests ─────────────────────────────────────────────────────────────────────
.PHONY: test
test: ## Run all unit tests
go test ./...
.PHONY: test-integration
test-integration: ## Run integration tests (requires Docker for testcontainers)
go test -tags integration ./...
# ── Lifecycle ─────────────────────────────────────────────────────────────────
.PHONY: bootstrap
bootstrap: up infra run ## Full bootstrap: cluster + infra + all services
.PHONY: reset
reset: down bootstrap ## Tear down and rebuild everything from scratch
# ── Help ──────────────────────────────────────────────────────────────────────
.PHONY: help
help: ## Show this help
@grep -hE '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'