diff --git a/Dockerfile b/Dockerfile index 481e3331..ef0a241b 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/README.md b/README.md index a52e05cd..fba72354 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) - + @@ -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 @@ -391,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`. @@ -798,11 +800,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-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 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 00000000..3bab4151 Binary files /dev/null and b/tests/setuponlytests/generic-packs-prefix/packs/testing.zip differ 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..b769bd13 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 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 00000000..3848a7f6 Binary files /dev/null and b/tests/setuponlytests/generic-packs/web/configs.zip differ 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