Compare commits

..

13 Commits

Author SHA1 Message Date
renovate[bot] 02a6a6c2f9 Update dependency itzg/restify to v1.7.17 2026-07-13 02:48:52 +00:00
Geoff Bourne 641f19879a Use GLIBC 2.34 compatible knockd for Java 17 images and older (#4158) 2026-07-12 21:48:11 -05:00
Geoff Bourne de75f2e671 Use http/1.1 for CurseForge (#4155) 2026-07-11 21:23:04 -05:00
renovate[bot] 175004e656 Update dependency itzg/mc-image-helper to v1.61.2 (#4154)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-11 20:23:54 -05:00
Bas Magré 81293634de Added: riscv64 support (#4144) 2026-07-11 17:37:36 -05:00
Geoff Bourne 3c3e49e385 Document troubleshooting of Reactor Netty's HTTP client (#4153) 2026-07-11 11:14:21 -05:00
Geoff Bourne fd55a0cc08 Added iproute2 package to provide ip tool (#4152) 2026-07-10 22:07:36 -05:00
dependabot[bot] b0de461d1e build(deps): bump the patches group in /docs with 2 updates (#4150) 2026-07-08 19:17:06 -05:00
dependabot[bot] ebb80ea264 build(deps): bump the updates group with 3 updates (#4149) 2026-07-08 07:29:39 -05:00
renovate[bot] 702d05e60c Update dependency itzg/mc-monitor to v0.16.10 (#4148)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-07 18:52:58 -05:00
David Gaag 32b026d0df Fix GTNH versions.json parsing (#4146) 2026-07-06 06:59:21 -05:00
Leon Kampwerth d9ee3ee68c Refactor deploy gtnh (#4141) 2026-07-05 07:43:43 -05:00
Geoff Bourne ab505fa43c Pass GH_TOKEN to containers started during tests (#4136) 2026-07-04 23:17:54 -05:00
16 changed files with 200 additions and 127 deletions
+2
View File
@@ -0,0 +1,2 @@
*.sh text eol=lf
scripts/** text eol=lf
+24 -6
View File
@@ -40,13 +40,17 @@ jobs:
include:
# JAVA 25
- variant: java25
baseImage: eclipse-temurin:25-jre
platforms: linux/amd64,linux/arm64
# NOTE: 25-jre is also Noble (currently), but this variant needs to be 25-jre-noble specifically to include riscv64
# Keep this aligned in verify-pr.yml also
baseImage: eclipse-temurin:25-jre-noble
platforms: linux/amd64,linux/arm64,linux/riscv64
mcVersion: latest
- variant: java25-alpine
baseImage: eclipse-temurin:25-jre-alpine
platforms: linux/amd64,linux/arm64
mcVersion: latest
# For GLIBC_2.34 support (and Alpine)
knockdRepoOrg: Metalcape/knock
- variant: java25-jdk
baseImage: eclipse-temurin:25
platforms: linux/amd64,linux/arm64
@@ -64,17 +68,23 @@ jobs:
baseImage: eclipse-temurin:21-jre-alpine
platforms: linux/amd64,linux/arm64
mcVersion: 1.21.11
# For GLIBC_2.34 support (and Alpine)
knockdRepoOrg: Metalcape/knock
# JAVA 17:
- variant: java17
# jammy doesn't work until minecraft updates to https://github.com/netty/netty/issues/12343
baseImage: eclipse-temurin:17-jre-focal
platforms: linux/amd64,linux/arm/v7,linux/arm64
mcVersion: 1.20.4
# For GLIBC_2.34 support (and Alpine)
knockdRepoOrg: Metalcape/knock
# JAVA 16
- variant: java16
baseImage: adoptopenjdk:16-jre-hotspot
platforms: linux/amd64,linux/arm/v7,linux/arm64
mcVersion: 1.16.5
# For GLIBC_2.34 support
knockdRepoOrg: Metalcape/knock
# Pin version for pre-Java 17
mcHelperVersion: 1.51.3-java8
# JAVA 11
@@ -82,6 +92,8 @@ jobs:
baseImage: adoptopenjdk:11-jre-hotspot
platforms: linux/amd64,linux/arm/v7,linux/arm64
mcVersion: 1.16.4
# For GLIBC_2.34 support
knockdRepoOrg: Metalcape/knock
# Pin version for pre-Java 17
mcHelperVersion: 1.51.3-java8
# JAVA 8: NOTE: Unable to go past 8u312 because of Forge dependencies
@@ -89,12 +101,16 @@ jobs:
baseImage: eclipse-temurin:8u312-b07-jre-focal
platforms: linux/amd64,linux/arm/v7,linux/arm64
mcVersion: 1.12.2
# For GLIBC_2.34 support
knockdRepoOrg: Metalcape/knock
# Pin version for Java 8, also be sure to set in verify-pr.yml
mcHelperVersion: 1.51.3-java8
- variant: java8-jdk
baseImage: eclipse-temurin:8u312-b07-jdk-focal
platforms: linux/amd64,linux/arm64
mcVersion: 1.12.2
# For GLIBC_2.34 support
knockdRepoOrg: Metalcape/knock
# Pin version for Java 8, also be sure to set in verify-pr.yml
mcHelperVersion: 1.51.3-java8
env:
@@ -111,7 +127,7 @@ jobs:
- name: Docker meta
id: meta
uses: docker/metadata-action@v6.1.0
uses: docker/metadata-action@v6.2.0
with:
# NOTE for forks: if your Docker Hub organization doesn't match your Github repo's,
# then the use of ${{ github.repository_owner }} will need to be replaced.
@@ -144,7 +160,7 @@ jobs:
uses: docker/setup-buildx-action@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v4.1.0
uses: docker/setup-qemu-action@v4.2.0
- name: Build for test
uses: docker/build-push-action@v7
@@ -159,6 +175,7 @@ jobs:
build-args: |
BASE_IMAGE=${{ matrix.baseImage }}
${{ matrix.mcHelperVersion && format('MC_HELPER_VERSION={0}', matrix.mcHelperVersion) }}
${{ matrix.knockdRepoOrg && format('KNOCKD_REPO_ORG={0}', matrix.knockdRepoOrg) }}
cache-from: type=gha,scope=${{ matrix.variant }}
# no cache-to to avoid cross-cache update from next build step
@@ -172,14 +189,14 @@ jobs:
tests/test.sh
- name: Login to DockerHub
uses: docker/login-action@v4.2.0
uses: docker/login-action@v4.4.0
if: env.HAS_IMAGE_REPO_ACCESS
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v4.2.0
uses: docker/login-action@v4.4.0
if: env.HAS_IMAGE_REPO_ACCESS
with:
registry: ghcr.io
@@ -215,5 +232,6 @@ jobs:
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
${{ matrix.mcHelperVersion && format('MC_HELPER_VERSION={0}', matrix.mcHelperVersion) }}
${{ matrix.knockdRepoOrg && format('KNOCKD_REPO_ORG={0}', matrix.knockdRepoOrg) }}
cache-from: type=gha,scope=${{ matrix.variant }}
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
+10 -1
View File
@@ -29,23 +29,30 @@ jobs:
include:
# JAVA 21/25:
- variant: java25
baseImage: eclipse-temurin:25-jre
# stay aligned with build.yml
baseImage: eclipse-temurin:25-jre-noble
platforms: linux/amd64,linux/arm64
mcVersion: latest
- variant: java25-alpine
baseImage: eclipse-temurin:25-jre-alpine
platforms: linux/amd64,linux/arm64
mcVersion: latest
# For GLIBC_2.34 support (and Alpine)
knockdRepoOrg: Metalcape/knock
# JAVA 17:
- variant: java17
# jammy doesn't work until minecraft updates to https://github.com/netty/netty/issues/12343
baseImage: eclipse-temurin:17-jre-focal
platforms: linux/amd64
mcVersion: 1.20.4
# For GLIBC_2.34 support
knockdRepoOrg: Metalcape/knock
- variant: java8
baseImage: eclipse-temurin:8u312-b07-jre-focal
platforms: linux/amd64
mcVersion: 1.12.2
# For GLIBC_2.34 support
knockdRepoOrg: Metalcape/knock
# Pin version for Java 8, be sure to also set in build.yml
mcHelperVersion: 1.51.3-java8
env:
@@ -70,6 +77,7 @@ jobs:
build-args: |
BASE_IMAGE=${{ matrix.baseImage }}
${{ matrix.mcHelperVersion && format('MC_HELPER_VERSION={0}', matrix.mcHelperVersion) }}
${{ matrix.knockdRepoOrg && format('KNOCKD_REPO_ORG={0}', matrix.knockdRepoOrg) }}
cache-from: type=gha,scope=${{ matrix.variant }}
- name: Build for test
@@ -87,6 +95,7 @@ jobs:
build-args: |
BASE_IMAGE=${{ matrix.baseImage }}
${{ matrix.mcHelperVersion && format('MC_HELPER_VERSION={0}', matrix.mcHelperVersion) }}
${{ matrix.knockdRepoOrg && format('KNOCKD_REPO_ORG={0}', matrix.knockdRepoOrg) }}
cache-from: type=gha,scope=${{ matrix.variant }}
- name: Run tests
+5 -3
View File
@@ -12,6 +12,8 @@ ARG EXTRA_DEB_PACKAGES=""
ARG EXTRA_DNF_PACKAGES=""
ARG EXTRA_ALPINE_PACKAGES=""
ARG FORCE_INSTALL_PACKAGES=1
ARG KNOCKD_VERSION=0.8.1
ARG KNOCKD_REPO_ORG=Opvolger/knock
RUN --mount=target=/build,source=build \
TARGET=${TARGETARCH}${TARGETVARIANT} \
/build/run.sh install-packages
@@ -31,7 +33,7 @@ ADD ${GITHUB_BASEURL}/itzg/easy-add/releases/download/${EASY_ADD_VERSION}/easy-a
RUN chmod +x /usr/bin/easy-add
# renovate: datasource=github-releases packageName=itzg/restify
ARG RESTIFY_VERSION=1.7.16
ARG RESTIFY_VERSION=1.7.17
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=${RESTIFY_VERSION} --var app=restify --file {{.app}} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
@@ -43,7 +45,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
# renovate: datasource=github-releases packageName=itzg/mc-monitor
ARG MC_MONITOR_VERSION=0.16.8
ARG MC_MONITOR_VERSION=0.16.10
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=${MC_MONITOR_VERSION} --var app=mc-monitor --file {{.app}} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
@@ -55,7 +57,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
# renovate: datasource=github-releases packageName=itzg/mc-image-helper versioning=loose
ARG MC_HELPER_VERSION=1.61.1
ARG MC_HELPER_VERSION=1.61.2
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
# used for cache busting local copy of mc-image-helper
ARG MC_HELPER_REV=1
+2 -1
View File
@@ -17,6 +17,7 @@ apk add --no-cache -U \
bash \
curl \
iputils \
iproute2 \
git \
git-lfs \
jq \
@@ -37,7 +38,7 @@ apk add --no-cache -U \
${EXTRA_ALPINE_PACKAGES}
# Download and install patched knockd
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-alpine-amd64.tar.gz
curl -fsSL -o /tmp/knock.tar.gz "https://github.com/${KNOCKD_REPO_ORG}/releases/download/${KNOCKD_VERSION}/knock-${KNOCKD_VERSION}-alpine-amd64.tar.gz"
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
setcap cap_net_raw=ep /usr/local/sbin/knockd
+1
View File
@@ -33,6 +33,7 @@ dnf install -y \
sudo \
net-tools \
iputils \
iproute \
curl \
git \
jq \
+2 -1
View File
@@ -14,6 +14,7 @@ apt-get install -y \
sudo \
net-tools \
iputils-ping \
iproute2 \
curl \
git \
git-lfs \
@@ -37,7 +38,7 @@ apt-get install -y \
apt-get clean
# Download and install patched knockd
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz
curl -fsSL -o /tmp/knock.tar.gz "https://github.com/${KNOCKD_REPO_ORG}/releases/download/${KNOCKD_VERSION}/knock-${KNOCKD_VERSION}-$TARGET.tar.gz"
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
setcap cap_net_raw=ep /usr/local/sbin/knockd
+8 -1
View File
@@ -51,4 +51,11 @@ When exec'ed interactively into the container, jattach can be invoked against th
```shell
jattach $(pgrep java) threaddump
```
```
## Networking errors
If observing network error/exceptions that involve the term "reactor.netty.http.client", then further tracing logs can be enabled by setting the following environment variables:
- `FETCH_WIRETAP` to `true`
- `HELPER_LOGGING_LEVEL` to `trace`
+2 -2
View File
@@ -16,10 +16,10 @@ packaging==26.2
pathspec==1.1.1
platformdirs==4.10.0
Pygments==2.20.0
pymdown-extensions==11.0
pymdown-extensions==11.0.1
python-dateutil==2.9.0.post0
PyYAML==6.0.3
pyyaml_env_tag==1.1
six==1.17.0
watchdog==6.0.0
zensical==0.0.46
zensical==0.0.47
@@ -35,7 +35,7 @@ For optimal performance choose java25 with GTNH 2.8.0 and later.
## Config backups
During version upgrade, the server will replace all config files to make sure all new features are setup as intended. The old config files are stored in a backup folder in the data directory, for you to use as reference for manual reapplication of your changed settings. Set the environment variable `GTNH_DELETE_BACKUPS` to true to delete all backup folders at startup.
During version upgrade, the server will replace all config files to make sure all new features are setup as intended. The old config files are stored in a backup folder in the data directory, for you to use as reference for manual reapplication of your changed settings. The folder name starts with `gtnh-upgrade-` followed by a timestamp. Set the environment variable `GTNH_DELETE_BACKUPS` to true to delete all backup folders at startup.
## server.properties defaults
+14 -14
View File
@@ -10,20 +10,20 @@ or explicitly include the tag, such as
where `<tag>` refers to the first column of this table:
| Tag | Java version | Linux | JVM Type | Architecture | Note |
|----------------|--------------|--------|--------------------|---------------------|------|
| latest | 25 | Ubuntu | Hotspot | amd64, arm64 | |
| stable | 25 | Ubuntu | Hotspot | amd64, arm64 | |
| java25 | 25 | Ubuntu | Hotspot | amd64, arm64 | |
| java25-alpine | 25 | Alpine | Hotspot | amd64, arm64 | |
| java25-jdk | 25 | Ubuntu | Hotspot+JDK | amd64, arm64 | |
| java21 | 21 | Ubuntu | Hotspot | amd64, arm64 | |
| java21-jdk | 21 | Ubuntu | Hotspot+JDK | amd64, arm64 | |
| java21-alpine | 21 | Alpine | Hotspot | amd64, arm64 | |
| java17 | 17 | Ubuntu | Hotspot | amd64, arm64, armv7 | |
| java16 | 16 | Ubuntu | Hotspot | amd64, arm64, armv7 | (1) |
| java11 | 11 | Ubuntu | Hotspot | amd64, arm64, armv7 | |
| java8 | 8 | Ubuntu | Hotspot | amd64, arm64, armv7 | |
| Tag | Java version | Linux | JVM Type | Architecture | Note |
|---------------|--------------|--------|-------------|-----------------------|------|
| latest | 25 | Ubuntu | Hotspot | amd64, arm64, riscv64 | |
| stable | 25 | Ubuntu | Hotspot | amd64, arm64, riscv64 | |
| java25 | 25 | Ubuntu | Hotspot | amd64, arm64, riscv64 | |
| java25-alpine | 25 | Alpine | Hotspot | amd64, arm64 | |
| java25-jdk | 25 | Ubuntu | Hotspot+JDK | amd64, arm64 | |
| java21 | 21 | Ubuntu | Hotspot | amd64, arm64 | |
| java21-jdk | 21 | Ubuntu | Hotspot+JDK | amd64, arm64 | |
| java21-alpine | 21 | Alpine | Hotspot | amd64, arm64 | |
| java17 | 17 | Ubuntu | Hotspot | amd64, arm64, armv7 | |
| java16 | 16 | Ubuntu | Hotspot | amd64, arm64, armv7 | (1) |
| java11 | 11 | Ubuntu | Hotspot | amd64, arm64, armv7 | |
| java8 | 8 | Ubuntu | Hotspot | amd64, arm64, armv7 | |
Notes
+3 -3
View File
@@ -5,7 +5,7 @@
"java": "25",
"distribution": "ubuntu",
"jvm": "hotspot",
"architectures": ["amd64", "arm64"],
"architectures": ["amd64", "arm64", "riscv64"],
"lts": true
},
{
@@ -14,7 +14,7 @@
"java": "25",
"distribution": "ubuntu",
"jvm": "hotspot",
"architectures": ["amd64", "arm64"],
"architectures": ["amd64", "arm64", "riscv64"],
"lts": true
},
{
@@ -22,7 +22,7 @@
"java": "25",
"distribution": "ubuntu",
"jvm": "hotspot",
"architectures": ["amd64", "arm64"]
"architectures": ["amd64", "arm64", "riscv64"]
},
{
"tag": "java25-alpine",
+2
View File
@@ -24,6 +24,7 @@ set -eu
: "${CF_API_CACHE_DEFAULT_TTL:=}" # as ISO-8601 duration, such as P2D or PT12H
: "${CF_API_KEY_FILE:=}" # Path to file containing CurseForge API key
: "${CF_MOD_LOADER_VERSION:=}" # Override mod loader version
: "${CF_USE_HTTP2:=false}" # CF downloads are faster with HTTP 1.1
resultsFile=/data/.install-curseforge.env
@@ -46,6 +47,7 @@ args=(
--force-synchronize="$CF_FORCE_SYNCHRONIZE"
--force-reinstall-modloader="$CF_FORCE_REINSTALL_MODLOADER"
--overrides-skip-existing="$CF_OVERRIDES_SKIP_EXISTING"
--use-http2="$CF_USE_HTTP2"
)
setArg() {
arg="${1?}"
+119 -92
View File
@@ -7,13 +7,14 @@
function getGTNHdownloadPath(){
gtnh_download_path=""
local release_object=""
local current_java_version=$(mc-image-helper java-release)
local current_java_version=""
current_java_version=$(mc-image-helper java-release)
# Select release JSON object
if [ "$GTNH_PACK_VERSION" == "latest-dev" ]; then
if ! release_object="$(
curl -fsSL "https://downloads.gtnewhorizons.com/versions.json" \
| jq -r '.versions|to_entries|sort_by(.value.releaseDate)|map(select(.value.title=="Beta release"))|.[-1]'
| jq -r '(.versions // .)|to_entries|sort_by(.value.releaseDate)|map(select(.value.title=="Beta release"))|.[-1]'
)"; then logError "Failed to retrieve release from https://downloads.gtnewhorizons.com/versions.json"
exit 1
fi
@@ -22,7 +23,7 @@ function getGTNHdownloadPath(){
elif [ "$GTNH_PACK_VERSION" == "latest" ]; then
if ! release_object="$(
curl -fsSL "https://downloads.gtnewhorizons.com/versions.json" \
| jq -r '.versions|to_entries|sort_by(.value.releaseDate)|map(select(.value.title=="Stable release"))|.[-1]'
| jq -r '(.versions // .)|to_entries|sort_by(.value.releaseDate)|map(select(.value.title=="Stable release"))|.[-1]'
)"; then logError "Failed to retrieve release from https://downloads.gtnewhorizons.com/versions.json"
exit 1
fi
@@ -31,13 +32,18 @@ function getGTNHdownloadPath(){
else
if ! release_object="$(
curl -fsSL "https://downloads.gtnewhorizons.com/versions.json" \
| jq -r --arg USRIN "$GTNH_PACK_VERSION" '.versions|to_entries|sort_by(.value.releaseDate)|map(select(.key==$USRIN))|.[]'
| jq -r --arg USRIN "$GTNH_PACK_VERSION" '(.versions // .)|to_entries|sort_by(.value.releaseDate)|map(select(.key==$USRIN))|.[]'
)"; then logError "Failed to retrieve release from https://downloads.gtnewhorizons.com/versions.json"
exit 1
fi
log "Selected $(jq -r '.key' <<< "$release_object") as matching version for download."
fi
if [[ -z $release_object ]]; then
logError "No release found for GTNH_PACK_VERSION=$GTNH_PACK_VERSION. Please check if the version is valid."
exit 1
fi
# Select compatible server files for java version
if (( current_java_version == 8 )); then
@@ -59,6 +65,10 @@ function getGTNHdownloadPath(){
fi
if [[ -z $gtnh_download_path ]]; then
logError "Server files not found! Please check if the selected GTNH_PACK_VERSION=$GTNH_PACK_VERSION is valid."
exit 1
fi
debug "Download source URL: $gtnh_download_path"
}
@@ -70,80 +80,125 @@ function deleteGTNHbackup(){
fi
}
function downloadGTNH(){
local gtnh_download=""
base_dir=/data/.tmp/gtnh_base
debug "Creating temporary /data/.tmp/packs folder for GTNH download"
mkdir -p /data/.tmp/packs
trap 'rm -rf /data/.tmp' EXIT
log "Downloading $gtnh_download_path."
if ! gtnh_download=$(mc-image-helper get -o /data/.tmp/packs --output-filename --skip-up-to-date "$gtnh_download_path"); then
logError "Failed to download $gtnh_download_path"
exit 1
fi
debug "Downloaded GTNH server files to $gtnh_download"
# Unpacking Server files into temporary directory
log "Unpacking Server Files into $base_dir"
mkdir -p "${base_dir}"
extract "${gtnh_download}" "${base_dir}"
# Remove any eula file since container manages it
debug "Removing eula.txt from $base_dir"
rm -f "${base_dir}/eula.txt"
# recalculate the actual base directory of content
if ! base_dir=$(mc-image-helper find \
--max-depth=3 --type=directory --name=mods,config \
--only-shallowest --fail-no-matches --format '%h' \
"$base_dir"); then
logError "Unable to find content base of downloaded Server Files"
exit 1
fi
debug "Base directory of unpacked Server Files: $base_dir"
}
function updateGTNHresource(){
local resource="$1"
local new_resource="$2"
log "Trying to update $resource"
if [[ -z "$resource" ]]; then
logWarning "No resource specified for update"
return 0
fi
if [[ -e "$resource" ]]; then
log "Deleting existing resource: $resource"
if ! rm -rf "$resource"; then
logError "Failed to delete resource: $resource"
exit 1
fi
fi
if [[ -d "$new_resource" ]]; then
log "Copying $new_resource to /data"
if ! cp -r "$new_resource" "/data/"; then
logError "Failed to copy $new_resource to /data"
exit 1
fi
return 0
fi
if [[ -f "$new_resource" ]]; then
log "Copying $new_resource to /data"
if ! cp "$new_resource" "/data/"; then
logError "Failed to copy $new_resource to /data"
exit 1
fi
return 0
fi
logWarning "Resource update failed: $new_resource does not exist!"
return 0
}
function updateGTNH(){
# Get the current date and time
current_datetime=$(date +%Y-%m-%dT%H:%M)
local current_datetime=""
current_datetime=$(date +%Y-%m-%dT+%H%M)
# Define folders and files to update
folders_to_update=("libraries" "mods" "resources" "scripts")
files_to_update=("lwjgl3ify-forgePatches.jar" "java9args.txt" "startserver-java9.bat" "startserver-java9.sh" "forge-1.7.10-10.13.4.1614-1.7.10-universal.jar" "startserver.bat" "startserver.sh" "server-icon.png")
config_folder="config"
backup_folder="/data/gtnh-upgrade-$current_datetime"
journey_map_folder="JourneyMapServer"
# Delete specified folders if they exist
for folder in "${folders_to_update[@]}"; do
folder_path="/data/$folder"
if [[ -d "$folder_path" ]]; then
log "Deleting folder: $folder_path"
rm -rf "$folder_path"
fi
done
# Delete specific files if they exist
for file in "${files_to_update[@]}"; do
file_path="/data/$file"
if [[ -f "$file_path" ]]; then
log "Deleting file: $file_path"
rm -f "$file_path"
fi
done
# base_dir is already defined in handleGTNH function
local folders_to_update=("libraries" "mods" "resources" "scripts")
local files_to_update=("lwjgl3ify-forgePatches.jar" "java9args.txt" "startserver-java9.bat" "startserver-java9.sh" "forge-1.7.10-10.13.4.1614-1.7.10-universal.jar" "startserver.bat" "startserver.sh" "server-icon.png")
local config_folder="config"
local backup_folder="/data/gtnh-upgrade-$current_datetime"
local journey_map_folder="JourneyMapServer"
# Backup the config folder
if [[ -d "/data/$config_folder" ]]; then
log "Creating backup of /data/$config_folder at $backup_folder"
cp -r "/data/$config_folder" "$backup_folder"
log "Deleting original /data/$config_folder"
rm -rf "/data/$config_folder"
fi
# Updating the required folders in data directory
for folder in "${folders_to_update[@]}" "$config_folder"; do
if [[ -d "$base_dir/$folder" ]]; then
log "Copying $folder to /data"
cp -r "$base_dir/$folder" "/data/"
else
logWarning "Folder $folder not found in the unzipped data!"
fi
done
# Copy specific files to the /data directory
for file in "${files_to_update[@]}"; do
if [[ -f "$base_dir/$file" ]]; then
log "Copying $file to /data"
cp "$base_dir/$file" "/data/"
else
logWarning "File $file not found in the unzipped data!"
fi
done
# Update resources from unpacked server files to /data
for resource in "${folders_to_update[@]}" "$config_folder" "${files_to_update[@]}"; do
local resource_path="/data/$resource"
local new_resource_path="$base_dir/$resource"
# Ensure the config folder exists
if [[ ! -d "$config_folder" ]]; then
log "$config_folder does not exist. Creating it now."
mkdir -p "$config_folder"
fi
debug "Updating resource: $resource_path with new resource: $new_resource_path"
updateGTNHresource "$resource_path" "$new_resource_path"
done
# Restore JourneyMapServer folder from backup
if [[ -d "$backup_folder/$journey_map_folder" ]]; then
log "Restoring $journey_map_folder to $config_folder"
cp -r "$backup_folder/$journey_map_folder" "$config_folder/"
if [[ ! -d "/data/$config_folder" ]]; then
log "/data/$config_folder folder does not exist. Creating it now."
mkdir -p "/data/$config_folder"
fi
log "Restoring $journey_map_folder to /data/$config_folder"
cp -r "$backup_folder/$journey_map_folder" "/data/$config_folder/"
else
logWarning "$journey_map_folder not found in backup!"
fi
# Copy the changelog file to /data
local gtnh_changelog_file=""
gtnh_changelog_file=$(mc-image-helper find --max-depth=1 --type=file --name=changelog*.md "$base_dir")
if [[ -n "$gtnh_changelog_file" ]]; then
debug "Found changelog file: $gtnh_changelog_file"
log "Copying changelog file to /data"
cp -f "$gtnh_changelog_file" /data/
fi
@@ -163,46 +218,16 @@ function handleGTNH() {
if [[ -n "$GTNH_PACK_VERSION" ]] && isFalse "$SKIP_GTNH_UPDATE_CHECK" ; then
getGTNHdownloadPath
if [[ -z $gtnh_download_path ]]; then
logError "Server files not found for GTNH_PACK_VERSION=$GTNH_PACK_VERSION! Download not possible!"
exit 1
fi
log "Server files located! Will proceed update $gtnh_download_path."
# Decide if update or install is needed or not.
if [[ ! -f /data/.gtnh-version || "$(basename "$gtnh_download_path")" != "$(cat /data/.gtnh-version)" ]]; then
log "Update/Install required: /data/.gtnh-version is missing or does not match the selected version $(basename "$gtnh_download_path")."
mkdir -p /data/packs
log "Downloading $gtnh_download_path."
if ! gtnh_download=$(mc-image-helper get -o /data/packs --output-filename --skip-up-to-date "$gtnh_download_path"); then
logError "Failed to download $gtnh_download_path"
exit 1
fi
# Unpacking Server files into temporary directory
log "Unpacking Server Files..."
original_base_dir=/data/.tmp/gtnh_base
base_dir=$original_base_dir
rm -rf "${base_dir}"
mkdir -p "${base_dir}"
extract "${gtnh_download}" "${base_dir}"
trap 'rm -rf /data/.tmp' EXIT
# Removing downloaded zip
rm -f "$gtnh_download"
# Remove any eula file since container manages it
rm -f "${base_dir}/eula.txt"
# recalculate the actual base directory of content
if ! base_dir=$(mc-image-helper find \
--max-depth=3 --type=directory --name=mods,config \
--only-shallowest --fail-no-matches --format '%h' \
"$base_dir"); then
logError "Unable to find content base of downloaded Server Files"
exit 1
fi
# Download and unpack GTNH server files
downloadGTNH
log "GTNH server files downloaded and unpacked to $base_dir."
# Split installation from update path. Check for version file.
if [[ -f /data/.gtnh-version ]]; then
@@ -212,10 +237,12 @@ function handleGTNH() {
log "No .gtnh-version file detected! Assuming no old server exists. Proceed installing new server..."
cp -R -f "${base_dir}"/* /data
fi
# Update .gtnh-version
basename "$gtnh_download_path" > /data/.gtnh-version
# Cleaning up
rm -rf "$original_base_dir"
# Cleaning up temporary files
rm -rf /data/.tmp
else
log "No update required: /data/.gtnh-version matches the selected version $(basename "$gtnh_download_path")."
+4 -1
View File
@@ -10,6 +10,7 @@ set -e -o pipefail
: "${REMOVE_OLD_MODS_DEPTH:=1} "
: "${REMOVE_OLD_MODS_INCLUDE:=*.jar,*-version.json}"
: "${CF_API_KEY_FILE:=}" # Path to file containing CurseForge API key
: "${CF_USE_HTTP2:=false}" # CF downloads are faster with HTTP 1.1
: "${MODRINTH_LOADER:=}"
# shellcheck source=start-utils
@@ -296,7 +297,9 @@ function handleModrinthProjects() {
}
function handleCurseForgeFiles() {
args=()
args=(
--use-http2="$CF_USE_HTTP2"
)
if usesMods && ! usesPlugins; then
args+=(--default-category mc-mods)
elif usesPlugins && ! usesMods; then
+1 -1
View File
@@ -46,7 +46,7 @@ setupOnlyMinecraftTest(){
start=$(date +%s)
status=PASSED
verify=
if ! logs=$(docker compose run --rm -e SETUP_ONLY=true -e DEBUG="${DEBUG:-false}" mc 2>&1); then
if ! logs=$(docker compose run --rm -e SETUP_ONLY=true -e DEBUG="${DEBUG:-false}" -e GH_TOKEN="${GH_TOKEN:-}" mc 2>&1); then
status=FAILED
outputContainerLog "$logs"
result=1