refactor: replace Makefile with maintenance.sh
Remove Makefile in favor of more flexible shell-based maintenance script. The new maintenance.sh provides all the same functionality with easier maintenance and better shell script integration.
This commit is contained in:
63
Makefile
63
Makefile
@@ -1,63 +0,0 @@
|
|||||||
# Makefile for KNEL-AIMiddleware
|
|
||||||
# Common operations for building, managing, and deploying MCP/LSP services
|
|
||||||
|
|
||||||
.PHONY: help build-all clean-vendor clone-vendors status test
|
|
||||||
|
|
||||||
# Default target
|
|
||||||
help: ## Show this help message
|
|
||||||
@echo 'Usage: make [target]'
|
|
||||||
@echo ''
|
|
||||||
@echo 'Available targets:'
|
|
||||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
||||||
|
|
||||||
clone-vendors: ## Clone all vendor MCP/LSP repositories
|
|
||||||
@echo "Cloning all vendor repositories..."
|
|
||||||
@./CloneVendorRepos.sh
|
|
||||||
|
|
||||||
build-all: ## Build all MCP/LSP services
|
|
||||||
@echo "Building all services..."
|
|
||||||
@./BuildAll.sh
|
|
||||||
|
|
||||||
clean-vendor: ## Remove all cloned vendor repositories
|
|
||||||
@echo "Cleaning vendor directory..."
|
|
||||||
@./CleanVendor.sh
|
|
||||||
|
|
||||||
status: ## Check build status of all services
|
|
||||||
@echo "Checking service status..."
|
|
||||||
@./StatusCheck.sh
|
|
||||||
|
|
||||||
test: ## Run tests for all services (if available)
|
|
||||||
@echo "Running tests..."
|
|
||||||
@docker compose config --quiet && echo "✓ docker-compose.yml is valid"
|
|
||||||
|
|
||||||
logs: ## Show logs from all running services
|
|
||||||
@docker compose logs -f
|
|
||||||
|
|
||||||
ps: ## Show status of all services
|
|
||||||
@docker compose ps
|
|
||||||
|
|
||||||
up: ## Start all services in dev profile
|
|
||||||
@echo "Starting all services..."
|
|
||||||
@docker compose up -d --profile dev
|
|
||||||
|
|
||||||
down: ## Stop all services
|
|
||||||
@echo "Stopping all services..."
|
|
||||||
@docker compose down
|
|
||||||
|
|
||||||
rebuild: SERVICE? ## Rebuild a specific service (usage: make rebuild SERVICE=service-name)
|
|
||||||
@echo "Rebuilding $(SERVICE)..."
|
|
||||||
@docker compose build --no-cache $(SERVICE)
|
|
||||||
@docker compose up -d $(SERVICE)
|
|
||||||
|
|
||||||
# Service-specific build targets
|
|
||||||
build-context7: ## Build context7-mcp service
|
|
||||||
@docker compose build context7-mcp
|
|
||||||
|
|
||||||
build-bash-language-server: ## Build bash-language-server service
|
|
||||||
@docker compose build bash-language-server
|
|
||||||
|
|
||||||
build-docker-language-server: ## Build docker-language-server service
|
|
||||||
@docker compose build docker-language-server
|
|
||||||
|
|
||||||
build-marksman: ## Build marksman service
|
|
||||||
@docker compose build marksman
|
|
||||||
177
maintenance.sh
Executable file
177
maintenance.sh
Executable file
@@ -0,0 +1,177 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# maintenance.sh
|
||||||
|
# Comprehensive maintenance script for KNEL-AIMiddleware
|
||||||
|
# Combines functionality from the old Makefile with Docker Compose
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Colors for output
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# Change to project directory
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
|
# Function to show usage
|
||||||
|
show_usage() {
|
||||||
|
cat << EOF
|
||||||
|
Usage: $0 <command>
|
||||||
|
|
||||||
|
Available commands:
|
||||||
|
clone-vendors Clone all vendor MCP/LSP repositories
|
||||||
|
build-all Build all MCP/LSP services
|
||||||
|
build <service> Build a specific service
|
||||||
|
clean-vendor Remove all cloned vendor repositories
|
||||||
|
status Check build status of all services
|
||||||
|
validate Validate MCP servers
|
||||||
|
logs Show logs from all running services
|
||||||
|
ps Show status of all services
|
||||||
|
up [profile] Start services (default: dev profile)
|
||||||
|
down Stop all services
|
||||||
|
rebuild <service> Rebuild a specific service
|
||||||
|
help Show this help message
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
$0 clone-vendors
|
||||||
|
$0 build ghost-mcp
|
||||||
|
$0 rebuild context7-mcp
|
||||||
|
$0 up dev
|
||||||
|
$0 down
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to clone vendor repositories
|
||||||
|
clone_vendors() {
|
||||||
|
echo -e "${GREEN}=== Cloning Vendor Repositories ===${NC}"
|
||||||
|
./scripts/CloneVendorRepos.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to build all services
|
||||||
|
build_all() {
|
||||||
|
echo -e "${GREEN}=== Building All Services ===${NC}"
|
||||||
|
./scripts/BuildAll.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to build specific service
|
||||||
|
build_service() {
|
||||||
|
local service=$1
|
||||||
|
if [ -z "$service" ]; then
|
||||||
|
echo -e "${RED}Error: Service name required${NC}"
|
||||||
|
echo "Usage: $0 build <service-name>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "${GREEN}=== Building $service ===${NC}"
|
||||||
|
docker compose build "$service"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to clean vendor directory
|
||||||
|
clean_vendor() {
|
||||||
|
echo -e "${YELLOW}=== Cleaning Vendor Directory ===${NC}"
|
||||||
|
read -p "This will remove all cloned vendor repositories. Continue? (y/N) " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
./scripts/CleanVendor.sh
|
||||||
|
else
|
||||||
|
echo "Cancelled."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to check status
|
||||||
|
status() {
|
||||||
|
echo -e "${GREEN}=== Service Status ===${NC}"
|
||||||
|
./scripts/StatusCheck.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to validate MCP servers
|
||||||
|
validate() {
|
||||||
|
echo -e "${GREEN}=== Validating MCP Servers ===${NC}"
|
||||||
|
./scripts/validate-mcp.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to show logs
|
||||||
|
logs() {
|
||||||
|
echo -e "${GREEN}=== Service Logs ===${NC}"
|
||||||
|
docker compose logs -f
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to show process status
|
||||||
|
ps() {
|
||||||
|
echo -e "${GREEN}=== Service Process Status ===${NC}"
|
||||||
|
docker compose ps
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to start services
|
||||||
|
up() {
|
||||||
|
local profile=${1:-dev}
|
||||||
|
echo -e "${GREEN}=== Starting Services (profile: $profile) ===${NC}"
|
||||||
|
docker compose up -d --profile "$profile"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to stop services
|
||||||
|
down() {
|
||||||
|
echo -e "${GREEN}=== Stopping Services ===${NC}"
|
||||||
|
docker compose down
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to rebuild service
|
||||||
|
rebuild() {
|
||||||
|
local service=$1
|
||||||
|
if [ -z "$service" ]; then
|
||||||
|
echo -e "${RED}Error: Service name required${NC}"
|
||||||
|
echo "Usage: $0 rebuild <service-name>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "${GREEN}=== Rebuilding $service ===${NC}"
|
||||||
|
docker compose build --no-cache "$service"
|
||||||
|
docker compose up -d "$service"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main script logic
|
||||||
|
case "${1:-help}" in
|
||||||
|
clone-vendors)
|
||||||
|
clone_vendors
|
||||||
|
;;
|
||||||
|
build-all)
|
||||||
|
build_all
|
||||||
|
;;
|
||||||
|
build)
|
||||||
|
build_service "$2"
|
||||||
|
;;
|
||||||
|
clean-vendor)
|
||||||
|
clean_vendor
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status
|
||||||
|
;;
|
||||||
|
validate)
|
||||||
|
validate
|
||||||
|
;;
|
||||||
|
logs)
|
||||||
|
logs
|
||||||
|
;;
|
||||||
|
ps)
|
||||||
|
ps
|
||||||
|
;;
|
||||||
|
up)
|
||||||
|
up "$2"
|
||||||
|
;;
|
||||||
|
down)
|
||||||
|
down
|
||||||
|
;;
|
||||||
|
rebuild)
|
||||||
|
rebuild "$2"
|
||||||
|
;;
|
||||||
|
help|--help|-h)
|
||||||
|
show_usage
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${RED}Unknown command: $1${NC}"
|
||||||
|
echo ""
|
||||||
|
show_usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Reference in New Issue
Block a user