mc-cluster/README.md
2024-12-06 06:38:37 -05:00

174 lines
4.4 KiB
Markdown

# Minecraft Cluster Deployment with Velocity Proxy and Holesail Integration
This master README consolidates all parts of the Minecraft Cluster setup using Docker. It includes deploying a Minecraft server cluster, configuring Velocity Proxy, and integrating Holesail for secure peer-to-peer connections.
---
## Overview
This project enables seamless deployment of a Minecraft server cluster with the following features:
- **Clustered Minecraft Servers:** Deployed using Docker Compose with FabricMC mod support.
- **Velocity Proxy:** Lightweight and flexible proxy for managing player connections.
- **Holesail Networking:** Secure peer-to-peer networking for connecting servers.
- **Mod Management:** Integrated mod management system for Minecraft servers.
- **PM2 Orchestration:** Manages processes and ensures stability.
---
## Prerequisites
- **Docker:** Version 20.10 or higher.
- **Docker Compose:** Version 1.29 or higher.
- **Node.js:** Version 18 or higher (for FabricMC version scripts and Holesail).
- **Basic Knowledge:** Understanding of Docker, Minecraft server administration, and basic Linux commands.
---
## Setup Instructions
### 1. Minecraft Host Node Setup
This step sets up the Minecraft cluster, consisting of multiple FabricMC servers.
1. **Clone the Repository:**
```bash
git clone https://git.ssh.surf/snxraven/mc-cluster.git
cd mc-cluster/mc-cluster-image
```
2. **Build the Minecraft Cluster Image:**
```bash
docker build . -t mc:cluster
```
3. **Navigate Back to the Main Directory:**
```bash
cd ..
```
4. **Start the Minecraft Cluster:**
```bash
docker-compose up -d
```
This will deploy a cluster of 4 Minecraft servers with unique Holesail connection strings.
---
### 2. JUMP Node Setup
The JUMP node hosts the Velocity proxy, managing player connections and routing traffic to the Minecraft cluster.
1. **Clone the Repository:**
```bash
git clone https://git.ssh.surf/snxraven/mc-cluster.git
cd mc-cluster/velocity-image
```
2. **Build the Velocity Proxy Image:**
```bash
docker build . -t velocity:proxy
```
3. **Start the Velocity Proxy:**
```bash
docker-compose up -d
```
---
## Configuration
### Holesail Connection Strings
To customize the Holesail connection strings:
1. **Edit the `pm2-setup.sh` File:**
```bash
cd mc-cluster/holesail-connector
nano pm2-setup.sh
```
Update the `connections` array with your desired connection strings and ports.
Example:
```bash
connections=(
["mc-server-1"]="5000"
["mc-server-2"]="5001"
)
```
2. **Modify the Docker Compose File:**
```bash
cd mc-cluster
nano docker-compose.yml
```
Update the `CONNECTION_STRING` and `PORT` environment variables for each Minecraft server.
---
## Managing the Cluster
### Logs and Debugging
- **View PM2 Logs for Minecraft Servers:**
```bash
docker exec -it mc-server-1 pm2 logs
```
- **View Velocity Proxy Logs:**
```bash
docker exec -it velocity-proxy pm2 logs
```
### Add or Remove Minecraft Servers
1. Edit the `docker-compose.yml` file in the root directory to add or remove server configurations.
2. Restart the cluster:
```bash
docker-compose down
docker-compose up -d
```
---
## Notes
1. **Ports and Connection Strings:** Ensure no conflicts with other services when configuring ports.
2. **Security:** Update `forwarding.secret` in the Velocity Proxy setup for secure player forwarding.
3. **Default Passwords:** Change the default root password (`noshallpass`) for better security.
---
## Directory Structure Overview
```plaintext
mc-cluster/
├── mc-cluster-image/
│ ├── Dockerfile
│ ├── pm2/
│ ├── scripts/
│ ├── server.properties
│ ├── get_latest_fabric_version.js
│ ├── mod-manager-installer.sh
│ └── start.sh
├── velocity-image/
│ ├── Dockerfile
│ ├── velocity.toml
│ ├── pm2/startServer.json
│ ├── start.sh
│ └── forwarding.secret
├── holesail-connector/
│ ├── Dockerfile
│ └── pm2-setup.sh
└── docker-compose.yml
```
---
## Future Extensions
- **Additional Nodes:** Add more Minecraft servers or JUMP nodes to scale the deployment.
- **Mod Automation:** Enhance the mod manager for auto-updating and downloading new mods.
- **Monitoring Tools:** Integrate monitoring tools like Netdata for better visibility into server performance.