- Complete Rentcast API integration with all endpoints - Intelligent caching system with hit/miss tracking - Rate limiting with exponential backoff - User confirmation system with MCP elicitation support - Docker Compose setup with dev/prod modes - PostgreSQL database for persistence - Comprehensive test suite foundation - Full project structure and documentation
136 lines
4.0 KiB
Makefile
136 lines
4.0 KiB
Makefile
# mcrentcast - Makefile for Docker Compose management
|
|
|
|
.PHONY: help dev prod up down logs shell test clean build lint format check install setup
|
|
|
|
# Default environment
|
|
ENV_FILE := .env
|
|
|
|
# Load environment variables
|
|
ifneq (,$(wildcard $(ENV_FILE)))
|
|
include $(ENV_FILE)
|
|
export
|
|
endif
|
|
|
|
# Default target
|
|
help: ## Show this help message
|
|
@echo "mcrentcast - Docker Compose Management"
|
|
@echo ""
|
|
@echo "Usage: make [target]"
|
|
@echo ""
|
|
@echo "Targets:"
|
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
|
|
setup: ## Initial setup - copy .env.example to .env and create external caddy network
|
|
@if [ ! -f .env ]; then \
|
|
cp .env.example .env; \
|
|
echo "Created .env file from .env.example"; \
|
|
echo "Please edit .env and set your RENTCAST_API_KEY"; \
|
|
fi
|
|
@docker network inspect caddy >/dev/null 2>&1 || docker network create caddy
|
|
@echo "Setup complete!"
|
|
|
|
install: setup ## Install dependencies and sync with uv
|
|
uv sync
|
|
|
|
dev: setup ## Start development environment
|
|
@echo "Starting development environment..."
|
|
MODE=development docker compose up -d
|
|
@echo "Development environment started!"
|
|
@echo "Frontend: https://$(DOMAIN)"
|
|
@echo "API: https://api.$(DOMAIN)"
|
|
@echo "Logs: make logs"
|
|
|
|
prod: setup ## Start production environment
|
|
@echo "Starting production environment..."
|
|
MODE=production docker compose up -d
|
|
@echo "Production environment started!"
|
|
|
|
up: ## Start services (uses MODE from .env, defaults to development)
|
|
docker compose up -d
|
|
|
|
down: ## Stop all services
|
|
docker compose down
|
|
|
|
logs: ## Show logs from all services
|
|
docker compose logs -f
|
|
|
|
logs-server: ## Show logs from MCP server only
|
|
docker compose logs -f mcrentcast-server
|
|
|
|
logs-frontend: ## Show logs from frontend only
|
|
docker compose logs -f frontend
|
|
|
|
shell: ## Get a shell in the MCP server container
|
|
docker compose exec mcrentcast-server /bin/bash
|
|
|
|
shell-db: ## Get a shell in the database container
|
|
docker compose exec mcrentcast-db psql -U mcrentcast -d mcrentcast
|
|
|
|
test: ## Run tests in container
|
|
docker compose exec mcrentcast-server uv run pytest
|
|
|
|
test-local: ## Run tests locally with uv
|
|
uv run pytest
|
|
|
|
coverage: ## Run tests with coverage report
|
|
docker compose exec mcrentcast-server uv run pytest --cov=src --cov-report=html:reports/coverage_html
|
|
@echo "Coverage report: reports/coverage_html/index.html"
|
|
|
|
lint: ## Run linting with ruff
|
|
uv run ruff check src/ tests/
|
|
|
|
format: ## Format code with black and ruff
|
|
uv run black src/ tests/
|
|
uv run ruff format src/ tests/
|
|
|
|
check: ## Run type checking with mypy
|
|
uv run mypy src/
|
|
|
|
clean: ## Clean up containers, volumes, and cache
|
|
docker compose down -v
|
|
docker system prune -f
|
|
rm -rf .pytest_cache/ reports/ htmlcov/
|
|
|
|
build: ## Build all images
|
|
docker compose build
|
|
|
|
rebuild: ## Rebuild all images from scratch
|
|
docker compose build --no-cache
|
|
|
|
restart: ## Restart all services
|
|
docker compose restart
|
|
|
|
restart-server: ## Restart MCP server only
|
|
docker compose restart mcrentcast-server
|
|
|
|
status: ## Show status of all services
|
|
docker compose ps
|
|
|
|
# Database management
|
|
db-migrate: ## Run database migrations
|
|
docker compose exec mcrentcast-server uv run python -m mcrentcast.db.migrate
|
|
|
|
db-reset: ## Reset database (WARNING: destroys all data)
|
|
@echo "WARNING: This will destroy all data in the database!"
|
|
@read -p "Are you sure? [y/N] " -n 1 -r; \
|
|
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
|
|
docker compose down -v; \
|
|
docker volume rm $(COMPOSE_PROJECT)_postgres_data 2>/dev/null || true; \
|
|
docker compose up -d mcrentcast-db; \
|
|
echo "Database reset complete"; \
|
|
fi
|
|
|
|
# Development helpers
|
|
watch: ## Watch for file changes and restart server
|
|
docker compose exec mcrentcast-server watchfiles --clear uv run uvicorn mcrentcast.server:app --reload src/
|
|
|
|
pip-compile: ## Update dependencies lock file
|
|
uv lock
|
|
|
|
# Production helpers
|
|
deploy: prod ## Alias for prod
|
|
|
|
backup-db: ## Backup database
|
|
@mkdir -p backups
|
|
docker compose exec mcrentcast-db pg_dump -U mcrentcast mcrentcast | gzip > backups/mcrentcast_$(shell date +%Y%m%d_%H%M%S).sql.gz
|
|
@echo "Database backup created in backups/"
|