From 0ddabf3089f561acf159ad63ecaef041d6b3c2db Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 10 Sep 2020 16:25:29 -0500 Subject: [PATCH 01/17] Corrected Fabric installer variables in README --- README.md | 34 ++++++++++++++++++---------------- start-deployFabric | 24 +++++++++++------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 3a9083f2..799e177f 100644 --- a/README.md +++ b/README.md @@ -557,29 +557,31 @@ Just change it with `SPONGEBRANCH`, such as: ## Running a Fabric Server -Enable Fabric server mode by adding a `-e TYPE=FABRIC` to your command-line. -By default the container will run the latest version of [Fabric server](http://fabricmc.net/use/) -but you can also choose to run a specific version with `-e FABRICVERSION=0.5.0.32`. +Enable [Fabric server](http://fabricmc.net/use/) mode by adding a `-e TYPE=FABRIC` to your command-line. By default, the container will run the latest version, but you can also choose to run a specific version with `VERSION`. - $ docker run -d -v /path/on/host:/data \ - -e TYPE=FABRIC -e FABRICVERSION=0.5.0.32 \ - -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server +``` +docker run -d -v /path/on/host:/data \ + -e TYPE=FABRIC \ + -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server +``` -To use a pre-downloaded Fabric installer, place it in the attached `/data` directory and -specify the name of the installer file with `FABRIC_INSTALLER`, such as: +A specific installer version can be requested using `FABRIC_INSTALLER_VERSION`. - $ docker run -d -v /path/on/host:/data ... \ - -e FABRIC_INSTALLER=fabric-installer-0.5.0.32.jar ... +To use a pre-downloaded Fabric installer, place it in a directory attached into the container, such as the `/data` volume and specify the name of the installer file with `FABRIC_INSTALLER`, such as: -To download a Fabric installer from a custom location, such as your own file repository, specify -the URL with `FABRIC_INSTALLER_URL`, such as: +``` +docker run -d -v /path/on/host:/data ... \ + -e FABRIC_INSTALLER=fabric-installer-0.5.0.32.jar ... +``` - $ docker run -d -v /path/on/host:/data ... \ - -e FORGE_INSTALLER_URL=http://HOST/fabric-installer-0.5.0.32.jar ... +To download a Fabric installer from a custom location, such as your own file repository, specify the URL with `FABRIC_INSTALLER_URL`, such as: -In both of the cases above, there is no need for the `VERSION` or `FABRICVERSION` variables. +``` +docker run -d -v /path/on/host:/data ... \ + -e FABRIC_INSTALLER_URL=http://HOST/fabric-installer-0.5.0.32.jar ... +``` -In order to add mods, you have two options. +In order to add mods, you have two options: ### Using the /data volume diff --git a/start-deployFabric b/start-deployFabric index 0c748455..e933b6f7 100644 --- a/start-deployFabric +++ b/start-deployFabric @@ -7,36 +7,34 @@ export TYPE=FABRIC FABRIC_INSTALLER=${FABRIC_INSTALLER:-} FABRIC_INSTALLER_URL=${FABRIC_INSTALLER_URL:-} -FABRICVERSION=${FABRICVERSION:-LATEST} +FABRIC_INSTALLER_VERSION=${FABRIC_INSTALLER_VERSION:-${FABRICVERSION:-LATEST}} if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then log "Checking Fabric version information." - case $FABRICVERSION in + case $FABRIC_INSTALLER_VERSION in LATEST) - FABRIC_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml) - ;; - - *) - FABRIC_VERSION=$FABRICVERSION + FABRIC_INSTALLER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml) ;; esac - FABRIC_INSTALLER="/tmp/fabric-installer-$FABRIC_VERSION.jar" + FABRIC_INSTALLER="/tmp/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar" + markerVersion=$FABRIC_INSTALLER_VERSION elif [[ -z $FABRIC_INSTALLER ]]; then FABRIC_INSTALLER="/tmp/fabric-installer.jar" + markerVersion=custom elif [[ ! -e $FABRIC_INSTALLER ]]; then log "ERROR: the given Fabric installer doesn't exist : $FABRIC_INSTALLER" exit 2 fi -installMarker="/data/.fabric-installed-${VANILLA_VERSION}-${FABRIC_VERSION:-manual}" +installMarker="/data/.fabric-installed-${VANILLA_VERSION}-${markerVersion}" debug Checking for installMarker ${installMarker} if [[ ! -e $installMarker ]]; then if [[ ! -e $FABRIC_INSTALLER ]]; then if [[ -z $FABRIC_INSTALLER_URL ]]; then - log "Downloading $FABRIC_VERSION" - downloadUrl="https://maven.fabricmc.net/net/fabricmc/fabric-installer/$FABRIC_VERSION/fabric-installer-$FABRIC_VERSION.jar" + log "Downloading installer version $FABRIC_INSTALLER_VERSION" + downloadUrl="https://maven.fabricmc.net/net/fabricmc/fabric-installer/${FABRIC_INSTALLER_VERSION}/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar" log "...trying $downloadUrl" curl -o $FABRIC_INSTALLER -fsSL $downloadUrl else @@ -49,9 +47,9 @@ if [[ ! -e $installMarker ]]; then fi if isDebugging; then - debug "Installing Fabric $FABRIC_VERSION using $FABRIC_INSTALLER with mcversion ${VANILLA_VERSION}" + debug "Installing Fabric ${VANILLA_VERSION} using $FABRIC_INSTALLER" else - log "Installing Fabric $FABRIC_VERSION using $FABRIC_INSTALLER" + log "Installing Fabric using $FABRIC_INSTALLER" fi tries=3 set +e From 7c3139226c6c631b0d3e113ad32f2d3e2c653f81 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 16 Sep 2020 17:09:16 -0500 Subject: [PATCH 02/17] Changed Paper update process to check FORCE_REDOWNLOAD first For #634 --- start-deployPaper | 64 +++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/start-deployPaper b/start-deployPaper index 6a84a51c..ebe6c958 100644 --- a/start-deployPaper +++ b/start-deployPaper @@ -2,42 +2,46 @@ . ${SCRIPTS:-/}start-utils set -o pipefail +isDebugging && set -x : ${PAPERBUILD:=latest} export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar -if [ -f "$SERVER" ] && ! isTrue "$FORCE_REDOWNLOAD"; then - zarg="-z '$SERVER'" -fi +if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then -downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download} -log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..." -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 "$@" + if [ -f "$SERVER" ]; then + zarg=(-z "$SERVER") + fi + + downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download} + log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..." + 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 - 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 + exit 3 + ;; + *) + log "ERROR: failed to contact PaperMC at $downloadUrl" + log " $out" + exit 3 + ;; + esac +fi # Normalize on Spigot for downstream operations export TYPE=SPIGOT From 8b977f87863dba3730c10ca593c6ae4dd1bd1725 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 27 Aug 2020 18:57:47 -0500 Subject: [PATCH 03/17] Added adopt14 variant --- README.md | 1 + docker-versions-create.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 799e177f..78bc997b 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ To use a different version of Java, please use a docker tag to run your Minecraf | Tag name | Description | Linux | | -------------- | ------------------------------------------- | ------------ | | latest | **Default**. Uses Java version 8 update 212 | Alpine Linux | +| adopt14 | Uses Java version 14 latest update | Alpine Linux | | adopt13 | Uses Java version 13 latest update | Alpine Linux | | adopt11 | Uses Java version 11 latest update | Alpine Linux | | openj9 | Uses Eclipse OpenJ9 JVM | Alpine Linux | diff --git a/docker-versions-create.sh b/docker-versions-create.sh index 8ed98c54..23a5ebae 100755 --- a/docker-versions-create.sh +++ b/docker-versions-create.sh @@ -1,7 +1,7 @@ #!/bin/bash #set -x # Use this variable to indicate a list of branches that docker hub is watching -branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'multiarch') +branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'adopt14' 'multiarch') function TrapExit { echo "Checking out back in master" From 777ad31de0d084dc04933f0469b4ceaadcd2c001 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 27 Sep 2020 10:21:33 -0500 Subject: [PATCH 04/17] Resolve latest bukkit/spigot directly from getbukkit Fixes #629 #631 --- start-deployBukkitSpigot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/start-deployBukkitSpigot b/start-deployBukkitSpigot index cb2309e5..96a262e2 100644 --- a/start-deployBukkitSpigot +++ b/start-deployBukkitSpigot @@ -58,6 +58,10 @@ function downloadSpigot { ;; esac + if [[ ${VERSION^^} = LATEST ]]; then + VANILLA_VERSION=$(restify https://getbukkit.org/download/spigot --attribute='property=og:title' | jq -r '.[0] | .attributes | select(.property == "og:title") | .content | split(" ") | .[-1]') + fi + if [[ -z $downloadUrl ]]; then downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar" fi From b06f1115d4e93af93c539209d0ba4487fa2e39bd Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 27 Sep 2020 10:27:46 -0500 Subject: [PATCH 05/17] Added pruning of 'config' to CF modpack upgrade Fixes #626 --- start-deployCF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start-deployCF b/start-deployCF index 3c902953..e81b5e59 100644 --- a/start-deployCF +++ b/start-deployCF @@ -28,7 +28,7 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then serverJar=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar") if [[ "${serverJar}" ]]; then - rm -rf $(dirname "${serverJar}")/{mods,*.jar,libraries,resources,scripts} + rm -rf $(dirname "${serverJar}")/{mods,*.jar,libraries,resources,scripts,config} fi else needsInstall=false From 6f1f8d7806c72f45e4b5f36319565ee396a6e9dd Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 3 Oct 2020 14:34:02 -0500 Subject: [PATCH 06/17] Added use of REMOVE_OLD_MODS to /mods processing --- README.md | 2 +- start-minecraftFinalSetup | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 78bc997b..1ef13abf 100644 --- a/README.md +++ b/README.md @@ -297,7 +297,7 @@ or downloading a world with the `WORLD` option. There are two additional volumes that can be mounted; `/mods` and `/config`. Any files in either of these filesystems will be copied over to the main -`/data` filesystem before starting Minecraft. +`/data` filesystem before starting Minecraft. If you want old mods to be removed as the `/mods` content is updated, then add `-e REMOVE_OLD_MODS=TRUE`. This works well if you want to have a common set of modules in a separate location, but still have multiple worlds with different server requirements diff --git a/start-minecraftFinalSetup b/start-minecraftFinalSetup index c2377d3a..c19a2a13 100644 --- a/start-minecraftFinalSetup +++ b/start-minecraftFinalSetup @@ -54,7 +54,10 @@ done if [ -d /mods ]; then log "Copying any mods over..." mkdir -p /data/mods - rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /mods /data + if isTrue "${REMOVE_OLD_MODS}"; then + rsyncArgs=(--delete) + fi + rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods /data fi [ -d /data/config ] || mkdir /data/config From 3cb72797b6abdd72e08e0c5429847dbea23c87ee Mon Sep 17 00:00:00 2001 From: vatertime Date: Wed, 7 Oct 2020 13:35:07 -0500 Subject: [PATCH 07/17] Added AWS blurb to readme (#644) * Added AWS blurb to readme * moved section in readme Co-authored-by: Chris Vater --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ef13abf..9420e52c 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,10 @@ describes period of the daemonized state machine, that handles the pausing of th The [examples directory](https://github.com/itzg/docker-minecraft-server/tree/master/examples) also provides examples of deploying the [itzg/minecraft-server](https://hub.docker.com/r/itzg/minecraft-server/) Docker image. +### Amazon Web Services (AWS) Deployment + +If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Minecraft Server Deployment (CloudFormation) repository](https://github.com/vatertime/minecraft-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use. + ## Running a Forge Server Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line. @@ -1117,4 +1121,4 @@ To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag itzg/minecraft-server:multiarch -> NOTE: you may need to lower the memory allocation, such as `-e MEMORY=750m` +> NOTE: you may need to lower the memory allocation, such as `-e MEMORY=750m` \ No newline at end of file From b7ac28e902101b0607004a6f8862c932829a1d43 Mon Sep 17 00:00:00 2001 From: Paul1365972 Date: Sun, 11 Oct 2020 20:27:59 +0200 Subject: [PATCH 08/17] IPv6 support for autopause (#646) --- files/autopause/autopause-fcns.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/autopause/autopause-fcns.sh b/files/autopause/autopause-fcns.sh index aea37a6f..5ebae93c 100644 --- a/files/autopause/autopause-fcns.sh +++ b/files/autopause/autopause-fcns.sh @@ -13,7 +13,7 @@ rcon_client_exists() { } mc_server_listening() { - [[ -n $(netstat -tln | grep "0.0.0.0:$SERVER_PORT" | grep LISTEN) ]] + [[ -n $(netstat -tln | grep -e "0.0.0.0:$SERVER_PORT" -e ":::$SERVER_PORT" | grep LISTEN) ]] } java_clients_connected() { @@ -29,7 +29,7 @@ java_clients_connected() { # remember, that the host network mode does not work with autopause because of the knockd utility for (( i=0; i<${#connections[@]}; i++ )) do - if [[ ! $(echo "${connections[$i]}" | awk '{print $5}') =~ ^\s*127\.0\.0\.1:.*$ ]] ; then + if [[ ! $(echo "${connections[$i]}" | awk '{print $5}') =~ ^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$ ]] ; then # not localhost return 0 fi From ed1bb73c221db86aaec8320cd9e3d8ea86cfd2b0 Mon Sep 17 00:00:00 2001 From: stevoh6 Date: Thu, 15 Oct 2020 04:21:40 +0200 Subject: [PATCH 09/17] Update deprecated LegacyJavaFixer path. (#648) --- start-deployCF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start-deployCF b/start-deployCF index e81b5e59..97e4e54f 100644 --- a/start-deployCF +++ b/start-deployCF @@ -6,7 +6,7 @@ set -e 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 +legacyJavaFixerUrl=https://ftb.forgecdn.net/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar export TYPE=FEED-THE-BEAST FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD} From 31b8535854adaaea68eab5b9b2b0e79515b0651e Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 30 Oct 2020 17:03:13 -0500 Subject: [PATCH 10/17] Added debug output for bukkit/sigot type For #655 --- start-deployBukkitSpigot | 1 + 1 file changed, 1 insertion(+) diff --git a/start-deployBukkitSpigot b/start-deployBukkitSpigot index 96a262e2..bad714d6 100644 --- a/start-deployBukkitSpigot +++ b/start-deployBukkitSpigot @@ -1,6 +1,7 @@ #!/bin/bash . ${SCRIPTS:-/}start-utils +isDebugging && set -x set -e From e56a74dc81bc390cfccb4e06d7f28a1565d42366 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Mon, 2 Nov 2020 20:31:01 -0600 Subject: [PATCH 11/17] Improved handling of bad spigot/bukkit downloads via temp file For #655 --- start-deployBukkitSpigot | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/start-deployBukkitSpigot b/start-deployBukkitSpigot index bad714d6..77e8d24b 100644 --- a/start-deployBukkitSpigot +++ b/start-deployBukkitSpigot @@ -72,8 +72,9 @@ function downloadSpigot { zarg="-z $SERVER" fi log "Downloading $match from $downloadUrl ..." - curl -fsSL -o $SERVER $zarg "$downloadUrl" - if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then + tmpJar=/tmp/${getbukkitFlavor}.jar + curl -fsSL -o "$tmpJar" $zarg "$downloadUrl" + if [[ $? != 0 || $(grep -c "DOCTYPE html" $tmpJar) != 0 ]]; then cat < Date: Tue, 3 Nov 2020 16:47:46 -0600 Subject: [PATCH 12/17] Revert "Improved handling of bad spigot/bukkit downloads via temp file For #655" This reverts commit e56a74dc --- start-deployBukkitSpigot | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/start-deployBukkitSpigot b/start-deployBukkitSpigot index 77e8d24b..bad714d6 100644 --- a/start-deployBukkitSpigot +++ b/start-deployBukkitSpigot @@ -72,9 +72,8 @@ function downloadSpigot { zarg="-z $SERVER" fi log "Downloading $match from $downloadUrl ..." - tmpJar=/tmp/${getbukkitFlavor}.jar - curl -fsSL -o "$tmpJar" $zarg "$downloadUrl" - if [[ $? != 0 || $(grep -c "DOCTYPE html" $tmpJar) != 0 ]]; then + curl -fsSL -o $SERVER $zarg "$downloadUrl" + if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then cat < Date: Tue, 3 Nov 2020 16:49:38 -0600 Subject: [PATCH 13/17] Added debug logging of bukkit/spigot curl download For #655 --- start-deployBukkitSpigot | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/start-deployBukkitSpigot b/start-deployBukkitSpigot index bad714d6..443f6426 100644 --- a/start-deployBukkitSpigot +++ b/start-deployBukkitSpigot @@ -67,12 +67,16 @@ function downloadSpigot { downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar" fi + setServerVar if [ -f $SERVER ]; then # tell curl to only download when newer - zarg="-z $SERVER" + curlArgs="-z $SERVER" + fi + if isDebugging; then + curlArgs="$curlArgs -v" fi log "Downloading $match from $downloadUrl ..." - curl -fsSL -o $SERVER $zarg "$downloadUrl" + curl -fsSL -o $SERVER $curlArgs "$downloadUrl" if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then cat < Date: Wed, 4 Nov 2020 17:04:57 -0600 Subject: [PATCH 14/17] Removed invalid spigot/bukkit download along with debug of content For #655 --- start-deployBukkitSpigot | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/start-deployBukkitSpigot b/start-deployBukkitSpigot index 443f6426..37b59269 100644 --- a/start-deployBukkitSpigot +++ b/start-deployBukkitSpigot @@ -85,6 +85,13 @@ ERROR: failed to download from $downloadUrl exact version, such as 1.4.6-R0.4-SNAPSHOT or 1.8-R0.1-SNAPSHOT-LATEST EOF + + if isDebugging && [[ $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then + cat $SERVER + fi + + # remove invalid download + rm $SERVER exit 3 fi From f68e979229469f070a91155985f07439294b0649 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 6 Nov 2020 14:47:04 -0600 Subject: [PATCH 15/17] docs: Improved appearance of Discord badge For #481 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9420e52c..0aa245fa 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![Docker Pulls](https://img.shields.io/docker/pulls/itzg/minecraft-server.svg)](https://hub.docker.com/r/itzg/minecraft-server/) [![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/) [![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/docker-minecraft-server.svg)](https://github.com/itzg/docker-minecraft-server/issues) -[![Discord](https://img.shields.io/discord/660567679458869252)](https://discord.gg/DXfKpjB) +[![Discord](https://img.shields.io/discord/660567679458869252?label=Discord&logo=discord)](https://discord.gg/DXfKpjB) [![Build and Publish](https://github.com/itzg/docker-minecraft-server/workflows/Build%20and%20Publish/badge.svg)](https://github.com/itzg/docker-minecraft-server/actions) [![](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-orange.svg)](https://www.buymeacoffee.com/itzg) From 08a4bde6c1a004918f15ae825f0c72adbcde9462 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 25 Nov 2020 15:42:27 -0600 Subject: [PATCH 16/17] Switched to PaperMC v2 API Fixes #670 --- start-deployPaper | 79 +++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/start-deployPaper b/start-deployPaper index ebe6c958..16e80edb 100644 --- a/start-deployPaper +++ b/start-deployPaper @@ -4,43 +4,54 @@ set -o pipefail isDebugging && set -x -: ${PAPERBUILD:=latest} -export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar +# PaperMC API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config -if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then +build=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \ + | jq '.builds[-1]') +case $? in + 0) + ;; + 22) + versions=$(curl -fsSL "https://papermc.io/api/v2/projects/paper" -H "accept: application/json") + if [[ $VERSION = LATEST ]]; then + VANILLA_VERSION=$(echo "$versions" | jq -r '.versions[-1]') + 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 published by PaperMC" + log " Set VERSION to one of the following: " + log " $(echo "$versions" | jq -r '.versions | join(", ")')" + exit 1 + ;; + *) + echo "ERROR: unknown error while looking up PaperMC version=${VANILLA_VERSION}" + exit 1 + ;; +esac +if [ $? != 0 ]; then + echo "ERROR: failed to lookup PaperMC build from version ${VANILLA_VERSION}" + exit 1 +fi - if [ -f "$SERVER" ]; then - zarg=(-z "$SERVER") - fi +export SERVER=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}" -H "accept: application/json" \ + | jq -r '.downloads.application.name') +if [ $? != 0 ]; then + echo "ERROR: failed to lookup PaperMC download file from version=${VANILLA_VERSION} build=${build}" + exit 1 +fi - downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download} - log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..." - 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 +if [ -f "$SERVER" ]; then + zarg=(-z "$SERVER") +fi + +log "Downloading PaperMC $VANILLA_VERSION (build $build) ..." +curl -fsSL -o "$SERVER" "${zarg[@]}" \ + "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \ + -H "accept: application/java-archive" +if [ $? != 0 ]; then + echo "ERROR: failed to download PaperMC from version=${VANILLA_VERSION} build=${build} download=${SERVER}" + exit 1 fi # Normalize on Spigot for downstream operations From a368f4cf573b6069030c1b55aa633977cc4303d3 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 25 Nov 2020 15:52:07 -0600 Subject: [PATCH 17/17] misc: Added multiarch-latest to versions to release --- docker-versions-create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-versions-create.sh b/docker-versions-create.sh index 23a5ebae..b9a4c0a9 100755 --- a/docker-versions-create.sh +++ b/docker-versions-create.sh @@ -1,7 +1,7 @@ #!/bin/bash #set -x # Use this variable to indicate a list of branches that docker hub is watching -branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'adopt14' 'multiarch') +branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'adopt14' 'multiarch' 'multiarch-latest') function TrapExit { echo "Checking out back in master"