From 4d7cacaee456c014f32b620ca54474e54e783aa4 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 2 Oct 2025 10:16:46 +0200 Subject: [PATCH] Updated to less cluttered and removed features that dont work --- .env | 27 ------------------ .env.example | 27 ------------------ docker-compose.yml | 53 +++++++++++++++--------------------- docker/shulker/entrypoint.sh | 20 -------------- 4 files changed, 22 insertions(+), 105 deletions(-) delete mode 100644 .env delete mode 100644 .env.example diff --git a/.env b/.env deleted file mode 100644 index ee4df80..0000000 --- a/.env +++ /dev/null @@ -1,27 +0,0 @@ -# Copy this file to .env and fill in your values -# Discord bot token and channel -DISCORD_TOKEN=MTA3MTEwMzcwMDAyMzY0ODMyMA.GIlFkn.o10LKcpjlaLDvVsgF_WKZhz5ykPYf1KEds_g3I -DISCORD_CHANNEL_ID=1247178901004877916 -# Optional if using webhooks -WEBHOOK_URL= - -# Display name and avatar for server-origin messages when using webhooks -SERVER_NAME=TFMC -# Optional image URL to use as the avatar for server messages -# SERVER_IMAGE=https://example.com/server-icon.png - -# If logs are mounted, keep true; set to false to use remote webhook mode -IS_LOCAL_FILE=true - -# Path on host to the Minecraft server logs directory containing latest.log -MC_LOGS_DIR=./data/logs - -# Optionally override the log path inside the container -# LOCAL_FILE_PATH_OVERRIDE=/minecraft/logs/latest.log - -# RCON connection to send Discord -> Minecraft messages -# Ensure server.properties has enable-rcon=true and set password/port -# Set IP to the Minecraft server host or container name on the Docker network -MINECRAFT_SERVER_RCON_IP=mc -MINECRAFT_SERVER_RCON_PORT=25575 -MINECRAFT_SERVER_RCON_PASSWORD=509dbd71b996df2bd575d43b diff --git a/.env.example b/.env.example deleted file mode 100644 index 40c894a..0000000 --- a/.env.example +++ /dev/null @@ -1,27 +0,0 @@ -# Copy this file to .env and fill in your values -# Discord bot token and channel -DISCORD_TOKEN= -DISCORD_CHANNEL_ID= -# Optional if using webhooks -WEBHOOK_URL= - -# Display name and avatar for server-origin messages when using webhooks -SERVER_NAME=Shulker -# Optional image URL to use as the avatar for server messages -# SERVER_IMAGE=https://example.com/server-icon.png - -# If logs are mounted, keep true; set to false to use remote webhook mode -IS_LOCAL_FILE=true - -# Path on host to the Minecraft server logs directory containing latest.log -MC_LOGS_DIR=./data/logs - -# Optionally override the log path inside the container -# LOCAL_FILE_PATH_OVERRIDE=/minecraft/logs/latest.log - -# RCON connection to send Discord -> Minecraft messages -# Ensure server.properties has enable-rcon=true and set password/port -# Set IP to the Minecraft server host or container name on the Docker network -MINECRAFT_SERVER_RCON_IP=127.0.0.1 -MINECRAFT_SERVER_RCON_PORT=25575 -MINECRAFT_SERVER_RCON_PASSWORD= diff --git a/docker-compose.yml b/docker-compose.yml index afbfdb3..e296166 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,39 +2,35 @@ version: "3.8" services: shulker: - build: - context: . - dockerfile: docker/shulker/Dockerfile + image: gitea.taginu.com/marc/tfmc-website:latest container_name: shulker restart: unless-stopped + # Configure everything inline here; no .env file required environment: - # Provide these via environment or .env file - - DISCORD_TOKEN=${DISCORD_TOKEN} - - DISCORD_CHANNEL_ID=${DISCORD_CHANNEL_ID} - - WEBHOOK_URL=${WEBHOOK_URL} - - SERVER_NAME=${SERVER_NAME:-Shulker} - - SERVER_IMAGE=${SERVER_IMAGE} - - DISCORD_MESSAGE_TEMPLATE=${DISCORD_MESSAGE_TEMPLATE} - - DEBUG=${DEBUG} - - ALLOW_USER_MENTIONS=${ALLOW_USER_MENTIONS} - - ALLOW_HERE_EVERYONE_MENTIONS=${ALLOW_HERE_EVERYONE_MENTIONS} - - MINECRAFT_SERVER_RCON_IP=${MINECRAFT_SERVER_RCON_IP} - - MINECRAFT_SERVER_RCON_PORT=${MINECRAFT_SERVER_RCON_PORT} - - MINECRAFT_SERVER_RCON_PASSWORD=${MINECRAFT_SERVER_RCON_PASSWORD} - - MINECRAFT_TELLRAW_DOESNT_EXIST=${MINECRAFT_TELLRAW_DOESNT_EXIST} - - MINECRAFT_TELLRAW_TEMPLATE=${MINECRAFT_TELLRAW_TEMPLATE} - - MINECRAFT_TELLRAW_DOESNT_EXIST_SAY_TEMPLATE=${MINECRAFT_TELLRAW_DOESNT_EXIST_SAY_TEMPLATE} - # Set to false if using remote hook mode - - IS_LOCAL_FILE=${IS_LOCAL_FILE:-true} - # Optionally override the log path inside the container - - LOCAL_FILE_PATH_OVERRIDE=${LOCAL_FILE_PATH_OVERRIDE} + # Discord configuration (fill these) + DISCORD_TOKEN: "REPLACE_ME" + DISCORD_CHANNEL_ID: "" + # If set, webhook mode is used; leave empty to use the bot account + WEBHOOK_URL: "" + + # Display name/avatar for server-origin messages (webhook mode) + SERVER_NAME: "Shulker" + SERVER_IMAGE: "" + + # Message formatting and logging + DISCORD_MESSAGE_TEMPLATE: "<%username%> %message%" + DEBUG: "false" + + # Tail local logs inside the container (recommended) + IS_LOCAL_FILE: "true" + # Optionally override the log path inside the container (default shown) + # LOCAL_FILE_PATH_OVERRIDE: "/minecraft/logs/latest.log" volumes: # Persist config.json in a named volume - shulker_data:/data # Map your host/server Minecraft logs into the container - - ${MC_LOGS_DIR:-./data/logs}:/minecraft/logs:ro - ports: - - "8000:8000" + - ./data/logs:/minecraft/logs:ro + # No port exposure needed in local log tail mode mc: image: itzg/minecraft-server @@ -44,11 +40,6 @@ services: - "25565:25565" environment: EULA: "TRUE" - ENABLE_RCON: "true" - RCON_PASSWORD: ${MINECRAFT_SERVER_RCON_PASSWORD} - RCON_PORT: ${MINECRAFT_SERVER_RCON_PORT} - # Ensure env values are written into server.properties on each start - OVERRIDE_SERVER_PROPERTIES: "true" volumes: # attach the relative directory 'data' to the container's /data path - ./data:/data diff --git a/docker/shulker/entrypoint.sh b/docker/shulker/entrypoint.sh index 48516d0..c49bebc 100644 --- a/docker/shulker/entrypoint.sh +++ b/docker/shulker/entrypoint.sh @@ -60,26 +60,6 @@ fi [ -n "${SERVER_NAME}" ] && jq ".SERVER_NAME=\"${SERVER_NAME}\"" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json || true [ -n "${SERVER_IMAGE}" ] && jq ".SERVER_IMAGE=\"${SERVER_IMAGE}\"" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json || true -# RCON configuration overrides -[ -n "${MINECRAFT_SERVER_RCON_IP}" ] && jq ".MINECRAFT_SERVER_RCON_IP=\"${MINECRAFT_SERVER_RCON_IP}\"" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json || true -if [ -n "${MINECRAFT_SERVER_RCON_PORT}" ]; then - case "${MINECRAFT_SERVER_RCON_PORT}" in - ''|*[!0-9]*) jq ".MINECRAFT_SERVER_RCON_PORT=\"${MINECRAFT_SERVER_RCON_PORT}\"" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json ;; - *) jq ".MINECRAFT_SERVER_RCON_PORT=${MINECRAFT_SERVER_RCON_PORT}" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json ;; - esac -fi -[ -n "${MINECRAFT_SERVER_RCON_PASSWORD}" ] && jq ".MINECRAFT_SERVER_RCON_PASSWORD=\"${MINECRAFT_SERVER_RCON_PASSWORD}\"" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json || true - -# Minecraft output formatting overrides -if [ -n "${MINECRAFT_TELLRAW_DOESNT_EXIST}" ]; then - case "${MINECRAFT_TELLRAW_DOESNT_EXIST}" in - [Tt][Rr][Uu][Ee]|1|yes|on) jq ".MINECRAFT_TELLRAW_DOESNT_EXIST=true" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json ;; - [Ff][Aa][Ll][Ss][Ee]|0|no|off) jq ".MINECRAFT_TELLRAW_DOESNT_EXIST=false" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json ;; - esac -fi -[ -n "${MINECRAFT_TELLRAW_TEMPLATE}" ] && jq ".MINECRAFT_TELLRAW_TEMPLATE=\"${MINECRAFT_TELLRAW_TEMPLATE}\"" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json || true -[ -n "${MINECRAFT_TELLRAW_DOESNT_EXIST_SAY_TEMPLATE}" ] && jq ".MINECRAFT_TELLRAW_DOESNT_EXIST_SAY_TEMPLATE=\"${MINECRAFT_TELLRAW_DOESNT_EXIST_SAY_TEMPLATE}\"" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json || true - # Always set IS_LOCAL_FILE true and path to mounted logs unless overridden explicitly via env IS_LOCAL_FILE if [ -z "${IS_LOCAL_FILE}" ]; then IS_LOCAL_FILE=true; fi jq ".IS_LOCAL_FILE=${IS_LOCAL_FILE} | .LOCAL_FILE_PATH=\"${LOCAL_FILE_PATH}\"" /data/config.json > /data/config.json.tmp && mv /data/config.json.tmp /data/config.json