Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
450 changes: 0 additions & 450 deletions apps/infra-local/CONNECTIONS.md

This file was deleted.

109 changes: 22 additions & 87 deletions apps/infra-local/Makefile
Original file line number Diff line number Diff line change
@@ -1,99 +1,34 @@
# BoxLite-based infra-local orchestrator
#
# All targets are thin wrappers around `python -m boxlite_local`. The Python
# CLI is the source of truth — see `python -m boxlite_local --help` for the
# full surface area. This Makefile exists for muscle memory + tab completion.
# infra-local — thin aliases over `python -m compose <cmd>`.
# The Python CLI is the source of truth: `python -m compose --help`.
# This Makefile exists for muscle memory + tab completion.

PY ?= python

# All recipes must agree with scripts/_stack-common.sh (and the python
# orchestrator's own default) on where the L1 SDK home lives, so the
# `boxlite` CLI here (stack-rebuild-l1-box) sees the same boxes.
REPO_ROOT := $(abspath $(CURDIR)/../..)
export BOXLITE_HOME ?= $(REPO_ROOT)/.apps-local/boxlite
.PHONY: help install up down status logs restart reset nuke

# Prefer a boxlite CLI built from THIS checkout over a stale global install
# (an older PATH `boxlite` can fail to read this version's box-config rows).
# Matches the resolver in scripts/_stack-common.sh.
BOXLITE_CLI := $(firstword $(wildcard $(REPO_ROOT)/target/release/boxlite $(REPO_ROOT)/target/debug/boxlite) boxlite)
help: ## show this help
@awk -F':.*## ' '/^[a-zA-Z][a-zA-Z0-9_-]*:.*## / { printf " %-9s %s\n", $$1, $$2 }' $(MAKEFILE_LIST)

.PHONY: help up down ps doctor logs wipe itest test install migrate e2e itest-all \
stack-build stack-up stack-down stack-restart stack-status stack-logs stack-reset stack-reset-hard stack-nuke \
seed-init-data stack-rebuild-l1-box
install: ## install the package (editable; pulls the boxlite SDK)
$(PY) -m pip install -e .

help: ## show this help
@awk -F':.*## ' '/^[a-zA-Z][a-zA-Z0-9_-]*:.*## / { printf " %-16s %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
up: ## ensure L1 boxes + start L2 (COMPONENTS="api runner")
$(PY) -m compose up $(COMPONENTS)

install: ## install the package + test extras
$(PY) -m pip install -e ".[test]"
down: ## stop L2 procs (ARGS=--all also stops L1 boxes)
$(PY) -m compose down $(ARGS) $(COMPONENTS)

up: ## bring all services up (runs doctor preflight first)
$(PY) -m boxlite_local up
status: ## one-screen L1 + L2 health
$(PY) -m compose status

down: ## stop L2 native procs + remove L1 services
-./scripts/stack-down.sh
$(PY) -m boxlite_local down
logs: ## tail a component log (COMPONENT=api|all)
$(PY) -m compose logs $(COMPONENT)

wipe: ## stop L2 + remove L1 + wipe data dir
-./scripts/stack-down.sh
$(PY) -m boxlite_local down --wipe
restart: ## restart L2 proc(s) / recreate L1 box(es) (COMPONENTS="runner dex")
$(PY) -m compose restart $(COMPONENTS)

ps: ## list running boxlite-local-* boxes
$(PY) -m boxlite_local ps
reset: ## wipe L2 runtime state (ARGS=--hard also rebuilds the schema)
$(PY) -m compose reset $(ARGS)

doctor: ## run preflight checks (SDK + runtime + port conflicts)
$(PY) -m boxlite_local doctor

test: ## run unit tests (no BoxLite required)
$(PY) -m pytest tests/unit -q

itest: ## run integration smoke test (requires BoxLite runtime, ~30s)
BOXLITE_INTEGRATION=1 $(PY) -m pytest tests/integration/test_multi_service.py -v -s

e2e: ## run comprehensive E2E suite (~60s, ~90s with smoke)
BOXLITE_INTEGRATION=1 $(PY) -m pytest tests/integration/test_e2e_full.py -v -s

itest-all: ## run BOTH integration suites (~90s)
BOXLITE_INTEGRATION=1 $(PY) -m pytest tests/integration -v

migrate: ## build local pg schema by running all TypeORM migrations from scratch
cd ../api && set -a && . ../.env && set +a && \
npx ts-node -P ./tsconfig.json -r tsconfig-paths/register \
../node_modules/typeorm/cli.js migration:run -d ./src/migrations/data-source.ts

seed-init-data: ## ensure dashboard-required base data (admin org, default region, wait runner)
./scripts/seed-init-data.sh

# ── L2 stack wrappers (L1 + native API/Runner/Proxy/Dashboard) ───────────────

stack-build: ## build native runner + proxy binaries
./scripts/stack-build.sh

stack-up: ## ensure L1 up + start all L2 native processes (idempotent)
./scripts/stack-up.sh $(COMPONENTS)

stack-down: ## stop all L2 native processes (L1 stays up; add ARGS=--all to stop L1 too)
./scripts/stack-down.sh $(ARGS) $(COMPONENTS)

stack-restart: ## restart one or more L2 components (runner = also rebuild)
./scripts/stack-restart.sh $(COMPONENTS)

stack-status: ## one-screen health check across L1 + L2
./scripts/stack-status.sh

stack-logs: ## tail logs (COMPONENT=api|runner|proxy|dashboard|all)
./scripts/stack-logs.sh $(COMPONENT)

stack-reset: ## wipe L2 runtime state (PG user data + runner home; L1 + schema preserved)
./scripts/stack-reset.sh

stack-reset-hard: ## like stack-reset, but also re-applies prod schema baseline
./scripts/stack-reset.sh --hard

stack-nuke: ## ABSOLUTE NUKE: L1 boxes destroyed + data wiped + logs cleared
./scripts/stack-reset.sh --nuke

stack-rebuild-l1-box: ## destroy + recreate one L1 box (BOX=dex|registry|...) — for stuck stateful services
@if [ -z "$(BOX)" ]; then echo "usage: make stack-rebuild-l1-box BOX=<name>"; echo "e.g. BOX=dex when login returns stale tokens"; echo "e.g. BOX=registry when image pulls hang"; exit 1; fi
$(BOXLITE_CLI) rm boxlite-local-$(BOX) --force
python -m boxlite_local up $(BOX)
nuke: ## tear down EVERYTHING (L1 boxes + data + logs)
$(PY) -m compose nuke
Loading
Loading