-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (144 loc) · 6.19 KB
/
Makefile
File metadata and controls
176 lines (144 loc) · 6.19 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# QP Conduit - Makefile
# Internal infrastructure for on-premises AI deployments.
# https://github.com/quantumpipes/conduit
#
# Override CONDUIT_APP_NAME to rebrand for your project.
# Include this Makefile in your own: include path/to/conduit/Makefile
SHELL := /bin/bash
.DEFAULT_GOAL := help
CONDUIT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
UI_DIR := $(CONDUIT_DIR)/ui
# ---------------------------------------------------------------------------
# Help
# ---------------------------------------------------------------------------
.PHONY: help
help: ## Show this help
@echo ""
@echo " QP Conduit - On-Premises Infrastructure"
@echo " ========================================"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-26s\033[0m %s\n", $$1, $$2}'
@echo ""
# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
.PHONY: conduit-setup
conduit-setup: ## Initialize Conduit (dnsmasq, Caddy, internal CA)
@bash $(CONDUIT_DIR)/conduit-setup.sh
# ---------------------------------------------------------------------------
# Service Management
# ---------------------------------------------------------------------------
.PHONY: conduit-register
conduit-register: ## Register a service (NAME=grafana HOST=10.0.1.50:3000)
@bash $(CONDUIT_DIR)/conduit-register.sh --name $(NAME) --host $(HOST) \
$(if $(HEALTH),--health $(HEALTH),) \
$(if $(NO_TLS),--no-tls,)
.PHONY: conduit-deregister
conduit-deregister: ## Remove a service (NAME=grafana)
@bash $(CONDUIT_DIR)/conduit-deregister.sh --name $(NAME)
.PHONY: conduit-status
conduit-status: ## Show all services with health, TLS, and DNS status
@bash $(CONDUIT_DIR)/conduit-status.sh
# ---------------------------------------------------------------------------
# Monitoring
# ---------------------------------------------------------------------------
.PHONY: conduit-monitor
conduit-monitor: ## Show hardware stats (GPU, CPU, memory, disk)
@bash $(CONDUIT_DIR)/conduit-monitor.sh $(if $(SERVER),--server $(SERVER),)
.PHONY: conduit-monitor-containers
conduit-monitor-containers: ## Show Docker container health
@bash $(CONDUIT_DIR)/conduit-monitor.sh --containers
# ---------------------------------------------------------------------------
# Certificates
# ---------------------------------------------------------------------------
.PHONY: conduit-certs
conduit-certs: ## List all TLS certificates with expiry dates
@bash $(CONDUIT_DIR)/conduit-certs.sh
.PHONY: conduit-certs-rotate
conduit-certs-rotate: ## Rotate a certificate (NAME=grafana)
@bash $(CONDUIT_DIR)/conduit-certs.sh --rotate $(NAME)
.PHONY: conduit-certs-inspect
conduit-certs-inspect: ## Inspect a certificate (NAME=grafana)
@bash $(CONDUIT_DIR)/conduit-certs.sh --inspect $(NAME)
.PHONY: conduit-certs-trust
conduit-certs-trust: ## Install internal CA in system trust store
@bash $(CONDUIT_DIR)/conduit-certs.sh --trust
# ---------------------------------------------------------------------------
# DNS
# ---------------------------------------------------------------------------
.PHONY: conduit-dns
conduit-dns: ## List all DNS entries
@bash $(CONDUIT_DIR)/conduit-dns.sh
.PHONY: conduit-dns-flush
conduit-dns-flush: ## Flush DNS cache
@bash $(CONDUIT_DIR)/conduit-dns.sh --flush
.PHONY: conduit-dns-resolve
conduit-dns-resolve: ## Test DNS resolution (DOMAIN=grafana.internal)
@bash $(CONDUIT_DIR)/conduit-dns.sh --resolve $(DOMAIN)
# ---------------------------------------------------------------------------
# Audit
# ---------------------------------------------------------------------------
.PHONY: conduit-verify
conduit-verify: ## Verify Capsule audit chain integrity
@bash -c 'source $(CONDUIT_DIR)/conduit-preflight.sh && qp-capsule verify'
# ---------------------------------------------------------------------------
# Docker (recommended)
# ---------------------------------------------------------------------------
.PHONY: dev
dev: ## Start Conduit dashboard in Docker (http://localhost:9999)
@docker compose -f $(CONDUIT_DIR)/docker-compose.yml up --build -d
@docker compose -f $(CONDUIT_DIR)/docker-compose.yml logs -f
.PHONY: go
go: ## Start Conduit in Docker (background)
@docker compose -f $(CONDUIT_DIR)/docker-compose.yml up --build -d
.PHONY: stop
stop: ## Stop Conduit containers
@docker compose -f $(CONDUIT_DIR)/docker-compose.yml down
.PHONY: logs
logs: ## Tail Conduit container logs
@docker compose -f $(CONDUIT_DIR)/docker-compose.yml logs -f
.PHONY: refresh
refresh: ## Rebuild and restart the app container
@docker compose -f $(CONDUIT_DIR)/docker-compose.yml up --build -d app
# ---------------------------------------------------------------------------
# Admin UI (native, for development)
# ---------------------------------------------------------------------------
.PHONY: ui
ui: ## Start the admin dashboard via Docker (dev mode, port 5173)
@docker run --rm -it \
-v $(UI_DIR):/ui \
-w /ui \
-p 127.0.0.1:5173:5173 \
--add-host=host.docker.internal:host-gateway \
node:24-alpine \
sh -c "npm install && npm run dev -- --host 0.0.0.0"
.PHONY: ui-build
ui-build: ## Build the admin dashboard for production
@cd $(UI_DIR) && npm run build
.PHONY: ui-install
ui-install: ## Install admin dashboard dependencies
@cd $(UI_DIR) && npm install
.PHONY: ui-typecheck
ui-typecheck: ## Type-check the admin dashboard
@cd $(UI_DIR) && npm run typecheck
# ---------------------------------------------------------------------------
# Testing
# ---------------------------------------------------------------------------
.PHONY: test
test: ## Run all tests (requires bats-core)
@bats $(CONDUIT_DIR)/tests/unit/ $(CONDUIT_DIR)/tests/integration/
.PHONY: test-unit
test-unit: ## Run unit tests only
@bats $(CONDUIT_DIR)/tests/unit/
.PHONY: test-integration
test-integration: ## Run integration tests only
@bats $(CONDUIT_DIR)/tests/integration/
.PHONY: test-smoke
test-smoke: ## Run smoke tests
@bash $(CONDUIT_DIR)/tests/smoke/test_standalone.sh
.PHONY: test-ui
test-ui: ## Run admin dashboard tests
@cd $(UI_DIR) && npm test
.PHONY: check
check: test ui-typecheck ## Run all tests + type-check UI