From 18f0f0ceeee7f2aaf042da295eb14077330be82e Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 30 Jan 2022 11:17:21 -0600 Subject: [PATCH 01/10] fix: speedup generic pack update check (#1317) #1281 --- scripts/start-setupModpack | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/start-setupModpack b/scripts/start-setupModpack index 0c71c676..5dc66e38 100755 --- a/scripts/start-setupModpack +++ b/scripts/start-setupModpack @@ -207,12 +207,12 @@ if [[ "${GENERIC_PACKS}" ]]; then done isDebugging && [ -f "$sum_file}" ] && cat "$sum_file" - if ! sha256sum -c "${sum_file}" --status 2> /dev/null; then + if ! sha1sum -c "${sum_file}" --status 2> /dev/null; then base_dir=/tmp/generic_pack_base mkdir -p ${base_dir} for pack in "${packFiles[@]}"; do isDebugging && ls -l "${pack}" - unzip -q -d ${base_dir} "${pack}" + extract "${pack}" "${base_dir}" done # recalculate the actual base directory of content @@ -240,7 +240,7 @@ if [[ "${GENERIC_PACKS}" ]]; then cp -R -f "${base_dir}"/* /data rm -rf /tmp/generic_pack_base - sha256sum "${packFiles[@]}" > "${sum_file}" + sha1sum "${packFiles[@]}" > "${sum_file}" isDebugging && cat "$sum_file" fi fi From 240238013bbddd3044f4d835d64d669ba3bf0ded Mon Sep 17 00:00:00 2001 From: Alexandre Boucey Date: Sun, 30 Jan 2022 20:46:09 +0100 Subject: [PATCH 02/10] Use Log4J2 JVM flag when file download fail (#1316) --- scripts/start-finalExec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/start-finalExec b/scripts/start-finalExec index 3f282325..9cc2c7d0 100755 --- a/scripts/start-finalExec +++ b/scripts/start-finalExec @@ -20,13 +20,15 @@ if [ -n "$ICON" ]; then fi canUseRollingLogs=true +useFallbackJvmFlag=false patchLog4jConfig() { file=${1?} url=${2?} if ! get -o "$file" "$url"; then - log "ERROR: failed to download corrected log4j config" - exit 1 + log "ERROR: failed to download corrected log4j config, fallback to JVM flag" + useFallbackJvmFlag=true + return 1 fi JVM_OPTS="-Dlog4j.configurationFile=${file} ${JVM_OPTS}" canUseRollingLogs=false @@ -46,6 +48,10 @@ elif isType PURPUR && versionLessThan 1.17; then elif isType PURPUR && versionLessThan 1.18.1; then patchLog4jConfig purpur_log4j2_117.xml https://purpurmc.org/docs/xml/purpur_log4j2_117.xml elif versionLessThan 1.18.1; then + useFallbackJvmFlag=true +fi + +if ${useFallbackJvmFlag}; then JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}" fi From c55cce628d9506a5b42252df41559f48e8f0da49 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 30 Jan 2022 14:05:50 -0600 Subject: [PATCH 03/10] fix: bumped mc-image-helper to 1.16.3 to use specific user agent (#1320) --- Dockerfile | 2 +- scripts/start-utils | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 233bbe68..228a03e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,7 +61,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ --var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \ --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz -ARG MC_HELPER_VERSION=1.16.2 +ARG MC_HELPER_VERSION=1.16.3 ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/v${MC_HELPER_VERSION} RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \ | tar -C /usr/share -zxf - \ diff --git a/scripts/start-utils b/scripts/start-utils index f55af29c..376e52b8 100755 --- a/scripts/start-utils +++ b/scripts/start-utils @@ -211,7 +211,7 @@ function extract() { application/zip) unzip -q -d "${destDir}" "${src}" ;; - application/x-tar|application/gzip|application/x-bzip2|application/zstd) + application/x-tar|application/gzip|application/x-gzip|application/x-bzip2|application/zstd) tar -C "${destDir}" -xf "${src}" ;; *) From eb0c30d1341dcbc42eed31c9fb8196474c29fca3 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 30 Jan 2022 19:49:54 -0600 Subject: [PATCH 04/10] feat: added prefix/suffix support for GENERIC_PACKS (#1321) For #1315 --- README.md | 16 +++++++++++++--- scripts/start-setupModpack | 7 +++++-- .../generic-packs-prefix/docker-compose.yml | 14 ++++++++++++++ .../generic-packs-prefix/packs/testing.zip | Bin 0 -> 212 bytes .../generic-packs-prefix/verify.sh | 1 + .../generic-packs/docker-compose.yml | 8 +++++++- tests/setuponlytests/generic-packs/verify.sh | 3 ++- .../generic-packs/web/configs.zip | Bin 0 -> 126 bytes 8 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 tests/setuponlytests/generic-packs-prefix/docker-compose.yml create mode 100644 tests/setuponlytests/generic-packs-prefix/packs/testing.zip create mode 100644 tests/setuponlytests/generic-packs-prefix/verify.sh create mode 100644 tests/setuponlytests/generic-packs/web/configs.zip diff --git a/README.md b/README.md index aafa9bab..04d4ec4f 100644 --- a/README.md +++ b/README.md @@ -798,11 +798,21 @@ Example of expected ForgeAPI file format. ] ``` -### Generic pack file +### Generic pack files -To install all of the server content (jars, mods, plugins, configs, etc) from a zip file, such as a CurseForge modpack that is missing a server start script, then set `GENERIC_PACK` to the container path of the zip file. That, combined with `TYPE`, allows for custom content along with container managed server download and install. +To install all of the server content (jars, mods, plugins, configs, etc) from a zip or tgz file, such as a CurseForge modpack that is missing a server start script, then set `GENERIC_PACK` to the container path or URL of the archive file. -If multiple generic packs need to be applied together, set `GENERIC_PACKS` instead, with a comma separated list of zip file paths and/or URLs to zip files. +If multiple generic packs need to be applied together, set `GENERIC_PACKS` instead, with a comma separated list of archive file paths and/or URLs to files. + +To avoid repetition, each entry will be prefixed by the value of `GENERIC_PACKS_PREFIX` and suffixed by the value of `GENERIC_PACKS_SUFFIX`, both of which are optional. For example, the following variables + +``` +GENERIC_PACKS=configs-v9.0.1,mods-v4.3.6 +GENERIC_PACKS_PREFIX=https://cdn.example.org/ +GENERIC_PACKS_SUFFIX=.zip +``` + +would expand to `https://cdn.example.org/configs-v9.0.1.zip,https://cdn.example.org/mods-v4.3.6.zip`. ### Mod/Plugin URL Listing File diff --git a/scripts/start-setupModpack b/scripts/start-setupModpack index 5dc66e38..88281d4a 100755 --- a/scripts/start-setupModpack +++ b/scripts/start-setupModpack @@ -188,13 +188,16 @@ esac fi : "${GENERIC_PACKS:=${GENERIC_PACK}}" +: "${GENERIC_PACKS_PREFIX:=}" +: "${GENERIC_PACKS_SUFFIX:=}" if [[ "${GENERIC_PACKS}" ]]; then IFS=',' read -ra packs <<< "${GENERIC_PACKS}" packFiles=() - for pack in "${packs[@]}"; do - if isURL "$pack"; then + for packEntry in "${packs[@]}"; do + pack="${GENERIC_PACKS_PREFIX}${packEntry}${GENERIC_PACKS_SUFFIX}" + if isURL "${pack}"; then mkdir -p /data/packs if ! outfile=$(get -o /data/packs --output-filename --skip-existing "$pack"); then log "ERROR: failed to download $pack" diff --git a/tests/setuponlytests/generic-packs-prefix/docker-compose.yml b/tests/setuponlytests/generic-packs-prefix/docker-compose.yml new file mode 100644 index 00000000..4d84fa67 --- /dev/null +++ b/tests/setuponlytests/generic-packs-prefix/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3" + +services: + mc: + image: ${IMAGE_TO_TEST:-itzg/minecraft-server} + environment: + EULA: "true" + SETUP_ONLY: "TRUE" + GENERIC_PACKS: testing + GENERIC_PACKS_PREFIX: /packs/ + GENERIC_PACKS_SUFFIX: .zip + volumes: + - ./packs:/packs + - ./data:/data diff --git a/tests/setuponlytests/generic-packs-prefix/packs/testing.zip b/tests/setuponlytests/generic-packs-prefix/packs/testing.zip new file mode 100644 index 0000000000000000000000000000000000000000..3bab4151dc3e39c20c43ed93c720158acbb46935 GIT binary patch literal 212 zcmWIWW@Zs#00Hs&5y4;vlwb$a`FW{&B^4zBa7Bt}igO=z k2r*j$LLrPtXu@UzLX#?xiE14y8%UN32=jroKZwHs0QdwMxBvhE literal 0 HcmV?d00001 diff --git a/tests/setuponlytests/generic-packs-prefix/verify.sh b/tests/setuponlytests/generic-packs-prefix/verify.sh new file mode 100644 index 00000000..cb4652ec --- /dev/null +++ b/tests/setuponlytests/generic-packs-prefix/verify.sh @@ -0,0 +1 @@ +mc-image-helper assert fileExists one.txt mods/two.txt diff --git a/tests/setuponlytests/generic-packs/docker-compose.yml b/tests/setuponlytests/generic-packs/docker-compose.yml index 071c430d..b5450605 100644 --- a/tests/setuponlytests/generic-packs/docker-compose.yml +++ b/tests/setuponlytests/generic-packs/docker-compose.yml @@ -1,12 +1,18 @@ version: "3" services: + web: + image: nginx + volumes: + - ./web:/usr/share/nginx/html mc: + depends_on: + - web image: ${IMAGE_TO_TEST:-itzg/minecraft-server} environment: EULA: "true" SETUP_ONLY: "TRUE" - GENERIC_PACKS: https://github.com/itzg/mc-image-helper/releases/download/v1.9.5/mc-image-helper-1.9.5.zip,/packs/testing.zip + GENERIC_PACKS: http://web/configs.zip,/packs/testing.zip volumes: - ./packs:/packs - ./data:/data diff --git a/tests/setuponlytests/generic-packs/verify.sh b/tests/setuponlytests/generic-packs/verify.sh index 15166fe9..0b66ce48 100644 --- a/tests/setuponlytests/generic-packs/verify.sh +++ b/tests/setuponlytests/generic-packs/verify.sh @@ -1 +1,2 @@ -mc-image-helper assert fileExists one.txt mods/two.txt \ No newline at end of file +mc-image-helper assert fileExists one.txt mods/two.txt +mc-image-helper assert fileExists one.txt config/opt.yml \ No newline at end of file diff --git a/tests/setuponlytests/generic-packs/web/configs.zip b/tests/setuponlytests/generic-packs/web/configs.zip new file mode 100644 index 0000000000000000000000000000000000000000..3848a7f671b0d37c0f97182a0eef497752f50c22 GIT binary patch literal 126 zcmWIWW@Zs#0D+udyAUt~O7H>co OBp89v21x6GRRI89B@oX5 literal 0 HcmV?d00001 From dca4f86fa6be0a8664c9e58e82c2d489bf168cd5 Mon Sep 17 00:00:00 2001 From: itzg Date: Mon, 31 Jan 2022 01:50:07 +0000 Subject: [PATCH 05/10] docs: Auto update markdown TOC --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 04d4ec4f..49a4c2f2 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ By default, the container will download the latest version of the "vanilla" [Min * [Auto-downloading SpigotMC/Bukkit/PaperMC plugins](#auto-downloading-spigotmcbukkitpapermc-plugins) * [Downloadable mod/plugin pack for Forge, Fabric, and Bukkit-like Servers](#downloadable-modplugin-pack-for-forge-fabric-and-bukkit-like-servers) * [ForgeAPI usage to use non-version specific projects](#forgeapi-usage-to-use-non-version-specific-projects) - * [Generic pack file](#generic-pack-file) + * [Generic pack files](#generic-pack-files) * [Mod/Plugin URL Listing File](#modplugin-url-listing-file) * [Remove old mods/plugins](#remove-old-modsplugins) * [Working with world data](#working-with-world-data) @@ -141,7 +141,7 @@ By default, the container will download the latest version of the "vanilla" [Min * [Running on RaspberryPi](#running-on-raspberrypi) * [Contributing](#contributing) - + From 26809ef1f01654dfe001b5244c752a91461a270b Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Mon, 31 Jan 2022 21:44:18 -0600 Subject: [PATCH 06/10] build: enable exit on failure for verify in setuponlytests Related to #1305 --- tests/setuponlytests/generic-packs/verify.sh | 2 +- tests/setuponlytests/test.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/setuponlytests/generic-packs/verify.sh b/tests/setuponlytests/generic-packs/verify.sh index 0b66ce48..b769bd13 100644 --- a/tests/setuponlytests/generic-packs/verify.sh +++ b/tests/setuponlytests/generic-packs/verify.sh @@ -1,2 +1,2 @@ mc-image-helper assert fileExists one.txt mods/two.txt -mc-image-helper assert fileExists one.txt config/opt.yml \ No newline at end of file +mc-image-helper assert fileExists config/opt.yml \ No newline at end of file diff --git a/tests/setuponlytests/test.sh b/tests/setuponlytests/test.sh index 7eae2b5e..748b31ad 100644 --- a/tests/setuponlytests/test.sh +++ b/tests/setuponlytests/test.sh @@ -30,7 +30,7 @@ $logs " result=1 elif [ -f verify.sh ]; then - if ! docker run --rm --entrypoint bash -v "${PWD}/data":/data -v "${PWD}/verify.sh":/verify "${IMAGE_TO_TEST:-itzg/minecraft-server}" /verify; then + if ! docker run --rm --entrypoint bash -v "${PWD}/data":/data -v "${PWD}/verify.sh":/verify "${IMAGE_TO_TEST:-itzg/minecraft-server}" -e /verify; then echo "${folder} verify FAILED" result=1 else From de0bb14abd8fb78bb0450a20867a87078b9eddff Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 1 Feb 2022 15:08:09 -0600 Subject: [PATCH 07/10] docs: added inspect command to see anonymous volume path --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 49a4c2f2..7c825c8c 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,8 @@ If you had used the commands in the first section, without the `-v` volume attac > In this example, it is assumed the original container was given a `--name` of "mc", so change the container identifier accordingly. +> You can also locate the Docker-managed directory from the `Source` field obtained from `docker inspect -f "{{json .Mounts}}"` + First, stop the existing container: ```shell docker stop mc From 0ec73b141ff143e3544e9a75e73139e0708af6b0 Mon Sep 17 00:00:00 2001 From: itzg Date: Tue, 1 Feb 2022 21:08:27 +0000 Subject: [PATCH 08/10] docs: Auto update markdown TOC --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c825c8c..362e60fe 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ By default, the container will download the latest version of the "vanilla" [Min * [Running on RaspberryPi](#running-on-raspberrypi) * [Contributing](#contributing) - + From 2b093ad421dd2997910a113f30389f1b28f7912c Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 1 Feb 2022 20:53:05 -0600 Subject: [PATCH 09/10] docs: fixed Forge homepage link Fixes #1244 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 362e60fe..6ae60fe0 100644 --- a/README.md +++ b/README.md @@ -393,7 +393,7 @@ To troubleshoot any issues with memory allocation reported by the JVM, set the e ### Running a Forge Server -Enable [Forge server](http://www.minecraftforge.net/wiki/) mode by adding a `-e TYPE=FORGE` to your command-line. +Enable [Forge server](http://www.minecraftforge.net/) mode by adding a `-e TYPE=FORGE` to your command-line. The overall version is specified by `VERSION`, [as described in the section above](#versions) and will run the recommended Forge version by default. You can also choose to run a specific Forge version with `FORGEVERSION`, such as `-e FORGEVERSION=14.23.5.2854`. From de0188de3d7bcd919216ed20a04891896c347e6e Mon Sep 17 00:00:00 2001 From: itzg Date: Wed, 2 Feb 2022 02:53:20 +0000 Subject: [PATCH 10/10] docs: Auto update markdown TOC --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ae60fe0..bdf77d1a 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ By default, the container will download the latest version of the "vanilla" [Min * [Running on RaspberryPi](#running-on-raspberrypi) * [Contributing](#contributing) - +