forked from HKUDS/LightRAG
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
129 lines (111 loc) · 6.04 KB
/
Copy pathMakefile
File metadata and controls
129 lines (111 loc) · 6.04 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
SHELL := /bin/bash
SETUP_SCRIPT := scripts/setup/setup.sh
APPLE_SCRIPT := scripts/setup/apple-container.sh
SETUP_BASH ?= $(or $(firstword $(wildcard /opt/homebrew/bin/bash /usr/local/bin/bash /opt/local/bin/bash)),$(shell command -v bash 2>/dev/null),bash)
SETUP_OPTS ?=
COLOR_RESET := \033[0m
COLOR_BOLD := \033[1m
COLOR_BLUE := \033[34m
COLOR_GREEN := \033[32m
COLOR_YELLOW := \033[33m
ifeq ($(NO_COLOR),1)
COLOR_RESET :=
COLOR_BOLD :=
COLOR_BLUE :=
COLOR_GREEN :=
COLOR_YELLOW :=
endif
.PHONY: help dev configure env-base env-storage env-server env-validate env-backup env-security-check env-base-rewrite env-storage-rewrite env base storage server validate backup security security-check base-rewrite storage-rewrite apple-up apple-down apple-status apple-logs apple-restart apple-pull
help:
@printf "$(COLOR_BOLD)Interactive setup targets$(COLOR_RESET)\n"
@printf " $(COLOR_GREEN)make dev$(COLOR_RESET) Bootstrap local dev+test+offline env with uv + bun\n"
@printf " $(COLOR_GREEN)make env-base$(COLOR_RESET) Configure LLM, embedding, and reranker (run first)\n"
@printf " $(COLOR_GREEN)make env-storage$(COLOR_RESET) Configure storage backends and databases\n"
@printf " $(COLOR_GREEN)make env-server$(COLOR_RESET) Configure server, security, and SSL\n"
@printf " $(COLOR_GREEN)make env-validate$(COLOR_RESET) Validate existing .env\n"
@printf " $(COLOR_GREEN)make env-security-check$(COLOR_RESET) Audit existing .env for security risks\n"
@printf " $(COLOR_GREEN)make env-backup$(COLOR_RESET) Backup current .env\n"
@printf " $(COLOR_GREEN)make env-base-rewrite$(COLOR_RESET) Force-regenerate wizard-managed compose services during base setup\n"
@printf " $(COLOR_GREEN)make env-storage-rewrite$(COLOR_RESET) Force-regenerate wizard-managed compose services during storage setup\n"
@printf " $(COLOR_GREEN)make base$(COLOR_RESET) Short form of make env-base (all env prefix can be stripped)\n"
@printf "\n"
@printf "$(COLOR_BOLD)Typical workflow$(COLOR_RESET)\n"
@printf " 1. make dev # install backend/test deps and build frontend\n"
@printf " 2. make env-base # set LLM/embedding/reranker\n"
@printf " 3. make env-storage # set storage backends (optional)\n"
@printf " 4. make env-server # set port/security/SSL (optional)\n\n"
@printf "$(COLOR_BOLD)Examples$(COLOR_RESET)\n"
@printf " make dev\n"
@printf " make env-base\n"
@printf " make env-storage SETUP_OPTS=--debug\n"
@printf " make env-server\n\n"
@printf " make env-storage-rewrite\n\n"
@printf " make env-security-check\n\n"
@printf "$(COLOR_BOLD)Compose Output$(COLOR_RESET)\n"
@printf " Bundled service images are defined in scripts/setup/templates/*.yml.\n"
@printf " Compose file output: docker-compose.final.yml\n"
@printf "\n"
@printf "$(COLOR_BOLD)Apple container stack (macOS 26, Apple Silicon; no Docker)$(COLOR_RESET)\n"
@printf " $(COLOR_GREEN)make apple-up$(COLOR_RESET) Start Postgres/Neo4j/Milvus + LightRAG on Apple 'container'\n"
@printf " $(COLOR_GREEN)make apple-down$(COLOR_RESET) Stop and remove the stack (SETUP_OPTS=--purge also deletes data)\n"
@printf " $(COLOR_GREEN)make apple-status$(COLOR_RESET) Show stack containers, volumes, and networks\n"
@printf " $(COLOR_GREEN)make apple-logs SVC=lightrag$(COLOR_RESET) Tail a service's logs\n"
@printf " See docs/AppleContainerSetup.md for details.\n"
dev:
@if ! command -v uv >/dev/null 2>&1; then \
printf "$(COLOR_YELLOW)uv is required for make dev.$(COLOR_RESET)\n"; \
printf "Install uv first: https://docs.astral.sh/uv/getting-started/installation/\n"; \
printf "Unix/macOS: curl -LsSf https://astral.sh/uv/install.sh | sh\n"; \
printf "Windows: powershell -c \"irm https://astral.sh/uv/install.ps1 | iex\"\n"; \
exit 1; \
fi
@if ! command -v bun >/dev/null 2>&1; then \
printf "$(COLOR_YELLOW)bun is required for make dev.$(COLOR_RESET)\n"; \
printf "Install Bun first: https://bun.sh/docs/installation\n"; \
printf "macOS/Linux: curl -fsSL https://bun.sh/install | bash\n"; \
printf "Windows: powershell -c \"irm bun.sh/install.ps1 | iex\"\n"; \
exit 1; \
fi
@printf "$(COLOR_BLUE)Syncing backend and test dependencies with uv...$(COLOR_RESET)\n"
@uv sync --extra test --extra offline
@printf "$(COLOR_BLUE)Installing frontend dependencies with Bun...$(COLOR_RESET)\n"
@cd lightrag_webui && bun install --frozen-lockfile
@printf "$(COLOR_BLUE)Building frontend assets...$(COLOR_RESET)\n"
@cd lightrag_webui && bun run build
@printf "$(COLOR_GREEN)Development environment is ready.$(COLOR_RESET)\n"
@printf "Next steps:\n"
@printf " source .venv/bin/activate\n"
@printf " make env-base\n"
@printf " lightrag-server\n"
env-base env base configure:
@$(SETUP_BASH) $(SETUP_SCRIPT) --base $(SETUP_OPTS)
env-storage storage:
@$(SETUP_BASH) $(SETUP_SCRIPT) --storage $(SETUP_OPTS)
env-base-rewrite base-rewrite:
@$(SETUP_BASH) $(SETUP_SCRIPT) --base --rewrite-compose $(SETUP_OPTS)
env-storage-rewrite storage-rewrite:
@$(SETUP_BASH) $(SETUP_SCRIPT) --storage --rewrite-compose $(SETUP_OPTS)
env-server server:
@$(SETUP_BASH) $(SETUP_SCRIPT) --server $(SETUP_OPTS)
env-validate validate:
@$(SETUP_BASH) $(SETUP_SCRIPT) --validate $(SETUP_OPTS)
env-security-check security security-check:
@$(SETUP_BASH) $(SETUP_SCRIPT) --security-check $(SETUP_OPTS)
env-backup backup:
@$(SETUP_BASH) $(SETUP_SCRIPT) --backup $(SETUP_OPTS)
# Apple 'container' stack (macOS 26 + Apple Silicon). SETUP_BASH resolves a
# bash 4+ interpreter, which apple-container.sh requires. Pass flags via
# SETUP_OPTS (e.g. make apple-up SETUP_OPTS=--no-lightrag) and a service name
# via SVC (e.g. make apple-logs SVC=lightrag).
apple-up:
@$(SETUP_BASH) $(APPLE_SCRIPT) up $(SETUP_OPTS)
apple-down:
@$(SETUP_BASH) $(APPLE_SCRIPT) down $(SETUP_OPTS)
apple-status:
@$(SETUP_BASH) $(APPLE_SCRIPT) status
apple-logs:
@$(SETUP_BASH) $(APPLE_SCRIPT) logs $(SVC) $(SETUP_OPTS)
apple-restart:
@$(SETUP_BASH) $(APPLE_SCRIPT) restart $(SVC)
apple-pull:
@$(SETUP_BASH) $(APPLE_SCRIPT) pull