-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
103 lines (85 loc) · 3.73 KB
/
makefile
File metadata and controls
103 lines (85 loc) · 3.73 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
.PHONY: help setup-db drop-db recreate-db run-walkers report dashboard docker-up docker-down docker-down-volumes docker-run-walkers docker-logs docker-logs-db docker-logs-walker docker-logs-dashboard build-up
.DEFAULT_GOAL := help
n ?= 1
parallel ?= false
help:
@echo ""
@echo "-----------------------------------------------"
@echo " Local Run"
@echo "-----------------------------------------------"
@echo ""
@echo " make setup-db create schema and tables if not exists"
@echo " make drop-db drop all tables"
@echo " make recreate-db drop and recreate all tables"
@echo " make run-walkers n=3 parallel=false run n walkers, sequential by default"
@echo " make report session_id=<id> generate report for a session"
@echo " make dashboard start the dash dashboard"
@echo ""
@echo "-----------------------------------------------"
@echo " Docker Run"
@echo "-----------------------------------------------"
@echo ""
@echo " ~~~~~~~~~~~~~~~~~~~ Start ~~~~~~~~~~~~~~~~~~~~"
@echo ""
@echo " make docker-up build and start all containers"
@echo " make build-up c=dashboard re-build and start container"
@echo ""
@echo " ~~~~~~~~~~~~~~~~~~ Run ~~~~~~~~~~~~~~~~~~~"
@echo ""
@echo " make docker-run-walkers n=3 parallel=false run walkers in docker"
@echo ""
@echo " ~~~~~~~~~~~~~~~~~~ Stop ~~~~~~~~~~~~~~~~~~"
@echo ""
@echo " make docker-down stop all containers"
@echo " make docker-down-volumes stop all containers and remove volumes"
@echo ""
@echo " ~~~~~~~~~~~~~~~~~~ Logs ~~~~~~~~~~~~~~~~~~"
@echo ""
@echo " make docker-health check all containers health"
@echo " make docker-logs follow all logs"
@echo " make docker-logs-db follow db logs"
@echo " make docker-logs-translate follow translator logs"
@echo " make docker-logs-walker follow walker logs"
@echo " make docker-logs-dashboard follow dashboard logs"
@echo ""
setup-db:
@uv run python -c "import asyncio; from src.db.db import setup_database; asyncio.run(setup_database())"
drop-db:
@uv run python -c "from src.db.db import drop_all_tables; drop_all_tables()"
recreate-db: drop-db setup-db
report:
@uv run python -c "from src.db.utils import generate_report; generate_report('$(session_id)')"
run-walkers:
@uv run python -c "from src.walker.run import run_walkers; run_walkers($(n), '$(parallel)'.lower() == 'true')"
dashboard:
@uv run python -c 'from dashboard.app import app; app.run(debug=True, host="0.0.0.0")'
docker-up:
@docker compose up --build -d
build-up:
docker compose build --no-cache $(c) && docker compose up -d $(c)
docker-down:
@docker compose down
docker-down-volumes:
@docker compose down -v
docker-run-walkers:
@docker compose run --rm \
-e WALKERS_N=$(n) \
-e WALKERS_PARALLEL=$(parallel) \
walker uv run python -c \
"import os; from src.walker.run import run_walkers; run_walkers(int(os.getenv('WALKERS_N', 1)), os.getenv('WALKERS_PARALLEL', 'false').lower() == 'true')"
docker-logs:
@docker compose logs -f
docker-logs-db:
@docker compose logs -f db
docker-logs-walker:
@docker compose logs -f walker
docker-logs-dashboard:
@docker compose logs -f dashboard
docker-logs-translate:
@docker compose logs -f libretranslate
docker-health:
@echo "========== Container Status =========="
@docker compose ps
@echo ""
@echo "========== Health Checks =========="
@docker inspect --format='{{.Name}} → {{.State.Health.Status}}' $$(docker ps -q) 2>/dev/null || echo ""