A professional, production-ready Minecraft server management toolkit with automated setup, comprehensive monitoring, backup solutions, and performance optimization.
- ๐ Automated Server Management - One-command server setup and deployment
- ๐ Real-time Monitoring - Health checks, performance metrics, and player activity tracking
- ๐พ Automated Backups - Scheduled backups with rotation and compression
- ๐ Auto-Restart & Crash Recovery - Watchdog service for maximum uptime
- ๐ Log Management - Automatic log rotation, compression, and archiving
- ๐ฏ Cross-Platform Support - Java + Bedrock Edition via Geyser
- โก Performance Optimized - GraalVM support with tuned JVM flags
- ๐ง Mod Management - Profile-based mod organization and updates
- ๐ Public Hosting Ready - Playit.gg and Infrarust proxy support
- Quick Start
- Installation
- Server Scripts
- Management Tools
- Configuration
- Documentation
- Directory Structure
# 1. Clone the repository
git clone <your-repo-url>
cd MC-Server
# 2. Download and install Fabric server
./scripts/mcdl.sh
# 3. Accept EULA and prepare server
./scripts/prepare.sh
# 4. Start the server
./scripts/server-start.sh# Monitor server health
./tools/monitor.sh status
# Create backup
./tools/backup.sh backup
# Start watchdog (auto-restart on crash)
./tools/watchdog.sh monitor
# Rotate logs
./tools/logrotate.sh maintenance
```text
## ๐ฆ Installation
### System Requirements
- **OS**: Linux (Ubuntu 20.04+, Debian 11+, or similar)
- **RAM**: Minimum 4GB, Recommended 8GB+
- **Disk**: 10GB+ free space
- **Java**: Java 21+ (GraalVM recommended)
### Required Dependencies
```bash
# Ubuntu/Debian
sudo apt update
sudo apt install -y openjdk-21-jdk curl wget unzip screen
# Optional: Install GraalVM for better performance
# Download from https://www.graalvm.org/downloads/
```text
### Optional Dependencies
```bash
# Fast parallel downloads
sudo apt install -y aria2
# JSON processing (choose one)
sudo apt install -y jq # or
cargo install jaq
# Network utilities
sudo apt install -y netcat-openbsd
```text
## ๐ฎ Server Scripts
Located in `scripts/` directory:
### `server-start.sh`
Main server launcher with advanced optimizations
**Features:**
- Auto-detection of CPU cores and RAM
- GraalVM or Eclipse Temurin JDK support
- Optimized G1GC garbage collection settings
- Transparent Huge Pages support
- GameMode integration for performance
- Playit.gg tunnel support
**Usage:**
```bash
./scripts/server-start.sh
# Use specific JDK
MC_JDK=graalvm ./scripts/server-start.sh
MC_JDK=temurin ./scripts/server-start.sh
```text
### `mcdl.sh`
Fabric server downloader and installer
**Usage:**
```bash
./scripts/mcdl.sh [version] # Downloads specified version
./scripts/mcdl.sh # Downloads latest version
```text
### `mod-updates.sh`
Comprehensive mod manager with Modrinth and CurseForge support
**Features:**
- Profile-based mod organization
- Automatic version compatibility checking
- Parallel mod downloading
- Configuration management
**Usage:**
```bash
# Create profile
./scripts/mod-updates.sh profile create my-mods 1.21.5 fabric ./mods
# Add mods
./scripts/mod-updates.sh add modrinth sodium
./scripts/mod-updates.sh add modrinth lithium
# Download/update all mods
./scripts/mod-updates.sh upgrade
# List mods
./scripts/mod-updates.sh list
```text
### `mc-client.sh`
Minecraft Java Edition client launcher
**Usage:**
```bash
./scripts/mc-client.sh 1.21.5 YourUsername
MC_DIR=/custom/path ./scripts/mc-client.sh 1.21.5 Player
```text
### `prepare.sh`
Initial server preparation (EULA acceptance, directory setup)
### `infrarust.sh`
Infrarust proxy tunnel configuration
## ๐ ๏ธ Management Tools
Located in `tools/` directory:
### `backup.sh` - Backup Management
Automated backup solution for worlds, configurations, and mods.
**Features:**
- Automated world backups with server notifications
- Configuration and mod backups
- Automatic backup rotation (keeps last N backups)
- Restore functionality
- Compression support
**Usage:**
```bash
# Full backup
./tools/backup.sh backup
# Backup specific components
./tools/backup.sh backup world
./tools/backup.sh backup config
./tools/backup.sh backup mods
# List backups
./tools/backup.sh list
# Restore backup
./tools/backup.sh restore backups/worlds/world_20250119_120000.tar.gz
# Clean old backups
./tools/backup.sh cleanup --max-backups 10
```text
**Automated Backups:**
```bash
# Add to crontab for daily backups at 4 AM
0 4 * * * cd /path/to/MC-Server && ./tools/backup.sh backup all
```text
### `monitor.sh` - Server Monitoring
Real-time server health monitoring and performance tracking.
**Features:**
- Process and port status checking
- Memory and CPU usage tracking
- Disk space monitoring
- Player activity tracking
- Error detection and reporting
- TPS monitoring (with Spark plugin)
**Usage:**
```bash
# Show status
./tools/monitor.sh status
# Continuous monitoring
./tools/monitor.sh watch
# Health check (for scripts)
./tools/monitor.sh alert
# View player activity
./tools/monitor.sh players
# Check errors
./tools/monitor.sh errors
```text
### `watchdog.sh` - Auto-Restart & Crash Recovery
Automatic server monitoring with crash recovery and restart capabilities.
**Features:**
- Automatic restart on crashes
- Configurable restart attempts and cooldowns
- Emergency backup before restart
- Graceful shutdown handling
- Scheduled restarts with player warnings
**Usage:**
```bash
# Start watchdog monitor (run in screen/tmux)
./tools/watchdog.sh monitor
# Scheduled restart with 10-minute warning
./tools/watchdog.sh restart 600
# Immediate restart
./tools/watchdog.sh restart 0
# Start server
./tools/watchdog.sh start
# Stop server
./tools/watchdog.sh stop
# Check status
./tools/watchdog.sh status
```text
**Run as Background Service:**
```bash
# Using screen
screen -dmS watchdog bash -c "cd /path/to/MC-Server && ./tools/watchdog.sh monitor"
# Using tmux
tmux new-session -d -s watchdog "cd /path/to/MC-Server && ./tools/watchdog.sh monitor"
```text
### `logrotate.sh` - Log Management
Automated log rotation, compression, and archiving.
**Features:**
- Automatic log rotation based on size
- Compression of old logs
- Age-based cleanup
- Archive size limiting
- Log viewing and searching
**Usage:**
```bash
# Full maintenance
./tools/logrotate.sh maintenance
# Rotate logs
./tools/logrotate.sh rotate
# Compress old logs
./tools/logrotate.sh compress
# Clean logs older than 14 days
./tools/logrotate.sh clean 14
# Show statistics
./tools/logrotate.sh stats
# View log
./tools/logrotate.sh view latest.log 100
# Search logs
./tools/logrotate.sh search "error" latest.log
```text
**Automated Log Rotation:**
```bash
# Add to crontab for weekly log maintenance
0 3 * * 0 cd /path/to/MC-Server && ./tools/logrotate.sh maintenance
```text
## โ๏ธ Configuration
### Environment Variables
**Server Launcher (`server-start.sh`)**:
- `MC_JDK` - JDK selection: `graalvm` or `temurin` (default: auto-detect)
- `JAVA_GRAALVM` - Path to GraalVM installation
- `JAVA_TEMURIN` - Path to Temurin installation
**Client Launcher (`mc-client.sh`)**:
- `MC_DIR` - Minecraft directory (default: `~/.minecraft`)
**Mod Manager (`mod-updates.sh`)**:
- `XDG_CONFIG_HOME` - Config directory (default: `~/.config`)
### Server Properties
Edit `server.properties` to configure:
- Server port, IP binding
- Max players, view distance
- Game mode, difficulty
- World generation settings
### Plugin Configuration
All plugin configs are in `config/` directory:
- **ServerCore** (`config/servercore/`) - Performance optimization settings
- **Geyser** (`config/Geyser-Fabric/`) - Bedrock Edition support
- **Floodgate** (`config/floodgate/`) - Bedrock authentication
- And more...
## ๐ Documentation
Detailed documentation available in `docs/`:
- **[SETUP.md](docs/SETUP.md)** - Comprehensive setup guide
- **[TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)** - Common issues and solutions
- **[TOOLS.md](docs/TOOLS.md)** - Detailed tool documentation
- **[Flags.txt](docs/Flags.txt)** - JVM optimization flags reference
- **[mods.txt](docs/mods.txt)** - Complete list of installed mods
## ๐ Directory Structure
```text
MC-Server/
โโโ scripts/ # Server management scripts
โ โโโ server-start.sh # Main server launcher
โ โโโ mod-updates.sh # Mod management
โ โโโ mcdl.sh # Fabric downloader
โ โโโ mc-client.sh # Client launcher
โ โโโ prepare.sh # Initial setup
โ โโโ infrarust.sh # Proxy configuration
โ โโโ test_common.sh # Tests
โ
โโโ tools/ # Management utilities
โ โโโ backup.sh # Backup automation
โ โโโ monitor.sh # Server monitoring
โ โโโ watchdog.sh # Auto-restart & crash recovery
โ โโโ logrotate.sh # Log management
โ
โโโ config/ # Plugin configurations
โ โโโ servercore/ # ServerCore settings
โ โโโ Geyser-Fabric/ # Geyser configuration
โ โโโ floodgate/ # Floodgate settings
โ โโโ ... # Other plugin configs
โ
โโโ docs/ # Documentation
โ โโโ SETUP.md # Setup guide
โ โโโ TROUBLESHOOTING.md # Troubleshooting guide
โ โโโ TOOLS.md # Tools documentation
โ โโโ Flags.txt # JVM flags reference
โ โโโ mods.txt # Mod list
โ โโโ TODO.md # Development TODO
โ
โโโ backups/ # Backup storage
โ โโโ worlds/ # World backups
โ โโโ configs/ # Config backups
โ
โโโ lib/ # Shared utilities
โ โโโ common.sh # Common functions
โ
โโโ .github/ # GitHub configuration
โ โโโ workflows/ # CI/CD pipelines
โ โโโ ISSUE_TEMPLATE/ # Issue templates
โ
โโโ server.properties # Minecraft server config
โโโ config.yaml # Infrarust config
โโโ gamemode.ini # GameMode settings
โโโ README.md # This file
```text
## ๐ง Maintenance Tasks
### Daily
- Monitor server status: `./tools/monitor.sh status`
- Check for errors: `./tools/monitor.sh errors`
### Weekly
- Create backup: `./tools/backup.sh backup`
- Rotate logs: `./tools/logrotate.sh maintenance`
- Update mods: `./scripts/mod-updates.sh upgrade`
### Monthly
- Clean old backups: `./tools/backup.sh cleanup`
- Clean old logs: `./tools/logrotate.sh clean 30`
- Review server performance and adjust configs
## ๐ค Contributing
Contributions are welcome! Please read our contributing guidelines:
1. Fork the repository
2. Create a 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
This project is licensed under the MIT License - see the LICENSE file for details.
## ๐ Acknowledgments
- [Fabric](https://fabricmc.net/) - Modding framework
- [Geyser](https://geysermc.org/) - Bedrock Edition support
- [ServerCore](https://modrinth.com/mod/servercore) - Performance optimization
- [Ferium](https://github.com/gorilla-devs/ferium) - Mod manager inspiration
- [GraalVM](https://www.graalvm.org/) - High-performance JVM
## ๐ Useful Resources
- [Minecraft Server Optimization Guide](https://github.com/YouHaveTrouble/minecraft-optimization)
- [Fabric Mod List](https://fabricmc.net/use/mods/)
- [Modrinth](https://modrinth.com/) - Mod repository
- [Server Optimization Flags](docs/Flags.txt)
## ๐ Support
- ๐ [Report Issues](../../issues)
- ๐ฌ [Discussions](../../discussions)
- ๐ [Documentation](docs/)
---
**Note**: This is a production-ready server management suite. Always test changes in a development environment before applying to production servers.