Download platform/signalcore/deploy_phase2.sh from LevelUp2x/adaptai: direct link, hf CLI and curl.
- Browser
- Download file 11.3 kB
-
https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/main/platform/signalcore/deploy_phase2.sh
- Command line
-
hf download hf://datasets/LevelUp2x/adaptai/platform/signalcore/deploy_phase2.sh
-
curl -L -o deploy_phase2.sh https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/main/platform/signalcore/deploy_phase2.sh
11.3 kB
| # Phase 2 Cross-Domain Integration Deployment | |
| # Deploy CommsOps Neuromorphic Security & DataOps Integration | |
| set -e # Exit on any error | |
| # Colors for output | |
| RED='\033[0;31m' | |
| GREEN='\033[0;32m' | |
| YELLOW='\033[1;33m' | |
| BLUE='\033[0;34m' | |
| NC='\033[0m' # No Color | |
| echo -e "${BLUE}π Phase 2 Cross-Domain Integration Deployment${NC}" | |
| echo "==============================================================" | |
| # Check if we're in the correct directory | |
| if [ ! -d "commsops" ]; then | |
| echo -e "${RED}β Must run from signalcore directory${NC}" | |
| echo "Current directory: $(pwd)" | |
| exit 1 | |
| fi | |
| # Check Python availability | |
| echo -e "${YELLOW}π Checking Python environment...${NC}" | |
| if ! command -v python3 &> /dev/null; then | |
| echo -e "${RED}β Python3 not found${NC}" | |
| exit 1 | |
| fi | |
| python_version=$(python3 --version) | |
| echo -e "${GREEN}β Python version: ${python_version}${NC}" | |
| # Check required Python packages | |
| echo -e "${YELLOW}π¦ Checking Python dependencies...${NC}" | |
| required_packages=("numpy" "asyncio" "dataclasses") | |
| for package in "${required_packages[@]}"; do | |
| if ! python3 -c "import $package" 2>/dev/null; then | |
| echo -e "${RED}β Missing required package: $package${NC}" | |
| echo "Install with: pip3 install $package" | |
| exit 1 | |
| fi | |
| echo -e "${GREEN}β Package available: $package${NC}" | |
| done | |
| # Test the neuromorphic security system | |
| echo -e "${YELLOW}π Testing Neuromorphic Security System...${NC}" | |
| cd commsops | |
| if ! python3 neuromorphic_security.py; then | |
| echo -e "${RED}β Neuromorphic security test failed${NC}" | |
| exit 1 | |
| fi | |
| echo -e "${GREEN}β Neuromorphic security system test passed${NC}" | |
| # Test the DataOps integration | |
| echo -e "${YELLOW}π Testing DataOps Integration...${NC}" | |
| if ! python3 dataops_integration.py; then | |
| echo -e "${RED}β DataOps integration test failed${NC}" | |
| exit 1 | |
| fi | |
| echo -e "${GREEN}β DataOps integration test passed${NC}" | |
| # Create service files for production deployment | |
| echo -e "${YELLOW}π Creating production service files...${NC}" | |
| # Neuromorphic Security Service | |
| cat > neuromorphic-security.service << 'EOF' | |
| [Unit] | |
| Description=CommsOps Neuromorphic Security Service | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| User=root | |
| WorkingDirectory=/data/adaptai/platform/signalcore/commsops | |
| ExecStart=/usr/bin/python3 /data/adaptai/platform/signalcore/commsops/neuromorphic_security_service.py | |
| Restart=always | |
| RestartSec=5 | |
| Environment=PYTHONUNBUFFERED=1 | |
| [Install] | |
| WantedBy=multi-user.target | |
| EOF | |
| echo -e "${GREEN}β Neuromorphic security service file created${NC}" | |
| # DataOps Integration Service | |
| cat > dataops-integration.service << 'EOF' | |
| [Unit] | |
| Description=CommsOps DataOps Integration Service | |
| After=network.target neuromorphic-security.service | |
| [Service] | |
| Type=simple | |
| User=root | |
| WorkingDirectory=/data/adaptai/platform/signalcore/commsops | |
| ExecStart=/usr/bin/python3 /data/adaptai/platform/signalcore/commsops/dataops_integration_service.py | |
| Restart=always | |
| RestartSec=5 | |
| Environment=PYTHONUNBUFFERED=1 | |
| [Install] | |
| WantedBy=multi-user.target | |
| EOF | |
| echo -e "${GREEN}β DataOps integration service file created${NC}" | |
| # Create the service wrapper scripts | |
| echo -e "${YELLOW}π Creating service wrapper scripts...${NC}" | |
| # Neuromorphic Security Service Wrapper | |
| cat > neuromorphic_security_service.py << 'EOF' | |
| #!/usr/bin/env python3 | |
| """ | |
| Neuromorphic Security Service Wrapper | |
| Production service for cross-domain security scanning | |
| """ | |
| import asyncio | |
| import signal | |
| import sys | |
| from neuromorphic_security import NeuromorphicSecurityAPI | |
| class SecurityService: | |
| def __init__(self): | |
| self.api = NeuromorphicSecurityAPI() | |
| self.running = True | |
| async def run_service(self): | |
| """Main service loop""" | |
| print("π Neuromorphic Security Service starting...") | |
| # Initialize the API | |
| print("π§ Initializing neuromorphic security patterns...") | |
| # Service main loop | |
| while self.running: | |
| try: | |
| # Simulate processing messages | |
| await asyncio.sleep(1) | |
| # Print heartbeat every 10 seconds | |
| if int(asyncio.get_event_loop().time()) % 10 == 0: | |
| metrics = await self.api.get_security_metrics() | |
| print(f"π Service heartbeat: {metrics['total_messages_scanned']} messages scanned") | |
| except asyncio.CancelledError: | |
| break | |
| except Exception as e: | |
| print(f"β οΈ Service error: {e}") | |
| await asyncio.sleep(5) | |
| def shutdown(self): | |
| """Graceful shutdown""" | |
| print("π Shutting down neuromorphic security service...") | |
| self.running = False | |
| async def main(): | |
| service = SecurityService() | |
| # Setup signal handlers | |
| def signal_handler(sig, frame): | |
| service.shutdown() | |
| signal.signal(signal.SIGINT, signal_handler) | |
| signal.signal(signal.SIGTERM, signal_handler) | |
| try: | |
| await service.run_service() | |
| except KeyboardInterrupt: | |
| service.shutdown() | |
| finally: | |
| print("β Neuromorphic Security Service stopped") | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |
| EOF | |
| chmod +x neuromorphic_security_service.py | |
| echo -e "${GREEN}β Neuromorphic security service wrapper created${NC}" | |
| # DataOps Integration Service Wrapper | |
| cat > dataops_integration_service.py << 'EOF' | |
| #!/usr/bin/env python3 | |
| """ | |
| DataOps Integration Service Wrapper | |
| Production service for cross-domain data operations | |
| """ | |
| import asyncio | |
| import signal | |
| import sys | |
| from dataops_integration import DataOpsIntegration, create_dataops_integration | |
| class DataOpsService: | |
| def __init__(self): | |
| self.integration = create_dataops_integration() | |
| self.running = True | |
| async def run_service(self): | |
| """Main service loop""" | |
| print("π DataOps Integration Service starting...") | |
| # Initialize the integration | |
| print("π§ Initializing DataOps integration...") | |
| # Service main loop | |
| while self.running: | |
| try: | |
| # Simulate processing operations | |
| await asyncio.sleep(1) | |
| # Print heartbeat every 15 seconds | |
| if int(asyncio.get_event_loop().time()) % 15 == 0: | |
| metrics = await self.integration.get_performance_metrics() | |
| print(f"π Service heartbeat: {metrics['integration_metrics']['total_operations']} operations processed") | |
| except asyncio.CancelledError: | |
| break | |
| except Exception as e: | |
| print(f"β οΈ Service error: {e}") | |
| await asyncio.sleep(5) | |
| def shutdown(self): | |
| """Graceful shutdown""" | |
| print("π Shutting down DataOps integration service...") | |
| self.running = False | |
| async def main(): | |
| service = DataOpsService() | |
| # Setup signal handlers | |
| def signal_handler(sig, frame): | |
| service.shutdown() | |
| signal.signal(signal.SIGINT, signal_handler) | |
| signal.signal(signal.SIGTERM, signal_handler) | |
| try: | |
| await service.run_service() | |
| except KeyboardInterrupt: | |
| service.shutdown() | |
| finally: | |
| print("β DataOps Integration Service stopped") | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |
| EOF | |
| chmod +x dataops_integration_service.py | |
| echo -e "${GREEN}β DataOps integration service wrapper created${NC}" | |
| # Copy service files to systemd directory (if permitted) | |
| echo -e "${YELLOW}π Installing service files...${NC}" | |
| if [ -d "/etc/systemd/system" ]; then | |
| sudo cp neuromorphic-security.service /etc/systemd/system/ | |
| sudo cp dataops-integration.service /etc/systemd/system/ | |
| echo -e "${GREEN}β Service files installed to /etc/systemd/system/${NC}" | |
| # Reload systemd and enable services | |
| sudo systemctl daemon-reload | |
| echo -e "${YELLOW}βοΈ Enabling services...${NC}" | |
| sudo systemctl enable neuromorphic-security.service | |
| sudo systemctl enable dataops-integration.service | |
| echo -e "${GREEN}β Services enabled${NC}" | |
| # Start the services | |
| echo -e "${YELLOW}π Starting services...${NC}" | |
| sudo systemctl start neuromorphic-security.service | |
| sudo systemctl start dataops-integration.service | |
| echo -e "${GREEN}β Services started successfully${NC}" | |
| # Check service status | |
| echo -e "${YELLOW}π Service status:${NC}" | |
| sudo systemctl status neuromorphic-security.service --no-pager -l | |
| echo "" | |
| sudo systemctl status dataops-integration.service --no-pager -l | |
| else | |
| echo -e "${YELLOW}β οΈ Systemd directory not available, manual deployment required${NC}" | |
| echo "Service files have been created in current directory:" | |
| echo " - neuromorphic-security.service" | |
| echo " - dataops-integration.service" | |
| echo " - neuromorphic_security_service.py" | |
| echo " - dataops_integration_service.py" | |
| echo "" | |
| echo "Manual deployment commands:" | |
| echo " sudo cp *.service /etc/systemd/system/" | |
| echo " sudo systemctl daemon-reload" | |
| echo " sudo systemctl enable --now neuromorphic-security.service" | |
| echo " sudo systemctl enable --now dataops-integration.service" | |
| fi | |
| # Create deployment verification script | |
| cat > verify_deployment.sh << 'EOF' | |
| #!/bin/bash | |
| # Phase 2 Deployment Verification Script | |
| echo "π Verifying Phase 2 Deployment..." | |
| # Check if services are running | |
| if systemctl is-active --quiet neuromorphic-security.service; then | |
| echo "β Neuromorphic Security Service: ACTIVE" | |
| else | |
| echo "β Neuromorphic Security Service: INACTIVE" | |
| fi | |
| if systemctl is-active --quiet dataops-integration.service; then | |
| echo "β DataOps Integration Service: ACTIVE" | |
| else | |
| echo "β DataOps Integration Service: INACTIVE" | |
| fi | |
| # Test functionality | |
| echo "π§ͺ Testing functionality..." | |
| cd /data/adaptai/platform/signalcore/commsops | |
| if python3 -c " | |
| import asyncio | |
| from neuromorphic_security import NeuromorphicSecurityAPI | |
| async def test(): | |
| api = NeuromorphicSecurityAPI() | |
| result = await api.scan_message(b'test message', 'data_ops') | |
| print(f'Security scan test: {result.approved}') | |
| return result.approved | |
| result = asyncio.run(test()) | |
| print(f'β Security scan test completed: {result}') | |
| "; then | |
| echo "β Security functionality verified" | |
| else | |
| echo "β Security functionality test failed" | |
| fi | |
| echo "π Deployment verification complete!" | |
| EOF | |
| chmod +x verify_deployment.sh | |
| echo -e "${GREEN}β Deployment verification script created${NC}" | |
| # Final deployment summary | |
| echo "" | |
| echo -e "${BLUE}π Phase 2 Deployment Complete!${NC}" | |
| echo "==============================================================" | |
| echo "Services deployed:" | |
| echo " - neuromorphic-security.service (Neuromorphic Security)" | |
| echo " - dataops-integration.service (DataOps Integration)" | |
| echo "" | |
| echo "Next steps:" | |
| echo " 1. Run verification: ./verify_deployment.sh" | |
| echo " 2. Check logs: journalctl -u neuromorphic-security.service -f" | |
| echo " 3. Monitor performance: watch systemctl status dataops-integration.service" | |
| echo " 4. Integrate with monitoring dashboard" | |
| echo "" | |
| echo -e "${GREEN}π Phase 2 Cross-Domain Integration is now LIVE!${NC}" |