-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (59 loc) · 3.25 KB
/
Makefile
File metadata and controls
87 lines (59 loc) · 3.25 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
87
# Load .env if it exists (docker compose reads it automatically too).
# Variables defined here are overridden by the actual .env file.
SSH_PORT ?= 6922
HTTP_PORT ?= 8080
DATA_DIR ?= ./data
-include .env
export
COMPOSE = docker compose
# ── Stack ──────────────────────────────────────────────────────────────────────
.PHONY: up down build rebuild restart logs
up: ## Start the stack in the background
$(COMPOSE) up -d
down: ## Stop the stack
$(COMPOSE) down --remove-orphans
build: ## Build images (incremental)
$(COMPOSE) build
rebuild: ## Force-rebuild all images from scratch
$(COMPOSE) build --no-cache
restart: down up ## Restart the stack
logs: ## Tail all service logs
$(COMPOSE) logs -f
logs-%: ## Tail a single service (e.g. make logs-tobby)
$(COMPOSE) logs -f $*
# ── Tests ──────────────────────────────────────────────────────────────────────
.PHONY: test e2e e2e-full
test: ## Run unit tests
go test . -count=1
e2e: ## Run e2e tests against the already-running stack on SSH_PORT=$(SSH_PORT)
go test ./tests/ -v -timeout 60s
e2e-full: ## Build, start, run e2e tests, then stop (self-contained)
go test ./tests/ -v -timeout 300s -run-stack
# ── User / data cleanup ────────────────────────────────────────────────────────
.PHONY: clean-users clean-data clean-volumes clean
clean-users: ## Remove all registered nicks and Logto identity bindings (keeps host key + app volumes)
@find $(DATA_DIR)/nicks $(DATA_DIR)/identities \
-mindepth 1 -delete 2>/dev/null || true
@echo "Users wiped ($(DATA_DIR)/nicks and $(DATA_DIR)/identities cleared)."
clean-data: ## Wipe the entire local data dir (host key will regenerate on next start)
rm -rf $(DATA_DIR)
@echo "$(DATA_DIR) removed."
clean-volumes: ## Remove Docker volumes (tobby SQLite DBs, sshchat data, etc.)
$(COMPOSE) down -v --remove-orphans
clean: ## Full reset: stop stack, wipe data dir and all Docker volumes
clean: clean-volumes clean-data
# ── Dev helpers ────────────────────────────────────────────────────────────────
.PHONY: ssh
ssh: ## Open an SSH session to the local stack
ssh -p $(SSH_PORT) -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null localhost
# ── Help ───────────────────────────────────────────────────────────────────────
.PHONY: help
.DEFAULT_GOAL := help
help: ## Show this help
@echo "Usage: make [target]"
@echo ""
@echo "Environment: .env (copy from .env.example). Active values:"
@echo " SSH_PORT=$(SSH_PORT) HTTP_PORT=$(HTTP_PORT) DATA_DIR=$(DATA_DIR)"
@echo ""
@grep -hE '^[a-zA-Z_%/-]+:.*##' $(MAKEFILE_LIST) | \
awk -F ':.*## ' '{printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'