From 07185534fbf1bedd731ae183cc77a5cb2f587fb2 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 9 Aug 2020 13:28:36 -0500 Subject: [PATCH 01/10] Upgraded to mc-server-runner 1.5.0 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bfbd9a2a..ef7b5e41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,7 +55,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ - --var version=1.4.3 --var app=mc-server-runner --file {{.app}} \ + --var version=1.5.0 --var app=mc-server-runner --file {{.app}} \ --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ From 99ed83022ed55b5bb6ea18a283d75c1f2d6b157f Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 12 Aug 2020 20:47:52 -0500 Subject: [PATCH 02/10] misc: added EOL config to .editorconfig --- .editorconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 6583457a..c8fbb7e9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,2 +1,4 @@ [start-*] -indent_size = 2 \ No newline at end of file +indent_size = 2 +indent_style = space +end_of_line = lf From 8a5e5bf01e9f0e636c83558da0c09aaba28071fc Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 15 Aug 2020 10:02:45 -0500 Subject: [PATCH 03/10] Improved handling of missing Paper server version downloads Fixes #607 --- start-deployPaper | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/start-deployPaper b/start-deployPaper index 1bc5839e..870a8e0b 100644 --- a/start-deployPaper +++ b/start-deployPaper @@ -1,6 +1,7 @@ #!/bin/bash . ${SCRIPTS:-/}start-utils +set -o pipefail : ${PAPERBUILD:=latest} export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar @@ -11,8 +12,14 @@ fi downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download} log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..." -if ! curl -fsSL -o "$SERVER" $zarg "$downloadUrl"; then - log "ERROR: failed to download from $downloadUrl (status=$?)" +if ! curl -fsSL -o "$SERVER" $zarg "$downloadUrl" 2> /dev/null; then + if versions=$(curl -fsSL https://papermc.io/api/v1/paper 2> /dev/null | jq -r '.versions | join(", ")'); then + log "ERROR: ${VANILLA_VERSION} is not (yet) published by PaperMC" + log " The following versions are available: " + log " ${versions}" + else + log "ERROR: failed to contact PaperMC at https://papermc.io/api/v1/paper" + fi exit 3 fi From 2322dffd49cd95e3736bb3a21b8770293dae87f7 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 15 Aug 2020 10:06:49 -0500 Subject: [PATCH 04/10] misc: Improved error log for missing Paper versions --- start-deployPaper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start-deployPaper b/start-deployPaper index 870a8e0b..0422eafc 100644 --- a/start-deployPaper +++ b/start-deployPaper @@ -15,7 +15,7 @@ log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl .. if ! curl -fsSL -o "$SERVER" $zarg "$downloadUrl" 2> /dev/null; then if versions=$(curl -fsSL https://papermc.io/api/v1/paper 2> /dev/null | jq -r '.versions | join(", ")'); then log "ERROR: ${VANILLA_VERSION} is not (yet) published by PaperMC" - log " The following versions are available: " + log " Set VERSION to one of the following: " log " ${versions}" else log "ERROR: failed to contact PaperMC at https://papermc.io/api/v1/paper" From 48ccdf128f18061603eb48ce21ee1e59358e941d Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 18 Aug 2020 20:44:11 -0500 Subject: [PATCH 05/10] Fixed CF_SERVER_MOD to handle spaces in the given filename Updated USE_MODPACK_START_SCRIPT=false to support forge provided by pack For #608 --- start-deployCF | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/start-deployCF b/start-deployCF index 3af069a7..3c902953 100644 --- a/start-deployCF +++ b/start-deployCF @@ -3,6 +3,7 @@ set -e . ${SCRIPTS:-/}start-utils +isDebugging && set -x export FTB_BASE_DIR=/data/FeedTheBeast legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar @@ -14,7 +15,7 @@ log "Looking for Feed-The-Beast / CurseForge server modpack." requireVar FTB_SERVER_MOD if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then - if ! [ -f ${FTB_SERVER_MOD} ]; then + if ! [ -f "${FTB_SERVER_MOD}" ]; then log "ERROR unable to find requested modpack file ${FTB_SERVER_MOD}" exit 2 fi @@ -37,22 +38,25 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then if $needsInstall; then log "Unpacking FTB server modpack ${FTB_SERVER_MOD} ..." mkdir -p ${FTB_BASE_DIR} - unzip -o ${FTB_SERVER_MOD} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}' + unzip -o "${FTB_SERVER_MOD}" -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}' - forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar") - if [[ -z "${forgeInstallerJar}" ]]; then - log "ERROR Unable to find forge installer in modpack." - log " Make sure you downloaded the server files." - exit 2 + serverJar=$(find ${FTB_BASE_DIR} -path "*/libraries/*" -prune -type f -o -not -name "forge*installer.jar" -name "forge*.jar") + if [[ -z "$serverJar" ]]; then + forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar") + if [[ -z "${forgeInstallerJar}" ]]; then + log "ERROR Unable to find forge installer in modpack." + log " Make sure you downloaded the server files." + exit 2 + fi + + log "Installing forge server" + (cd $(dirname "${forgeInstallerJar}"); java -jar $(basename "${forgeInstallerJar}") --installServer) | awk '{printf "."} END {print ""}' fi - log "Installing forge server" - (cd $(dirname "${forgeInstallerJar}"); java -jar $(basename ${forgeInstallerJar}) --installServer) | awk '{printf "."} END {print ""}' - echo "${FTB_SERVER_MOD}" > $installMarker fi - export SERVER=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar") + export SERVER=$(find ${FTB_BASE_DIR} -path "*/libraries/*" -prune -type f -o -not -name "forge*installer.jar" -name "forge*.jar") if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then log "ERROR unable to locate installed forge server jar" isDebugging && find ${FTB_BASE_DIR} -name "forge*.jar" @@ -89,7 +93,7 @@ fi # this allows saving just the world separate from the rest of the data directory if [[ $startScriptCount = 0 ]]; then srv_modpack=${FTB_SERVER_MOD} - if isURL ${srv_modpack}; then + if isURL "${srv_modpack}"; then case $srv_modpack in https://www.feed-the-beast.com/*/download|https://www.curseforge.com/minecraft/modpacks/*/download/*/file) ;; @@ -107,19 +111,19 @@ if [[ $startScriptCount = 0 ]]; then fi srv_modpack=$downloaded fi - if [[ ${srv_modpack:0:5} == "data/" ]]; then + if [[ "${srv_modpack:0:5}" == "data/" ]]; then # Prepend with "/" - srv_modpack=/${srv_modpack} + srv_modpack="/${srv_modpack}" fi - if [[ ! ${srv_modpack:0:1} == "/" ]]; then + if [[ ! "${srv_modpack:0:1}" == "/" ]]; then # If not an absolute path, assume file is in "/data" srv_modpack=/data/${srv_modpack} fi - if [[ ! -f ${srv_modpack} ]]; then + if [[ ! -f "${srv_modpack}" ]]; then log "FTB server modpack ${srv_modpack} not found." exit 2 fi - if [[ ! ${srv_modpack: -4} == ".zip" ]]; then + if [[ ! "${srv_modpack: -4}" == ".zip" ]]; then log "FTB server modpack ${srv_modpack} is not a zip archive." log "Please set FTB_SERVER_MOD to a file with a .zip extension." exit 2 @@ -127,7 +131,7 @@ if [[ $startScriptCount = 0 ]]; then log "Unpacking FTB server modpack ${srv_modpack} ..." mkdir -p ${FTB_BASE_DIR} - unzip -o ${srv_modpack} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}' + unzip -o "${srv_modpack}" -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}' fi if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then @@ -165,7 +169,7 @@ export FTB_SERVER_START=$(find "${FTB_BASE_DIR}" $entryScriptExpr) export FTB_DIR=$(dirname "${FTB_SERVER_START}") chmod a+x "${FTB_SERVER_START}" -grep fml.queryResult=confirm ${FTB_SERVER_START} > /dev/null || \ +grep fml.queryResult=confirm "${FTB_SERVER_START}" > /dev/null || \ sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}" sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}" legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar" From d78272c1fa696ab85758528a443e1acd1a29dad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Stefa=C5=84czyk?= Date: Sun, 23 Aug 2020 16:16:04 +0200 Subject: [PATCH 06/10] PaperSpigot is now known as Paper (#614) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a9b71349..3e87379f 100644 --- a/README.md +++ b/README.md @@ -421,9 +421,9 @@ You can build spigot from source by adding `-e BUILD_FROM_SOURCE=true` If you have attached a host directory to the `/data` volume, then you can install plugins within the `plugins` subdirectory. You can also [attach a `/plugins` volume](#deploying-plugins-from-attached-volume). If you add plugins while the container is running, you'll need to restart it to pick those up. -## Running a PaperSpigot server +## Running a Paper server -Enable PaperSpigot server mode by adding a `-e TYPE=PAPER` to your command-line. +Enable Paper server mode by adding a `-e TYPE=PAPER` to your command-line. By default the container will run the latest build of [Paper server](https://papermc.io/downloads) but you can also choose to run a specific build with `-e PAPERBUILD=205`. @@ -432,7 +432,7 @@ but you can also choose to run a specific build with `-e PAPERBUILD=205`. -e TYPE=PAPER \ -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server -If you are hosting your own copy of PaperSpigot you can override the download URL with: +If you are hosting your own copy of Paper you can override the download URL with: - -e PAPER_DOWNLOAD_URL= From c8b6eac8fe50157afc7ea51cfa24b530f3741f05 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 23 Aug 2020 20:40:47 -0500 Subject: [PATCH 07/10] Updated FTBA modpack ID instructions Fixes #612 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e87379f..0d30aa04 100644 --- a/README.md +++ b/README.md @@ -482,7 +482,7 @@ A [Catserver](http://catserver.moe/) type server can be used with [Feed the Beast application](https://www.feed-the-beast.com/) modpacks are supported by using `-e TYPE=FTBA` (**note** the "A" at the end of the type). This server type will automatically take care of downloading and installing the modpack and appropriate version of Forge, so the `VERSION` does not need to be specified. ### Environment Variables: -- `FTB_MODPACK_ID`: **required**, the numerical ID of the modpack to install. The ID can be located by finding the modpack at [Neptune FTB](https://ftb.neptunepowered.org/) and using the "Pack ID" +- `FTB_MODPACK_ID`: **required**, the numerical ID of the modpack to install. The ID can be located by [finding the modpack](https://www.feed-the-beast.com/modpack) and using the "ID" displayed next to the name - `FTB_MODPACK_VERSION_ID`: optional, the numerical Id of the version to install. If not specified, the latest version will be installed. The "Version ID" can be obtained by drilling into the Versions tab and clicking a specific version. ### Upgrading From 42f90c880657143e7d95a6b09883d7e977f7669e Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 25 Aug 2020 19:10:55 -0500 Subject: [PATCH 08/10] Added variable to configure stop duration Fixes #617 --- README.md | 4 ++++ start-minecraftFinalSetup | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d30aa04..3a9083f2 100644 --- a/README.md +++ b/README.md @@ -1104,6 +1104,10 @@ Some older versions (pre-1.14) of Spigot required `--noconsole` to be passed whe Some older servers get confused and think that the GUI interface is enabled. You can explicitly disable that by passing `-e GUI=FALSE`. +### Stop Duration + +When the container is signalled to stop, the Minecraft process wrapper will attempt to send a "stop" command via RCON or console and waits for the process to gracefully finish. By defaul it waits 60 seconds, but that duration can be configured by setting the environment variable `STOP_DURATION` to the number of seconds. + ## Running on RaspberryPi To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag diff --git a/start-minecraftFinalSetup b/start-minecraftFinalSetup index 21b933cf..c2377d3a 100644 --- a/start-minecraftFinalSetup +++ b/start-minecraftFinalSetup @@ -173,7 +173,7 @@ function copyFilesForCurseForge() { cp -f /data/eula.txt "${FTB_DIR}/" } -mcServerRunnerArgs="--stop-duration 60s" +mcServerRunnerArgs="--stop-duration ${STOP_DURATION:-60}s" if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then if isTrue ${DEBUG_EXEC}; then set -x From 9ea675bc8913bf275e7c01173c26f02bc5ddc7ed Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 25 Aug 2020 21:44:36 -0500 Subject: [PATCH 09/10] Improved handling of latest PaperMC version Fixes #563 --- start-deployPaper | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/start-deployPaper b/start-deployPaper index 0422eafc..6a84a51c 100644 --- a/start-deployPaper +++ b/start-deployPaper @@ -12,16 +12,32 @@ fi downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download} log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..." -if ! curl -fsSL -o "$SERVER" $zarg "$downloadUrl" 2> /dev/null; then - if versions=$(curl -fsSL https://papermc.io/api/v1/paper 2> /dev/null | jq -r '.versions | join(", ")'); then - log "ERROR: ${VANILLA_VERSION} is not (yet) published by PaperMC" - log " Set VERSION to one of the following: " - log " ${versions}" - else - log "ERROR: failed to contact PaperMC at https://papermc.io/api/v1/paper" - fi - exit 3 -fi +out=$(curl -fsSL -o "$SERVER" $zarg "$downloadUrl" 2>&1) +case $? in + 0) + ;; + 22) # = 404 HTTP status + if versions=$(curl -fsSL https://papermc.io/api/v1/paper 2> /dev/null); then + if [[ $VERSION = LATEST ]]; then + VANILLA_VERSION=$(echo $versions | jq -r '.versions[0]') + log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC" + # re-execute the current script with the newly computed version + exec $0 "$@" + fi + log "ERROR: ${VANILLA_VERSION} is not (yet) published by PaperMC" + log " Set VERSION to one of the following: " + log " $(echo $versions | jq -r '.versions | join(", ")')" + else + log "ERROR: failed to retrieve versions from https://papermc.io/api/v1/paper" + fi + exit 3 + ;; + *) + log "ERROR: failed to contact PaperMC at $downloadUrl" + log " $out" + exit 3 + ;; +esac # Normalize on Spigot for downstream operations export TYPE=SPIGOT From 6cfc7e45efdea0b5b03ecaebb017b66d9a42ac2b Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 27 Aug 2020 18:49:24 -0500 Subject: [PATCH 10/10] ci: prepared for adopt14 variant --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9e436904..93c06f1e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,12 +8,14 @@ on: - openj9-nightly - adopt11 - adopt13 + - adopt14 tags: - "[0-9]+.[0-9]+.[0-9]+" - "[0-9]+.[0-9]+.[0-9]+-openj9" - "[0-9]+.[0-9]+.[0-9]+-openj9-nightly" - "[0-9]+.[0-9]+.[0-9]+-adopt11" - "[0-9]+.[0-9]+.[0-9]+-adopt13" + - "[0-9]+.[0-9]+.[0-9]+-adopt14" jobs: test: