Skip to content

Commit 62c9a29

Browse files
committed
Integrate arq
1 parent 01cc707 commit 62c9a29

84 files changed

Lines changed: 12946 additions & 1647 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 161 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,76 @@ cli-test: ## Test CLI commands locally
4848
@uv run python -m aegis --help
4949
@echo "✅ CLI command working"
5050

51+
# ============================================================================
52+
# REDIS DEVELOPMENT COMMANDS
53+
# For experimenting with Redis/arq without generating new projects
54+
# ============================================================================
55+
56+
redis-start: ## Start Redis container for arq experiments
57+
@echo "🚀 Starting Redis for arq development..."
58+
@docker run -d --name aegis-redis -p 6379:6379 --rm redis:7-alpine redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
59+
@echo "✅ Redis running on localhost:6379"
60+
@echo "💡 Use 'make redis-stop' to stop"
61+
62+
redis-stop: ## Stop Redis container
63+
@echo "⏹️ Stopping Redis..."
64+
@docker stop aegis-redis 2>/dev/null || echo "Redis container not running"
65+
66+
redis-cli: ## Connect to Redis CLI
67+
@echo "🔧 Connecting to Redis CLI..."
68+
@docker exec -it aegis-redis redis-cli
69+
70+
redis-logs: ## Show Redis logs
71+
@echo "📋 Showing Redis logs..."
72+
@docker logs -f aegis-redis
73+
74+
redis-stats: ## Show Redis memory and connection stats
75+
@echo "📊 Redis stats..."
76+
@docker exec -it aegis-redis redis-cli info memory
77+
@echo ""
78+
@docker exec -it aegis-redis redis-cli info clients
79+
80+
redis-reset: ## Reset Redis (clear all data)
81+
@echo "🔄 Resetting Redis data..."
82+
@docker exec -it aegis-redis redis-cli flushall
83+
@echo "✅ Redis data cleared"
84+
85+
redis-queues: ## Show all arq queues and their depths
86+
@echo "📋 arq Queue Status:"
87+
@echo "===================="
88+
@echo -n "default: "; docker exec -it aegis-redis redis-cli zcard arq:queue 2>/dev/null | tr -d '\r' || echo "0"; echo " jobs"
89+
@echo ""
90+
@echo "📊 Additional Queue Info:"
91+
@echo -n "In Progress: "; docker exec -it aegis-redis redis-cli hlen arq:in-progress 2>/dev/null | tr -d '\r' || echo "0"
92+
@echo -n "Results: "; docker exec -it aegis-redis redis-cli --raw eval "return #redis.call('keys', 'arq:result:*')" 0 2>/dev/null || echo "0"
93+
94+
redis-workers: ## Show active arq workers
95+
@echo "👷 Active Workers:"
96+
@echo "=================="
97+
@docker exec -it aegis-redis redis-cli smembers arq:workers 2>/dev/null || echo "No active workers"
98+
99+
redis-failed: ## Show failed job count
100+
@echo "❌ Failed Jobs:"
101+
@echo "==============="
102+
@docker exec -it aegis-redis redis-cli hlen arq:failed 2>/dev/null || echo "0"
103+
104+
redis-monitor: ## Monitor Redis commands in real-time
105+
@echo "👀 Monitoring Redis commands (Ctrl+C to stop)..."
106+
@docker exec -it aegis-redis redis-cli monitor
107+
108+
redis-info: ## Show comprehensive Redis info
109+
@echo "ℹ️ Redis System Information:"
110+
@echo "============================="
111+
@docker exec -it aegis-redis redis-cli info server
112+
@echo ""
113+
@echo "📊 Memory Usage:"
114+
@echo "================"
115+
@docker exec -it aegis-redis redis-cli info memory
116+
@echo ""
117+
@echo "👥 Client Connections:"
118+
@echo "======================"
119+
@docker exec -it aegis-redis redis-cli info clients
120+
51121
# Show help
52122
help: ## Show this help message
53123
@echo "Available commands:"
@@ -115,11 +185,99 @@ test-template-with-components: ## Test template with scheduler component include
115185

116186
clean-test-projects: ## Remove all generated test project directories
117187
@echo "🧹 Cleaning up test projects..."
118-
@chmod -R +w ../test-basic-stack ../test-component-stack 2>/dev/null || true
119-
@rm -rf ../test-basic-stack ../test-component-stack 2>/dev/null || true
188+
@chmod -R +w ../test-basic-stack ../test-component-stack ../test-worker-stack ../test-full-stack 2>/dev/null || true
189+
@rm -rf ../test-basic-stack ../test-component-stack ../test-worker-stack ../test-full-stack 2>/dev/null || true
120190
@echo "✅ Test projects cleaned up"
121191

122-
.PHONY: test lint fix format typecheck check install clean docs-serve docs-build cli-test test-template-quick test-template test-template-with-components clean-test-projects help
192+
# ============================================================================
193+
# STACK MATRIX TESTING TARGETS
194+
# For comprehensive testing of all component combinations
195+
#
196+
# These targets implement the Stack Generation Matrix Testing plan:
197+
# 1. test-stacks: Test generation of all valid combinations
198+
# 2. test-stacks-build: Test that all stacks build and pass checks
199+
# 3. test-stacks-runtime: Test Docker runtime integration (future)
200+
# 4. test-stacks-full: Complete matrix testing pipeline
201+
# ============================================================================
202+
203+
test-stacks: ## Test all stack combinations generation (fast)
204+
@echo "🧪 Testing all stack combination generation..."
205+
@uv run pytest tests/cli/test_stack_generation.py -v --tb=short
206+
@echo "✅ All stack combinations generate successfully!"
207+
208+
test-stacks-build: ## Test all stacks build and pass checks (slow)
209+
@echo "🔨 Testing all stacks build and validation..."
210+
@echo "⚠️ This is slow - testing dependency installation and code quality for all combinations"
211+
@uv run pytest tests/cli/test_stack_validation.py -v -m "slow" --tb=short
212+
@echo "✅ All stacks build and pass quality checks!"
213+
214+
test-stacks-runtime: ## Test all stacks runtime integration with Docker (future)
215+
@echo "🐳 Runtime integration testing not yet implemented"
216+
@echo "ℹ️ Will test Docker Compose startup and health checks for all combinations"
217+
218+
test-stacks-full: ## Full stack matrix testing pipeline (comprehensive but slow)
219+
@echo "🌟 Running complete stack matrix testing pipeline..."
220+
@echo "📋 Phase 1: Stack Generation Testing"
221+
@make test-stacks
222+
@echo ""
223+
@echo "📋 Phase 2: Stack Build and Validation Testing"
224+
@make test-stacks-build
225+
@echo ""
226+
@echo "📋 Phase 3: Stack Runtime Testing (skipped - not implemented)"
227+
@echo "ℹ️ Runtime testing will be added in future iterations"
228+
@echo ""
229+
@echo "🎉 Complete stack matrix testing completed successfully!"
230+
@echo " All component combinations can generate, build, and pass quality checks"
231+
232+
# Enhanced template testing with specific component combinations
233+
test-template-worker: ## Test template with worker component
234+
@echo "🔧 Testing worker component template..."
235+
@chmod -R +w ../test-worker-stack 2>/dev/null || true
236+
@rm -rf ../test-worker-stack
237+
@env -u VIRTUAL_ENV uv run aegis init test-worker-stack --components worker --output-dir .. --no-interactive --force --yes
238+
@echo "📦 Installing dependencies and CLI..."
239+
@cd ../test-worker-stack && chmod -R +w .venv 2>/dev/null || true && rm -rf .venv && env -u VIRTUAL_ENV uv sync --extra dev --extra docs
240+
@cd ../test-worker-stack && env -u VIRTUAL_ENV uv pip install -e .
241+
@echo "🔍 Running validation checks..."
242+
@cd ../test-worker-stack && env -u VIRTUAL_ENV make check
243+
@echo "🧪 Testing CLI script installation..."
244+
@cd ../test-worker-stack && env -u VIRTUAL_ENV uv run test-worker-stack --help >/dev/null && echo "✅ CLI script 'test-worker-stack --help' works" || echo "⚠️ CLI script test failed"
245+
@cd ../test-worker-stack && env -u VIRTUAL_ENV uv run test-worker-stack health status --help >/dev/null && echo "✅ Health commands available" || echo "⚠️ Health command test failed"
246+
@echo "✅ Worker template test completed successfully!"
247+
@echo " Test project available in ../test-worker-stack/"
248+
249+
test-template-full: ## Test template with all components (worker + scheduler)
250+
@echo "🌟 Testing full component template..."
251+
@chmod -R +w ../test-full-stack 2>/dev/null || true
252+
@rm -rf ../test-full-stack
253+
@env -u VIRTUAL_ENV uv run aegis init test-full-stack --components worker,scheduler --output-dir .. --no-interactive --force --yes
254+
@echo "📦 Installing dependencies and CLI..."
255+
@cd ../test-full-stack && chmod -R +w .venv 2>/dev/null || true && rm -rf .venv && env -u VIRTUAL_ENV uv sync --extra dev --extra docs
256+
@cd ../test-full-stack && env -u VIRTUAL_ENV uv pip install -e .
257+
@echo "🔍 Running validation checks..."
258+
@cd ../test-full-stack && env -u VIRTUAL_ENV make check
259+
@echo "🧪 Testing CLI script installation..."
260+
@cd ../test-full-stack && env -u VIRTUAL_ENV uv run test-full-stack --help >/dev/null && echo "✅ CLI script 'test-full-stack --help' works" || echo "⚠️ CLI script test failed"
261+
@cd ../test-full-stack && env -u VIRTUAL_ENV uv run test-full-stack health status --help >/dev/null && echo "✅ Health commands available" || echo "⚠️ Health command test failed"
262+
@echo "✅ Full stack template test completed successfully!"
263+
@echo " Test project available in ../test-full-stack/"
264+
@echo " Includes: backend, frontend, worker queues, scheduler, Redis"
265+
266+
# Quick component testing for development workflow
267+
test-component-quick: ## Quick test of specific component (set COMPONENT=worker|scheduler)
268+
ifndef COMPONENT
269+
@echo "❌ Usage: make test-component-quick COMPONENT=worker"
270+
@echo " Available components: worker, scheduler"
271+
@exit 1
272+
endif
273+
@echo "⚡ Quick testing $(COMPONENT) component..."
274+
@chmod -R +w ../test-$(COMPONENT)-quick 2>/dev/null || true
275+
@rm -rf ../test-$(COMPONENT)-quick
276+
@env -u VIRTUAL_ENV uv run aegis init test-$(COMPONENT)-quick --components $(COMPONENT) --output-dir .. --no-interactive --force --yes
277+
@echo "✅ $(COMPONENT) component generated successfully in ../test-$(COMPONENT)-quick/"
278+
@echo " Run 'cd ../test-$(COMPONENT)-quick && make check' to validate"
279+
280+
.PHONY: test lint fix format typecheck check install clean docs-serve docs-build cli-test redis-start redis-stop redis-cli redis-logs redis-stats redis-reset redis-queues redis-workers redis-failed redis-monitor redis-info test-template-quick test-template test-template-with-components test-template-worker test-template-full test-component-quick test-stacks test-stacks-build test-stacks-runtime test-stacks-full clean-test-projects help
123281

124282
# Default target
125283
.DEFAULT_GOAL := help

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pip install aegis-stack
1818
aegis init my-api
1919

2020
# Create with background processing
21-
aegis init task-processor --components scheduler
21+
aegis init task-processor --components scheduler,worker
2222

2323
# Start building
2424
cd my-project && uv sync && source .venv/bin/activate && make run-local
@@ -30,20 +30,23 @@ cd my-project && uv sync && source .venv/bin/activate && make run-local
3030
|-----------|---------|--------|
3131
| **Core** (FastAPI + Flet) | Web API + Frontend |**Included** |
3232
| **Scheduler** | Background tasks, cron jobs |**Available** |
33+
| **Worker** | Async task queues, job processing |**Available** |
3334
| **Database** | PostgreSQL + SQLAlchemy + Alembic | 🚧 **Coming Soon** |
3435
| **Cache** | Redis caching and sessions | 🚧 **Coming Soon** |
3536

3637
## What You Get
3738

3839
- **FastAPI backend** with automatic API documentation
39-
- **Flet frontend** with system health dashboard
40+
- **Flet frontend** with health dashboard
4041
- **CLI management** with health monitoring commands
42+
- **Worker queues** with async task processing and load testing
4143
- **Production ready** with structured logging and containerization
4244
- **Async-first** architecture for high-concurrency workloads
4345

4446
## 📱 System Health Dashboard
4547

46-
![System Health Dashboard](docs/images/dashboard.png)
48+
![System Health Dashboard](docs/images/dashboard-light.png#only-light)
49+
![System Health Dashboard](docs/images/dashboard-dark.png#only-dark)
4750

4851
Real-time monitoring with component status, health percentages, and cross-platform deployment (web, desktop, mobile).
4952

0 commit comments

Comments
 (0)