-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (66 loc) · 4.22 KB
/
Copy pathMakefile
File metadata and controls
86 lines (66 loc) · 4.22 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
.PHONY: help lint test test-unit test-integration build build-push deploy infra-preview infra-up infra-config dev
GCP_PROJECT ?= promptforge-1212
GCP_REGION ?= us-central1
REGISTRY = $(GCP_REGION)-docker.pkg.dev/$(GCP_PROJECT)/promptforge
help:
@echo "PromptForge"
@echo ""
@echo " make dev Start local dev stack (mock LLM + services)"
@echo " make test Run all tests"
@echo " make lint Lint all Python services"
@echo " make build Build Docker images locally"
@echo " make build-push Build + push images to Artifact Registry"
@echo " make deploy build-push then pulumi up"
@echo " make infra-config Set Pulumi secrets from .env (run once)"
@echo " make infra-preview Pulumi preview (dry run)"
@echo " make infra-up Pulumi up (apply infrastructure)"
# ─── Local Dev ────────────────────────────────────────────────────────────────
dev:
docker compose up --build
# ─── Test ─────────────────────────────────────────────────────────────────────
test:
pytest tests/unit -v
pytest tests/integration -v
test-unit:
pytest tests/unit -v
test-integration:
@echo "Requires: gcloud auth application-default login + .env with GCP values"
pytest tests/integration -v -s
# ─── Lint ─────────────────────────────────────────────────────────────────────
lint:
ruff check services/ shared/ tests/
ruff format --check services/ shared/ tests/
format:
ruff format services/ shared/ tests/
# ─── Build ────────────────────────────────────────────────────────────────────
build:
docker build -t promptforge-api -f services/api/Dockerfile .
docker build -t promptforge-launcher -f services/launcher/Dockerfile .
docker build -t promptforge-execution -f services/execution/Dockerfile .
# Build + tag for Artifact Registry + push all three images.
# Requires: docker, gcloud auth configure-docker (done automatically below).
build-push:
gcloud auth configure-docker $(GCP_REGION)-docker.pkg.dev --quiet
docker buildx build --platform linux/amd64 --push -t $(REGISTRY)/api:latest -f services/api/Dockerfile .
docker buildx build --platform linux/amd64 --push -t $(REGISTRY)/launcher:latest -f services/launcher/Dockerfile .
docker buildx build --platform linux/amd64 --push -t $(REGISTRY)/execution:latest -f services/execution/Dockerfile .
# ─── Deploy ───────────────────────────────────────────────────────────────────
# Full deploy: build images, push to Artifact Registry, then apply infra.
deploy: build-push
PULUMI_CONFIG_PASSPHRASE="" cd infra && pulumi up --yes
# ─── Infrastructure ───────────────────────────────────────────────────────────
# Run once after cloning — loads secrets from .env into Pulumi stack config.
# Requires .env to have: UNKEY_API_ID, UNKEY_ROOT_KEY, SENTRY_DSN, AXIOM_API_KEY
infra-config:
@PULUMI_CONFIG_PASSPHRASE="" bash -c 'set -a && . ./.env && set +a && cd infra && \
pulumi config set --secret unkeyApiId "$$UNKEY_API_ID" && \
pulumi config set --secret unkeyRootKey "$$UNKEY_ROOT_KEY" && \
pulumi config set --secret sentryDsn "$$SENTRY_DSN" && \
pulumi config set --secret axiomApiKey "$$AXIOM_API_KEY" && \
pulumi config set --secret openaiApiKey "$$OPENAI_API_KEY" && \
pulumi config set --secret geminiApiKey "$$GEMINI_API_KEY"'
@echo "Pulumi secrets set from .env"
infra-preview:
PULUMI_CONFIG_PASSPHRASE="" cd infra && pulumi preview
infra-up:
PULUMI_CONFIG_PASSPHRASE="" cd infra && pulumi up