-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
157 lines (134 loc) · 4.18 KB
/
Makefile
File metadata and controls
157 lines (134 loc) · 4.18 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Configuration is loaded from `.env.maintainer` and can be overridden by
# environment variables.
#
# Usage:
# make build # Build using `.env.maintainer`.
# BUILD_IMAGE=... make build # Override specific variables.
# Load configuration from `.env.maintainer` if it exists.
-include .env.maintainer
# Load configuration from `.env` if it exists.
-include .env
# Allow environment variable overrides with defaults.
BUILD_IMAGE ?= unattended/petros:latest
HIEROPHANT_IMAGE ?= unattended/hierophant:latest
MAGISTER_IMAGE ?= unattended/magister:latest
COMPOSE_FILE ?= docker-compose.yml
# Export variables for docker-compose to use.
export BUILD_IMAGE
export HIEROPHANT_IMAGE
export MAGISTER_IMAGE
.PHONY: init
init:
@echo "Initializing configuration files ..."
@if [ ! -f .env ]; then \
cp .env.example .env; \
echo "Created .env from .env.example."; \
else \
echo ".env already exists."; \
fi
@if [ ! -f hierophant.toml ]; then \
cp hierophant.example.toml hierophant.toml; \
echo "Created hierophant.toml from hierophant.example.toml."; \
else \
echo "hierophant.toml already exists."; \
fi
@if [ ! -f magister.toml ]; then \
cp magister.example.toml magister.toml; \
echo "Created magister.toml from magister.example.toml."; \
else \
echo "magister.toml already exists."; \
fi
@echo "Initialization complete. Review configuration before running."
.PHONY: clean
clean:
@bash -c 'echo -e "\033[33mWARNING: This will remove volumes.\033[0m"; \
read -p "Are you sure you want to continue? [y/N]: " confirm; \
if [[ "$$confirm" != "y" && "$$confirm" != "Y" ]]; then \
echo "Operation cancelled."; \
exit 1; \
fi'
docker compose down -v
@echo "Cleanup complete."
.PHONY: build
build:
@echo "Building fibonacci Docker image ..."
docker compose build fibonacci
@echo "Build complete."
.PHONY: test
test:
@echo "Running fibonacci tests ..."
cd src/fibonacci && cargo test --release
@echo "Tests completed."
.PHONY: docker
docker: build
.PHONY: ci
ci: build
.PHONY: run-h
run-h:
@echo "Starting Hierophant ..."
docker compose up hierophant
.PHONY: run-m
run-m:
@echo "Starting Magister (and Hierophant if needed) ..."
docker compose up magister
.PHONY: run-f
run-f:
@echo "Starting fibonacci test (and dependencies if needed) ..."
docker compose up fibonacci
.PHONY: run
run: scriptory
.PHONY: scriptory
scriptory:
@echo "Starting scriptory services ..."
docker compose up --build
.PHONY: scriptory-d
scriptory-d:
@echo "Starting scriptory services in detached mode ..."
docker compose up --build -d
@echo "Services started. Use 'make logs' to view output."
.PHONY: stop
stop:
@echo "Stopping scriptory services ..."
docker compose down
.PHONY: restart
restart: stop scriptory
.PHONY: logs
logs:
@echo "Following logs (Ctrl+C to exit) ..."
docker compose logs -f
.PHONY: status
status:
@echo "Scriptory service status:"
@docker compose ps
.PHONY: help
help:
@echo "Build System"
@echo ""
@echo "Targets:"
@echo " init Initialize config from examples."
@echo " clean Clean volumes."
@echo " build Build the fibonacci Docker image."
@echo " test Run fibonacci tests."
@echo " docker Build the fibonacci Docker image."
@echo " ci Build the fibonacci Docker image."
@echo " run Run all Scriptory services."
@echo " run-h Run just Hierophant."
@echo " run-m Run Magister (starts Hierophant if needed)."
@echo " run-f Run fibonacci test (starts all dependencies)."
@echo " scriptory Start all services in foreground."
@echo " scriptory-d Start all services in background."
@echo " stop Stop all services."
@echo " restart Restart all services."
@echo " logs Follow logs from all services."
@echo " status Show service status."
@echo " help Show this help message."
@echo ""
@echo "Configuration:"
@echo " Variables are loaded from .env.maintainer."
@echo " Override with environment variables:"
@echo " COMPOSE_FILE - Docker compose file."
@echo ""
@echo "Examples:"
@echo " make build"
@echo " BUILD_IMAGE=unattended/petros:latest make build"
.DEFAULT_GOAL := build