-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·134 lines (109 loc) · 4.2 KB
/
Copy pathMakefile
File metadata and controls
executable file
·134 lines (109 loc) · 4.2 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
.PHONY: all
all:
.PHONY: certs
certs:
@echo "🔐 [Certificates] Generating self-signed certificates for SpiceDB..."
@mkdir -p certs
@if [ ! -f certs/spicedb-cert.pem ] || [ ! -f certs/spicedb-key.pem ]; then \
openssl req -x509 -newkey rsa:4096 \
-keyout certs/spicedb-key.pem \
-out certs/spicedb-cert.pem \
-days 365 -nodes \
-subj "/CN=spicedb/O=Kartograph Dev" \
-addext "subjectAltName=DNS:spicedb,DNS:localhost,IP:127.0.0.1"; \
chmod 555 certs/spicedb-cert.pem certs/spicedb-key.pem; \
echo "✓ Certificates generated in certs/"; \
echo " → Available for local tests via certs/spicedb-cert.pem"; \
else \
echo "✓ Certificates already exist in certs/"; \
fi
.PHONY: dev
dev: certs
@echo "🧰 [Development] Starting application containers..."
@./scripts/cleanup-openshell-sandboxes.sh
@HOST_UID=$$(id -u) HOST_GID=$$(id -g) \
docker compose -f compose.yaml -f compose.dev.yaml --profile build-only build agent-runtime
@HOST_UID=$$(id -u) HOST_GID=$$(id -g) \
docker compose -f compose.yaml build
@HOST_UID=$$(id -u) HOST_GID=$$(id -g) \
docker compose -f compose.yaml -f compose.dev.yaml --profile ui up -d --force-recreate api
@HOST_UID=$$(id -u) HOST_GID=$$(id -g) \
docker compose -f compose.yaml -f compose.dev.yaml --profile ui up -d
@echo "Done."
@echo "----------------------------"
@echo "API Root: http://localhost:8000"
@echo "API Docs: http://localhost:8000/docs/"
@echo "Dev UI: http://localhost:3000"
@echo "----------------------------"
.PHONY: down
down:
docker compose -f compose.yaml -f compose.dev.yaml down
@echo "Stopping Graph Management sticky, worker, and extraction job containers..."
-@docker ps -aq --filter name=kartograph-sticky- | xargs -r docker rm -f
-@docker ps -aq --filter name=kartograph-worker- | xargs -r docker rm -f
-@docker ps -aq --filter name=kartograph-extract- | xargs -r docker rm -f
-@./scripts/cleanup-openshell-sandboxes.sh
.PHONY: dev-backup dev-restore dev-backup-list dev-repair-age-graphs
dev-backup:
@./scripts/dev-data-backup.sh backup
dev-restore:
@./scripts/dev-data-backup.sh restore $(or $(BACKUP),latest)
dev-backup-list:
@./scripts/dev-data-backup.sh list
dev-repair-age-graphs:
@./scripts/dev-data-backup.sh repair
.PHONY: kg-backup kg-restore kg-backup-list
kg-backup:
@test -n "$(KG_ID)" || (echo "Usage: make kg-backup KG_ID=<knowledge-graph-id>" && exit 1)
@./scripts/kg-data-backup.sh capture "$(KG_ID)"
kg-restore:
@test -n "$(KG_ID)" || (echo "Usage: make kg-restore KG_ID=<knowledge-graph-id> [BACKUP=latest] [YES=1] [REPLACE=1]" && exit 1)
@./scripts/kg-data-backup.sh restore "$(KG_ID)" $(or $(BACKUP),latest) $(if $(YES),--yes,) $(if $(REPLACE),--replace,)
kg-backup-list:
@test -n "$(KG_ID)" || (echo "Usage: make kg-backup-list KG_ID=<knowledge-graph-id>" && exit 1)
@./scripts/kg-data-backup.sh list "$(KG_ID)"
.PHONY: run
run:
@echo "🖥 [Non-Development] Starting application containers..."
docker compose -f compose.yaml build
docker compose -f compose.yaml up -d
@echo "Done."
@echo "----------------------------"
@echo "API Root: http://localhost:8000"
@echo "API Docs: http://localhost:8000/docs/"
@echo "----------------------------"
.PHONY: logs
logs:
docker compose logs --tail 1000 --follow
# --- Isolated instance management (for agents / worktrees) ---
.PHONY: instance-up
instance-up: certs
@./scripts/dev-instance.sh up --no-keycloak
.PHONY: instance-down
instance-down:
@./scripts/dev-instance.sh down
.PHONY: instance-status
instance-status:
@./scripts/dev-instance.sh status
.PHONY: instance-env
instance-env:
@./scripts/dev-instance.sh env --no-keycloak
# --- Test targets ---
.PHONY: test-unit
test-unit:
cd src/api && uv run pytest tests/unit -v
.PHONY: test-integration
test-integration:
cd src/api && uv run pytest tests/integration -v -m integration
.PHONY: docs-export
docs-export:
.PHONY: docs-export
docs-export:
@echo "📝 Exporting system properties to JSON..."
cd src/api && uv run python ../../scripts/export_system_properties.py
@echo "⚙️ Exporting environment variables to JSON..."
cd src/api && uv run python ../../scripts/export_settings.py
.PHONY: docs
docs: docs-export
@echo "🌐 Starting documentation dev server..."
cd website && npm i && npm run dev