The docs run on dell01 now; the apex warehack.ing SSH name points at the web relay (no port 22) and docker-2 is superseded. Also fix the fetch bug: 'git fetch origin main' only writes FETCH_HEAD, so 'reset --hard origin/main' fails on a fresh checkout — use bare 'git fetch origin'.
52 lines
2.0 KiB
Makefile
52 lines
2.0 KiB
Makefile
# mcqemu docs — targets follow the warehacking cookie-cutter.
|
|
|
|
SHELL := /usr/bin/env bash
|
|
.SHELLFLAGS := -eu -o pipefail -c
|
|
.DEFAULT_GOAL := help
|
|
|
|
.PHONY: help
|
|
help: ## Show this help
|
|
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z0-9_-]+:.*##/ {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
|
|
.PHONY: prod
|
|
prod: ## Build + run the production docs container (Caddy serves dist/)
|
|
docker compose up -d --build docs
|
|
|
|
.PHONY: dev
|
|
dev: ## Run the Astro dev server with HMR (--profile dev)
|
|
docker compose --profile dev up --build docs-dev
|
|
|
|
.PHONY: down
|
|
down: ## Stop and remove the docs containers
|
|
docker compose --profile dev down
|
|
docker compose down
|
|
|
|
.PHONY: logs
|
|
logs: ## Tail logs (works for whichever profile is up)
|
|
docker compose logs -f --tail=100
|
|
|
|
.PHONY: build
|
|
build: ## Build the static site without bringing up Caddy (CI gate)
|
|
docker compose build docs
|
|
|
|
# ---- Production deploy --------------------------------------------------
|
|
#
|
|
# The docs site runs on dell01 (behind the shared caddy-docker-proxy). `make
|
|
# deploy` SSHes in with agent forwarding, has dell01 pull origin/main from Gitea
|
|
# (the forwarded key authenticates the fetch), and rebuilds the container.
|
|
#
|
|
# `git fetch origin` (bare) — NOT `git fetch origin main`, which only writes
|
|
# FETCH_HEAD, leaving origin/main unresolved so the reset fails on a fresh
|
|
# checkout. See ~/.claude/references/warehacking.md.
|
|
|
|
DEPLOY_HOST ?= dell01
|
|
DEPLOY_PATH ?= warehack-ing/mcqemu
|
|
|
|
.PHONY: deploy
|
|
deploy: ## Pull origin/main on dell01 + rebuild the docs container
|
|
@echo "==> deploying on $(DEPLOY_HOST):$(DEPLOY_PATH)"
|
|
ssh -A $(DEPLOY_HOST) "cd $(DEPLOY_PATH) && git fetch --quiet origin && git reset --hard origin/main && cd docs-site && make prod"
|
|
@echo "==> verifying by content (these sites return 200 for every path)"
|
|
@curl -sS https://mcqemu.warehack.ing/ | grep -oE "<title>[^<]*</title>" || echo " homepage title not found"
|
|
@curl -sS https://mcqemu.warehack.ing/definitely-not-a-page-xyz/ | grep -oE "<title>[^<]*</title>" || echo " (bogus path returned no title)"
|