-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (102 loc) 路 5.59 KB
/
Copy pathMakefile
File metadata and controls
142 lines (102 loc) 路 5.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
.DEFAULT_GOAL := help
.PHONY: help bootstrap install-git-hooks generate-dev-cert setup-local-https \
backend-up backend-down frontend-up frontend-down watch \
build-backend build-frontend up down logs logs-worker logs-runner logs-frontend ps shell \
worker-up worker-down runner-up runner-down migrate migrate-down migrate-force new-migration seed-data generate sync-worker plugin-scan create-plugin config prod-config argocd-ui argocd-token minikube-registry
BACKEND_SERVICES := backend worker db redis devhub-registry gitea gitea-runner tempo grafana otel-collector
FRONTEND_SERVICES := frontend nginx
##@ Setup
bootstrap: ## Create local env files for first run
@./scripts/bootstrap.sh
install-git-hooks: ## Install local Git hooks, including Conventional Commit message validation
@git config core.hooksPath .githooks
@chmod +x .githooks/commit-msg scripts/validate-commit-msg.sh
@echo "Git hooks installed from .githooks"
generate-dev-cert: ## Generate local TLS certs, optionally with DOMAIN=devhub.local API_DOMAIN=api.devhub.local GRAFANA_DOMAIN=grafana.devhub.local
@./scripts/generate-dev-cert.sh $(if $(DOMAIN),$(DOMAIN),) $(if $(API_DOMAIN),$(API_DOMAIN),) $(if $(GITEA_DOMAIN),$(GITEA_DOMAIN),) $(if $(GRAFANA_DOMAIN),$(GRAFANA_DOMAIN),)
setup-local-https: ## Generate certs, update hosts, and trust local devhub/api/gitea/grafana certs (macOS)
@./scripts/setup-local-https.sh $(if $(DOMAIN),$(DOMAIN),) $(if $(API_DOMAIN),$(API_DOMAIN),) $(if $(GITEA_DOMAIN),$(GITEA_DOMAIN),) $(if $(GRAFANA_DOMAIN),$(GRAFANA_DOMAIN),)
##@ Development
backend-up: ## Start backend services without UI or nginx
@./scripts/dev.sh up --build $(BACKEND_SERVICES)
frontend-up: ## Start the UI stack; nginx will also bring up backend dependencies it needs
@./scripts/dev.sh up --build $(FRONTEND_SERVICES)
watch: ## Start backend and frontend dev stack, then follow app logs
@./scripts/watch.sh
build-backend: ## Build backend-side dev images without UI services
@./scripts/dev.sh build $(BACKEND_SERVICES)
build-frontend: ## Build only the frontend UI services
@./scripts/dev.sh build $(FRONTEND_SERVICES)
up: ## Start full stack services
@./scripts/dev.sh up --build
down: ## Stop and remove the dev stack
@./scripts/dev.sh down
backend-down: ## Stop backend services without touching the UI profile
@./scripts/dev.sh stop $(BACKEND_SERVICES)
frontend-down: ## Stop the frontend and nginx services
@./scripts/dev.sh stop $(FRONTEND_SERVICES)
logs: ## Follow logs for the dev stack
@./scripts/dev.sh logs -f
logs-worker: ## Follow logs for the worker service
@./scripts/dev.sh logs -f worker
logs-frontend: ## Follow logs for the frontend and nginx services
@./scripts/dev.sh logs -f frontend nginx
logs-runner: ## Follow logs for the Gitea Actions runner
@./scripts/dev.sh logs -f gitea-runner
ps: ## List dev stack containers
@./scripts/dev.sh ps
shell: ## Open a shell in the backend container
@./scripts/dev.sh run --rm backend sh
worker-up: ## Start only the worker service and its dependencies
@./scripts/dev.sh up -d worker
worker-down: ## Stop the worker service
@./scripts/dev.sh stop worker
runner-up: ## Start the Gitea Actions runner
@./scripts/dev.sh up -d gitea-runner
runner-down: ## Stop the Gitea Actions runner
@./scripts/dev.sh stop gitea-runner
##@ Backend
migrate: ## Run database migrations up
@./scripts/migrate.sh up
migrate-down: ## Roll back one database migration
@./scripts/migrate.sh down
migrate-force: ## Force-set migration version; defaults to -1, or pass VERSION=<n>
@FORCE_VERSION=$(if $(VERSION),$(VERSION),-1) ./scripts/migrate.sh
new-migration: ## Create a new migration pair, e.g. make new-migration NAME=add_services_table
@test -n "$(NAME)" || (echo "Usage: make new-migration NAME=add_services_table" && exit 1)
@./scripts/dev.sh run --rm backend go run . new-migration "$(NAME)"
seed-data: ## Seed RBAC roles, permissions, and role-permission mappings
@./scripts/dev.sh run --rm backend go run . seed-data
generate: ## Run backend DB code generation
@./scripts/generate.sh
sync-worker: ## Run the backend async worker process in a one-off worker container
@./scripts/sync-worker.sh
plugin-scan: ## Scan plugin manifests and upsert them into the plugins table
@./scripts/plugin-scan.sh $(ARGS)
argocd-ui: ## Install/apply Argo CD resources if needed, then port-forward the UI
@./scripts/argocd.sh all
argocd-token: ## Generate and print an ARGOCD_AUTH_TOKEN export line
@./scripts/argocd.sh token
minikube-registry: ## Recreate minikube with host.minikube.internal:5001 allowed as an insecure registry
@./scripts/dev.sh up -d --build devhub-registry
@minikube delete
@minikube start --insecure-registry="host.minikube.internal:5001"
@minikube ssh -- 'nc -vz host.minikube.internal 5001'
create-plugin: ## Scaffold a local plugin folder, e.g. make create-plugin NAME=my-plugin TYPE=scaffolder
@./scripts/create-plugin.sh \
$(if $(NAME),--name "$(NAME)") \
$(if $(TYPE),--type "$(TYPE)") \
$(if $(SCOPE),--scope "$(SCOPE)") \
$(if $(VERSION),--version "$(VERSION)") \
$(if $(DESCRIPTION),--description "$(DESCRIPTION)") \
$(if $(LANGUAGE),--language "$(LANGUAGE)") \
$(if $(filter 1 true TRUE yes YES,$(FORCE)),--force) \
$(ARGS)
##@ Compose
config: ## Render the development compose config
@./scripts/dev.sh config
prod-config: ## Render the production compose config
@COMPOSE_ENV=prod ./scripts/docker-build-and-run.sh config
##@ Help
help: ## Show help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_.-]+:.*?##/ { printf " \033[36m%-18s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)