-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
140 lines (115 loc) · 5.74 KB
/
Copy pathMakefile
File metadata and controls
140 lines (115 loc) · 5.74 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/Makefile
$(info LOADING MAKEFILE)
# ──────────────────────────────────────────────
# Default values
# ──────────────────────────────────────────────
export IS_MANUAL ?= false
export ANYLOG_TYPE ?= anylog-generic
export TAG ?= 1.5.2606
export IMAGE ?= anylogco/anylog-network
export TEST_CONN ?=
export LICENSE_KEY ?=
export PROMPT_LICENSE ?= true
# Resolve short-form aliases (operator → anylog-operator)
ifeq ($(ANYLOG_TYPE),$(filter $(ANYLOG_TYPE),generic master operator query publisher standalone-operator standalone-publisher))
ANYLOG_TYPE := anylog-$(ANYLOG_TYPE)
export ANYLOG_TYPE
endif
# ──────────────────────────────────────────────
# Internal — build the flag string passed to deploy.sh
# ──────────────────────────────────────────────
_FLAGS := --type $(ANYLOG_TYPE) --tag $(TAG)
ifneq ($(IMAGE),anylogco/anylog-network)
_FLAGS += --image $(IMAGE)
endif
ifeq ($(IS_MANUAL),true)
_FLAGS += --manual
endif
ifneq ($(TEST_CONN),)
_FLAGS += --test-conn $(TEST_CONN)
endif
ifeq ($(origin LICENSE_KEY),command line)
_FLAGS += --license-key '$(LICENSE_KEY)'
endif
ifneq ($(filter true True TRUE 1 yes Yes YES,$(PROMPT_LICENSE)),)
_FLAGS += --prompt-license
endif
ANYLOG_SH := bash deploy.sh
# ──────────────────────────────────────────────
all: help
# ──────────────────────────────────────────────
# Docker Hub
# ──────────────────────────────────────────────
login: ## log into Docker Hub for AnyLog
$(ANYLOG_SH) login $(_FLAGS)
pull: ## pull image from Docker Hub
$(ANYLOG_SH) pull $(_FLAGS)
# ──────────────────────────────────────────────
# Lifecycle
# ──────────────────────────────────────────────
dry-run: ## generate docker-compose.yaml (skipped in manual mode)
$(ANYLOG_SH) dry-run $(_FLAGS)
up: ## start AnyLog instance
$(ANYLOG_SH) up $(_FLAGS)
down: ## stop AnyLog instance
$(ANYLOG_SH) down $(_FLAGS)
clean: ## stop container and remove volumes
$(ANYLOG_SH) clean $(_FLAGS)
clean-all: ## stop container, remove volumes and image
$(ANYLOG_SH) clean-all $(_FLAGS)
# ──────────────────────────────────────────────
# Observation
# ──────────────────────────────────────────────
logs: ## view container logs
$(ANYLOG_SH) logs $(_FLAGS)
logs-f: ## follow container logs
$(ANYLOG_SH) logs-f $(_FLAGS)
attach: ## attach to container (ctrl-d to detach)
$(ANYLOG_SH) attach $(_FLAGS)
exec: ## attach to bash shell (anylog user)
$(ANYLOG_SH) exec $(_FLAGS)
exec-root: ## attach to bash shell as root
$(ANYLOG_SH) exec-root $(_FLAGS)
# ──────────────────────────────────────────────
# Testing
# ──────────────────────────────────────────────
full-test: ## run test-status + test-node + test-network
$(ANYLOG_SH) full-test $(_FLAGS)
test-status: ## execute `get status` against AnyLog node
$(ANYLOG_SH) test-status $(_FLAGS)
test-node: ## execute `test node` against AnyLog node
$(ANYLOG_SH) test-node $(_FLAGS)
test-network: ## execute `test network` against AnyLog node
$(ANYLOG_SH) test-network $(_FLAGS)
check-processes: ## execute `get processes` against AnyLog node
$(ANYLOG_SH) check-processes $(_FLAGS)
# ──────────────────────────────────────────────
# Info
# ──────────────────────────────────────────────
check-vars: ## show resolved variable values
$(ANYLOG_SH) check-vars $(_FLAGS)
help: ## show this help message
@echo ""
@echo "Usage: make <target> [VARIABLE=value]"
@echo ""
@echo "Available targets:"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk -F':|##' '{ printf " \033[36m%-20s\033[0m %s\n", $$1, $$3 }'
@echo ""
@echo "Variables:"
@echo " IS_MANUAL Use docker run instead of docker compose (default: false)"
@echo " ANYLOG_TYPE Node type: generic master operator query publisher"
@echo " standalone-operator standalone-publisher"
@echo " TAG Image tag (default: pre-develop)"
@echo " IMAGE Image repository (default: anylogco/anylog-network)"
@echo " TEST_CONN ip:port for test commands (default: auto-resolved)"
@echo " LICENSE_KEY License key for deployment (prompts if missing)"
@echo " PROMPT_LICENSE Prompt if no saved license (default: true)"
@echo ""
@echo "Without make:"
@echo " bash deploy.sh help"
@echo ""
.PHONY: login pull dry-run up down clean clean-all \
logs logs-f attach exec exec-root \
full-test test-status test-node test-network check-processes \
check-vars help