@@ -2,7 +2,7 @@ |
| 2 | # Targets mirror what CI runs. The Makefile is the source of truth. | 2 | # Targets mirror what CI runs. The Makefile is the source of truth. |
| 3 | | 3 | |
| 4 | .DEFAULT_GOAL := help | 4 | .DEFAULT_GOAL := help |
| 5 | -.PHONY: help dev build test test-race lint lint-policy lint-markdown lint-secret-logs fmt tidy clean ci assets install-tools version | 5 | +.PHONY: help dev build test test-race lint lint-policy lint-markdown lint-secret-logs fmt tidy clean ci assets install-tools version deploy deploy-check restore-drill bench-staging |
| 6 | | 6 | |
| 7 | # Build metadata embedded into the binary via -ldflags. | 7 | # Build metadata embedded into the binary via -ldflags. |
| 8 | VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev) | 8 | VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev) |
@@ -152,3 +152,26 @@ version: ## Print version info that would be embedded into the binary. |
| 152 | @echo "Version: $(VERSION)" | 152 | @echo "Version: $(VERSION)" |
| 153 | @echo "Commit: $(COMMIT)" | 153 | @echo "Commit: $(COMMIT)" |
| 154 | @echo "Built: $(BUILT)" | 154 | @echo "Built: $(BUILT)" |
| | 155 | + |
| | 156 | +# --- deploy --- |
| | 157 | +# Inventory selection: ANSIBLE_INVENTORY=production make deploy (default: staging). |
| | 158 | +ANSIBLE_INVENTORY ?= staging |
| | 159 | +ANSIBLE_TAGS ?= |
| | 160 | +ANSIBLE_LIMIT ?= |
| | 161 | + |
| | 162 | +deploy-check: ## Dry-run the Ansible playbook (--check) against $$ANSIBLE_INVENTORY. |
| | 163 | + cd deploy/ansible && ansible-playbook -i inventory/$(ANSIBLE_INVENTORY) site.yml --check --diff \ |
| | 164 | + $(if $(ANSIBLE_TAGS),--tags $(ANSIBLE_TAGS)) \ |
| | 165 | + $(if $(ANSIBLE_LIMIT),--limit $(ANSIBLE_LIMIT)) |
| | 166 | + |
| | 167 | +deploy: ## Apply the Ansible playbook against $$ANSIBLE_INVENTORY (set to production for prod). |
| | 168 | + cd deploy/ansible && ansible-playbook -i inventory/$(ANSIBLE_INVENTORY) site.yml \ |
| | 169 | + $(if $(ANSIBLE_TAGS),--tags $(ANSIBLE_TAGS)) \ |
| | 170 | + $(if $(ANSIBLE_LIMIT),--limit $(ANSIBLE_LIMIT)) |
| | 171 | + |
| | 172 | +restore-drill: ## Run the restore drill on the backup host (must be run via ssh on that host). |
| | 173 | + deploy/restore-drill/run.sh |
| | 174 | + |
| | 175 | +bench-staging: ## Run the bench harness against staging (BENCH_TARGET must be set to the staging URL). |
| | 176 | + @if [ -z "$$BENCH_TARGET" ]; then echo "set BENCH_TARGET=https://staging.shithub.example"; exit 2; fi |
| | 177 | + go run ./bench -target=$$BENCH_TARGET -iters=$${BENCH_ITERS:-50} |