mindXsh.md · 15.5 KB

mindX.sh - Comprehensive Deployment Script Documentation

Overview

mindX.sh is a production-focused deployment script for the MindX Augmentic Intelligence System. It provides automated setup, configuration, and service management for the entire MindX ecosystem.

Version: 2.0.0 Purpose: Complete MindX system deployment and management Target: Production environments, development setups, and hackathon deployments

🎯 Key Features

Automated Deployment

Modular Architecture

📋 Usage

Basic Usage

./mindX.sh <target_install_directory>

Advanced Usage

./mindX.sh [options] <target_install_directory>

Command Line Options

OptionDescriptionDefault
--config-file <path>Path to existing mindx_config.jsonAuto-generated
--dotenv-file <path>Path to existing .env fileAuto-generated
--runStart services after setupfalse
--interactivePrompt for API keys (Gemini, Mistral AI)false
--venv-name <name>Virtual environment name.mindx_env
--frontend-port <port>Frontend service port3000
--backend-port <port>Backend service port8000
--log-level <level>Application log levelINFO
-h, --helpShow help message-

Examples

Quick Setup (Development)

./mindX.sh --run /opt/mindx

Interactive Setup with API Keys

./mindX.sh --interactive --run /opt/mindx

Will prompt for Gemini and Mistral AI API keys

Production Deployment

./mindX.sh --config-file /path/to/prod-config.json \
           --dotenv-file /path/to/prod.env \
           --log-level WARNING \
           /opt/mindx-production

Custom Configuration

./mindX.sh --venv-name mindx-prod \
           --frontend-port 8080 \
           --backend-port 9000 \
           --run \
           /var/www/mindx

🏗️ Architecture

Directory Structure

<target_install_directory>/
├── .mindx_env/                    # Python virtual environment
├── data/                          # Data directory
│   ├── logs/                      # Application logs
│   ├── pids/                      # Process ID files
│   └── config/                    # Configuration files
├── mindx_backend_service/         # Backend API service
│   └── main_service.py           # FastAPI application
├── mindx_frontend_ui/             # Frontend UI service
│   ├── index.html                # Main UI page
│   ├── styles.css                # Styling
│   ├── app.js                    # Frontend logic
│   ├── server.js                 # Express server
│   └── package.json              # Node.js dependencies
├── .env                          # Environment configuration
└── [mindx source code]           # Core MindX modules

Service Architecture

Backend Service (FastAPI)

Frontend Service (Express.js)

🔧 Configuration

Interactive API Key Setup

The script supports interactive collection of API keys during setup using the --interactive flag:

./mindX.sh --interactive /opt/mindx

When interactive mode is enabled, the script will prompt for:

  1. Gemini API Key - From Google AI Studio (https://aistudio.google.com/app/apikey)
  2. Mistral AI API Key - From Mistral AI Console (https://console.mistral.ai/)

Features:

Example Interactive Session:

=== API Key Configuration ===
Enter your API keys (press Enter to skip and use defaults):

Gemini API Key (from https://aistudio.google.com/app/apikey): your-gemini-key-here

Mistral AI API Key (from https://console.mistral.ai/): your-mistral-key-here

[INFO] Gemini API key provided. [INFO] Mistral AI API key provided. [INFO] API key collection complete.

Environment Variables (.env)

The script generates a comprehensive .env file with the following sections:

General Configuration

# Logging Level
MINDX_LOG_LEVEL="INFO"

Default LLM Provider

MINDX_LLM__DEFAULT_PROVIDER="ollama"

LLM Provider Configuration

# Ollama Configuration
MINDX_LLM__OLLAMA__DEFAULT_MODEL="nous-hermes2:latest"
MINDX_LLM__OLLAMA__DEFAULT_MODEL_FOR_CODING="deepseek-coder:6.7b-instruct"

Gemini Configuration

GEMINI_API_KEY="YOUR_GEMINI_API_KEY_HERE" MINDX_LLM__GEMINI__DEFAULT_MODEL="gemini-1.5-flash-latest"

Mistral AI Configuration

MISTRAL_API_KEY="YOUR_MISTRAL_API_KEY_HERE" MINDX_LLM__MISTRAL__DEFAULT_MODEL="mistral-large-latest" MINDX_LLM__MISTRAL__DEFAULT_MODEL_FOR_CODING="codestral-latest"

Agent-Specific Configuration

# Self-Improvement Agent
MINDX_SELF_IMPROVEMENT_AGENT__LLM__PROVIDER="ollama"
MINDX_SELF_IMPROVEMENT_AGENT__LLM__MODEL="deepseek-coder:6.7b-instruct"

Coordinator Agent

MINDX_COORDINATOR__LLM__PROVIDER="ollama" MINDX_COORDINATOR__LLM__MODEL="nous-hermes2:latest"

Monitoring Configuration

# Resource Monitoring
MINDX_MONITORING__RESOURCE__ENABLED="true"
MINDX_MONITORING__RESOURCE__INTERVAL="15.0"

Performance Monitoring

MINDX_MONITORING__PERFORMANCE__ENABLE_PERIODIC_SAVE="true" MINDX_MONITORING__PERFORMANCE__PERIODIC_SAVE_INTERVAL_SECONDS="300"

JSON Configuration (mindx_config.json)

The script generates a comprehensive JSON configuration file:

{
  "system": {
    "version": "0.4.0",
    "name": "MindX Self-Improving System (Augmentic)"
  },
  "logging": {
    "uvicorn_level": "info"
  },
  "llm": {
    "providers": {
      "ollama": {"enabled": true},
      "gemini": {"enabled": true}
    }
  },
  "self_improvement_agent": {
    "analysis": {
      "max_code_chars": 70000,
      "max_description_tokens": 350
    }
  },
  "coordinator": {
    "autonomous_improvement": {
      "critical_components": [
        "mindx.learning.self_improve_agent",
        "mindx.orchestration.coordinator_agent",
        "mindx.utils.config"
      ]
    }
  },
  "tools": {
    "note_taking": {"enabled": true},
    "summarization": {"enabled": true},
    "web_search": {"enabled": true}
  }
}

🚀 Service Management

Starting Services

Automatic Start (with --run flag)

./mindX.sh --run /opt/mindx

Manual Start

# Backend Service
cd /opt/mindx/mindx_backend_service
/opt/mindx/.mindx_env/bin/python main_service.py

Frontend Service

cd /opt/mindx/mindx_frontend_ui node server.js

Service Monitoring

Check Service Status

# Check if services are running
ps aux | grep -E "(uvicorn|node server.js)"

Check PID files

cat /opt/mindx/data/pids/mindx_backend.pid cat /opt/mindx/data/pids/mindx_frontend.pid

View Logs

# Backend logs
tail -f /opt/mindx/data/logs/mindx_coordinator_service.log

Frontend logs

tail -f /opt/mindx/data/logs/mindx_frontend_service.log

Deployment logs

tail -f /opt/mindx/data/logs/mindx_deployment_setup.log

Stopping Services

Graceful Stop (Ctrl+C)

The script handles SIGINT/SIGTERM signals and gracefully stops all services.

Manual Stop

# Stop backend
kill $(cat /opt/mindx/data/pids/mindx_backend.pid)

Stop frontend

kill $(cat /opt/mindx/data/pids/mindx_frontend.pid)

🔌 API Endpoints

The script generates a comprehensive FastAPI backend with the following endpoints:

Core Commands

System Status

Identity Management

Coordinator Operations

Agent Management

🎨 Frontend Interface

The script generates a modern web interface with:

Features

UI Components

🛠️ Development Features

Graceful Degradation

Logging System

Error Handling

🔒 Security Features

File Permissions

Process Management

📊 Monitoring & Maintenance

Health Checks

Maintenance Tasks

🚨 Troubleshooting

Common Issues

Service Won't Start

# Check logs
tail -f /opt/mindx/data/logs/mindx_coordinator_service.log

Check Python environment

/opt/mindx/.mindx_env/bin/python --version

Check dependencies

/opt/mindx/.mindx_env/bin/pip list

Port Conflicts

# Check port usage
netstat -tlnp | grep :8000
netstat -tlnp | grep :3000

Use different ports

./mindX.sh --backend-port 9000 --frontend-port 4000 /opt/mindx

Permission Issues

# Fix permissions
chmod +x mindX.sh
chmod 600 /opt/mindx/.env
chmod 644 /opt/mindx/data/config/mindx_config.json

Debug Mode

# Enable debug logging
./mindX.sh --log-level DEBUG --run /opt/mindx

Check deployment logs

tail -f /opt/mindx/data/logs/mindx_deployment_setup.log

🎯 Best Practices

Production Deployment

  1. Use dedicated user - Run as non-root user
  2. Configure firewall - Restrict port access
  3. Set up monitoring - Use external monitoring tools
  4. Regular backups - Backup configuration and data
  5. Update dependencies - Keep packages current

Development Setup

  1. Use virtual environments - Isolate dependencies
  2. Enable debug logging - For troubleshooting
  3. Use local API keys - For testing
  4. Monitor logs - Watch for errors
  5. Test regularly - Verify functionality

Hackathon Deployment

  1. Quick setup - Use --run flag for immediate start
  2. Default configuration - Use built-in defaults
  3. Monitor status - Check service health
  4. Test endpoints - Verify API functionality
  5. Document changes - Keep track of modifications

📈 Performance Optimization

Resource Management

Scaling Considerations

🔄 Updates & Maintenance

Script Updates

# Backup current deployment
cp -r /opt/mindx /opt/mindx-backup-$(date +%Y%m%d)

Update script

wget https://raw.githubusercontent.com/your-repo/mindX.sh chmod +x mindX.sh

Re-deploy

./mindX.sh --run /opt/mindx

Configuration Updates

# Edit configuration
nano /opt/mindx/.env
nano /opt/mindx/data/config/mindx_config.json

Restart services

pkill -f "uvicorn\|node server.js" ./mindX.sh --run /opt/mindx

🎉 Conclusion

mindX.sh is a comprehensive deployment script that provides:

The script enables rapid deployment of the MindX system for development, testing, production, and hackathon environments while maintaining security, reliability, and maintainability.


All DocumentsDocument IndexThe Book of mindXImprovement JournalAPI Reference