Compare commits

...
4 Commits
4 changed files with 104 additions and 33 deletions
+1 -1
View File
@@ -57,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 --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 # renovate: datasource=github-releases packageName=itzg/mc-image-helper versioning=loose
ARG MC_HELPER_VERSION=1.62.1 ARG MC_HELPER_VERSION=1.63.1
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION} 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 # used for cache busting local copy of mc-image-helper
ARG MC_HELPER_REV=1 ARG MC_HELPER_REV=1
+2 -2
View File
@@ -14,7 +14,7 @@ mkdocstrings==1.0.6
mkdocstrings-python==2.0.5 mkdocstrings-python==2.0.5
packaging==26.2 packaging==26.2
pathspec==1.1.1 pathspec==1.1.1
platformdirs==4.10.0 platformdirs==4.11.0
Pygments==2.20.0 Pygments==2.20.0
pymdown-extensions==11.0.1 pymdown-extensions==11.0.1
python-dateutil==2.9.0.post0 python-dateutil==2.9.0.post0
@@ -22,4 +22,4 @@ PyYAML==6.0.3
pyyaml_env_tag==1.1 pyyaml_env_tag==1.1
six==1.17.0 six==1.17.0
watchdog==6.0.0 watchdog==6.0.0
zensical==0.0.50 zensical==0.0.51
@@ -12,7 +12,7 @@ Configuration options with defaults:
## Set Modpack version ## Set Modpack version
As GTNH is a Minecraft 1.7.10 modpack, when using it your minecraft version is set to 1.7.10 by default. The [modpack version](https://www.gtnewhorizons.com/downloads/) can be selected by setting `GTNH_PACK_VERSION` to `latest`, `latest-dev` or any specific version number. `latest` will automatically select the latest full release version available and deploy the server with it (Note: this will also automatically update the server on startup). `latest-dev` does the same but selects the latest version marked as beta or RC (it won't select a full release version even if a newer exist). The third (and recommended) option is setting the server to a specific version like `2.8.1` to manage updates manually. As GTNH is a Minecraft 1.7.10 modpack, when using it your minecraft version is set to 1.7.10 by default. The [modpack version](https://www.gtnewhorizons.com/downloads/) can be selected by setting `GTNH_PACK_VERSION` to `latest`, `latest-beta` (formerly `latest-dev`) or any specific version number. `latest` will automatically select the latest full release version available and deploy the server with it (Note: this will also automatically update the server on startup). `latest-beta` does the same but selects the latest version marked as beta or RC (it won't select a full release version even if a newer exist). The third (and recommended) option is setting the server to a specific version like `2.8.1` to manage updates manually.
> To actively prevent an update from happening you can set the environment variable `SKIP_GTNH_UPDATE_CHECK` to true this will prevent any update check from running, but will also prevent the server install from running, so just set it after the initial setup. > To actively prevent an update from happening you can set the environment variable `SKIP_GTNH_UPDATE_CHECK` to true this will prevent any update check from running, but will also prevent the server install from running, so just set it after the initial setup.
@@ -52,3 +52,11 @@ To deliver the intended GTNH by default, when running a GTNH server, the followi
With java 17+ the server starts with `-Dfml.readTimeout=180 @java9args.txt -jar lwjgl3ify-forgePatches.jar`. With java 17+ the server starts with `-Dfml.readTimeout=180 @java9args.txt -jar lwjgl3ify-forgePatches.jar`.
With java 8 the server stars with `-XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseCodeCacheFlushing -Dfml.readTimeout=180 -jar forge-1.7.10-10.13.4.1614-1.7.10-universal.jar` With java 8 the server stars with `-XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseCodeCacheFlushing -Dfml.readTimeout=180 -jar forge-1.7.10-10.13.4.1614-1.7.10-universal.jar`
## Developer Versions
To run the nightly developer builds of GTNH, set the environment variable `GTNH_USE_DAILY_BUILD` to true and set `GTNH_PACK_VERSION` either to `latest` or a specific run ID of the build workflow. The run ID can be found in the [GTNH GitHub Actions](https://github.com/GTNewHorizons/DreamAssemblerXXL/actions) page of the DreamAssemblerXXL repository. The run ID is the number in the URL of the workflow run, for example `123456789`.
Since downloads require authentication, you will also need to set the environment variable `GH_TOKEN` to a valid GitHub Personal Access Token with `public_repo` scope. You can create a token in your [GitHub settings](https://github.com/settings/tokens) page. Be sure to keep your token secret and do not share it with anyone. The token is only used to download the developer builds and is not stored anywhere in the server (except in the environment variables).
Keep in mind that developer builds are not stable and may contain bugs or incomplete features. Use them at your own risk. It is recommended to use the latest stable release for production servers!
+78 -15
View File
@@ -7,11 +7,13 @@
function getGTNHdownloadPath(){ function getGTNHdownloadPath(){
gtnh_download_path="" gtnh_download_path=""
local release_object="" local release_object=""
local current_java_version=""
current_java_version=$(mc-image-helper java-release)
# Select release JSON object # Select release JSON object
# latest-dev will be removed in the future, but is still supported for now.
if [ "$GTNH_PACK_VERSION" == "latest-dev" ] || [ "$GTNH_PACK_VERSION" == "latest-beta" ]; then
if [ "$GTNH_PACK_VERSION" == "latest-dev" ]; then if [ "$GTNH_PACK_VERSION" == "latest-dev" ]; then
logWarning "GTNH_PACK_VERSION=latest-dev is deprecated and will be removed in the future."
fi
if ! release_object="$( if ! release_object="$(
curl -fsSL "https://downloads.gtnewhorizons.com/versions.json" \ 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]'
@@ -46,23 +48,18 @@ function getGTNHdownloadPath(){
fi fi
# Select compatible server files for java version # Select compatible server files for java version
if (( current_java_version == 8 )); then if (( java_version == 8 )); then
gtnh_download_path=$(jq -r '.value.server.java8Url' <<< "$release_object") gtnh_download_path=$(jq -r '.value.server.java8Url' <<< "$release_object")
log "Use GTNH Server Java 8 release." log "Use GTNH Server Java 8 release."
elif (( current_java_version >= 17 )); then elif (( java_version >= 17 )); then
if (( current_java_version > $(jq '.value.maxJavaVersion' <<< "$release_object") )); then if (( java_version > $(jq '.value.maxJavaVersion' <<< "$release_object") )); then
logError "Container Java version $current_java_version is not supported by GTNH. Try an older release." logError "Container Java version $java_version is not supported by GTNH. Try an older release."
exit 1 exit 1
fi fi
gtnh_download_path=$(jq -r '.value.server.java17_2XUrl' <<< "$release_object") gtnh_download_path=$(jq -r '.value.server.java17_2XUrl' <<< "$release_object")
log "Use GTNH Server Java 17+ release." log "Use GTNH Server Java 17+ release."
else
logError "Container Java version $current_java_version is not supported by GTNH."
exit 1
fi fi
if [[ -z $gtnh_download_path ]]; then if [[ -z $gtnh_download_path ]]; then
@@ -73,6 +70,56 @@ function getGTNHdownloadPath(){
} }
function getGTNHdownloadOptions(){
# Used for GTNH daily build downloads, to pass additional options to the download command.
gtnh_download_options=()
# Used for dryrun check
gtnh_download_path=""
# Check if GH_TOKEN is set for daily builds
if [ -z "$GH_TOKEN" ]; then
logError "GH_TOKEN environment variable must be set to use daily builds."
exit 1
fi
gtnh_download_options+=( --output-filename )
# prepare download options as an array to safely append patterns
if [ "$GTNH_PACK_VERSION" == "latest" ] || [ "$GTNH_PACK_VERSION" == "latest-dev" ]; then
if [ "$GTNH_PACK_VERSION" == "latest-dev" ]; then
logWarning "GTNH_PACK_VERSION=latest-dev is deprecated and will be removed in the future."
fi
gtnh_download_options+=( --workflow=daily-modpack-build.yml )
log "Using latest daily build for GTNH server files."
elif [ "$GTNH_PACK_VERSION" == "latest-beta" ]; then
gtnh_download_options+=( --workflow=daily-modpack-build.yml )
logWarning "Using daily build instead of latest beta release for GTNH server files. If this is not intended, set GTNH_USE_DAILY_BUILD=false to use the latest beta release instead."
else
gtnh_download_options+=( --run-id="$GTNH_PACK_VERSION" )
log "Using specific daily build run ID $GTNH_PACK_VERSION for GTNH server files."
fi
# Select compatible server files for java version
if (( java_version == 8 )); then
log "Use GTNH Server Java 8 release."
gtnh_download_options+=( --artifact-pattern='GTNH-daily-\d{4}-\d{2}-\d{2}\+\d+-server-java8\.zip' )
elif (( java_version >= 17 )); then
log "Use GTNH Server Java 17+ release."
gtnh_download_options+=( --artifact-pattern='GTNH-daily-\d{4}-\d{2}-\d{2}\+\d+-server-java17-\d{2}\.zip' )
fi
debug "GTNH daily build download options: ${gtnh_download_options[*]}"
if ! gtnh_download_path=$(mc-image-helper github download-artifact --no-download "${gtnh_download_options[@]}" GTNewHorizons/DreamAssemblerXXL); then
logError "Failed to find a matching daily build for GTNH server files with the specified options."
exit 1
fi
debug "GTNH daily build download path: $gtnh_download_path"
}
function deleteGTNHbackup(){ function deleteGTNHbackup(){
log "Start deleting all config backups" log "Start deleting all config backups"
if ! find . -maxdepth 1 -type d -name 'gtnh-upgrade-*' -exec rm -rf {} + ; then if ! find . -maxdepth 1 -type d -name 'gtnh-upgrade-*' -exec rm -rf {} + ; then
@@ -81,13 +128,22 @@ function deleteGTNHbackup(){
} }
function downloadGTNH(){ function downloadGTNH(){
local gtnh_download="" gtnh_download=""
base_dir=/data/.tmp/gtnh_base base_dir=/data/.tmp/gtnh_base
debug "Creating temporary /data/.tmp/packs folder for GTNH download" debug "Creating temporary /data/.tmp/packs folder for GTNH download"
mkdir -p /data/.tmp/packs mkdir -p /data/.tmp/packs
trap 'rm -rf /data/.tmp' EXIT trap 'rm -rf /data/.tmp' EXIT
mkdir -p "${base_dir}"
if isTrue "$GTNH_USE_DAILY_BUILD"; then
log "Downloading Daily Build for GTNH server files."
# gtnh_download_options is injecting download parameters -> (--workflow or --run-id) and --artifact-pattern
if ! gtnh_download=$(mc-image-helper github download-artifact -o=$base_dir --unzip "${gtnh_download_options[@]}" GTNewHorizons/DreamAssemblerXXL); then
logError "Failed to download Daily Build for GTNH server files."
exit 1
fi
else
log "Downloading $gtnh_download_path." 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 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" logError "Failed to download $gtnh_download_path"
@@ -97,8 +153,8 @@ function downloadGTNH(){
# Unpacking Server files into temporary directory # Unpacking Server files into temporary directory
log "Unpacking Server Files into $base_dir" log "Unpacking Server Files into $base_dir"
mkdir -p "${base_dir}"
extract "${gtnh_download}" "${base_dir}" extract "${gtnh_download}" "${base_dir}"
fi
# Remove any eula file since container manages it # Remove any eula file since container manages it
debug "Removing eula.txt from $base_dir" debug "Removing eula.txt from $base_dir"
@@ -209,7 +265,9 @@ function handleGTNH() {
: "${GTNH_PACK_VERSION:=latest}" : "${GTNH_PACK_VERSION:=latest}"
: "${GTNH_DELETE_BACKUPS:=false}" : "${GTNH_DELETE_BACKUPS:=false}"
: "${SKIP_GTNH_UPDATE_CHECK:=false}" : "${SKIP_GTNH_UPDATE_CHECK:=false}"
debug "GTNH VAR CHECK: GTNH_DELETE_BACKUPS=$GTNH_DELETE_BACKUPS, GTNH_PACK_VERSION=$GTNH_PACK_VERSION, TYPE=$TYPE, SKIP_GTNH_UPDATE_CHECK=$SKIP_GTNH_UPDATE_CHECK" : "${GTNH_USE_DAILY_BUILD:=false}"
debug "GTNH VAR CHECK: GTNH_DELETE_BACKUPS=$GTNH_DELETE_BACKUPS, GTNH_PACK_VERSION=$GTNH_PACK_VERSION, TYPE=$TYPE, SKIP_GTNH_UPDATE_CHECK=$SKIP_GTNH_UPDATE_CHECK, GTNH_USE_DAILY_BUILD=$GTNH_USE_DAILY_BUILD"
if isTrue "$GTNH_DELETE_BACKUPS"; then if isTrue "$GTNH_DELETE_BACKUPS"; then
deleteGTNHbackup deleteGTNHbackup
@@ -217,8 +275,13 @@ function handleGTNH() {
if [[ -n "$GTNH_PACK_VERSION" ]] && isFalse "$SKIP_GTNH_UPDATE_CHECK"; then if [[ -n "$GTNH_PACK_VERSION" ]] && isFalse "$SKIP_GTNH_UPDATE_CHECK"; then
if isFalse "$GTNH_USE_DAILY_BUILD"; then
getGTNHdownloadPath getGTNHdownloadPath
log "Server files located! Will proceed update $gtnh_download_path." log "Server files located! Will proceed update $gtnh_download_path."
else
getGTNHdownloadOptions
log "Will proceed update with daily build options: ${gtnh_download_options[*]}."
fi
# Decide if update or install is needed or not. # Decide if update or install is needed or not.
@@ -239,7 +302,7 @@ function handleGTNH() {
fi fi
# Update .gtnh-version # Update .gtnh-version
basename "$gtnh_download_path" > /data/.gtnh-version basename "$gtnh_download" > /data/.gtnh-version
# Cleaning up temporary files # Cleaning up temporary files
rm -rf /data/.tmp rm -rf /data/.tmp