Updated to only shulker container
Some checks failed
Build and Push Shulker Image / build (push) Failing after 4s
Some checks failed
Build and Push Shulker Image / build (push) Failing after 4s
This commit is contained in:
206
README.md
206
README.md
@@ -1,26 +1,192 @@
|
|||||||
Website for TFMC (teknisk fysiks minecraft server)
|
# Discord-Minecraft Bridge with Shulker
|
||||||
|
|
||||||
|
A Dockerized Discord-Minecraft chat bridge using [Shulker](https://github.com/destruc7i0n/shulker). This allows bidirectional communication between your Minecraft server and a Discord channel - players can chat from Discord to Minecraft and vice versa.
|
||||||
|
|
||||||
[] Add integration for playerstatistics across servers
|
## Features
|
||||||
- We have to read the jsons in world (i have example for two worlds)
|
|
||||||
- we have to get the uuid as stats are saved in uuid
|
- **Bidirectional Chat**: Messages from Minecraft appear in Discord, and Discord messages are sent to Minecraft
|
||||||
- convert playername to uuid maybe? is there an api?
|
- **Docker-based**: Easy deployment with Docker Compose
|
||||||
- Would be nice to see playtime and block usage over all the different servers + a total.
|
- **Flexible Configuration**: Support for both Discord bot and webhook modes
|
||||||
for example using edc64... uuid i would like to see total amount of diamond collected on all worlds and also diamond per world in a list.
|
- **Log Tailing**: Automatically reads Minecraft server logs without needing additional plugins
|
||||||
[] Add a nice site for TFMC with information about the server.
|
- **RCON Support**: Optional RCON integration for sending Discord messages to Minecraft
|
||||||
[] Add statistics of online status on the server?
|
|
||||||
- Graphs of players online?
|
## Prerequisites
|
||||||
- Show total players that have played on server?
|
|
||||||
-
|
- Docker and Docker Compose installed
|
||||||
[] Registering form with email authentication so only UMU university students can join. (link email to minecraft account for whitelist)
|
- A Discord bot token (see [Creating a Discord Bot](#creating-a-discord-bot))
|
||||||
- This could be done via rcon maybe? and have a separate list of players that have registered.
|
- A Minecraft server with accessible log files
|
||||||
|
- (Optional) RCON enabled on your Minecraft server for full bidirectional chat
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### 1. Clone and Initialize
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone <your-repo-url>
|
||||||
|
cd TFMC-Discord
|
||||||
|
git submodule update --init --recursive
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Configure Environment
|
||||||
|
|
||||||
|
Edit `docker-compose.yml` and update the environment variables:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
environment:
|
||||||
|
DISCORD_TOKEN: "YOUR_DISCORD_BOT_TOKEN_HERE"
|
||||||
|
DISCORD_CHANNEL_ID: "YOUR_DISCORD_CHANNEL_ID_HERE"
|
||||||
|
WEBHOOK_URL: "" # Optional: Use webhook instead of bot
|
||||||
|
SERVER_NAME: "My Minecraft Server"
|
||||||
|
# ... other settings
|
||||||
|
```
|
||||||
|
|
||||||
|
**Important**: Update the volume path to point to your Minecraft server's log directory:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
volumes:
|
||||||
|
- /path/to/your/minecraft/logs:/minecraft/logs:ro
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
The container will:
|
||||||
|
1. Build the Shulker application from the submodule
|
||||||
|
2. Generate a `config.json` from the environment variables
|
||||||
|
3. Start tailing your Minecraft server logs
|
||||||
|
4. Bridge messages between Discord and Minecraft
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
|
| Variable | Required | Description | Default |
|
||||||
|
|----------|----------|-------------|---------|
|
||||||
|
| `DISCORD_TOKEN` | Yes* | Discord bot token | - |
|
||||||
|
| `DISCORD_CHANNEL_ID` | Yes* | Discord channel ID for chat | - |
|
||||||
|
| `WEBHOOK_URL` | No | Discord webhook URL (alternative to bot) | - |
|
||||||
|
| `SERVER_NAME` | No | Server name shown in Discord | "Minecraft Server" |
|
||||||
|
| `SERVER_IMAGE` | No | Server avatar URL in webhook mode | "" |
|
||||||
|
| `DISCORD_MESSAGE_TEMPLATE` | No | Message format template | "<%username%> %message%" |
|
||||||
|
| `DEBUG` | No | Enable debug logging | "false" |
|
||||||
|
| `IS_LOCAL_FILE` | No | Use log file tailing | "true" |
|
||||||
|
| `LOCAL_FILE_PATH_OVERRIDE` | No | Custom log file path | "/minecraft/logs/latest.log" |
|
||||||
|
|
||||||
|
\* Either `DISCORD_TOKEN` + `DISCORD_CHANNEL_ID` OR `WEBHOOK_URL` is required
|
||||||
|
|
||||||
|
### Bot vs Webhook Mode
|
||||||
|
|
||||||
|
**Bot Mode** (recommended):
|
||||||
|
- Requires a Discord bot token and channel ID
|
||||||
|
- Better for interactive features
|
||||||
|
- Can use RCON to send messages to Minecraft
|
||||||
|
|
||||||
|
**Webhook Mode**:
|
||||||
|
- Only requires a webhook URL
|
||||||
|
- One-way: Minecraft → Discord
|
||||||
|
- Simpler setup but limited functionality
|
||||||
|
|
||||||
|
### RCON Configuration
|
||||||
|
|
||||||
|
To enable Discord → Minecraft messages, you need RCON enabled on your Minecraft server.
|
||||||
|
|
||||||
|
1. Enable RCON in your `server.properties`:
|
||||||
|
```properties
|
||||||
|
enable-rcon=true
|
||||||
|
rcon.port=25575
|
||||||
|
rcon.password=your_secure_password
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Add RCON settings to your environment or edit `/data/config.json` after first run:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"MINECRAFT_SERVER_RCON_IP": "your-minecraft-server-ip",
|
||||||
|
"MINECRAFT_SERVER_RCON_PORT": 25575,
|
||||||
|
"MINECRAFT_SERVER_RCON_PASSWORD": "your_secure_password"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Creating a Discord Bot
|
||||||
|
|
||||||
|
1. Go to the [Discord Developer Portal](https://discord.com/developers/applications)
|
||||||
|
2. Click "New Application" and give it a name
|
||||||
|
3. Go to the "Bot" tab and click "Add Bot"
|
||||||
|
4. Under "Token", click "Copy" to get your `DISCORD_TOKEN`
|
||||||
|
5. Enable "Message Content Intent" under "Privileged Gateway Intents"
|
||||||
|
6. Go to "OAuth2" → "URL Generator"
|
||||||
|
- Select scopes: `bot`
|
||||||
|
- Select permissions: `Send Messages`, `Read Messages/View Channels`, `Read Message History`
|
||||||
|
7. Copy the generated URL and open it in your browser to invite the bot to your server
|
||||||
|
8. Right-click on the channel where you want the chat bridge and click "Copy Channel ID" to get your `DISCORD_CHANNEL_ID`
|
||||||
|
- You may need to enable Developer Mode in Discord Settings → Advanced → Developer Mode
|
||||||
|
|
||||||
|
## Volumes
|
||||||
|
|
||||||
|
- `/data` - Stores `config.json` (mounted as tmpfs by default since config is generated from env vars)
|
||||||
|
- `/minecraft/logs` - Mount your Minecraft server's log directory here (read-only)
|
||||||
|
|
||||||
|
## Updating Shulker
|
||||||
|
|
||||||
|
Shulker is included as a Git submodule. To update to the latest version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git submodule update --remote external/shulker
|
||||||
|
docker compose build shulker
|
||||||
|
docker compose up -d shulker
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Messages not appearing in Discord
|
||||||
|
|
||||||
|
- Check that your `DISCORD_TOKEN` and `DISCORD_CHANNEL_ID` are correct
|
||||||
|
- Ensure the bot has permissions to send messages in the channel
|
||||||
|
- Check logs: `docker compose logs shulker`
|
||||||
|
|
||||||
|
### Messages not appearing in Minecraft
|
||||||
|
|
||||||
|
- Verify RCON is enabled and configured correctly in `server.properties`
|
||||||
|
- Check RCON credentials in `config.json`
|
||||||
|
- Ensure the Minecraft server is accessible from the Docker container
|
||||||
|
- Test RCON connectivity separately
|
||||||
|
|
||||||
|
### Log file not found
|
||||||
|
|
||||||
|
- Verify the volume path points to the correct directory
|
||||||
|
- Ensure `latest.log` exists in the mounted directory
|
||||||
|
- Check file permissions (should be readable by container user)
|
||||||
|
|
||||||
|
### Modded Server Issues
|
||||||
|
|
||||||
|
If you're running a modded server (Forge, Fabric, etc.), you may need to adjust the `REGEX_SERVER_PREFIX` setting. See [Shulker's FAQ](https://github.com/destruc7i0n/shulker#faq) for details.
|
||||||
|
|
||||||
|
## Advanced Configuration
|
||||||
|
|
||||||
|
After the first run, you can manually edit `/data/config.json` for advanced settings. Stop the container, edit the file, and restart:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose down
|
||||||
|
# Edit config.json in the Docker volume
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
For all available configuration options, see the [Shulker documentation](https://github.com/destruc7i0n/shulker).
|
||||||
|
|
||||||
|
## Technical Details
|
||||||
|
|
||||||
|
- Built on Node.js 22 Alpine
|
||||||
|
- Runs as non-root user (uid 10001)
|
||||||
|
- Uses `IS_LOCAL_FILE` mode for log tailing (no webhook server needed)
|
||||||
|
- Configuration is generated from environment variables via the entrypoint script
|
||||||
|
- The Shulker source code is maintained as a Git submodule and built during Docker image creation
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project uses [Shulker](https://github.com/destruc7i0n/shulker) which is licensed under MIT. Please see the Shulker repository for its license terms.
|
||||||
|
|
||||||
[] Build this entire website and management via docker for easier release?
|
|
||||||
- We could use environment variables and maybe also add volumes with the player files
|
|
||||||
like mounting ./minecraftserver/world/stats:/status/server1:ro or something?
|
|
||||||
- Maybe use integration with itgz, and get variables from those servers? via for example docker sock? or would that be to insecure?
|
|
||||||
[] Maybe integrate chat with discord via rcon?
|
|
||||||
- Base on existing project? This one exist and could maybe be useful? https://github.com/destruc7i0n/shulker
|
|
||||||
|
|
||||||
## Shulker Discord-Minecraft Bridge (Dockerized)
|
## Shulker Discord-Minecraft Bridge (Dockerized)
|
||||||
|
|
||||||
|
|||||||
@@ -2,20 +2,22 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
shulker:
|
shulker:
|
||||||
image: gitea.taginu.com/marc/tfmc-website:latest
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/shulker/Dockerfile
|
||||||
container_name: shulker
|
container_name: shulker
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
user: "root"
|
user: "root"
|
||||||
# Configure everything inline here; no .env file required
|
# Configure everything inline here; no .env file required
|
||||||
environment:
|
environment:
|
||||||
# Discord configuration (fill these)
|
# Discord configuration (fill these with your own values)
|
||||||
DISCORD_TOKEN: "MTA3MTEwMzcwMDAyMzY0ODMyMA.GIlFkn.o10LKcpjlaLDvVsgF_WKZhz5ykPYf1KEds_g3I"
|
DISCORD_TOKEN: "YOUR_DISCORD_BOT_TOKEN_HERE"
|
||||||
DISCORD_CHANNEL_ID: "1247178901004877916"
|
DISCORD_CHANNEL_ID: "YOUR_DISCORD_CHANNEL_ID_HERE"
|
||||||
# If set, webhook mode is used; leave empty to use the bot account
|
# If set, webhook mode is used; leave empty to use the bot account
|
||||||
WEBHOOK_URL: "https://discord.com/api/webhooks/1423056957434101850/QOQgLa1Y3TkH2JPOJuLXvh4IO8YXo-hMUVeOErZ4Hcz27uticHY09x9Z1cm-AksDeJ7Z"
|
WEBHOOK_URL: ""
|
||||||
|
|
||||||
# Display name/avatar for server-origin messages (webhook mode)
|
# Display name/avatar for server-origin messages (webhook mode)
|
||||||
SERVER_NAME: "TFMC"
|
SERVER_NAME: "Minecraft Server"
|
||||||
SERVER_IMAGE: ""
|
SERVER_IMAGE: ""
|
||||||
|
|
||||||
# Message formatting and logging
|
# Message formatting and logging
|
||||||
@@ -31,19 +33,10 @@ services:
|
|||||||
- type: tmpfs
|
- type: tmpfs
|
||||||
target: /data
|
target: /data
|
||||||
# Map your host/server Minecraft logs into the container
|
# Map your host/server Minecraft logs into the container
|
||||||
|
# Update the path on the left side to point to your Minecraft server's log directory
|
||||||
- ./data/logs:/minecraft/logs:ro
|
- ./data/logs:/minecraft/logs:ro
|
||||||
# No port exposure needed in local log tail mode
|
# Port 8000 is only needed if you want to use webhook mode for remote log streaming
|
||||||
|
# ports:
|
||||||
mc:
|
# - "8000:8000"
|
||||||
image: itzg/minecraft-server
|
|
||||||
tty: true
|
|
||||||
stdin_open: true
|
|
||||||
ports:
|
|
||||||
- "25565:25565"
|
|
||||||
environment:
|
|
||||||
EULA: "TRUE"
|
|
||||||
volumes:
|
|
||||||
# attach the relative directory 'data' to the container's /data path
|
|
||||||
- ./data:/data
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user