Files
mc/SETUP.md
2025-10-13 13:53:48 -05:00

242 lines
5.2 KiB
Markdown

# 🚀 Setup Guide for Minecraft Dashboard
## Quick Setup (Recommended)
### Step 1: Ensure Minecraft Server is Running
First, make sure your Minecraft server is running. Save this as `docker-compose.minecraft.yml`:
```yaml
version: '3.8'
services:
minecraft:
image: itzg/minecraft-server:latest
container_name: mc-java
environment:
EULA: "TRUE"
ENABLE_RCON: "true"
RCON_PASSWORD: "bethureddy1"
RCON_PORT: "25575"
TZ: "America/Chicago"
TYPE: "PAPER"
VERSION: "1.21.10"
MEMORY: "20G"
volumes:
- ./data:/data
expose:
- "25565"
restart: unless-stopped
networks:
- mcnet
nginx-stream:
image: nginx:1.27-alpine
container_name: mc-proxy
depends_on:
- minecraft
ports:
- "25565:25565/tcp"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
restart: unless-stopped
networks:
- mcnet
networks:
mcnet:
driver: bridge
```
Start the Minecraft server:
```bash
docker-compose -f docker-compose.minecraft.yml up -d
```
### Step 2: Start the Dashboard
Make the start script executable and run it:
```bash
chmod +x start-dashboard.sh
./start-dashboard.sh
```
Or manually:
```bash
docker-compose -f docker-compose.dashboard.yml up -d --build
```
### Step 3: Access the Dashboard
Open your browser and navigate to:
```
http://localhost:8080
```
## 🎯 What You'll See
The dashboard displays:
1. **Server Status** - Real-time online/offline indicator
2. **Control Buttons** - Start and Stop your server
3. **Player Count** - Current players vs max capacity
4. **Server Version** - Minecraft version running
5. **Latency** - Server response time
6. **TPS** - Server performance (if available)
7. **Online Players List** - Names of all connected players
8. **MOTD** - Server message of the day
## 🛠️ Troubleshooting
### Dashboard shows "Server Offline" but server is running
1. Check if both containers are on the same network:
```bash
docker network inspect mcnet
```
2. Verify RCON is enabled on the Minecraft server:
```bash
docker exec mc-java cat /data/server.properties | grep rcon
```
3. Check backend logs:
```bash
docker logs mc-dashboard-backend
```
### Start/Stop buttons don't work
The backend needs access to the Docker socket. Verify the volume mount:
```bash
docker inspect mc-dashboard-backend | grep docker.sock
```
Should show: `/var/run/docker.sock:/var/run/docker.sock`
### Dashboard won't load
1. Check if frontend is running:
```bash
docker ps | grep mc-dashboard-frontend
```
2. Check frontend logs:
```bash
docker logs mc-dashboard-frontend
```
3. Verify port 8080 is not in use:
```bash
lsof -i :8080
```
## 🔄 Updates and Maintenance
### Rebuild the Dashboard
```bash
docker-compose -f docker-compose.dashboard.yml up -d --build
```
### View Logs
```bash
# All services
docker-compose -f docker-compose.dashboard.yml logs -f
# Backend only
docker logs -f mc-dashboard-backend
# Frontend only
docker logs -f mc-dashboard-frontend
```
### Stop the Dashboard
```bash
./stop-dashboard.sh
```
Or manually:
```bash
docker-compose -f docker-compose.dashboard.yml down
```
## 🔐 Security Considerations
1. **Change RCON Password**: Update `RCON_PASSWORD` in both your Minecraft and dashboard configurations
2. **Firewall**: Only expose port 8080 to trusted networks
3. **Reverse Proxy**: Consider using nginx/traefik with authentication for production
4. **Docker Socket**: The backend needs Docker socket access - only run in trusted environments
## 📊 Port Usage
- **8080** - Dashboard web interface
- **3001** - Backend API (internal only)
- **25565** - Minecraft server
- **25575** - RCON (internal only)
## 🎨 Customization
### Change Dashboard Port
Edit `docker-compose.dashboard.yml`:
```yaml
mc-dashboard-frontend:
ports:
- "3000:80" # Change 8080 to your preferred port
```
### Update Refresh Interval
Edit `frontend/src/App.jsx`, line with `setInterval`:
```javascript
const interval = setInterval(fetchStatus, 10000) // 10 seconds instead of 5
```
## 🐳 Docker Commands Reference
```bash
# Start everything
docker-compose -f docker-compose.dashboard.yml up -d
# Stop everything
docker-compose -f docker-compose.dashboard.yml down
# Rebuild and restart
docker-compose -f docker-compose.dashboard.yml up -d --build
# View logs
docker-compose -f docker-compose.dashboard.yml logs -f
# Restart a specific service
docker-compose -f docker-compose.dashboard.yml restart mc-dashboard-backend
# Remove everything including volumes
docker-compose -f docker-compose.dashboard.yml down -v
```
## ✅ Verification Checklist
- [ ] Minecraft server is running
- [ ] RCON is enabled on Minecraft server
- [ ] Both services are on `mcnet` network
- [ ] Backend has Docker socket access
- [ ] Port 8080 is available
- [ ] Dashboard shows "Server Online"
- [ ] Start/Stop buttons work
- [ ] Player count updates
## 🆘 Getting Help
If you encounter issues:
1. Check logs: `docker-compose -f docker-compose.dashboard.yml logs`
2. Verify network: `docker network inspect mcnet`
3. Test RCON: `docker exec mc-java rcon-cli -p bethureddy1 list`
4. Restart everything: `./stop-dashboard.sh && ./start-dashboard.sh`
---
Happy Minecrafting! 🎮⛏️