Files
ad-infr-control/Makefile
ilyastar9999 cffbd77b74 init
2025-12-02 14:01:34 +03:00

120 lines
3.1 KiB
Makefile

.PHONY: help build up down restart logs clean setup test
help:
@echo "A/D Infrastructure Control - Makefile Commands"
@echo ""
@echo "Setup:"
@echo " make init - Initialize environment (copy .env.example)"
@echo " make setup - Run setuper script for A/D services"
@echo ""
@echo "Docker:"
@echo " make build - Build all Docker images"
@echo " make up - Start all services"
@echo " make down - Stop all services"
@echo " make restart - Restart all services"
@echo " make rebuild - Rebuild and restart all services"
@echo ""
@echo "Monitoring:"
@echo " make logs - View all logs"
@echo " make logs-web - View web dashboard logs"
@echo " make logs-ctrl - View controller logs"
@echo " make logs-score - View scoreboard injector logs"
@echo " make logs-tg - View telegram bot logs"
@echo " make ps - Show running containers"
@echo ""
@echo "Maintenance:"
@echo " make clean - Stop services and remove volumes"
@echo " make reset - Complete reset (clean + remove .env)"
@echo " make test - Test all API endpoints"
@echo ""
init:
@if [ ! -f .env ]; then \
cp .env.example .env; \
echo "Created .env file. Please edit it with your configuration."; \
else \
echo ".env already exists. Skipping."; \
fi
build:
docker-compose build
up:
docker-compose up -d
@echo ""
@echo "Services started!"
@echo "Web Dashboard: http://localhost:8000"
@echo "Controller API: http://localhost:8001"
@echo "Scoreboard API: http://localhost:8002"
@echo "Telegram API: http://localhost:8003"
down:
docker-compose down
restart:
docker-compose restart
rebuild:
docker-compose up -d --build
logs:
docker-compose logs -f
logs-web:
docker-compose logs -f web
logs-ctrl:
docker-compose logs -f controller
logs-score:
docker-compose logs -f scoreboard-injector
logs-tg:
docker-compose logs -f tg-bot
ps:
docker-compose ps
clean:
docker-compose down -v
@echo "All services stopped and volumes removed"
reset: clean
@if [ -f .env ]; then \
read -p "Remove .env file? [y/N] " confirm; \
if [ "$$confirm" = "y" ]; then \
rm .env; \
echo ".env removed"; \
fi \
fi
@echo "Reset complete"
setup:
@chmod +x setuper/setup.sh
@cd setuper && ./setup.sh
test:
@echo "Testing API endpoints..."
@echo ""
@echo "Testing Web Dashboard..."
@curl -s http://localhost:8000/health || echo "Web: Not responding"
@echo ""
@echo "Testing Controller API..."
@curl -s http://localhost:8001/health || echo "Controller: Not responding"
@echo ""
@echo "Testing Scoreboard API..."
@curl -s http://localhost:8002/health || echo "Scoreboard: Not responding"
@echo ""
@echo "Testing Telegram API..."
@curl -s http://localhost:8003/health || echo "Telegram: Not responding"
@echo ""
install: init build up
@echo ""
@echo "Installation complete!"
@echo "Next steps:"
@echo " 1. Edit .env with your configuration"
@echo " 2. Run: make restart"
@echo " 3. Run: make setup (to configure A/D services)"
@echo " 4. Access dashboard at http://localhost:8000"