Skip to content

rokhanz/nexus-cli-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

46 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Nexus CLI Docker Manager

All-in-One Solution for Running Nexus Network Prover with Docker & Screen Monitoring

License: MIT Docker Shell Script

๐Ÿ“‹ Table of Contents

โœจ Features

๐Ÿ”ง Core Features

  • One-Click Installation: Automated Docker & dependency setup
  • Smart Environment Management: Secure wallet & node configuration
  • Screen Session Monitoring: Background monitoring with easy attach/detach
  • Enhanced Docker Integration: Optimized networking with --network host
  • Robust Error Handling: Automatic retry mechanisms & graceful recovery

๐Ÿ›ก๏ธ Security & Reliability

  • Input Validation: Wallet address format verification
  • Secure Configuration: Environment file with proper permissions (600)
  • Clean Shutdown: Proper container & session cleanup
  • Health Monitoring: Container status & resource usage tracking

๐ŸŽฏ User Experience

  • Rich Logging: Color-coded output with emojis for easy reading
  • Debug Mode: Comprehensive system diagnostics
  • Multi-OS Support: Ubuntu, Debian, CentOS, Fedora, Arch Linux
  • Interactive Setup: Guided configuration process

๐Ÿš€ Quick Start

# Download the script
curl -sSL https://raw.githubusercontent.com/rokhanz/nexus-cli-docker/main/nexus-manager.sh -o nexus-manager.sh

# Make it executable
chmod +x nexus-manager.sh

# Install and setup
./nexus-manager.sh install

# Start the Nexus node
./nexus-manager.sh start

๐Ÿ’ป Installation

Prerequisites

  • OS: Linux (Ubuntu/Debian/CentOS/Fedora/Arch)
  • RAM: Minimum 2GB (recommended 4GB+)
  • Storage: 10GB free space
  • Network: Stable internet connection

Automated Installation

The script automatically handles:

  • โœ… Docker installation and configuration
  • โœ… Screen utility setup
  • โœ… System validation
  • โœ… Image building and optimization
  • โœ… Network configuration
./nexus-manager.sh install

During installation you'll be prompted for:

  • Wallet Address: Your Ethereum wallet (0x format, 40 characters)
  • Node ID: Unique identifier for your node (minimum 3 characters)

๐Ÿ“– Usage

Basic Workflow

  1. Install: ./nexus-manager.sh install
  2. Start: ./nexus-manager.sh start
  3. Monitor: ./nexus-manager.sh status or screen -r nexus
  4. Stop: ./nexus-manager.sh stop

๐ŸŽฎ Commands

Command Description Example
install Complete setup and installation ./nexus-manager.sh install
start Start Nexus node with monitoring ./nexus-manager.sh start
stop Stop node and cleanup ./nexus-manager.sh stop
restart Restart the node ./nexus-manager.sh restart
status Show current status ./nexus-manager.sh status
info Detailed container information ./nexus-manager.sh info
debug System diagnostics ./nexus-manager.sh debug
logs View container logs ./nexus-manager.sh logs
attach Attach to screen session ./nexus-manager.sh attach
uninstall Complete removal ./nexus-manager.sh uninstall
help Show help information ./nexus-manager.sh help

Advanced Usage

# Check detailed container info (ports, network, resources)
./nexus-manager.sh info

# Debug system issues
./nexus-manager.sh debug

# Monitor real-time logs
./nexus-manager.sh logs

# Quick status check
./nexus-manager.sh status

๐Ÿ“Š Monitoring

Screen Session Management

The script creates a dedicated screen session for monitoring:

# Attach to monitor
screen -r nexus

# Detach (keep running)
Ctrl+A, D

# List all sessions
screen -list

Container Monitoring

# Quick status
docker ps | grep nexus-node

# Resource usage
docker stats nexus-node

# Live logs
docker logs -f nexus-node

Status Output Example

๐Ÿ“Š Status Nexus Node:
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
Docker Container:
NAMES        STATUS         PORTS     IMAGE
nexus-node   Up 10 minutes            nexus-cli:latest

โœ… Screen Session: Aktif (nexus)
๐Ÿ”ต Gunakan 'screen -r nexus' untuk attach

Environment:
WALLET_ADDRESS=0x1234567890123456789012345678901234567890
NODE_ID=my-node-001
DEBUG=false
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

๐Ÿ”ง Troubleshooting

Common Issues

"docker ps -a tidak menampilkan port"

This is NORMAL when using --network host. The container uses all host ports directly for optimal performance.

Container restart loops

# Debug the issue
./nexus-manager.sh debug

# Check logs
./nexus-manager.sh logs

# Restart cleanly
./nexus-manager.sh restart

Screen session issues

# Check screen installation
screen -v

# Manual cleanup
screen -S nexus -X quit

# Restart
./nexus-manager.sh start

Network connectivity issues

# Check TUN device
ls -la /dev/net/tun

# Verify network interfaces
ip link show

# Debug system
./nexus-manager.sh debug

Debug Information

Use the built-in debug command for comprehensive diagnostics:

./nexus-manager.sh debug

This provides:

  • Screen session status
  • Docker container details
  • Environment configuration
  • Network interface information
  • System resource usage

Error Codes

  • Exit 1: System validation failed
  • Exit 1: Docker issues
  • Exit 1: Environment setup problems

๐Ÿ“ File Structure

~/nexus-cli-docker/
โ”œโ”€โ”€ .env                    # Environment configuration
โ”œโ”€โ”€ Dockerfile             # Docker image definition
โ””โ”€โ”€ config/
    โ””โ”€โ”€ config.json        # Node configuration

~/.nexus/                  # Nexus configuration directory

๐Ÿ”’ Security Notes

  • Environment file (.env) has restricted permissions (600)
  • Wallet address validation ensures proper format
  • Container runs with minimal required privileges
  • No sensitive data exposed in logs

๐Ÿš€ Performance Optimization

Network Configuration

  • Uses --network host for optimal performance
  • TUN device support for VPN capabilities
  • DNS configuration passthrough

Resource Management

  • Automatic restart policy: unless-stopped
  • Memory-efficient Docker image
  • Background processing with screen

๐Ÿ› ๏ธ Development

Prerequisites for Development

  • Docker installed
  • Bash 4.0+
  • Linux environment

Testing

# Syntax check
bash -n nexus-manager.sh

# Enable debug mode
export DEBUG=true
./nexus-manager.sh start

๐Ÿ“ž Support

Getting Help

  1. Check Status: ./nexus-manager.sh status
  2. Debug System: ./nexus-manager.sh debug
  3. View Logs: ./nexus-manager.sh logs
  4. Check Issues: GitHub Issues

Common Solutions

  • Port not showing: Normal with --network host
  • Container restarting: Check debug output
  • Screen not working: Reinstall with ./nexus-manager.sh install

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Nexus Network for the innovative prover network
  • Docker community for containerization standards
  • Screen maintainers for session management

โญ Star this repository if it helped you!

๐Ÿ› Found a bug? Report it

๐Ÿ’ก Have a suggestion? Let us know

Releases

No releases published

Packages

No packages published

Languages