-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (57 loc) · 2.25 KB
/
Makefile
File metadata and controls
77 lines (57 loc) · 2.25 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
.PHONY: help install dev worker clean build deploy logs stop reset-db format lint
help: ## Show this help message
@echo 'Code Review Agent - Development Commands'
@echo ''
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $1, $2}' $(MAKEFILE_LIST)
install: ## Install dependencies
pip install --upgrade pip
pip install -r requirements.txt
dev: ## Start development server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
worker: ## Start Celery worker
celery -A app.tasks.analysis_tasks worker --loglevel=info --concurrency=4
scheduler: ## Start Celery beat scheduler
celery -A app.tasks.analysis_tasks beat --loglevel=info
format: ## Format code
black app/
isort app/
lint: ## Run linting
black --check app/
isort --check-only app/
flake8 app/ --max-line-length=100 --ignore=E203,W503
clean: ## Clean up temporary files
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
find . -name "*.log" -delete
build: ## Build Docker image
docker build -t code-review-agent .
deploy: ## Deploy with Docker Compose
docker-compose up -d
logs: ## Show logs
docker-compose logs -f
stop: ## Stop all services
docker-compose down
reset-db: ## Reset database
alembic downgrade base
alembic upgrade head
db-migrate: ## Create new database migration
alembic revision --autogenerate -m "$(MSG)"
db-upgrade: ## Apply database migrations
alembic upgrade head
shell: ## Start Python shell with app context
python -c "from app.models import *; from app.services import *; print('App context loaded')"
monitor: ## Show system resources
docker stats
backup-db: ## Backup database
@echo "Creating database backup..."
mkdir -p backups
docker-compose exec db pg_dump -U postgres code_review_db > backups/backup_$(shell date +%Y%m%d_%H%M%S).sql
restore-db: ## Restore database (usage: make restore-db FILE=backup.sql)
@if [ -z "$(FILE)" ]; then echo "Usage: make restore-db FILE=backup.sql"; exit 1; fi
docker-compose exec -T db psql -U postgres code_review_db < $(FILE)
scale-workers: ## Scale worker instances (usage: make scale-workers N=4)
@if [ -z "$(N)" ]; then echo "Usage: make scale-workers N=4"; exit 1; fi
docker-compose up -d --scale worker=$(N)