- Multi-stage Dockerfile with development and production modes - Docker Compose with caddy-docker-proxy labels for HTTPS - Domain configuration: DOMAIN=rentcache.l.supported.systems - Comprehensive Makefile with development and production targets - Support for external caddy network and Redis backend - Health checks and proper volume management - Environment configuration with .env file Usage: - make setup # Complete setup - make dev # Development with hot reload - make prod # Production deployment - URL: https://rentcache.l.supported.systems
118 lines
3.6 KiB
Makefile
118 lines
3.6 KiB
Makefile
# RentCache Makefile
|
|
.PHONY: help dev prod build up down logs shell test clean
|
|
|
|
# Default target
|
|
help: ## Show this help message
|
|
@echo "RentCache - Intelligent Rentcast API caching proxy"
|
|
@echo ""
|
|
@echo "Available targets:"
|
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
|
|
# Development
|
|
dev: ## Start development environment with hot reload
|
|
@echo "🚀 Starting RentCache in development mode..."
|
|
@docker compose --profile redis up --build -d
|
|
@echo "✅ RentCache available at: https://rentcache.l.supported.systems"
|
|
@echo "📚 API docs: https://rentcache.l.supported.systems/docs"
|
|
@echo "❤️ Health: https://rentcache.l.supported.systems/health"
|
|
|
|
prod: ## Start production environment
|
|
@echo "🏭 Starting RentCache in production mode..."
|
|
@MODE=production DEBUG=false docker compose up --build -d
|
|
@echo "✅ RentCache running in production mode"
|
|
|
|
# Docker management
|
|
build: ## Build Docker images
|
|
@docker compose build
|
|
|
|
up: ## Start services
|
|
@docker compose up -d
|
|
|
|
down: ## Stop services
|
|
@docker compose down
|
|
|
|
logs: ## View logs
|
|
@docker compose logs -f rentcache
|
|
|
|
shell: ## Open shell in running container
|
|
@docker compose exec rentcache /bin/bash
|
|
|
|
# Testing and development
|
|
test: ## Run tests
|
|
@echo "🧪 Running tests..."
|
|
@uv run pytest tests/ -v
|
|
|
|
test-cov: ## Run tests with coverage
|
|
@echo "🧪 Running tests with coverage..."
|
|
@uv run pytest tests/ --cov=src/rentcache --cov-report=html
|
|
|
|
lint: ## Run linting
|
|
@echo "🔍 Running linting..."
|
|
@uv run ruff check src/ tests/
|
|
@uv run mypy src/
|
|
|
|
format: ## Format code
|
|
@echo "✨ Formatting code..."
|
|
@uv run black src/ tests/
|
|
@uv run ruff --fix src/ tests/
|
|
|
|
# Database and cache
|
|
db-shell: ## Open database shell
|
|
@echo "🗄️ Opening database shell..."
|
|
@docker compose exec rentcache uv run python -c "from rentcache.database import engine; import sqlite3; sqlite3.connect('data/rentcache.db').execute('.tables')"
|
|
|
|
cache-clear: ## Clear all cache
|
|
@echo "🧹 Clearing cache..."
|
|
@docker compose exec rentcache uv run rentcache clear-cache --all
|
|
|
|
health: ## Check system health
|
|
@echo "❤️ Checking health..."
|
|
@docker compose exec rentcache uv run rentcache health
|
|
|
|
stats: ## Show usage statistics
|
|
@echo "📊 Usage statistics..."
|
|
@docker compose exec rentcache uv run rentcache stats
|
|
|
|
# Cleanup
|
|
clean: ## Clean up containers, volumes, and images
|
|
@echo "🧹 Cleaning up..."
|
|
@docker compose down -v --remove-orphans
|
|
@docker system prune -f
|
|
|
|
clean-all: clean ## Clean everything including images
|
|
@docker compose down -v --rmi all --remove-orphans
|
|
@docker system prune -af
|
|
|
|
# API key management
|
|
create-key: ## Create API key (usage: make create-key NAME=myapp KEY=your_key)
|
|
@docker compose exec rentcache uv run rentcache create-key $(NAME) $(KEY) --daily-limit 1000
|
|
|
|
list-keys: ## List all API keys
|
|
@docker compose exec rentcache uv run rentcache list-keys
|
|
|
|
# Install local development
|
|
install: ## Install for local development
|
|
@echo "📦 Installing dependencies..."
|
|
@uv sync
|
|
@echo "✅ Ready for development"
|
|
|
|
local-dev: install ## Run locally for development
|
|
@echo "🖥️ Starting local development server..."
|
|
@uv run rentcache server --reload
|
|
|
|
# URL helpers
|
|
url: ## Show the service URL
|
|
@echo "🌐 RentCache URL: https://rentcache.l.supported.systems"
|
|
|
|
docs: ## Open API documentation
|
|
@echo "📚 API Documentation: https://rentcache.l.supported.systems/docs"
|
|
|
|
# Quick setup
|
|
setup: ## Complete setup (build, create network if needed, start)
|
|
@echo "🚀 Setting up RentCache..."
|
|
@docker network create caddy 2>/dev/null || true
|
|
@make build
|
|
@make dev
|
|
@echo ""
|
|
@echo "🎉 RentCache is ready!"
|
|
@make url
|