98 lines
2.4 KiB
Makefile
98 lines
2.4 KiB
Makefile
.PHONY: help build up down logs restart clean test monitor redis-cli
|
|
|
|
# Detect Docker Compose command (v1 or v2)
|
|
DOCKER_COMPOSE := $(shell command -v docker-compose 2>/dev/null)
|
|
ifndef DOCKER_COMPOSE
|
|
DOCKER_COMPOSE := docker compose
|
|
endif
|
|
|
|
help:
|
|
@echo "Binance Real-time Data Ingestion - Quick Commands"
|
|
@echo ""
|
|
@echo "Setup:"
|
|
@echo " make setup - Initial setup (copy .env, build images)"
|
|
@echo " make build - Build Docker images"
|
|
@echo ""
|
|
@echo "Operations:"
|
|
@echo " make up - Start all services"
|
|
@echo " make down - Stop all services"
|
|
@echo " make restart - Restart all services"
|
|
@echo " make logs - View application logs (follow)"
|
|
@echo ""
|
|
@echo "Monitoring:"
|
|
@echo " make monitor - Show system status and statistics"
|
|
@echo " make redis-cli - Open Redis CLI"
|
|
@echo " make test-read - Test reading data from Redis"
|
|
@echo ""
|
|
@echo "Maintenance:"
|
|
@echo " make clean - Stop and remove all containers, volumes"
|
|
@echo " make clean-data - Remove Redis data volume"
|
|
@echo ""
|
|
|
|
setup:
|
|
@echo "Setting up environment..."
|
|
@cp -n .env.example .env || true
|
|
@chmod +x scripts/*.sh scripts/*.py 2>/dev/null || true
|
|
@echo "✓ Environment file created (.env)"
|
|
@echo "✓ Please edit .env if needed"
|
|
@$(MAKE) build
|
|
|
|
build:
|
|
@echo "Building Docker images..."
|
|
@$(DOCKER_COMPOSE) build
|
|
@echo "✓ Build completed"
|
|
|
|
up:
|
|
@echo "Starting services..."
|
|
@$(DOCKER_COMPOSE) up -d
|
|
@echo "✓ Services started"
|
|
@echo ""
|
|
@$(MAKE) logs
|
|
|
|
down:
|
|
@echo "Stopping services..."
|
|
@$(DOCKER_COMPOSE) down
|
|
@echo "✓ Services stopped"
|
|
|
|
restart:
|
|
@$(MAKE) down
|
|
@$(MAKE) up
|
|
|
|
logs:
|
|
@$(DOCKER_COMPOSE) logs -f ingestion
|
|
|
|
monitor:
|
|
@bash scripts/monitor.sh
|
|
|
|
redis-cli:
|
|
@docker exec -it tradus-redis redis-cli
|
|
|
|
test-read:
|
|
@python scripts/test_redis_read.py
|
|
|
|
clean:
|
|
@echo "Cleaning up..."
|
|
@$(DOCKER_COMPOSE) down -v
|
|
@docker system prune -f
|
|
@echo "✓ Cleanup completed"
|
|
|
|
clean-data:
|
|
@echo "Removing Redis data volume..."
|
|
@docker volume rm realtime-ingestion_redis_data || true
|
|
@echo "✓ Data volume removed"
|
|
|
|
# Development
|
|
dev:
|
|
@echo "Starting in development mode with Redis UI..."
|
|
@$(DOCKER_COMPOSE) --profile debug up -d
|
|
@echo "✓ Services started with Redis Commander"
|
|
@echo " Redis UI: http://localhost:8081"
|
|
|
|
# Health check
|
|
health:
|
|
@echo "Checking service health..."
|
|
@$(DOCKER_COMPOSE) ps
|
|
@echo ""
|
|
@docker exec tradus-redis redis-cli PING
|
|
@echo "✓ Health check completed"
|