From 10922b261b00c93265fe6acd923e9b6d5f1a5e91 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 2 Feb 2022 22:18:54 -0600 Subject: [PATCH 01/10] build: build-multiarch tags were too broad --- .github/workflows/build-multiarch.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index de1eecde..7dc3539b 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -6,7 +6,6 @@ on: - test/** tags: - "[0-9]+.[0-9]+.[0-9]+" - - "[0-9]+.[0-9]+.[0-9]+-*" paths-ignore: - "*.md" - "docs/**" From 4a1d2d2b805ceee4eb7d61bc1a685b03d1952f80 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 2 Feb 2022 22:27:38 -0600 Subject: [PATCH 02/10] build: adjusted for eclipse-temurin:8-jdk not being on armv7 --- .github/workflows/build-multiarch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index 7dc3539b..6bb19752 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -38,7 +38,7 @@ jobs: - variant: java8-multiarch baseImage: eclipse-temurin:8-jdk tagPrefix: java8- - platforms: linux/amd64,linux/arm/v7,linux/arm64 + platforms: linux/amd64,linux/arm64 mcVersion: 1.12.2 - variant: java8-openj9 baseImage: ibm-semeru-runtimes:open-8-jdk From 22f2eb730872b5139da1427cee5711bdcb71f242 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 5 Feb 2022 12:27:17 -0600 Subject: [PATCH 03/10] feat: add option to include timestamp with init logs (#1332) --- README.md | 14 ++++++++++++++ scripts/start-utils | 18 +++++++++++++++++- ...compose.yml => docker-compose.disabled.yml} | 0 ...compose.yml => docker-compose.disabled.yml} | 0 4 files changed, 31 insertions(+), 1 deletion(-) rename tests/setuponlytests/forgeapimods_file/{docker-compose.yml => docker-compose.disabled.yml} (100%) rename tests/setuponlytests/forgeapimods_projectids/{docker-compose.yml => docker-compose.disabled.yml} (100%) diff --git a/README.md b/README.md index bdf77d1a..91d17cd2 100644 --- a/README.md +++ b/README.md @@ -1559,6 +1559,20 @@ To enable the JVM flags required to fully support the [Flare profiling suite](ht Flare is built-in to Airplane/Pufferfish/Purpur, and is available in [plugin form](https://github.com/TECHNOVE/FlarePlugin) for other server types. +### Enable timestamps in init logs + +Before the container starts the Minecraft Server its output is prefixed with `[init]`, such as + +``` +[init] Starting the Minecraft server... +``` + +To also include the timestamp with each log, set `LOG_TIMESTAMP` to "true". The log output will then look like: + +``` +[init] 2022-02-05 16:58:33+00:00 Starting the Minecraft server... +``` + ## Autopause ### Description diff --git a/scripts/start-utils b/scripts/start-utils index 376e52b8..d56d41f2 100755 --- a/scripts/start-utils +++ b/scripts/start-utils @@ -40,6 +40,10 @@ function getFilenameFromUrl() { } function isTrue() { + local oldState + oldState=$(shopt -po xtrace) + shopt -u -o xtrace + local value=${1,,} result= @@ -53,6 +57,7 @@ function isTrue() { ;; esac + eval "$oldState" return ${result} } @@ -82,7 +87,18 @@ function logn() { } function log() { - echo "[init] $*" + local oldState + # The return status when listing options is zero if all optnames are enabled, non- zero otherwise. + oldState=$(shopt -po xtrace || true) + shopt -u -o xtrace + + if isDebugging || isTrue "${LOG_TIMESTAMP:-false}"; then + ts=" $(date --rfc-3339=seconds)" + else + ts= + fi + echo "[init]${ts} $*" + eval "$oldState" } function logAutopause() { diff --git a/tests/setuponlytests/forgeapimods_file/docker-compose.yml b/tests/setuponlytests/forgeapimods_file/docker-compose.disabled.yml similarity index 100% rename from tests/setuponlytests/forgeapimods_file/docker-compose.yml rename to tests/setuponlytests/forgeapimods_file/docker-compose.disabled.yml diff --git a/tests/setuponlytests/forgeapimods_projectids/docker-compose.yml b/tests/setuponlytests/forgeapimods_projectids/docker-compose.disabled.yml similarity index 100% rename from tests/setuponlytests/forgeapimods_projectids/docker-compose.yml rename to tests/setuponlytests/forgeapimods_projectids/docker-compose.disabled.yml From 0cde40604e329a932e51622a78aa0798428a9fee Mon Sep 17 00:00:00 2001 From: itzg Date: Sat, 5 Feb 2022 18:27:33 +0000 Subject: [PATCH 04/10] docs: Auto update markdown TOC --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91d17cd2..a26aa52f 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,7 @@ By default, the container will download the latest version of the "vanilla" [Min * [Stop Duration](#stop-duration) * [Setup only](#setup-only) * [Enable Flare Flags](#enable-flare-flags) + * [Enable timestamps in init logs](#enable-timestamps-in-init-logs) * [Autopause](#autopause) * [Description](#description) * [Enabling Autopause](#enabling-autopause) @@ -141,7 +142,7 @@ By default, the container will download the latest version of the "vanilla" [Min * [Running on RaspberryPi](#running-on-raspberrypi) * [Contributing](#contributing) - + From b5b164d5d3b4418f53320e9f1eccec30302366c7 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 5 Feb 2022 12:38:33 -0600 Subject: [PATCH 05/10] feat: added SKIP_GENERIC_PACK_UPDATE_CHECK and FORCE_GENERIC_PACK_UPDATE (#1333) --- Dockerfile | 2 +- README.md | 16 +++++++++------- scripts/start-setupModpack | 12 ++++++++++-- .../generic-packs/docker-compose.yml | 8 +++++++- tests/setuponlytests/generic-packs/fake.jar | 0 5 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 tests/setuponlytests/generic-packs/fake.jar diff --git a/Dockerfile b/Dockerfile index 228a03e6..e9c33f62 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.3 +ARG MC_HELPER_VERSION=1.16.5 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 a26aa52f..cfb32691 100644 --- a/README.md +++ b/README.md @@ -747,9 +747,9 @@ You may also download or copy over individual mods using the `MODS` environment docker run -d -e MODS=https://www.example.com/mods/mod1.jar,/plugins/common,/plugins/special/mod2.jar ... -### **ForgeAPI** usage to use non-version specific projects +### ForgeAPI usage to use non-version specific projects -**NOTE:** This potentially could lead to unexpected behavior if the Mod recieves an update with unexpected behavior. +**NOTE:** This potentially could lead to unexpected behavior if the Mod receives an update with unexpected behavior. This is more complicated because you will be pulling/using the latest mod for the release of your game. To get started make sure you have a [CursedForge API Key](https://docs.curseforge.com/#getting-started). Then use the environmental parameters in your docker build. @@ -775,10 +775,10 @@ Example of expected forge api project ids, releases, and key: Example of expected ForgeAPI file format. **Field Description**: -* Name is currently unused, but can be used to document each entry. -* Project id is the id found on the CurseForge website for a particular mod -* Release Type corresponds to forge's R, B, A icon for each file. Default Release, options are (release|beta|alpha). -* FileName is used for version pinning if latest file will not work for you. +* `name` is currently unused, but can be used to document each entry. +* `projectId` id is the id found on the CurseForge website for a particular mod +* `releaseType` Type corresponds to forge's R, B, A icon for each file. Default Release, options are (release|beta|alpha). +* `fileName` is used for version pinning if latest file will not work for you. ```json [ @@ -803,7 +803,7 @@ Example of expected ForgeAPI file format. ### Generic pack files -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. +To install all the server content (jars, mods, plugins, configs, etc.) from a zip or tgz file, then set `GENERIC_PACK` to the container path or URL of the archive file. This can also be used to apply a CurseForge modpack that is missing a server start script and/or Forge installer. 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. @@ -817,6 +817,8 @@ 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`. +If applying large generic packs, the update check can be time-consuming since a SHA1 checksum is compared. To skip the update check set `SKIP_GENERIC_PACK_UPDATE_CHECK` to "true". Conversely, the generic pack(s) can be forced to be applied without comparing the checksum by setting `FORCE_GENERIC_PACK_UPDATE` to "true". + ### Mod/Plugin URL Listing File As an alternative to `MODS`, the variable `MODS_FILE` can be set with the path to a text file listing a mod/plugin URL on each line. For example, the following diff --git a/scripts/start-setupModpack b/scripts/start-setupModpack index 88281d4a..cc421780 100755 --- a/scripts/start-setupModpack +++ b/scripts/start-setupModpack @@ -29,7 +29,7 @@ if [[ "${PACKWIZ_URL}" ]]; then if [[ -z "${latestPackwiz}" ]]; then log "WARNING: Could not retrieve Packwiz bootstrap installer release information" else - isDebugging && log "Latest packwiz ${latestPackWiz}" + isDebugging && log "Latest packwiz ${latestPackwiz}" latestPackwizVer=$(echo ${latestPackwiz} | jq --raw-output '.tag_name') latestPackwizUrl=$(echo ${latestPackwiz} | jq --raw-output '.assets[] | select(.name | match("packwiz-installer-bootstrap.jar")) | .url') : "${PACKWIZ_JAR:=packwiz-installer-bootstrap_${latestPackwizVer}.jar}" @@ -199,6 +199,7 @@ if [[ "${GENERIC_PACKS}" ]]; then pack="${GENERIC_PACKS_PREFIX}${packEntry}${GENERIC_PACKS_SUFFIX}" if isURL "${pack}"; then mkdir -p /data/packs + log "Downloading generic pack from $pack" if ! outfile=$(get -o /data/packs --output-filename --skip-existing "$pack"); then log "ERROR: failed to download $pack" exit 2 @@ -210,7 +211,13 @@ if [[ "${GENERIC_PACKS}" ]]; then done isDebugging && [ -f "$sum_file}" ] && cat "$sum_file" - if ! sha1sum -c "${sum_file}" --status 2> /dev/null; then + + log "Checking if generic packs are up to date" + if isTrue "${SKIP_GENERIC_PACK_UPDATE_CHECK:-false}" && [ -f "$sum_file" ]; then + log "Skipping generic pack update check" + elif isTrue "${FORCE_GENERIC_PACK_UPDATE}" || ! sha1sum -c "${sum_file}" --status 2> /dev/null; then + log "Generic pack(s) are out of date. Re-applying..." + base_dir=/tmp/generic_pack_base mkdir -p ${base_dir} for pack in "${packFiles[@]}"; do @@ -243,6 +250,7 @@ if [[ "${GENERIC_PACKS}" ]]; then cp -R -f "${base_dir}"/* /data rm -rf /tmp/generic_pack_base + log "Saving generic pack(s) checksum" sha1sum "${packFiles[@]}" > "${sum_file}" isDebugging && cat "$sum_file" fi diff --git a/tests/setuponlytests/generic-packs/docker-compose.yml b/tests/setuponlytests/generic-packs/docker-compose.yml index b5450605..a2b27c5d 100644 --- a/tests/setuponlytests/generic-packs/docker-compose.yml +++ b/tests/setuponlytests/generic-packs/docker-compose.yml @@ -11,8 +11,14 @@ services: image: ${IMAGE_TO_TEST:-itzg/minecraft-server} environment: EULA: "true" - SETUP_ONLY: "TRUE" + SETUP_ONLY: "true" GENERIC_PACKS: http://web/configs.zip,/packs/testing.zip + LOG_TIMESTAMP: "true" + # the following are only used to speed up test execution + TYPE: CUSTOM + CUSTOM_SERVER: /servers/fake.jar + VERSION: 1.18.1 volumes: - ./packs:/packs - ./data:/data + - ./fake.jar:/servers/fake.jar diff --git a/tests/setuponlytests/generic-packs/fake.jar b/tests/setuponlytests/generic-packs/fake.jar new file mode 100644 index 00000000..e69de29b From 2b374a2073874c942f58393f7ba5a22fca6ef446 Mon Sep 17 00:00:00 2001 From: itzg Date: Sat, 5 Feb 2022 18:38:46 +0000 Subject: [PATCH 06/10] docs: Auto update markdown TOC --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cfb32691..853664c0 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ By default, the container will download the latest version of the "vanilla" [Min * [Optional plugins, mods, and config attach points](#optional-plugins-mods-and-config-attach-points) * [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) + * [ForgeAPI usage to use non-version specific projects](#forgeapi-usage-to-use-non-version-specific-projects) * [Generic pack files](#generic-pack-files) * [Mod/Plugin URL Listing File](#modplugin-url-listing-file) * [Remove old mods/plugins](#remove-old-modsplugins) @@ -142,7 +142,7 @@ By default, the container will download the latest version of the "vanilla" [Min * [Running on RaspberryPi](#running-on-raspberrypi) * [Contributing](#contributing) - + From b65f1089170a50c341f7795506241dcb69a3d964 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 5 Feb 2022 16:02:27 -0600 Subject: [PATCH 07/10] build: also push git tag builds --- .github/workflows/build-multiarch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index 6bb19752..3f8d2ff1 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -70,7 +70,7 @@ jobs: itzg/minecraft-server tags: | type=ref,event=tag,enable=${{ matrix.variant == 'java17' }} - type=ref,event=tag,prefix=${{ matrix.variant }}- + type=ref,event=tag,suffix=-${{ matrix.variant }} type=raw,value=${{ matrix.variant }} flavor: | latest=${{ matrix.variant == 'java17' }} @@ -115,7 +115,7 @@ jobs: uses: docker/build-push-action@v2.8.0 with: platforms: ${{ matrix.platforms }} - push: ${{ github.ref_name == 'master' }} + push: ${{ github.ref_type = 'tag' || github.ref_name == 'master' }} tags: ${{ steps.meta.outputs.tags }} # ensure latest base image is used pull: true From 8995e63b72c751d9a7f45810bbbe5f24276d0c20 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 5 Feb 2022 16:03:40 -0600 Subject: [PATCH 08/10] build: fixed typo in push condition --- .github/workflows/build-multiarch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index 3f8d2ff1..3f37ce8c 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -115,7 +115,7 @@ jobs: uses: docker/build-push-action@v2.8.0 with: platforms: ${{ matrix.platforms }} - push: ${{ github.ref_type = 'tag' || github.ref_name == 'master' }} + push: ${{ github.ref_type == 'tag' || github.ref_name == 'master' }} tags: ${{ steps.meta.outputs.tags }} # ensure latest base image is used pull: true From 3472c67ca8cb96cfbe36770f8a2887ce2e47371c Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 5 Feb 2022 16:10:12 -0600 Subject: [PATCH 09/10] build: give issue-label workflow a name --- .github/workflows/issue-label.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/issue-label.yml b/.github/workflows/issue-label.yml index cc4f3b56..a628c898 100644 --- a/.github/workflows/issue-label.yml +++ b/.github/workflows/issue-label.yml @@ -1,3 +1,5 @@ +name: Issue labels + on: issues: types: [labeled] From eb6c7c98f0360c832bea46b89fd4decfd90e7049 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 5 Feb 2022 22:40:42 -0600 Subject: [PATCH 10/10] build: adjusted discord workflow name --- .github/workflows/discord.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/discord.yml b/.github/workflows/discord.yml index 495b6e47..3b1619fe 100644 --- a/.github/workflows/discord.yml +++ b/.github/workflows/discord.yml @@ -1,4 +1,4 @@ -name: discord +name: Discord notifications on: workflow_run: