-
Notifications
You must be signed in to change notification settings - Fork 152
Expand file tree
/
Copy pathMakefile
More file actions
102 lines (85 loc) · 3.22 KB
/
Copy pathMakefile
File metadata and controls
102 lines (85 loc) · 3.22 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
.PHONY: help init fireform build up down logs logs-app logs-ollama shell pull-model test clean super-clean
COMPOSE = docker compose -f docker/dev/compose.yml --env-file docker/.env.dev
ENV_DEV = docker/.env.dev
# Read OLLAMA_MODEL from .env.dev at runtime; fall back to default if file absent.
OLLAMA_MODEL = $(shell grep -E '^OLLAMA_MODEL=' $(ENV_DEV) 2>/dev/null | cut -d= -f2 | tr -d '[:space:]' || echo qwen2.5:1.5b)
help:
@printf '%s\n' \
' ______ ______ ' \
' / ____/(_)_______ / ____/___ _________ ___ ' \
' / /_ / // ___/ _ \ / /_ / __ \/ ___/ __ `__ \' \
' / __/ / // / / __/ / __/ / /_/ / / / / / / / /' \
'/_/ /_//_/ \___/ /_/ \____/_/ /_/ /_/ /_/ ' \
''
@echo ""
@echo "FireForm Development Commands"
@echo "=============================="
@echo "make init - First-time setup: check deps, create .env.dev, pick model"
@echo "make fireform - Build images, start containers, pull Ollama model"
@echo "make build - Build Docker images"
@echo "make up - Start all containers (detached)"
@echo "make down - Stop all containers"
@echo "make logs - Stream all container logs"
@echo "make logs-app - Stream app container logs"
@echo "make logs-ollama - Stream Ollama container logs"
@echo "make logs-worker - Stream Celery worker logs"
@echo "make shell - Open shell in running app container"
@echo "make pull-model - Pull Ollama model from .env.dev ($(OLLAMA_MODEL))"
@echo "make test - Run test suite"
@echo "make clean - Stop containers (preserves volumes)"
@echo "make super-clean - [CAUTION] Stop containers, delete volumes, prune Docker"
init:
@chmod +x scripts/check-deps.sh scripts/init-env.sh scripts/select-model.sh
@sh scripts/check-deps.sh
@sh scripts/init-env.sh
@sh scripts/select-model.sh
@printf "Build containers and pull model now? [y/N] "; \
read answer; \
case "$$answer" in \
[yY]*) $(MAKE) fireform ;; \
*) echo "Run 'make fireform' when ready." ;; \
esac
fireform: build up
@printf "Waiting for Ollama to be ready..."
@until $(COMPOSE) exec -T ollama ollama list > /dev/null 2>&1; do \
printf '.'; sleep 2; \
done
@echo " ready."
@if $(COMPOSE) exec -T ollama ollama list 2>/dev/null | grep -q "^$(OLLAMA_MODEL)"; then \
echo " Model $(OLLAMA_MODEL) already pulled."; \
else \
echo " Pulling $(OLLAMA_MODEL)..."; \
$(COMPOSE) exec -T ollama ollama pull $(OLLAMA_MODEL); \
fi
@echo ""
@echo "FireForm is ready!"
@echo " API: http://localhost:8000"
@echo " API Docs: http://localhost:8000/docs"
@echo ""
@echo "Run 'make logs' to view live logs, 'make down' to stop."
build:
@$(COMPOSE) build
up:
@$(COMPOSE) up -d
down:
@$(COMPOSE) down --remove-orphans
logs:
@$(COMPOSE) logs -f
logs-app:
@$(COMPOSE) logs -f app
logs-ollama:
@$(COMPOSE) logs -f ollama
logs-worker:
@$(COMPOSE) logs -f celery-worker
shell:
@$(COMPOSE) exec app /bin/sh
pull-model:
@$(COMPOSE) exec -T ollama ollama pull $(OLLAMA_MODEL)
test:
@$(COMPOSE) exec -T app python3 -m pytest tests/ -v
clean:
@$(COMPOSE) down
super-clean:
@echo "WARNING: this will delete all volumes (database, uploads, model weights)."
@$(COMPOSE) down -v
@docker system prune -f