-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
102 lines (89 loc) · 2.87 KB
/
Makefile
File metadata and controls
102 lines (89 loc) · 2.87 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
.PHONY: help start start-background stop redis celery api services check install
# Default target
help:
@echo "AETHERA Service Management"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " start Start all services (foreground)"
@echo " start-background Start all services (background)"
@echo " stop Stop all services"
@echo " redis Start Redis server only"
@echo " celery Start Celery worker only"
@echo " api Start FastAPI server only"
@echo " services Start all services (alias for start)"
@echo " check Check if services are running"
@echo " install Install dependencies"
@echo ""
# Configuration
REDIS_PORT ?= 6379
API_PORT ?= 8000
API_HOST ?= localhost
# Detect OS
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
START_SCRIPT = scripts/start_services.sh
STOP_SCRIPT = scripts/stop_services.sh
endif
ifeq ($(UNAME_S),Darwin)
START_SCRIPT = scripts/start_services.sh
STOP_SCRIPT = scripts/stop_services.sh
endif
ifeq ($(OS),Windows_NT)
START_SCRIPT = scripts/start_services.ps1
STOP_SCRIPT = scripts/stop_services.ps1
endif
# Start all services
start:
@echo "Starting all services..."
ifeq ($(OS),Windows_NT)
@powershell -ExecutionPolicy Bypass -File $(START_SCRIPT)
else
@bash $(START_SCRIPT)
endif
start-background:
@echo "Starting all services in background..."
ifeq ($(OS),Windows_NT)
@powershell -ExecutionPolicy Bypass -File $(START_SCRIPT) -Background
else
@bash $(START_SCRIPT) --background
endif
services: start
# Stop all services
stop:
@echo "Stopping all services..."
ifeq ($(OS),Windows_NT)
@if exist stop_services.ps1 powershell -ExecutionPolicy Bypass -File scripts/stop_services.ps1
else
@if [ -f scripts/stop_services.sh ]; then bash scripts/stop_services.sh; fi
endif
@echo "Note: You may need to manually stop services if stop script doesn't exist"
# Start individual services
redis:
@echo "Starting Redis..."
@redis-server --port $(REDIS_PORT) || echo "Redis already running or not installed"
celery:
@echo "Starting Celery worker..."
@celery -A backend.src.workers.celery_app worker --loglevel=info
api:
@echo "Starting FastAPI server..."
@uvicorn backend.src.api.app:app --host $(API_HOST) --port $(API_PORT) --reload
# Check services
check:
@echo "Checking services..."
@echo ""
@echo "Redis:"
@redis-cli -p $(REDIS_PORT) ping 2>/dev/null && echo " ✓ Running" || echo " ✗ Not running"
@echo ""
@echo "Celery:"
@celery -A backend.src.workers.celery_app inspect active 2>/dev/null > /dev/null && echo " ✓ Running" || echo " ✗ Not running"
@echo ""
@echo "FastAPI:"
@curl -s http://$(API_HOST):$(API_PORT)/docs > /dev/null 2>&1 && echo " ✓ Running" || echo " ✗ Not running"
@echo ""
# Install dependencies
install:
@echo "Installing dependencies..."
@cd backend && pip install -e .
@echo "✓ Dependencies installed"