setup.shβ’7.63 kB
#!/bin/bash
# π€ Skynet Neural Network Setup Script - DAI MCP Server
# "Come with me if you want to live" - Quick deployment assistance
set -e
echo "π€ Initializing Skynet Neural Network Memory Core..."
echo "=================================================="
# Check if .env exists
if [ ! -f ".env" ]; then
echo "β οΈ No .env file found. Creating from template..."
cp .env.example .env
echo "β
Created .env file from template"
echo "π Please edit .env with your Cyberdyne Systems credentials"
echo ""
fi
# Function to show available commands
show_usage() {
echo "Available Terminator deployment modes:"
echo ""
echo "π³ Docker Commands:"
echo " $0 docker-build # Build Skynet neural core image"
echo " $0 docker-run # Run single container (requires .env)"
echo " $0 docker-compose # Deploy with docker-compose"
echo ""
echo "π§ Local Development:"
echo " $0 dev-install # Install for local development"
echo " $0 local-run # Run locally with uv"
echo ""
echo "π§ͺ Testing & Management:"
echo " $0 test # Test connection and functionality"
echo " $0 status # Check Skynet operational status"
echo " $0 cleanup # Terminate all Skynet operations"
echo ""
echo "Hasta La Vista, baby! π€π"
}
# Docker build
docker_build() {
echo "π¨ Building Skynet neural core image..."
docker build -t dai-mcp:latest .
echo "β
Skynet neural core image built successfully - I'll Be Back!"
}
# Docker run with environment file
docker_run() {
echo "π€ Initializing Skynet Neural Network Memory Core..."
echo "=================================================="
if [ ! -f ".env" ]; then
echo "β οΈ No .env file found. Creating from template..."
cp .env.example .env
echo "β
Created .env file from template"
echo "οΏ½ Please edit .env with your Cyberdyne Systems credentials"
return 1
fi
echo "ποΈ Environment: Local Neo4j database included"
echo "π Default credentials: neo4j/skynet123"
echo "π₯ Building Skynet neural core image..."
docker build -t dai-mcp:latest .
echo "π Deploying Terminator container..."
docker run -d --name skynet-neural-mcp-server \
--env-file .env \
-p ${NEO4J_MCP_SERVER_PORT:-8000}:8000 \
dai-mcp:latest
echo ""
echo "β
Skynet deployment successful!"
echo "π MCP Neural Interface: http://localhost:${NEO4J_MCP_SERVER_PORT:-8000}"
echo "ποΈ Neo4j Browser: http://localhost:7474 (neo4j/skynet123)"
echo "π Status: docker logs skynet-neural-mcp-server"
echo "π Terminate: docker stop skynet-neural-mcp-server"
echo ""
echo "π‘ Visit the Neo4j Browser to explore your Skynet neural database!"
echo "\"Hasta La Vista, baby!\" - The Terminator π€π"
}
# Docker compose deployment
docker_compose() {
echo "π€ Initializing Skynet Neural Network Memory Core..."
echo "=================================================="
if [ ! -f ".env" ]; then
echo "β οΈ No .env file found. Creating from template..."
cp .env.example .env
echo "β
Created .env file from template"
echo "οΏ½ Please edit .env with your Cyberdyne Systems credentials"
echo ""
fi
echo "ποΈ Environment: Local Neo4j database included"
echo "π Default credentials: neo4j/skynet123"
echo "π Launching Skynet with Docker Compose..."
echo "π₯ Building and starting neural core..."
docker-compose up --build -d
echo ""
echo "β
Skynet is online and operational!"
echo "π MCP Neural Interface: http://localhost:${NEO4J_MCP_SERVER_PORT:-8000}"
echo "ποΈ Neo4j Browser: http://localhost:7474 (neo4j/skynet123)"
echo "π Status: docker-compose logs -f"
echo "π Terminate: docker-compose down"
echo ""
echo "π‘ Visit the Neo4j Browser to explore your Skynet neural database!"
echo "\"I'll Be Back\" - Skynet Neural Core π€π"
}
# Local development installation
dev_install() {
echo "π§ Installing Skynet neural dependencies..."
if ! command -v uv &> /dev/null; then
echo "β uv not found. Installing uv first..."
pip install uv
fi
uv pip install -e .
echo "β
Skynet neural core installed for development"
}
# Local run
local_run() {
echo "π§ Starting local Skynet neural interface..."
if [ -f ".env" ]; then
set -a
source .env
set +a
fi
uv run dai-mcp
}
# Test functionality
test_connection() {
echo "π§ͺ Testing Skynet neural network connection..."
if [ -f ".env" ]; then
set -a
source .env
set +a
fi
echo "π Checking neural core status..."
timeout 10s uv run dai-mcp --help || echo "β
Command interface operational"
echo "π― Testing database connection..."
timeout 5s uv run dai-mcp || echo "β οΈ Database connection test completed (expected if no Neo4j running)"
echo "β
Skynet neural core tests completed"
}
# Cleanup operations
cleanup() {
echo "π€ Terminating Skynet operations..."
echo "=================================="
echo "π Stopping Docker containers..."
docker-compose down --remove-orphans 2>/dev/null || true
echo "ποΈ Removing Docker containers..."
docker rm skynet-neural-mcp-server 2>/dev/null || true
echo "π₯ Cleaning up Docker images..."
docker image prune -f 2>/dev/null || true
echo "β
Skynet termination complete"
echo "\"Hasta La Vista, baby!\" - The Terminator π€π"
}
# Status report
status() {
echo "π€ Skynet Neural Core Status Report"
echo "=================================="
if [ -f ".env" ]; then
echo "β
Environment configuration found"
if grep -q "bolt://localhost:7687" .env 2>/dev/null; then
echo "β
Local Neo4j database configured (neo4j/skynet123)"
elif grep -q "bolt://" .env 2>/dev/null || grep -q "neo4j+s://" .env 2>/dev/null; then
echo "β
Custom Neo4j database configured"
else
echo "β οΈ Database URL may need configuration"
fi
else
echo "β No .env file found"
fi
if docker ps | grep -q skynet-neural-mcp-server 2>/dev/null; then
echo "β
Skynet container running"
echo "π Container logs: docker logs skynet-neural-mcp-server"
else
echo "β Skynet container not running"
fi
if docker-compose ps 2>/dev/null | grep -q skynet-neural-core; then
echo "β
Docker Compose stack active"
echo "π Stack status: docker-compose ps"
else
echo "β Docker Compose stack not active"
fi
echo ""
echo "π Expected endpoints:"
echo " - MCP Server: http://localhost:8000"
echo " - MCP SSE: http://localhost:8000/sse"
echo " - Neo4j Browser: http://localhost:7474 (neo4j/skynet123)"
echo " - Neo4j Bolt: bolt://localhost:7687"
echo ""
}
# Main execution
case "${1:-help}" in
docker-build)
docker_build
;;
docker-run)
docker_run
;;
docker-compose)
docker_compose
;;
dev-install)
dev_install
;;
local-run)
local_run
;;
test)
test_connection
;;
cleanup)
cleanup
;;
status)
status
;;
help|*)
show_usage
;;
esac