From 2ec577c9b7f2c7ab60bf3995353c815c5fda28bc Mon Sep 17 00:00:00 2001 From: jarno Date: Fri, 17 Jan 2025 14:09:03 +0100 Subject: [PATCH] TEST: mod support --- Makefile | 3 ++- envsubstitute.sh | 26 ++++++++++++++++++++++++++ swarm-compose.minecraft.yml | 11 ++++++----- 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 envsubstitute.sh diff --git a/Makefile b/Makefile index fd2316e..17cce67 100644 --- a/Makefile +++ b/Makefile @@ -24,12 +24,13 @@ build\:swarm: sudo docker swarm init deploy: + chmod +x ./envsubstitute.sh; \ for file in swarm-compose*.yml; do \ if [ -f "$$file" ]; then \ + ./envsubstitute.sh $$file; \ files="$$files -c $$file"; \ fi; \ done; \ - sudo docker stack deploy $$files server update: sudo docker service update --image $(image):$(version) $(service) diff --git a/envsubstitute.sh b/envsubstitute.sh new file mode 100644 index 0000000..b5e8710 --- /dev/null +++ b/envsubstitute.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Check if filename is provided +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +# Get the filename from the first argument +filename="$1" + +# Check if the file exists +if [ ! -f "$filename" ]; then + echo "File '$filename' not found!" + exit 1 +fi + +# Process the file +while IFS= read -r line; do + while [[ "$line" =~ %%([^%]+)%% ]]; do + varname="${BASH_REMATCH[1]}" + varvalue="${!varname}" + line="${line//%%$varname%%/$varvalue}" + done + echo "$line" +done < "$filename" > temp.yml && mv temp.yml "$filename" \ No newline at end of file diff --git a/swarm-compose.minecraft.yml b/swarm-compose.minecraft.yml index 3d32dbb..71099ee 100644 --- a/swarm-compose.minecraft.yml +++ b/swarm-compose.minecraft.yml @@ -3,26 +3,27 @@ services: networks: - reverse_proxy_network - minecraft_network - image: itzg/minecraft-server + image: itzg/minecraft-server:java8 tty: true stdin_open: true environment: EULA: "TRUE" MAX_MEMORY: "16G" - TYPE: "FABRIC" - VERSION: "SNAPSHOT" + TYPE: "FORGE" + VERSION: "1.12.2" DIFFICULTY: "hard" ICON: "https://jarnowieman.nl/api/files/minecraft/server_icon" MOTD: "§l§5WiemanServer§r\n§rWelcome to my server!" VANILLATWEAKS_SHARECODE: "cFTVFy,M6j9tu" DATAPACKS: "" - CF_API_KEY: $${CF_API_KEY} + CF_PAGE_URL: "https://www.curseforge.com/minecraft/modpacks/rlcraft/files/4612979" + CF_API_KEY: %%CF_API_KEY%% MAX_PLAYERS: "20" SNOOPER_ENABLED: "false" MAX_BUILD_HEIGHT: "256" SPAWN_PROTECTION: "0" VIEW_DISTANCE: "10" - LEVEL: "world" + LEVEL: "rlcraft" ALLOW_FLIGHT: "TRUE" SERVER_NAME: "WiemanServer" PLAYER_IDLE_TIMEOUT: "0"