Skip to content

faruk-guler/Neutron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

424 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Neutron v10 Web - Automation Platform

Neutron Logo

Lightweight, Powerful, and Modern Web-Based Infrastructure Automation Tool

License Python Node

✨ Features

  • πŸ–₯️ Modern Web UI - Beautiful, responsive dashboard with real-time updates
  • πŸš€ Parallel Execution - Run commands on multiple hosts simultaneously
  • πŸ“‚ File Manager - Push/pull files across hosts with ease
  • πŸ“œ Playbooks - Create and automate multi-step deployments
  • πŸ’» Interactive Terminal - Real-time terminal with xterm.js
  • πŸ“Š Dashboard - Monitor infrastructure with live statistics and charts
  • πŸ“ Command History - Track all executed commands
  • πŸ”’ SSH Key-Based Auth - Secure, password-less authentication
  • ⚑ FastAPI Backend - High-performance async API
  • 🎨 React + TailwindCSS - Modern, customizable frontend

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • Node.js 18+
  • SSH key for host authentication

Installation

Windows:

.\setup-web.bat

Linux/Mac:

chmod +x setup-web.sh
./setup-web.sh

Manual Setup

Backend:

cd backend
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or
venv\Scripts\activate     # Windows

pip install -r requirements.txt

Frontend:

cd frontend
npm install
npm run build

Running

Production Mode (Single Server):

cd backend
source venv/bin/activate  # or venv\Scripts\activate on Windows
uvicorn main:app --host 0.0.0.0 --port 8080

Development Mode (Two Servers):

# Terminal 1 - Backend
cd backend
source venv/bin/activate
uvicorn main:app --host 0.0.0.0 --port 8080

# Terminal 2 - Frontend
cd frontend
npm run dev

Access

πŸ”§ Configuration

SSH Key Setup

Generate SSH key pair:

ssh-keygen -t ed25519 -f ~/.ssh/neutron.key
chmod 600 ~/.ssh/neutron.key

Distribute public key to hosts:

ssh-copy-id -i ~/.ssh/neutron.key.pub root@192.168.1.100

Import from Config File

Neutron Web can automatically import hosts from config.yaml:

ssh_user: "root"
private_key_file: "~/.ssh/neutron.key"
strict_host_key_checking: "no"

hosts:
  - "192.168.1.100:22"
  - "192.168.1.101:22"

Place config.yaml in the project root and hosts will be auto-imported on startup.

πŸ“– API Documentation

Once the backend is running, visit http://localhost:8080/docs for interactive API documentation.

Key Endpoints

GET    /api/hosts                - List all hosts
POST   /api/hosts                - Add new host
PUT    /api/hosts/{id}           - Update host
DELETE /api/hosts/{id}           - Delete host
POST   /api/hosts/{id}/connect   - Connect to host
POST   /api/commands/execute     - Execute command
POST   /api/files/push           - Upload file
POST   /api/files/pull           - Download file
GET    /api/playbooks            - List playbooks
POST   /api/playbooks            - Create playbook
POST   /api/playbooks/execute    - Run playbook
GET    /api/history              - Command history
GET    /api/dashboard            - Dashboard stats

🎯 Usage Examples

1. Add Hosts

Navigate to /hosts and click "Add Host" or use the API:

curl -X POST http://localhost:8080/api/hosts \
  -H "Content-Type: application/json" \
  -d '{
    "name": "web-server-1",
    "ip_address": "192.168.1.100",
    "port": 22,
    "user": "root"
  }'

2. Execute Commands

Use the Terminal page at /terminal:

  1. Select target hosts
  2. Enter command (e.g., uptime, df -h)
  3. Click Execute to run on all selected hosts in parallel

3. Create Playbook

Navigate to /playbooks:

  1. Click "New Playbook"
  2. Add commands sequentially
  3. Select target hosts
  4. Execute with one click

Example playbook:

Name: Deploy Web App
Commands:
  1. systemctl stop nginx
  2. cd /var/www && git pull
  3. systemctl start nginx
  4. systemctl status nginx

4. Transfer Files

Use the Files page at /files:

  • Push: Upload local file to multiple hosts
  • Pull: Download remote file from multiple hosts

πŸ›‘οΈ Security

  • SSH key-only authentication (no passwords)
  • Configurable StrictHostKeyChecking
  • Input sanitization on all endpoints
  • SQLite database with proper permissions
  • CORS configured for production use

πŸ“ Project Structure

neutron-v10-web/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py              # FastAPI application
β”‚   β”œβ”€β”€ ssh_manager.py       # SSH connection pool
β”‚   β”œβ”€β”€ commands.py          # Command executor
β”‚   β”œβ”€β”€ models.py            # SQLAlchemy models
β”‚   └── requirements.txt     # Python dependencies
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.jsx          # Main app router
β”‚   β”‚   β”œβ”€β”€ main.jsx         # React entry point
β”‚   β”‚   β”œβ”€β”€ components/      # Reusable components
β”‚   β”‚   β”œβ”€β”€ pages/           # Page components
β”‚   β”‚   └── services/        # API client
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”œβ”€β”€ config.yaml              # SSH configuration & hosts
β”œβ”€β”€ .env.example             # Environment variables template
β”œβ”€β”€ setup-web.bat            # Windows setup script
β”œβ”€β”€ setup-web.sh             # Linux/Mac setup script
└── README.md

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

Apache License 2.0 - See LICENSE for details

πŸ‘₯ Author

faruk-guler - github.com/faruk-guler

πŸ™ Acknowledgments

  • FastAPI for the amazing backend framework
  • React and the frontend ecosystem
  • Paramiko for SSH support
  • xterm.js for terminal emulation

Neutron v10 Web - Modern infrastructure automation made simple ⚑

About

Ansible Alternative Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors