-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
123 lines (107 loc) · 4.23 KB
/
Makefile
File metadata and controls
123 lines (107 loc) · 4.23 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
# Itential Dev Stack
# run 'make help' to see available commands
.PHONY: help setup up down logs status certs login clean generate-key
.DEFAULT_GOAL := help
# load defaults first, then .env overrides
-include defaults.env
-include .env
export
# auto-detect user/group IDs for volume ownership
UID ?= $(shell id -u)
GID ?= $(shell id -g)
# default values
PLATFORM_PORT ?= 3000
GATEWAY_MANAGER_PORT ?= 8080
GATEWAY4_PORT ?= 8083
GATEWAY5_PORT ?= 50051
MONGO_PORT ?= 27017
REDIS_PORT ?= 6379
LDAP_PORT ?= 3389
MCP_SSE_PORT ?= 8000
OPENBAO_PORT ?= 8200
# build profile list based on enabled services
STACK_PROFILE ?= full
PROFILES := --profile $(STACK_PROFILE)
ifeq ($(GATEWAY4_ENABLED),true)
PROFILES += --profile gateway4
endif
ifeq ($(GATEWAY5_ENABLED),true)
PROFILES += --profile gateway5
endif
ifeq ($(LDAP_ENABLED),true)
PROFILES += --profile ldap
endif
ifeq ($(MCP_ENABLED),true)
PROFILES += --profile mcp
endif
ifeq ($(OPENBAO_ENABLED),true)
PROFILES += --profile openbao
endif
help: ## Show available commands
@echo "Itential Dev Stack"
@echo ""
@echo "Usage: make [target]"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
@echo ""
@echo "First time? Run: make setup"
setup: ## First-time setup (generates key, certs, starts services, configures Gateway Manager)
@./scripts/setup.sh
up: ## Start all services
@docker compose $(PROFILES) up -d
@$(MAKE) --no-print-directory status
down: ## Stop all services
@docker compose $(PROFILES) down
logs: ## Follow logs (all services, or: make logs LOG=platform)
@docker compose logs -f $(LOG)
status: ## Show service status and URLs
@echo ""
@docker compose --profile full --profile ldap --profile mcp --profile openbao ps --format "table {{.Name}}\t{{.Status}}\t{{.Ports}}"
@echo ""
@echo "URLs:"
@echo " Platform: http://localhost:$(PLATFORM_PORT) (admin/admin)"
@if docker ps --format '{{.Names}}' | grep -q '^platform$$'; then \
echo " Gateway Manager: http://localhost:$(GATEWAY_MANAGER_PORT)"; \
fi
@if docker ps --format '{{.Names}}' | grep -q '^gateway4$$'; then \
echo " Gateway4: http://localhost:$(GATEWAY4_PORT) (admin@itential/admin)"; \
fi
@if docker ps --format '{{.Names}}' | grep -q '^gateway5$$'; then \
echo " Gateway5: localhost:$(GATEWAY5_PORT) (gRPC)"; \
fi
@if docker ps --format '{{.Names}}' | grep -q '^openldap$$'; then \
echo " OpenLDAP: localhost:$(LDAP_PORT) (cn=admin,dc=itential,dc=io/admin)"; \
fi
@if docker ps --format '{{.Names}}' | grep -q '^mcp$$'; then \
echo " MCP: http://localhost:$(MCP_SSE_PORT) (SSE transport)"; \
fi
@if docker ps --format '{{.Names}}' | grep -q '^openbao$$'; then \
TOKEN=$$(cat volumes/openbao/init-keys.json 2>/dev/null | jq -r '.root_token // "see init-keys.json"'); \
echo " OpenBao: http://localhost:$(OPENBAO_PORT) (token: $$TOKEN)"; \
fi
@echo ""
certs: ## Generate SSL certificates
@./scripts/generate-certificates.sh
login: ## Login to AWS ECR
@ECR_REGISTRY=$$(echo "$(PLATFORM_IMAGE)" | cut -d'/' -f1); \
aws ecr get-login-password --region us-east-2 | \
docker login --username AWS --password-stdin "$$ECR_REGISTRY" && \
echo "ECR login successful for $$ECR_REGISTRY"
clean: ## Stop services and remove data (destructive)
@echo "WARNING: This will delete all container data."
@echo "Press Ctrl+C within 3 seconds to cancel..."
@sleep 3
@docker compose --profile full --profile ldap --profile mcp --profile openbao down -v
@docker rm -f $$(docker ps -aq --filter "ancestor=ghcr.io/itential/itential-mcp") 2>/dev/null || true
@docker volume rm itential-dev-stack_gateway5-data 2>/dev/null || true
@docker volume rm itential-dev-stack_openbao-data 2>/dev/null || true
@docker volume rm itential-dev-stack_platform-logs 2>/dev/null || true
@rm -f volumes/openbao/init-keys.json 2>/dev/null || true
@sed -i '/^# OpenBao Platform Integration/d' .env 2>/dev/null || true
@sed -i '/^ITENTIAL_VAULT_/d' .env 2>/dev/null || true
@docker run --rm -u root -v $(PWD)/dependencies/mongodb-data:/data alpine sh -c 'rm -rf /data/* /data/.*' 2>/dev/null || true
@rm -rf volumes/gateway4/data/*.db 2>/dev/null || true
@echo "Cleanup complete"
generate-key: ## Generate a new 64-character encryption key
@openssl rand -hex 32