This commit is contained in:
Marc
2025-10-02 00:29:29 +02:00
parent e69f8f5a7d
commit 1b74197680
9 changed files with 308 additions and 4 deletions

View File

@@ -21,3 +21,55 @@ Website for TFMC (teknisk fysiks minecraft server)
- 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)
This repo includes [Shulker](https://github.com/destruc7i0n/shulker) as a Git submodule under `external/shulker`, plus a Docker setup so you can run it and mount your Minecraft logs as a volume.
### Prereqs
- Docker and Docker Compose installed
- A Discord bot token and (optionally) a Discord channel webhook
- Your Minecraft server configured with rcon and accessible logs
### First-time setup
1. Initialize and update submodules:
- git submodule update --init --recursive
2. Configure environment variables (create a `.env` in repo root or pass via CLI):
- DISCORD_TOKEN=... (required)
- DISCORD_CHANNEL_ID=... (required if not using webhooks only)
- WEBHOOK_URL=... (if using webhooks)
- MC_LOGS_DIR=/absolute/path/to/your/minecraft/logs (defaults to `./Worlds/tfmc23-24/logs`)
- IS_LOCAL_FILE=true to tail logs directly (recommended when logs are mounted)
### Run
Start the service (from repo root):
```
docker compose up -d --build shulker
```
On first run, `/data/config.json` will be created from `config.example.json`. The container will symlink it to `/app/config.json` and set `IS_LOCAL_FILE` and `LOCAL_FILE_PATH` to `/minecraft/logs/latest.log` by default. You can edit `config.json` by entering the container or by stopping the container and editing the file in the named volume.
Expose the Shulker webhook on port 8000 if you want to send remote hooks instead of tailing logs. For remote setup, set `IS_LOCAL_FILE=false` and follow the command in Shulker's README to pipe log lines to the webhook.
### Volumes
- `shulker_data` named volume stores `config.json`.
- `${MC_LOGS_DIR}` (host) is mounted read-only at `/minecraft/logs` (container). Ensure this path contains `latest.log`.
### Updating Shulker
Shulker is a submodule:
```
git submodule update --remote external/shulker
```
Rebuild the image after updating:
```
docker compose build shulker && docker compose up -d shulker
```
### Notes
- Node 16+ is required; the Docker image uses Node 18 Alpine.
- If your server is modded, you may need to adjust `REGEX_SERVER_PREFIX` per Shulkers FAQ.
- For RCON features, set `MINECRAFT_SERVER_RCON_*` in `config.json` and ensure your server has rcon enabled.