mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 11:03:59 +00:00
Brings up the smallest k3d-resident stack that lets a host-side knoe-auth
(run via `mvn spring-boot:run` or IntelliJ) iterate against real Postgres
+ Kerberos. Closes Phase 1 of the k3d-gke-mirror plan (docs/plans/k3d-gke-mirror.md).
Scope:
- k8s/knoe/knoe-kdc-{configmap,deployment,service,pvc,init-job}.yaml
NEW; standalone KDC, realm KNOE.LOCAL (distinct from KNOE.DEV).
- etc/init_knoe_auth.sh: --mode k3d flag added; swaps realm + skips
GCP-specific steps. GKE behavior unchanged when flag absent.
- Makefile: k3d-knoe-up, k3d-knoe-pf, k3d-knoe-down (delegate to
scripts/k3d-knoe-{up,pf,down}.sh).
- scripts/k3d-knoe-{up,pf,down,smoke}.sh NEW; up = full bring-up,
pf = three port-forwards (5432/88/464) + JDBC URL + ^C cleanup,
down = teardown, smoke = sanity check.
- etc/krb5.local.conf NEW; checked-in libdefaults+realms config
pointing at localhost:88. udp_preference_limit=1 to dodge
kubectl port-forward UDP flakiness on macOS.
- docs/local-dev-knoe-auth.md NEW; one-time setup + daily loop +
IntelliJ run config.
- docs/knoe-system.md NEW; unified reference for the knoe-auth
service (GKE deployment + k3d dev loop + schema overview +
source map + open work items).
Verified per the brief's Definition of done: fresh-clone laptop can
`make k3d-knoe-up` + `make k3d-knoe-pf` + `mvn -pl authority spring-boot:run`
and hit /health, /.well-known/openid-configuration in <8 minutes.
Out of scope (parent plan docs/plans/k3d-gke-mirror.md §6):
- SPNEGO from host browsers (Phase 2)
- knoe-auth-as-pod / image build/load (Phase 3)
- Supabase stack on k3d (Phase 4)
- OidcCodeService DB persistence (separate track)
docs/plans/junie/README.md — k3d brief moved from Active to Shipped.
docs/TODO.md — In-progress now empty; Phase 2 pg_oauth notes that the
local dev loop is in place so it can resume.
Closes Phase 1; Phase 2+ briefs filed as needed.
Co-authored-by: Junie <junie@jetbrains.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
114 lines
4.4 KiB
Makefile
114 lines
4.4 KiB
Makefile
# Makefile for Knoe Database Deployment and Installer
|
|
|
|
ifneq ($(wildcard bin/python3),)
|
|
PYTHON ?= bin/python3
|
|
else
|
|
PYTHON ?= python3
|
|
endif
|
|
PYINSTALLER = $(PYTHON) -m PyInstaller
|
|
DIST_DIR = dist
|
|
BUILD_DIR = build
|
|
KNOE_CONF ?= conf
|
|
KNOE_MODE ?= k3d
|
|
PIPELINE_DIR ?= deploy/opentofu/k3s
|
|
DEPLOYMENT_GIT_DIR ?= knoe/deployment
|
|
GITEA_SCRIPT ?= knoe/etc/gitea.sh
|
|
KUBECONFIG_PATH ?= $(CURDIR)/knoe-k3s.kubeconfig
|
|
DEPLOYMENT_REPO_URL ?= http://gitea.local/knoe/deployment.git
|
|
|
|
.PHONY: all knoe build build-auth install deploy init clean help requirements test pyconv start \
|
|
k3d-knoe-up k3d-knoe-pf k3d-knoe-down
|
|
|
|
all: build
|
|
|
|
start: build
|
|
open "$(DIST_DIR)/Knoe.DB Installer.app"
|
|
|
|
help:
|
|
@echo "Knoe Build & Deployment System"
|
|
@echo ""
|
|
@echo "Targets:"
|
|
@echo " knoe - Launch the Ncurses installer"
|
|
@echo " start - Build and launch the GUI installer"
|
|
@echo " install - Run silent install via install.sh"
|
|
@echo " deploy - Run infrastructure deployment via deploy.sh"
|
|
@echo " build - Build the 'knoe' CLI binary"
|
|
@echo " build-auth - Build the knoe-auth Spring Boot jar (authority/pom.xml)"
|
|
@echo " requirements - Install Python dependencies"
|
|
@echo " test - Run full test suite"
|
|
@echo " pyconv - Check Python code style conventions (black)"
|
|
@echo " clean - Remove build artifacts"
|
|
@echo ""
|
|
@echo "Environment:"
|
|
@echo " KNOE_CONF - Directory containing knoe.cfg (default: conf)"
|
|
@echo ""
|
|
@echo "k3d dev loop targets:"
|
|
@echo " k3d-knoe-up - Bring up local k3d cluster (CNPG + KDC + schema)"
|
|
@echo " k3d-knoe-pf - Open port-forwards (5432/88/464) — foreground, ^C to stop"
|
|
@echo " k3d-knoe-down - Tear down the k3d-knoe cluster"
|
|
|
|
requirements:
|
|
@echo "Installing dependencies..."
|
|
$(PYTHON) -m pip install -r requirements.txt
|
|
|
|
knoe:
|
|
./install.sh
|
|
|
|
build:
|
|
@$(PYTHON) -c "import PyInstaller" 2>/dev/null || (echo "Error: PyInstaller not found. Please run 'make requirements' or install it with: $(PYTHON) -m pip install -r requirements.txt" && exit 1)
|
|
@echo "Building 'Knoe.DB Installer' macOS App Bundle..."
|
|
$(PYINSTALLER) --clean --noconfirm knoe.spec
|
|
@echo "✓ Build complete: $(DIST_DIR)/Knoe.DB Installer.app"
|
|
|
|
build-auth:
|
|
@command -v mvn >/dev/null 2>&1 || (echo "Error: mvn not found in PATH." && exit 1)
|
|
@echo "Building knoe-auth (dev.knoe:auth) via authority/pom.xml..."
|
|
mvn -f authority/pom.xml -DskipTests package
|
|
@echo "✓ knoe-auth jar: authority/target/knoe-auth.jar"
|
|
|
|
install:
|
|
@echo "Running silent install..."
|
|
KNOE_CONF=$(KNOE_CONF) ./install.sh -s -c $(KNOE_CONF)/knoe.cfg
|
|
|
|
init:
|
|
@command -v tofu >/dev/null 2>&1 || (echo "Error: OpenTofu (tofu) not found in PATH." && exit 1)
|
|
@echo "Syncing OpenTofu pipeline from $(KNOE_MODE) runtime into $(PIPELINE_DIR)..."
|
|
@KNOE_MODE=$(KNOE_MODE) KNOE_CONF=$(KNOE_CONF) KNOE_GIT_REPO=$(DEPLOYMENT_REPO_URL) PYTHONPATH=$(CURDIR) $(PYTHON) -c "from knoe.core.controller import KnoeController; from knoe.core.env import PROJECT_ROOT; from knoe.deployment import KnoeDeployment; import sys, os; conf_dir = os.environ.get('KNOE_CONF', 'conf'); cfg_path = PROJECT_ROOT / conf_dir / 'knoe.cfg'; deployment = KnoeDeployment(KnoeController(PROJECT_ROOT, verbose=False, cfg_path=cfg_path), PROJECT_ROOT); ok = deployment.duplicate_k3d_to_k3s(); sys.exit(0 if ok else 1)"
|
|
@echo "Initializing OpenTofu backend in $(PIPELINE_DIR)..."
|
|
@cd $(PIPELINE_DIR) && tofu init
|
|
@echo "Staging pipeline sources into $(DEPLOYMENT_GIT_DIR) for Gitea"
|
|
@mkdir -p $(DEPLOYMENT_GIT_DIR)
|
|
@if command -v rsync >/dev/null 2>&1; then rsync -a $(PIPELINE_DIR)/ $(DEPLOYMENT_GIT_DIR)/; else cp -a $(PIPELINE_DIR)/. $(DEPLOYMENT_GIT_DIR)/; fi
|
|
@cd $(DEPLOYMENT_GIT_DIR) && if [ ! -d .git ]; then git init -q; fi
|
|
@echo "✓ init complete"
|
|
|
|
deploy:
|
|
@echo "Running Knoe deployment..."
|
|
./deploy.sh
|
|
|
|
test: pyconv
|
|
@echo "Running full test suite..."
|
|
@./tests/run_tests.sh
|
|
@echo ""
|
|
@echo "Test Summary:"
|
|
@$(PYTHON) -m coverage report | grep TOTAL | awk '{print "Total Coverage: " $$4 " (Statements: " $$2 ", Missed: " $$3 ")"}'
|
|
|
|
pyconv:
|
|
@echo "Checking Python code style conventions..."
|
|
@$(PYTHON) -m black --check . || (echo "Warning: pyconv (black) found style issues. Run 'black .' to fix." && exit 1)
|
|
|
|
k3d-knoe-up:
|
|
@./scripts/k3d-knoe-up.sh
|
|
|
|
k3d-knoe-pf:
|
|
@./scripts/k3d-knoe-pf.sh
|
|
|
|
k3d-knoe-down:
|
|
@./scripts/k3d-knoe-down.sh
|
|
|
|
clean:
|
|
@echo "Cleaning build artifacts..."
|
|
rm -rf $(BUILD_DIR) $(DIST_DIR) *.spec
|
|
rm -rf __pycache__ knoe/__pycache__
|
|
@echo "✓ Clean complete"
|