Compare commits

..

1 Commits

Author SHA1 Message Date
Geoff Bourne 78c24b580e Revert "Add use-proxy support to health extra args (#2973)"
This reverts commit 11d8d917f2.
2024-07-08 12:29:07 -05:00
40 changed files with 200 additions and 784 deletions
+12 -8
View File
@@ -11,7 +11,6 @@ on:
- "docs/**" - "docs/**"
- "examples/**" - "examples/**"
- "notes/**" - "notes/**"
- "kustomize/**"
jobs: jobs:
build: build:
@@ -31,6 +30,7 @@ jobs:
- java8-graalvm-ce - java8-graalvm-ce
- java8-openj9 - java8-openj9
- java8-jdk - java8-jdk
- java8-alpine
- java11 - java11
include: include:
# JAVA 21: # JAVA 21:
@@ -74,6 +74,10 @@ jobs:
baseImage: eclipse-temurin:8u312-b07-jre-focal baseImage: eclipse-temurin:8u312-b07-jre-focal
platforms: linux/amd64,linux/arm/v7,linux/arm64 platforms: linux/amd64,linux/arm/v7,linux/arm64
mcVersion: 1.12.2 mcVersion: 1.12.2
- variant: java8-alpine
baseImage: openjdk:8-jre-alpine3.9
platforms: linux/amd64
mcVersion: 1.12.2
- variant: java8-graalvm-ce - variant: java8-graalvm-ce
baseImage: ghcr.io/graalvm/graalvm-ce:java8 baseImage: ghcr.io/graalvm/graalvm-ce:java8
platforms: linux/amd64 platforms: linux/amd64
@@ -93,7 +97,7 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4.2.0 uses: actions/checkout@v4.1.7
with: with:
# for build-files step # for build-files step
fetch-depth: 0 fetch-depth: 0
@@ -128,13 +132,13 @@ jobs:
org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com> org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.7.1 uses: docker/setup-buildx-action@v3.4.0
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3.2.0 uses: docker/setup-qemu-action@v3.1.0
- name: Build for test - name: Build for test
uses: docker/build-push-action@v6.9.0 uses: docker/build-push-action@v5.4.0
with: with:
platforms: linux/amd64 platforms: linux/amd64
tags: ${{ env.IMAGE_TO_TEST }} tags: ${{ env.IMAGE_TO_TEST }}
@@ -157,14 +161,14 @@ jobs:
tests/test.sh tests/test.sh
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v3.3.0 uses: docker/login-action@v3.2.0
if: env.HAS_IMAGE_REPO_ACCESS if: env.HAS_IMAGE_REPO_ACCESS
with: with:
username: ${{ secrets.DOCKER_USER }} username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR - name: Login to GHCR
uses: docker/login-action@v3.3.0 uses: docker/login-action@v3.2.0
if: env.HAS_IMAGE_REPO_ACCESS if: env.HAS_IMAGE_REPO_ACCESS
with: with:
registry: ghcr.io registry: ghcr.io
@@ -172,7 +176,7 @@ jobs:
password: ${{ github.token }} password: ${{ github.token }}
- name: Build and push - name: Build and push
uses: docker/build-push-action@v6.9.0 uses: docker/build-push-action@v5.4.0
if: github.actor == github.repository_owner if: github.actor == github.repository_owner
with: with:
platforms: ${{ matrix.platforms }} platforms: ${{ matrix.platforms }}
+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
steps: steps:
- name: on-publish - name: on-publish
if: github.event_name == 'release' && github.event.action == 'published' if: github.event_name == 'release' && github.event.action == 'published'
uses: SethCohen/github-releases-to-discord@v1.15.1 uses: SethCohen/github-releases-to-discord@v1.15.0
with: with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }} webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
- name: on-success - name: on-success
+4 -5
View File
@@ -8,7 +8,6 @@ on:
- "docs/**" - "docs/**"
- "examples/**" - "examples/**"
- "notes/**" - "notes/**"
- "kustomize/**"
- "docker-compose*.yml" - "docker-compose*.yml"
- "mkdocs.yml" - "mkdocs.yml"
@@ -47,16 +46,16 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4.2.0 uses: actions/checkout@v4.1.7
with: with:
# for build-files step # for build-files step
fetch-depth: 0 fetch-depth: 0
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.7.1 uses: docker/setup-buildx-action@v3.4.0
- name: Confirm multi-arch build - name: Confirm multi-arch build
uses: docker/build-push-action@v6.9.0 uses: docker/build-push-action@v5.4.0
with: with:
platforms: ${{ matrix.platforms }} platforms: ${{ matrix.platforms }}
# ensure latest base image is used # ensure latest base image is used
@@ -66,7 +65,7 @@ jobs:
cache-from: type=gha,scope=${{ matrix.variant }} cache-from: type=gha,scope=${{ matrix.variant }}
- name: Build for test - name: Build for test
uses: docker/build-push-action@v6.9.0 uses: docker/build-push-action@v5.4.0
with: with:
# Only build single platform since loading multi-arch image into daemon fails with # Only build single platform since loading multi-arch image into daemon fails with
# "docker exporter does not currently support exporting manifest lists" # "docker exporter does not currently support exporting manifest lists"
+10 -13
View File
@@ -1,3 +1,5 @@
# syntax = docker/dockerfile:1.3
ARG BASE_IMAGE=eclipse-temurin:21-jre ARG BASE_IMAGE=eclipse-temurin:21-jre
FROM ${BASE_IMAGE} FROM ${BASE_IMAGE}
@@ -7,14 +9,9 @@ ARG TARGETOS
ARG TARGETARCH ARG TARGETARCH
ARG TARGETVARIANT ARG TARGETVARIANT
# The following three arg/env vars get used by the platform specific "install-packages" script
ARG EXTRA_DEB_PACKAGES=""
ARG EXTRA_DNF_PACKAGES=""
ARG EXTRA_ALPINE_PACKAGES=""
ARG FORCE_INSTALL_PACKAGES=1 ARG FORCE_INSTALL_PACKAGES=1
RUN --mount=target=/build,source=build \ RUN --mount=target=/build,source=build \
TARGET=${TARGETARCH}${TARGETVARIANT} \ TARGET=${TARGETARCH}${TARGETVARIANT} /build/run.sh install-packages
/build/run.sh install-packages
RUN --mount=target=/build,source=build \ RUN --mount=target=/build,source=build \
/build/run.sh setup-user /build/run.sh setup-user
@@ -26,31 +23,31 @@ EXPOSE 25565
ARG APPS_REV=1 ARG APPS_REV=1
ARG GITHUB_BASEURL=https://github.com ARG GITHUB_BASEURL=https://github.com
ARG EASY_ADD_VERSION=0.8.8 ARG EASY_ADD_VERSION=0.8.6
ADD ${GITHUB_BASEURL}/itzg/easy-add/releases/download/${EASY_ADD_VERSION}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add ADD ${GITHUB_BASEURL}/itzg/easy-add/releases/download/${EASY_ADD_VERSION}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
RUN chmod +x /usr/bin/easy-add RUN chmod +x /usr/bin/easy-add
ARG RESTIFY_VERSION=1.7.5 ARG RESTIFY_VERSION=1.7.3
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=${RESTIFY_VERSION} --var app=restify --file {{.app}} \ --var version=${RESTIFY_VERSION} --var app=restify --file {{.app}} \
--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
ARG RCON_CLI_VERSION=1.6.9 ARG RCON_CLI_VERSION=1.6.7
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=${RCON_CLI_VERSION} --var app=rcon-cli --file {{.app}} \ --var version=${RCON_CLI_VERSION} --var app=rcon-cli --file {{.app}} \
--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
ARG MC_MONITOR_VERSION=0.14.1 ARG MC_MONITOR_VERSION=0.12.12
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=${MC_MONITOR_VERSION} --var app=mc-monitor --file {{.app}} \ --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 --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG MC_SERVER_RUNNER_VERSION=1.12.3 ARG MC_SERVER_RUNNER_VERSION=1.12.2
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \ --var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \
--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
ARG MC_HELPER_VERSION=1.39.13 ARG MC_HELPER_VERSION=1.39.3
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
@@ -77,4 +74,4 @@ RUN curl -fsSL -o /image/Log4jPatcher.jar https://github.com/CreeperHost/Log4jPa
RUN dos2unix /start* /auto/* RUN dos2unix /start* /auto/*
ENTRYPOINT [ "/start" ] ENTRYPOINT [ "/start" ]
HEALTHCHECK --start-period=30s --retries=24 --interval=60s CMD mc-health HEALTHCHECK --start-period=1m --interval=5s --retries=24 CMD mc-health
+5 -5
View File
@@ -44,7 +44,7 @@ do
if [[ "$RCON_CMDS_STARTUP" ]]; then if [[ "$RCON_CMDS_STARTUP" ]]; then
while read -r cmd; do while read -r cmd; do
run_command "$cmd" run_command "$cmd"
done <<< "$(echo -e "$RCON_CMDS_STARTUP")" done <<< "$RCON_CMDS_STARTUP"
fi fi
if if
[[ -z "$RCON_CMDS_ON_CONNECT" ]] && [[ -z "$RCON_CMDS_ON_CONNECT" ]] &&
@@ -66,7 +66,7 @@ do
logRcon "First Clients has Connected, running first connect cmds" logRcon "First Clients has Connected, running first connect cmds"
while read -r cmd; do while read -r cmd; do
run_command "$cmd" run_command "$cmd"
done <<< "$(echo -e "$RCON_CMDS_FIRST_CONNECT")" done <<< "$RCON_CMDS_FIRST_CONNECT"
fi fi
# When a client joins # When a client joins
@@ -74,13 +74,13 @@ do
logRcon "Clients have Connected, running connect cmds" logRcon "Clients have Connected, running connect cmds"
while read -r cmd; do while read -r cmd; do
run_command "$cmd" run_command "$cmd"
done <<< "$(echo -e "$RCON_CMDS_ON_CONNECT")" done <<< "$RCON_CMDS_ON_CONNECT"
# When a client leaves # When a client leaves
elif (( CURR_CLIENTCONNECTIONS < CLIENTCONNECTIONS )) && [[ "$RCON_CMDS_ON_DISCONNECT" ]]; then elif (( CURR_CLIENTCONNECTIONS < CLIENTCONNECTIONS )) && [[ "$RCON_CMDS_ON_DISCONNECT" ]]; then
logRcon "Clients have Disconnected, running disconnect cmds" logRcon "Clients have Disconnected, running disconnect cmds"
while read -r cmd; do while read -r cmd; do
run_command "$cmd" run_command "$cmd"
done <<< "$(echo -e "$RCON_CMDS_ON_DISCONNECT")" done <<< "$RCON_CMDS_ON_DISCONNECT"
fi fi
# Last client connection # Last client connection
@@ -89,7 +89,7 @@ do
logRcon "ALL Clients have Disconnected, running last disconnect cmds" logRcon "ALL Clients have Disconnected, running last disconnect cmds"
while read -r cmd; do while read -r cmd; do
run_command "$cmd" run_command "$cmd"
done <<< "$(echo -e "$RCON_CMDS_LAST_DISCONNECT")" done <<< "$RCON_CMDS_LAST_DISCONNECT"
fi fi
CLIENTCONNECTIONS=$CURR_CLIENTCONNECTIONS CLIENTCONNECTIONS=$CURR_CLIENTCONNECTIONS
;; ;;
+5 -13
View File
@@ -3,8 +3,6 @@
set -e set -e
set -o pipefail set -o pipefail
# Install necessary packages
# shellcheck disable=SC2086
apk add --no-cache -U \ apk add --no-cache -U \
openssl \ openssl \
imagemagick \ imagemagick \
@@ -16,8 +14,7 @@ apk add --no-cache -U \
procps \ procps \
shadow \ shadow \
bash \ bash \
curl \ curl iputils \
iputils \
git \ git \
jq \ jq \
mysql-client \ mysql-client \
@@ -30,18 +27,13 @@ apk add --no-cache -U \
nfs-utils \ nfs-utils \
libpcap \ libpcap \
libwebp \ libwebp \
libcap \ libcap
${EXTRA_ALPINE_PACKAGES}
# Download and install patched knockd # 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/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-alpine-amd64.tar.gz
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.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 ln -s /usr/local/sbin/knockd /usr/sbin/knockd
setcap cap_net_raw=ep /usr/local/sbin/knockd setcap cap_net_raw=ep /usr/local/sbin/knockd
# Set Git credentials globally # Set git credentials
cat <<EOF >> /etc/gitconfig echo -e "[user]\n name = Minecraft Server on Docker\n email = server@example.com" >> /etc/gitconfig
[user]
name = Minecraft Server on Docker
email = server@example.com
EOF
+10 -20
View File
@@ -1,22 +1,12 @@
#!/bin/bash #!/bin/bash
set -euo pipefail if [[ $(uname -m) == "aarch64" ]]; then
curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.16/gosu-arm64
GOSU_VERSION="1.16" chmod +x /bin/gosu
GOSU_BASE_URL="https://github.com/tianon/gosu/releases/download/$GOSU_VERSION" elif [[ $(uname -m) == "x86_64" ]]; then
curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.16/gosu-amd64
case $(uname -m) in chmod +x /bin/gosu
"aarch64") else
GOSU_ARCH="gosu-arm64" echo "Not supported!"
;; exit 1
"x86_64") fi
GOSU_ARCH="gosu-amd64"
;;
*)
echo "Architecture not supported!"
exit 1
;;
esac
curl -sL -o /bin/gosu "${GOSU_BASE_URL}/${GOSU_ARCH}"
chmod +x /bin/gosu
+10 -24
View File
@@ -4,26 +4,20 @@ export TARGET
set -euo pipefail set -euo pipefail
# Install and configure dnf
microdnf install dnf -y microdnf install dnf -y
dnf install 'dnf-command(config-manager)' -y dnf install 'dnf-command(config-manager)' -y
dnf config-manager --set-enabled ol8_codeready_builder dnf config-manager --set-enabled ol8_codeready_builder
tee /etc/yum.repos.d/ol8-epel.repo<<EOF
# Add EPEL repository
tee /etc/yum.repos.d/ol8-epel.repo <<EOF
[ol8_developer_EPEL] [ol8_developer_EPEL]
name=Oracle Linux \$releasever EPEL (\$basearch) name= Oracle Linux \$releasever EPEL (\$basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/developer/EPEL/\$basearch/ baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/developer/EPEL/\$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1 gpgcheck=1
enabled=1 enabled=1
EOF EOF
# Update system
dnf update -y dnf update -y
# Install necessary packages
# shellcheck disable=SC2086
dnf install -y \ dnf install -y \
ImageMagick \ ImageMagick \
file \ file \
@@ -32,6 +26,7 @@ dnf install -y \
iputils \ iputils \
curl \ curl \
git \ git \
git-lfs \
jq \ jq \
dos2unix \ dos2unix \
mysql \ mysql \
@@ -45,29 +40,20 @@ dnf install -y \
libpcap \ libpcap \
libwebp \ libwebp \
findutils \ findutils \
which \ which
${EXTRA_DNF_PACKAGES}
# Install Git LFS
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
dnf update -y dnf update -y
dnf install -y git-lfs dnf install -y \
git-lfs
# Clean up DNF when done
dnf clean all
# Install gosu (assuming the script /build/ol/install-gosu.sh exists and is executable)
bash /build/ol/install-gosu.sh bash /build/ol/install-gosu.sh
# Download and install patched knockd # 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/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.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 ln -s /usr/local/sbin/knockd /usr/sbin/knockd
setcap cap_net_raw=ep /usr/local/sbin/knockd setcap cap_net_raw=ep /usr/local/sbin/knockd
# Set git credentials globally # Set git credentials
cat <<EOF >> /etc/gitconfig echo -e "[user]\n name = Minecraft Server on Docker\n email = server@example.com" >> /etc/gitconfig
[user]
name = Minecraft Server on Docker
email = server@example.com
EOF
+7 -13
View File
@@ -4,9 +4,8 @@ export TARGET
set -euo pipefail set -euo pipefail
# Update and install packages
apt-get update apt-get update
# shellcheck disable=SC2086
DEBIAN_FRONTEND=noninteractive \ DEBIAN_FRONTEND=noninteractive \
apt-get install -y \ apt-get install -y \
imagemagick \ imagemagick \
@@ -28,26 +27,21 @@ apt-get install -y \
lbzip2 \ lbzip2 \
nfs-common \ nfs-common \
libpcap0.8 \ libpcap0.8 \
${EXTRA_DEB_PACKAGES} webp
# Install Git LFS
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
apt-get update apt-get update
apt-get install -y git-lfs apt-get install -y \
git-lfs
# Clean up APT when done
apt-get clean apt-get clean
# Download and install patched knockd # 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/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.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 ln -s /usr/local/sbin/knockd /usr/sbin/knockd
setcap cap_net_raw=ep /usr/local/sbin/knockd setcap cap_net_raw=ep /usr/local/sbin/knockd
find /usr/lib -name 'libpcap.so.0.8' -execdir cp '{}' libpcap.so.1 \; find /usr/lib -name 'libpcap.so.0.8' -execdir cp '{}' libpcap.so.1 \;
# Set git credentials globally # Set git credentials
cat <<EOF >> /etc/gitconfig echo -e "[user]\n name = Minecraft Server on Docker\n email = server@example.com" >> /etc/gitconfig
[user]
name = Minecraft Server on Docker
email = server@example.com
EOF
-4
View File
@@ -2,9 +2,5 @@
set -e set -e
if id ubuntu > /dev/null 2>&1; then
deluser ubuntu
fi
addgroup --gid 1000 minecraft addgroup --gid 1000 minecraft
adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data minecraft adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data minecraft
+5 -12
View File
@@ -128,7 +128,7 @@ When either is set, [whitelisting of connecting users](https://minecraft.wiki/w/
To change the behavior when the whitelist file already exists, set the variable `EXISTING_WHITELIST_FILE` to one of the following options: To change the behavior when the whitelist file already exists, set the variable `EXISTING_WHITELIST_FILE` to one of the following options:
`SKIP` `SKIP` (default)
: Skip processing of the whitelist file when one is already present. This is the same as setting the legacy variable `OVERRIDE_WHITELIST` to "false". : Skip processing of the whitelist file when one is already present. This is the same as setting the legacy variable `OVERRIDE_WHITELIST` to "false".
`SYNCHRONIZE` `SYNCHRONIZE`
@@ -137,7 +137,7 @@ To change the behavior when the whitelist file already exists, set the variable
`MERGE` `MERGE`
: Merge the list of users from `WHITELIST` into the existing file. `WHITELIST_FILE` cannot be used with this option. : Merge the list of users from `WHITELIST` into the existing file. `WHITELIST_FILE` cannot be used with this option.
`SYNC_FILE_MERGE_LIST` (default) `SYNC_FILE_MERGE_LIST`
: When `WHITELIST_FILE` is provided it will overwrite an existing whitelist file. Also, if `WHITELIST` is provided, then those users will be merged into the newly copied file. : When `WHITELIST_FILE` is provided it will overwrite an existing whitelist file. Also, if `WHITELIST` is provided, then those users will be merged into the newly copied file.
!!! note !!! note
@@ -171,7 +171,7 @@ Similar to the whitelist, users can be provisioned as operators (aka administrat
To change the behavior when the ops file already exists, set the variable `EXISTING_OPS_FILE` to one of the following options: To change the behavior when the ops file already exists, set the variable `EXISTING_OPS_FILE` to one of the following options:
`SKIP` `SKIP` (default)
: Skip processing of the ops file when one is already present. This is the same as setting the legacy variable `OVERRIDE_OPS` to "false". : Skip processing of the ops file when one is already present. This is the same as setting the legacy variable `OVERRIDE_OPS` to "false".
`SYNCHRONIZE` `SYNCHRONIZE`
@@ -180,7 +180,7 @@ To change the behavior when the ops file already exists, set the variable `EXIST
`MERGE` `MERGE`
: Merge the list of users from `OPS` into the existing file. `OPS_FILE` cannot be used with this option. : Merge the list of users from `OPS` into the existing file. `OPS_FILE` cannot be used with this option.
`SYNC_FILE_MERGE_LIST` (default) `SYNC_FILE_MERGE_LIST`
: When `OPS_FILE` is provided it will overwrite an existing ops file. Also, if `OPS` is provided, then those users will be merged into the newly copied file. : When `OPS_FILE` is provided it will overwrite an existing ops file. Also, if `OPS` is provided, then those users will be merged into the newly copied file.
!!! note !!! note
@@ -495,11 +495,4 @@ When using `docker run` from a bash shell, the entries must be quoted with the `
| SIMULATION_DISTANCE | simulation-distance | | SIMULATION_DISTANCE | simulation-distance |
| SYNC_CHUNK_WRITES | sync-chunk-writes | | SYNC_CHUNK_WRITES | sync-chunk-writes |
| USE_NATIVE_TRANSPORT | use-native-transport | | USE_NATIVE_TRANSPORT | use-native-transport |
| HIDE_ONLINE_PLAYERS | hide-online-players |
| RESOURCE_PACK_ID | resource-pack-id |
| RESOURCE_PACK_PROMPT | resource-pack-prompt |
| MAX_CHAINED_NEIGHBOR_UPDATES | max-chained-neighbor-updates |
| LOG_IPS | log-ips |
| REGION_FILE_COMPRESSION | region-file-compression |
| BUG_REPORT_LINK | bug-report-link |
| PAUSE_WHEN_EMPTY_SECONDS | pause-when-empty-seconds |
-3
View File
@@ -25,6 +25,3 @@ The following environment variables define the behavior of auto-stopping:
describes period of the daemonized state machine, that handles the stopping of the server describes period of the daemonized state machine, that handles the stopping of the server
> To troubleshoot, add `DEBUG_AUTOSTOP=true` to see additional output > To troubleshoot, add `DEBUG_AUTOSTOP=true` to see additional output
## Proxy Support
If you make use of PROXY Protocol, i.e. through something like HAProxy or Fly.io, you will need to enable it in your variety of server's configuration, and then set the `USES_PROXY_PROTOCOL` envar to `true`. This lets Autostop monitor the server, where it otherwise wouldn't
-8
View File
@@ -26,11 +26,3 @@ or just a plain build
```shell ```shell
docker build -t IMG_PREFIX/minecraft-server . docker build -t IMG_PREFIX/minecraft-server .
``` ```
## Installing extra packages
The following build args can be set to install additional packages for the respective base image distro:
- `EXTRA_DEB_PACKAGES`
- `EXTRA_DNF_PACKAGES`
- `EXTRA_ALPINE_PACKAGES`
-48
View File
@@ -26,54 +26,6 @@ services:
[Source](https://github.com/itzg/docker-minecraft-server/blob/master/examples/geyser/docker-compose.yml) [Source](https://github.com/itzg/docker-minecraft-server/blob/master/examples/geyser/docker-compose.yml)
## Lazymc - Put your Minecraft server to rest when idle
With [lazymc-docker-proxy](https://github.com/joesturge/lazymc-docker-proxy) you are able to use [lazymc](https://github.com/timvisee/lazymc) with the minecraft container.
```yaml
services:
lazymc:
container_name: lazymc
image: ghcr.io/joesturge/lazymc-docker-proxy:latest
environment:
# Point to the service name of the Minecraft server
SERVER_ADDRESS: mc:25565
# Required to find the container to manage it
LAZYMC_GROUP: mc
restart: unless-stopped
volumes:
# you should mount the minecraft server dir under /server, using read only.
- data:/server:ro
# you need to supply the docker socket, so that the container can run docker command
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
# lazymc-docker-proxy acts as a proxy, so there is
# no need to expose the server port on the Minecraft container
- "25565:25565"
# Standard Docker Minecraft server, also works with other server types
mc:
image: itzg/minecraft-server:java21
container_name: minecraft-server
# We need to add a label here so that lazymc-docker-proxy knows which
# container to manage
labels:
- lazymc.group=mc
tty: true
stdin_open: true
# This container should be managed solely by the lazymc container
# so set restart to no, or else the container will start again...
restart: no
environment:
EULA: "TRUE"
volumes:
- data:/data
volumes:
data:
```
[Source](https://github.com/joesturge/lazymc-docker-proxy/blob/master/docker-compose.yaml)
## Lazytainer - Stop Minecraft container based on traffic ## Lazytainer - Stop Minecraft container based on traffic
Monitors network traffic to the Minecraft containers. If there is traffic, the container runs, otherwise the container is stopped/paused. Monitors network traffic to the Minecraft containers. If there is traffic, the container runs, otherwise the container is stopped/paused.
+8 -10
View File
@@ -9,18 +9,16 @@
| |
+-- project slug +-- project slug
``` ```
Also, a specific version (or release type) can be declared adding a colon and then the version id, version name, or release type after the project slug. The version ID can be found in the 'Metadata' section. Valid release types are `release`, `beta`, `alpha`. Also, a specific version/type can be declared using colon symbol and version id/type after the project slug. The version id can be found in the 'Metadata' section. Valid version types are `release`, `beta`, `alpha`.
To select a datapack from a Modrinth project, prefix the entry with "datapack:". When running a vanilla server, this is optional since only datapacks will be available for vanilla servers to select. !!! example
| Description | Example projects entry | | Description | Example |
|---------------------------------|----------------------------| |---------------------------------|-----------------------|
| Select latest version | `fabric-api` | | Select latest version | `fabric-api` |
| Select specific version | `fabric-api:PbVeub96` | | Select specific version | `fabric-api:PbVeub96` |
| Select latest beta version | `fabric-api:beta` | | Select latest beta version | `fabric-api:beta` |
| Latest version using project ID | `P7dR8mSH` | | Latest version using project ID | `P7dR8mSH` |
| Latest version of datapack | `datapack:terralith` |
| Specific version of datapack | `datapack:terralith:2.5.5` |
## Extra options ## Extra options
+3 -3
View File
@@ -1,6 +1,6 @@
mkdocs-material == 9.5.39 mkdocs-material == 9.5.28
mkdocs-autorefs == 1.2.0 mkdocs-autorefs == 1.0.1
mkdocstrings == 0.26.1 mkdocstrings == 0.25.1
mkdocs-literate-nav == 0.6.1 mkdocs-literate-nav == 0.6.1
mdx-gh-links == 0.4 mdx-gh-links == 0.4
mkdocs-click == 0.8.1 mkdocs-click == 0.8.1
@@ -32,7 +32,7 @@ A [Ketting](https://github.com/kettingpowered/Ketting-1-20-x) server, which is a
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.20.1" or later. There are limited base versions supported, so you will also need to set `VERSION`, such as "1.20.1" or later.
`FORGE_VERSION` and `KETTING_VERSION` may be specified; however, they will be defaulted by the [Ketting launcher](https://github.com/kettingpowered/kettinglauncher) otherwise. `FORGE_VERSION` and `KETTING_VERSION` may be specified; however, they will be defaulted by the [Ketting launcher](https://github.com/kettingpowered/kettinglauncher) otherwise.
Available Ketting Versions may be found at [https://reposilite.c0d3m4513r.com/#/Ketting-Server-Releases/org/kettingpowered/server/forge](https://reposilite.c0d3m4513r.com/#/Ketting-Server-Releases/org/kettingpowered/server/forge). Available Ketting Versions may be found at [https://github.com/kettingpowered/Ketting-1-20-x/packages/2041866/versions](https://github.com/kettingpowered/Ketting-1-20-x/packages/2041866/versions).
The Version structure is `MinecraftVersion-ForgeVersion-KettingVersion` (e.g. `1.20.1-47.2.20-0.1.4` is for Minecraft `1.20.1`, Forge `47.2.20` and Ketting `0.1.4`). The Version structure is `MinecraftVersion-ForgeVersion-KettingVersion` (e.g. `1.20.1-47.2.20-0.1.4` is for Minecraft `1.20.1`, Forge `47.2.20` and Ketting `0.1.4`).
### Mohist ### Mohist
+2 -16
View File
@@ -16,14 +16,6 @@ To allow for the selection of experimental builds, set `PAPER_CHANNEL` to "exper
docker run ... -e TYPE=PAPER -e PAPER_CHANNEL=experimental ... docker run ... -e TYPE=PAPER -e PAPER_CHANNEL=experimental ...
``` ```
!!! tip
If you see the following error, it likely means you need to set the env var `PAPER_CHANNEL` to "experimental"
```
No build found for version 1.21 with channel 'default'
```
If you are hosting your own copy of Paper you can override the download URL with `PAPER_DOWNLOAD_URL=<url>`. If you are hosting your own copy of Paper you can override the download URL with `PAPER_DOWNLOAD_URL=<url>`.
If you have attached a host directory to the `/data` volume, then you can install plugins via the `plugins` subdirectory. You can also [attach a `/plugins` volume](../../mods-and-plugins/index.md#optional-plugins-mods-and-config-attach-points). If you add plugins while the container is running, you'll need to restart it to pick those up. If you have attached a host directory to the `/data` volume, then you can install plugins via the `plugins` subdirectory. You can also [attach a `/plugins` volume](../../mods-and-plugins/index.md#optional-plugins-mods-and-config-attach-points). If you add plugins while the container is running, you'll need to restart it to pick those up.
@@ -65,19 +57,13 @@ Extra variables:
### Folia ### Folia
A [Folia server](https://papermc.io/software/folia) can be used by setting the environment variable `TYPE` to "FOLIA". Enable Folia server mode by adding a `-e TYPE=FOLIA` to your command-line.
By default, the container will run the latest experimental build of [Folia server](https://papermc.io/downloads), but you can also choose to run a specific build with `-e FOLIABUILD=26`. The release channel can be changed with the variable `FOLIA_CHANNEL`; however, only experimental builds are available at this time. By default, the container will run the latest build of [Folia server](https://papermc.io/downloads), but you can also choose to run a specific build with `-e FOLIABUILD=26`.
!!! example
Using `docker run`
```
docker run -d -v /path/on/host:/data \ docker run -d -v /path/on/host:/data \
-e TYPE=FOLIA \ -e TYPE=FOLIA \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
```
If you are hosting your own copy of Folia you can override the download URL with `FOLIA_DOWNLOAD_URL=<url>`. If you are hosting your own copy of Folia you can override the download URL with `FOLIA_DOWNLOAD_URL=<url>`.
+29 -29
View File
@@ -563,35 +563,35 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
<td>⬜️</td> <td>⬜️</td>
</tr> </tr>
<tr> <tr>
<td><code>RCON_CMDS_STARTUP</code></td> <td><code>RCON_CMDS_STARTUP</code></td>
<td>RCON commands to execute when the server starts.</td> <td>RCON commands can be configured to execute when the server starts, a client connects, or a client disconnects</td>
<td><code></code></td> <td><code></code></td>
<td>⬜️</td> <td>⬜️</td>
</tr> </tr>
<tr> <tr>
<td><code>RCON_CMDS_ON_CONNECT</code></td> <td><code>RCON_CMDS_ON_CONNECT</code></td>
<td>RCON commands to execute whenever a client connects to the server.</td> <td>RCON commands can be configured to execute when the server starts, a client connects, or a client disconnects</td>
<td><code></code></td> <td><code></code></td>
<td>⬜️</td> <td>⬜️</td>
</tr> </tr>
<tr> <tr>
<td><code>RCON_CMDS_FIRST_CONNECT</code></td> <td><code>RCON_CMDS_ON_DISCONNECT</code></td>
<td>RCON commands to execute on the first client connection to the server.</td> <td>RCON commands can be configured to execute when the server starts, a client connects, or a client disconnects</td>
<td><code></code></td> <td><code></code></td>
<td>⬜️</td> <td>⬜️</td>
</tr> </tr>
<tr> <tr>
<td><code>RCON_CMDS_ON_DISCONNECT</code></td> <td><code>RCON_CMDS_LAST_DISCONNECT</code></td>
<td>RCON commands to execute whenever a client disconnects from the server.</td> <td>RCON commands can be configured to execute when the server starts, a client connects, or a client disconnects</td>
<td><code></code></td> <td><code></code></td>
<td>⬜️</td> <td>⬜️</td>
</tr> </tr>
<tr> <tr>
<td><code>RCON_CMDS_LAST_DISCONNECT</code></td> <td><code>RCON_CMDS_STARTUP</code></td>
<td>RCON commands to execute when the last client disconnects from the server.</td> <td>RCON commands can be configured to execute when the server starts, a client connects, or a client disconnects</td>
<td><code></code></td> <td><code></code></td>
<td>⬜️</td> <td>⬜️</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
+1 -1
View File
@@ -23,6 +23,7 @@ where `<tag>` refers to the first column of this table:
| java17-alpine | 17 | Alpine | Hotspot | amd64 (1) | | java17-alpine | 17 | Alpine | Hotspot | amd64 (1) |
| java11 | 11 | Ubuntu | Hotspot | amd64, arm64, armv7 | | java11 | 11 | Ubuntu | Hotspot | amd64, arm64, armv7 |
| java8 | 8 | Ubuntu | Hotspot | amd64, arm64, armv7 | | java8 | 8 | Ubuntu | Hotspot | amd64, arm64, armv7 |
| java8-alpine | 8 | Alpine | Hotspot | amd64 (1) |
| java8-jdk | 8 | Ubuntu | Hotspot+JDK | amd64 | | java8-jdk | 8 | Ubuntu | Hotspot+JDK | amd64 |
| java8-openj9 | 8 | Debian | OpenJ9 | amd64 | | java8-openj9 | 8 | Debian | OpenJ9 | amd64 |
| java8-graalvm-ce | 8 | Oracle | GraalVM CE | amd64 | | java8-graalvm-ce | 8 | Oracle | GraalVM CE | amd64 |
@@ -132,6 +133,5 @@ The following image tags have been deprecated and are no longer receiving update
- java17-openj9 - java17-openj9
- java20-graalvm, java20, java20-alpine - java20-graalvm, java20, java20-alpine
- java8-multiarch is still built and pushed, but please move to java8 instead - java8-multiarch is still built and pushed, but please move to java8 instead
- java8-alpine
[^1]: Based on the [Oracle GraalMV images](https://blogs.oracle.com/java/post/new-oracle-graalvm-container-images), which as of JDK 17, are now under the [GraalVM Free License](https://blogs.oracle.com/java/post/graalvm-free-license) incorporating what used to be known as the GraalVM Enterprise. [^1]: Based on the [Oracle GraalMV images](https://blogs.oracle.com/java/post/new-oracle-graalvm-container-images), which as of JDK 17, are now under the [GraalVM Free License](https://blogs.oracle.com/java/post/graalvm-free-license) incorporating what used to be known as the GraalVM Enterprise.
+15 -13
View File
@@ -1,20 +1,22 @@
services: services:
mc: mc:
image: itzg/minecraft-server image: itzg/minecraft-server:java17
environment: environment:
DEBUG: true
SETUP_ONLY: true
EULA: true EULA: true
MOD_PLATFORM: MODRINTH TYPE: MODRINTH
MODRINTH_MODPACK: https://modrinth.com/modpack/better-mc-forge-bmc4/version/v32.5 VERSION: 1.20.1
MODRINTH_EXCLUDE_FILES: |
XaeroPlus
XaerosWorldMap
MODRINTH_OVERRIDES_EXCLUSIONS: |
mods/citresewn-*.jar
**/datapacks/BE_default_endgen_fix*
MODRINTH_FORCE_SYNCHRONIZE: true
MEMORY: 4G MEMORY: 4G
MODRINTH_MODPACK: better-mc-forge-bmc4
MODRINTH_VERSION: v28
MODRINTH_OVERRIDES_EXCLUSIONS: |
mods/NekosEnchantedBooks-*.jar
mods/citresewn-*.jar
volumes:
- data:/data
ports: ports:
- "25565:25565" - "25565:25565"
# declare /data volume mapping as desired
# volumes: volumes:
# - ./data:/data data: {}
-40
View File
@@ -1,40 +0,0 @@
services:
lazymc:
container_name: lazymc
image: ghcr.io/joesturge/lazymc-docker-proxy:latest
environment:
# Point to the service name of the Minecraft server
SERVER_ADDRESS: mc:25565
# Required to find the container to manage it
LAZYMC_GROUP: mc
restart: unless-stopped
volumes:
# you should mount the minecraft server dir under /server, using read only.
- data:/server:ro
# you need to supply the docker socket, so that the container can run docker command
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
# lazymc-docker-proxy acts as a proxy, so there is
# no need to expose the server port on the Minecraft container
- "25565:25565"
# Standard Docker Minecraft server, also works with other server types
mc:
image: itzg/minecraft-server:java21
container_name: minecraft-server
# We need to add a label here so that lazymc-docker-proxy knows which
# container to manage
labels:
- lazymc.group=mc
tty: true
stdin_open: true
# This container should be managed solely by the lazymc container
# so set restart to no, or else the container will start again...
restart: no
environment:
EULA: "TRUE"
volumes:
- data:/data
volumes:
data:
-60
View File
@@ -1,60 +0,0 @@
# A Form to Load New Config Files to Paper MC
In this example, we illustrate how to efficiently load and manage different configuration files to optimize a Paper Minecraft server. To implement this, it is necessary to create a dedicated repository where the configuration files can be stored and later retrieved. The repository should adhere to a specific structure to facilitate seamless integration with your Docker setup. Notably, the configurations must be organized into a folder named after the version of Minecraft you are using.
For reference, I have provided this [repository](https://github.com/Alpha018/paper-config-optimized), which contains optimized configuration files for the latest version of Minecraft. You can use this repository by linking directly to the configuration files in your Docker file, as demonstrated in the example below.
## Usage
You can directly use the optimized configuration files from this repository by accessing them through the GitHub raw URLs. Simply replace the env var like the docker compose with any other repo with different configurations.
To use the raw files, you can download or link to them using the following pattern:
```yaml
services:
mc:
image: itzg/minecraft-server
container_name: paper
environment:
EULA: "true"
TYPE: "PAPER"
VIEW_DISTANCE: 10
MEMORY: 2G
PAPER_CONFIG_REPO: "https://raw.githubusercontent.com/[your-username]/[your-repository]/main/[file-path]"
ports:
- "25565:25565"
volumes:
- mc-paper:/data
restart: unless-stopped
volumes:
mc-paper: {}
```
For example:
```yaml
services:
mc:
image: itzg/minecraft-server
container_name: paper
environment:
EULA: "true"
TYPE: "PAPER"
VIEW_DISTANCE: 10
MEMORY: 2G
PAPER_CONFIG_REPO: "https://raw.githubusercontent.com/Alpha018/paper-config-optimized/main"
ports:
- "25565:25565"
volumes:
- mc-paper:/data
restart: unless-stopped
volumes:
mc-paper: {}
```
Feel free to explore and use the configurations in this repo to enhance your Minecraft server's performance.
## Contribution
If you'd like to improve or suggest changes to these configurations, feel free to submit a pull request in this [repository](https://github.com/Alpha018/paper-config-optimized). We welcome contributions from the community!
@@ -1,17 +0,0 @@
services:
mc:
image: itzg/minecraft-server
container_name: paper
environment:
EULA: "true"
TYPE: "PAPER"
VIEW_DISTANCE: 10
MEMORY: 2G
PAPER_CONFIG_REPO: "https://raw.githubusercontent.com/Alpha018/paper-config-optimized/main"
ports:
- "25565:25565"
volumes:
- mc-paper:/data
restart: unless-stopped
volumes:
mc-paper: {}
@@ -1,21 +0,0 @@
services:
mc:
image: itzg/minecraft-server
tty: true
stdin_open: true
ports:
# Game port
- "25565:25565/tcp"
# Voice chat port
- "24454:24454/udp"
environment:
EULA: "TRUE"
TYPE: "FABRIC"
VERSION: "1.21.1"
# This will select the latest version of simple voice chat for 1.21.1.
# You can specify a version by appending :versionID (e.g. simple-voice-chat:anabvqRL)
MODRINTH_PROJECTS: "simple-voice-chat"
MEMORY: 8G
volumes:
# attach the relative directory 'data' to the container's /data path
- ./data:/data
@@ -1,21 +0,0 @@
services:
mc:
image: itzg/minecraft-server
tty: true
stdin_open: true
ports:
# Game port
- "25565:25565/tcp"
# Voice chat port
- "24454:24454/udp"
environment:
EULA: "TRUE"
TYPE: "NEOFORGE"
VERSION: "1.21.1"
# This will select the latest version of simple voice chat for 1.21.1.
# You can specify a version by appending :versionID (e.g. simple-voice-chat:anabvqRL)
MODRINTH_PROJECTS: "simple-voice-chat"
MEMORY: 8G
volumes:
# attach the relative directory 'data' to the container's /data path
- ./data:/data
@@ -1,21 +0,0 @@
services:
mc:
image: itzg/minecraft-server
tty: true
stdin_open: true
ports:
# Game port
- "25565:25565/tcp"
# Voice chat port
- "24454:24454/udp"
environment:
EULA: "TRUE"
TYPE: "PAPER"
VERSION: "1.21.1"
# This will select the latest version of simple voice chat for 1.21.1.
# You can specify a version by appending :versionID (e.g. simple-voice-chat:anabvqRL)
MODRINTH_PROJECTS: "simple-voice-chat"
MEMORY: 8G
volumes:
# attach the relative directory 'data' to the container's /data path
- ./data:/data
+3 -11
View File
@@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# shellcheck source=../scripts/start-utils
. "${SCRIPTS:-/}start-utils"
current_uptime() { current_uptime() {
awk '{print $1}' /proc/uptime | cut -d . -f 1 awk '{print $1}' /proc/uptime | cut -d . -f 1
} }
@@ -18,20 +16,14 @@ rcon_client_exists() {
[[ -n "$(ps -ax -o comm | grep 'rcon-cli')" ]] [[ -n "$(ps -ax -o comm | grep 'rcon-cli')" ]]
} }
use_proxy() {
if isTrue "$USES_PROXY_PROTOCOL"; then
echo "--use-proxy"
fi
}
mc_server_listening() { mc_server_listening() {
mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" --timeout 10s >&/dev/null mc-monitor status --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" --timeout 10s >& /dev/null
} }
java_clients_connections() { java_clients_connections() {
local connections local connections
if java_running; then if java_running ; then
if ! connections=$(mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" --show-player-count); then if ! connections=$(mc-monitor status --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" --show-player-count); then
# consider it a non-zero player count if the ping fails # consider it a non-zero player count if the ping fails
# otherwise a laggy server with players connected could get paused # otherwise a laggy server with players connected could get paused
connections=1 connections=1
+10 -21
View File
@@ -1,24 +1,22 @@
{ {
"globalExcludes": [ "globalExcludes": [
"ambience-music-mod",
"ambientsounds", "ambientsounds",
"auudio-forge",
"ambience-music-mod",
"appleskin", "appleskin",
"armor-chroma", "armor-chroma",
"armor-toughness-bar", "armor-toughness-bar",
"auudio-forge",
"beehivetooltips", "beehivetooltips",
"better-advancements", "better-advancements",
"betterf3",
"betterfps",
"better-foliage", "better-foliage",
"better-placement", "better-placement",
"better-sprinting", "better-sprinting",
"better-third-person",
"better-tips-nbt-tag", "better-tips-nbt-tag",
"betterf3", "better-third-person",
"betterfps",
"biomeinfo", "biomeinfo",
"block-drops-jei-addon", "block-drops-jei-addon",
"blur-forge",
"cartography",
"cherished-worlds", "cherished-worlds",
"chunk-animator", "chunk-animator",
"clickable-advancements", "clickable-advancements",
@@ -29,15 +27,14 @@
"defensive-measures", "defensive-measures",
"ding", "ding",
"drippy-loading-screen", "drippy-loading-screen",
"dynamic-surroundings",
"dynamiclights-reforged", "dynamiclights-reforged",
"dynamic-surroundings",
"easiervillagertrading", "easiervillagertrading",
"effective-forge", "effective-forge",
"embeddium", "embeddium",
"embeddium-extension", "embeddium-extension",
"embeddium-extras", "embeddium-extras",
"enchantment-descriptions", "enchantment-descriptions",
"enhancedvisuals",
"entity-collision-fps-fix", "entity-collision-fps-fix",
"entity-texture-features-fabric", "entity-texture-features-fabric",
"entityculling", "entityculling",
@@ -48,49 +45,42 @@
"fancymenu", "fancymenu",
"faster-ladder-climbing", "faster-ladder-climbing",
"foamfix-optimization-mod", "foamfix-optimization-mod",
"fps-reducer",
"free-cam", "free-cam",
"ftb-backups-2", "ftb-backups-2",
"fullscreen-windowed-borderless-for-minecraft", "fullscreen-windowed-borderless-for-minecraft",
"hwyla", "hwyla",
"ignitioncoil", "ignitioncoil",
"inmisaddon", "inmisaddon",
"iris-flywheel-compat",
"irisshaders", "irisshaders",
"iris-flywheel-compat",
"item-obliterator", "item-obliterator",
"itemphysic-lite",
"itemzoom", "itemzoom",
"just-enough-harvestcraft", "just-enough-harvestcraft",
"just-enough-resources-jer", "just-enough-resources-jer",
"just-zoom",
"konkrete",
"legendary-tooltips", "legendary-tooltips",
"loot-capacitor-tooltips",
"lootbeams", "lootbeams",
"loot-capacitor-tooltips",
"magnesium-extras", "magnesium-extras",
"menumobs", "menumobs",
"minecraft-rich-presence", "minecraft-rich-presence",
"more-overlays", "more-overlays",
"mouse-tweaks", "mouse-tweaks",
"neat", "neat",
"necronomicon",
"nekos-enchanted-books", "nekos-enchanted-books",
"no-nv-flash",
"no-recipe-book", "no-recipe-book",
"no-nv-flash",
"not-enough-animations", "not-enough-animations",
"oculus", "oculus",
"oldjavawarning", "oldjavawarning",
"overloaded-armor-bar", "overloaded-armor-bar",
"packmodemenu", "packmodemenu",
"reauth", "reauth",
"reblured",
"reforgium",
"resource-reloader", "resource-reloader",
"rubidium", "rubidium",
"rubidium-extra", "rubidium-extra",
"ryoamiclights", "ryoamiclights",
"schematica", "schematica",
"seamless-loading-screen",
"seamless-loading-screen-forge",
"searchables", "searchables",
"shulkerboxviewer", "shulkerboxviewer",
"skin-layers-3d", "skin-layers-3d",
@@ -98,7 +88,6 @@
"smooth-font", "smooth-font",
"smoothwater", "smoothwater",
"sodium", "sodium",
"sodium-rubidium-occlusion-culling-fix",
"sound-filters", "sound-filters",
"sound-physics-remastered", "sound-physics-remastered",
"stellar-sky", "stellar-sky",
+1 -65
View File
@@ -1,79 +1,15 @@
{ {
"globalExcludes": [ "globalExcludes": [
"3dskinlayers", "3dskinlayers",
"ae2-emi-crafting",
"AmbientSounds",
"amecs",
"Animation_Overhaul",
"appleskin",
"auudio",
"axolotlbuckets",
"BadOptimizations",
"BetterAdvancements",
"betterbeds",
"BetterThirdPerson",
"BHMenu",
"blur",
"Boat-Item-View",
"bobby",
"cat_jam",
"chat_heads",
"chatanimation",
"cherishedworlds",
"citresewn", "citresewn",
"clickadv",
"connector", "connector",
"DisableCustomWorldsAdvice",
"drippyloadingscreen",
"eating-animation",
"emiffect",
"emitrades",
"entity_model_features", "entity_model_features",
"entity_texture_features", "entity_texture_features",
"entityculling",
"euphoriapatcher", "euphoriapatcher",
"fallingleaves",
"fancymenu",
"fast-ip-ping",
"FauxCustomEntityData",
"GeckoLibIrisCompat",
"gpumemleakfix",
"Highlighter",
"ImmediatelyFast",
"indium",
"iris",
"iris-flywheel",
"ItemBorders",
"ItemLocks",
"justzoom",
"language-reload",
"lazy-language-loader",
"LegendaryTooltips",
"loadmyresources",
"lootbeams",
"MindfulDarkness",
"MouseTweaks",
"nicer-skies",
"notenoughanimations", "notenoughanimations",
"oculus", "oculus",
"OverflowingBars",
"PickUpNotifier",
"PresenceFootsteps",
"Prism",
"reeses_sodium_options",
"ResourcePackOverrides",
"ryoamiclights", "ryoamiclights",
"Searchables", "yungsmenutweaks"
"seasonhud",
"ShoulderSurfing",
"skinlayers3d",
"sodium",
"sorted_enchantments",
"visuality",
"VR-Combat",
"YeetusExperimentus",
"yungsmenutweaks",
"Zoomify"
], ],
"globalForceIncludes": [], "globalForceIncludes": [],
"modpacks": {} "modpacks": {}
+48 -56
View File
@@ -1,66 +1,58 @@
{ {
"allow-flight": {"env": "ALLOW_FLIGHT"},
"allow-nether": {"env": "ALLOW_NETHER"},
"bug-report-link": {"env": "BUG_REPORT_LINK"},
"announce-player-achievements": {"env": "ANNOUNCE_PLAYER_ACHIEVEMENTS"},
"broadcast-console-to-ops": {"env": "BROADCAST_CONSOLE_TO_OPS"},
"broadcast-rcon-to-ops": {"env": "BROADCAST_RCON_TO_OPS"},
"difficulty": {"env": "DIFFICULTY"},
"enable-command-block": {"env": "ENABLE_COMMAND_BLOCK"},
"enable-jmx-monitoring": {"env": "ENABLE_JMX"},
"enable-query": {"env": "ENABLE_QUERY"},
"enable-rcon": {"env": "ENABLE_RCON"},
"enable-status": {"env": "ENABLE_STATUS"},
"enforce-secure-profile": {"env": "ENFORCE_SECURE_PROFILE"},
"enforce-whitelist": {"env": "ENFORCE_WHITELIST"},
"entity-broadcast-range-percentage": {"env": "ENTITY_BROADCAST_RANGE_PERCENTAGE"},
"force-gamemode": {"env": "FORCE_GAMEMODE"},
"function-permission-level": {"env": "FUNCTION_PERMISSION_LEVEL"},
"gamemode": {"env": "MODE"},
"generate-structures": {"env": "GENERATE_STRUCTURES"},
"generator-settings": {"env": "GENERATOR_SETTINGS"},
"hardcore": {"env": "HARDCORE"},
"hide-online-players": {"env": "HIDE_ONLINE_PLAYERS"},
"initial-disabled-packs": {"env": "INITIAL_DISABLED_PACKS"},
"initial-enabled-packs": {"env": "INITIAL_ENABLED_PACKS"},
"level-name": {"env": "LEVEL"},
"level-seed": {"env": "SEED"},
"level-type": {"env": "LEVEL_TYPE"},
"log-ips": {"env": "LOG_IPS"},
"max-build-height": {"env": "MAX_BUILD_HEIGHT"},
"max-chained-neighbor-updates": {"env": "MAX_CHAINED_NEIGHBOR_UPDATES"},
"max-players": {"env": "MAX_PLAYERS"},
"max-tick-time": {"env": "MAX_TICK_TIME"},
"max-world-size": {"env": "MAX_WORLD_SIZE"},
"motd": {"env": "MOTD"}, "motd": {"env": "MOTD"},
"network-compression-threshold": {"env": "NETWORK_COMPRESSION_THRESHOLD"}, "gamemode": {"env": "MODE"},
"online-mode": {"env": "ONLINE_MODE"}, "difficulty": {"env": "DIFFICULTY"},
"op-permission-level": {"env": "OP_PERMISSION_LEVEL"}, "white-list": {"env": "WHITELIST_PROP"},
"pause-when-empty-seconds": {"env": "PAUSE_WHEN_EMPTY_SECONDS"}, "enforce-whitelist": {"env": "ENFORCE_WHITELIST"},
"player-idle-timeout": {"env": "PLAYER_IDLE_TIMEOUT"}, "level-type": {"env": "LEVEL_TYPE"},
"prevent-proxy-connections": {"env": "PREVENT_PROXY_CONNECTIONS"},
"previews-chat": {"env": "PREVIEWS_CHAT"},
"pvp": {"env": "PVP"},
"query.port": {"env": "QUERY_PORT"},
"rcon.password": {"env": "RCON_PASSWORD"},
"rcon.port": {"env": "RCON_PORT"},
"region-file-compression": {"env": "REGION_FILE_COMPRESSION"},
"resource-pack": {"env": "RESOURCE_PACK"},
"resource-pack-id": {"env": "RESOURCE_PACK_ID"},
"resource-pack-prompt": {"env": "RESOURCE_PACK_PROMPT"},
"resource-pack-sha1": {"env": "RESOURCE_PACK_SHA1"},
"require-resource-pack": {"env": "RESOURCE_PACK_ENFORCE"},
"server-ip": {"env": "SERVER_IP"},
"server-name": {"env": "SERVER_NAME"}, "server-name": {"env": "SERVER_NAME"},
"server-ip": {"env": "SERVER_IP"},
"server-port": {"env": "SERVER_PORT"}, "server-port": {"env": "SERVER_PORT"},
"simulation-distance": {"env": "SIMULATION_DISTANCE"}, "allow-nether": {"env": "ALLOW_NETHER"},
"snooper-enabled": {"env": "SNOOPER_ENABLED"}, "announce-player-achievements": {"env": "ANNOUNCE_PLAYER_ACHIEVEMENTS"},
"enable-command-block": {"env": "ENABLE_COMMAND_BLOCK"},
"spawn-animals": {"env": "SPAWN_ANIMALS"}, "spawn-animals": {"env": "SPAWN_ANIMALS"},
"spawn-monsters": {"env": "SPAWN_MONSTERS"}, "spawn-monsters": {"env": "SPAWN_MONSTERS"},
"spawn-npcs": {"env": "SPAWN_NPCS"}, "spawn-npcs": {"env": "SPAWN_NPCS"},
"spawn-protection": {"env": "SPAWN_PROTECTION"}, "spawn-protection": {"env": "SPAWN_PROTECTION"},
"sync-chunk-writes": {"env": "SYNC_CHUNK_WRITES"}, "generate-structures": {"env": "GENERATE_STRUCTURES"},
"use-native-transport": {"env": "USE_NATIVE_TRANSPORT"},
"view-distance": {"env": "VIEW_DISTANCE"}, "view-distance": {"env": "VIEW_DISTANCE"},
"white-list": {"env": "WHITELIST_PROP"} "hardcore": {"env": "HARDCORE"},
"snooper-enabled": {"env": "SNOOPER_ENABLED"},
"max-build-height": {"env": "MAX_BUILD_HEIGHT"},
"force-gamemode": {"env": "FORCE_GAMEMODE"},
"max-tick-time": {"env": "MAX_TICK_TIME"},
"enable-query": {"env": "ENABLE_QUERY"},
"query.port": {"env": "QUERY_PORT"},
"enable-rcon": {"env": "ENABLE_RCON"},
"rcon.password": {"env": "RCON_PASSWORD"},
"rcon.port": {"env": "RCON_PORT"},
"max-players": {"env": "MAX_PLAYERS"},
"max-world-size": {"env": "MAX_WORLD_SIZE"},
"level-name": {"env": "LEVEL"},
"level-seed": {"env": "SEED"},
"pvp": {"env": "PVP"},
"generator-settings": {"env": "GENERATOR_SETTINGS"},
"online-mode": {"env": "ONLINE_MODE"},
"allow-flight": {"env": "ALLOW_FLIGHT"},
"resource-pack": {"env": "RESOURCE_PACK"},
"resource-pack-sha1": {"env": "RESOURCE_PACK_SHA1"},
"require-resource-pack": {"env": "RESOURCE_PACK_ENFORCE"},
"player-idle-timeout": {"env": "PLAYER_IDLE_TIMEOUT"},
"broadcast-console-to-ops": {"env": "BROADCAST_CONSOLE_TO_OPS"},
"broadcast-rcon-to-ops": {"env": "BROADCAST_RCON_TO_OPS"},
"enable-jmx-monitoring": {"env": "ENABLE_JMX"},
"sync-chunk-writes": {"env": "SYNC_CHUNK_WRITES"},
"enable-status": {"env": "ENABLE_STATUS"},
"entity-broadcast-range-percentage": {"env": "ENTITY_BROADCAST_RANGE_PERCENTAGE"},
"function-permission-level": {"env": "FUNCTION_PERMISSION_LEVEL"},
"network-compression-threshold": {"env": "NETWORK_COMPRESSION_THRESHOLD"},
"op-permission-level": {"env": "OP_PERMISSION_LEVEL"},
"prevent-proxy-connections": {"env": "PREVENT_PROXY_CONNECTIONS"},
"use-native-transport": {"env": "USE_NATIVE_TRANSPORT"},
"simulation-distance": {"env": "SIMULATION_DISTANCE"},
"previews-chat": {"env": "PREVIEWS_CHAT"},
"enforce-secure-profile": {"env": "ENFORCE_SECURE_PROFILE"},
"initial-enabled-packs": {"env": "INITIAL_ENABLED_PACKS"},
"initial-disabled-packs": {"env": "INITIAL_DISABLED_PACKS"}
} }
-14
View File
@@ -13,9 +13,6 @@ configMapGenerator:
- name: mc - name: mc
envs: envs:
- mc.env - mc.env
patches:
# Example of using a patch to set external service name for mc-router to pick up
- path: set-external-servername.yml
``` ```
### mc.env ### mc.env
@@ -23,14 +20,3 @@ patches:
EULA=true EULA=true
TYPE=FORGE TYPE=FORGE
``` ```
###
```yaml
apiVersion: v1
kind: Service
metadata:
name: mc
annotations:
mc-router.itzg.me/externalServerName: forge.example.com
```
+1 -27
View File
@@ -88,32 +88,6 @@ if ! [ -v SERVER ]; then
exit 2 exit 2
fi fi
# Remap the TYPE and FAMILY based on discovered server jar export FAMILY=FORGE
if [[ $SERVER = run.sh ]]; then
if grep -q neoforge "$SERVER"; then
export FAMILY=FORGE
export TYPE=NEOFORGE
elif grep -q forge "$SERVER"; then
export FAMILY=FORGE
export TYPE=FORGE
elif grep -q fabric run.s; then
export FAMILY=FABRIC
export TYPE=FABRIC
else
log "ERROR: unrecognized loader type in $SERVER"
cat "$SERVER"
exit 1
fi
elif [[ $SERVER = forge* ]]; then
export FAMILY=FORGE
export TYPE=FORGE
elif [[ $SERVER = fabric* ]]; then
export FAMILY=FABRIC
export TYPE=FABRIC
else
log "ERROR: unrecognized loader type from $SERVER"
exit 1
fi
exec "${SCRIPTS:-/}start-setupWorld" "$@" exec "${SCRIPTS:-/}start-setupWorld" "$@"
+1 -11
View File
@@ -1,12 +1,5 @@
#!/bin/bash #!/bin/bash
: "${FOLIA_CHANNEL:=experimental}"
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
set -o pipefail
handleDebugMode
if [[ $FOLIA_DOWNLOAD_URL ]]; then if [[ $FOLIA_DOWNLOAD_URL ]]; then
export PAPER_DOWNLOAD_URL="$FOLIA_DOWNLOAD_URL" export PAPER_DOWNLOAD_URL="$FOLIA_DOWNLOAD_URL"
fi fi
@@ -15,7 +8,4 @@ if [[ $FOLIABUILD ]]; then
export PAPERBUILD="$FOLIABUILD" export PAPERBUILD="$FOLIABUILD"
fi fi
PAPER_PROJECT="folia" \ PAPER_PROJECT="folia" PAPER_NAME="FoliaMC" exec "${SCRIPTS:-/}start-deployPaper" "$@"
PAPER_NAME="FoliaMC" \
PAPER_CHANNEL="${FOLIA_CHANNEL}" \
exec "${SCRIPTS:-/}start-deployPaper" "$@"
+1 -7
View File
@@ -10,7 +10,7 @@ handleDebugMode
: "${PAPER_CHANNEL:=default}" : "${PAPER_CHANNEL:=default}"
: "${PAPER_DOWNLOAD_URL:=}" : "${PAPER_DOWNLOAD_URL:=}"
: "${PAPER_CUSTOM_JAR:=}" : "${PAPER_CUSTOM_JAR:=}"
: "${PAPER_CONFIG_DEFAULTS_REPO:=${PAPER_CONFIG_REPO:=https://raw.githubusercontent.com/dayyeeet/minecraft-default-configs/main}}" : "${PAPER_CONFIG_DEFAULTS_REPO:=https://raw.githubusercontent.com/dayyeeet/minecraft-default-configs/main}"
resultsFile=/data/.paper.env resultsFile=/data/.paper.env
if [[ $PAPER_CUSTOM_JAR ]]; then if [[ $PAPER_CUSTOM_JAR ]]; then
@@ -52,12 +52,6 @@ else
fi fi
# Download default configs to allow for consistent patching
for c in paper-global.yml paper-world-defaults.yml spigot.yml; do
DOWNLOAD_DEFAULT_CONFIGS+=",${PAPER_CONFIG_DEFAULTS_REPO}/${VERSION}/$c"
done
export DOWNLOAD_DEFAULT_CONFIGS
# Normalize on Spigot for downstream operations # Normalize on Spigot for downstream operations
export FAMILY=SPIGOT export FAMILY=SPIGOT
-10
View File
@@ -64,9 +64,6 @@ patchLog4jConfig() {
canUseRollingLogs=false canUseRollingLogs=false
} }
# Temporarily disable debugging output
oldState=$(shopt -po xtrace || true)
shopt -u -o xtrace
# Patch Log4j remote code execution vulnerability # Patch Log4j remote code execution vulnerability
# See https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition # See https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition
if versionLessThan 1.7; then if versionLessThan 1.7; then
@@ -83,7 +80,6 @@ elif isType PURPUR && versionLessThan 1.18.1; then
elif versionLessThan 1.18.1; then elif versionLessThan 1.18.1; then
useFallbackJvmFlag=true useFallbackJvmFlag=true
fi fi
eval "$oldState"
if ${useFallbackJvmFlag}; then if ${useFallbackJvmFlag}; then
JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}" JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}"
@@ -231,12 +227,6 @@ MC_HEALTH_EXTRA_ARGS=(
--use-server-list-ping --use-server-list-ping
) )
" > /data/.mc-health.env " > /data/.mc-health.env
elif isTrue "$USES_PROXY_PROTOCOL"; then
echo "
MC_HEALTH_EXTRA_ARGS=(
--use-proxy
)
" > /data/.mc-health.env
else else
rm -f /data/.mc-health.env rm -f /data/.mc-health.env
fi fi
-12
View File
@@ -4,7 +4,6 @@
. "${SCRIPTS:-/}start-utils" . "${SCRIPTS:-/}start-utils"
set -e set -e
handleDebugMode
: "${REPLACE_ENV_IN_PLACE:=${REPLACE_ENV_VARIABLES:-false}}" : "${REPLACE_ENV_IN_PLACE:=${REPLACE_ENV_VARIABLES:-false}}"
: "${REPLACE_ENV_PATHS:=/data}" : "${REPLACE_ENV_PATHS:=/data}"
@@ -14,7 +13,6 @@ handleDebugMode
: "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}" : "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}"
: "${PATCH_DEFINITIONS:=}" : "${PATCH_DEFINITIONS:=}"
: "${DEBUG:=false}" : "${DEBUG:=false}"
: "${DOWNLOAD_DEFAULT_CONFIGS:=}"
if isTrue "${REPLACE_ENV_IN_PLACE}"; then if isTrue "${REPLACE_ENV_IN_PLACE}"; then
log "Replacing env variables in ${REPLACE_ENV_PATHS} that match the prefix '$REPLACE_ENV_VARIABLE_PREFIX' ..." log "Replacing env variables in ${REPLACE_ENV_PATHS} that match the prefix '$REPLACE_ENV_VARIABLE_PREFIX' ..."
@@ -27,16 +25,6 @@ if isTrue "${REPLACE_ENV_IN_PLACE}"; then
"${REPLACE_ENV_PATHS[@]}" "${REPLACE_ENV_PATHS[@]}"
fi fi
if [[ $DOWNLOAD_DEFAULT_CONFIGS ]]; then
log "Downloading default configs, if needed"
if ! mc-image-helper mcopy \
--to /data/config \
--skip-existing --skip-up-to-date=false \
"$DOWNLOAD_DEFAULT_CONFIGS" 2> /dev/null; then
log "WARN: one or more default config files were not available from $DOWNLOAD_DEFAULT_CONFIGS"
fi
fi
if [[ ${PATCH_DEFINITIONS} ]]; then if [[ ${PATCH_DEFINITIONS} ]]; then
log "Applying patch definitions from ${PATCH_DEFINITIONS}" log "Applying patch definitions from ${PATCH_DEFINITIONS}"
mc-image-helper patch \ mc-image-helper patch \
+1 -4
View File
@@ -244,17 +244,14 @@ function handleModrinthProjects() {
log " Use MODRINTH_DOWNLOAD_DEPENDENCIES=optional instead" log " Use MODRINTH_DOWNLOAD_DEPENDENCIES=optional instead"
fi fi
if [[ $MODRINTH_PROJECTS ]]; then if [[ $MODRINTH_PROJECTS ]] && isFamily HYBRID FORGE FABRIC SPIGOT; then
if isFamily HYBRID; then if isFamily HYBRID; then
loader=forge loader=forge
elif isFamily VANILLA; then
loader=datapack
else else
loader="${TYPE,,}" loader="${TYPE,,}"
fi fi
mc-image-helper modrinth \ mc-image-helper modrinth \
--output-directory=/data \ --output-directory=/data \
--world-directory="${LEVEL:-world}" \
--projects="${MODRINTH_PROJECTS}" \ --projects="${MODRINTH_PROJECTS}" \
--game-version="${VERSION}" \ --game-version="${VERSION}" \
--loader="$loader" \ --loader="$loader" \
+2 -2
View File
@@ -2,8 +2,8 @@
set -euo pipefail set -euo pipefail
IFS=$'\n\t' IFS=$'\n\t'
: "${EXISTING_OPS_FILE:=SYNC_FILE_MERGE_LIST}" : "${EXISTING_OPS_FILE:=SKIP}"
: "${EXISTING_WHITELIST_FILE:=SYNC_FILE_MERGE_LIST}" : "${EXISTING_WHITELIST_FILE:=SKIP}"
# shellcheck source=start-utils # shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils" . "${SCRIPTS:-/}start-utils"
+2 -112
View File
@@ -161,121 +161,11 @@ function normalizeMemSize() {
echo $((val * scale)) echo $((val * scale))
} }
function compare_version() {
local left_version=$1
local comparison=$2
local right_version=$3
if [[ -z "$left_version" ]]; then
echo "Left version is required"
return 1
fi
if [[ -z "$right_version" ]]; then
echo "Right version is required"
return 1
fi
# Handle version channels ('a', 'b', or numeric)
if [[ $left_version == a* || $left_version == b* ]]; then
left_version=${left_version:1}
fi
if [[ $right_version == a* || $right_version == b* ]]; then
right_version=${right_version:1}
fi
local left_version_channel=${left_version:0:1}
if [[ $left_version_channel =~ [0-9] ]]; then
left_version_channel='r'
fi
local right_version_channel=${right_version:0:1}
if [[ $right_version_channel =~ [0-9] ]]; then
right_version_channel='r'
fi
if [[ $comparison == "lt" && $left_version_channel < $right_version_channel ]]; then
return 0
elif [[ $comparison == "lt" && $left_version_channel > $right_version_channel ]]; then
return 1
elif [[ $comparison == "gt" && $left_version_channel > $right_version_channel ]]; then
return 0
elif [[ $comparison == "gt" && $left_version_channel < $right_version_channel ]]; then
return 1
elif [[ $comparison == "le" && $left_version_channel < $right_version_channel ]]; then
return 0
elif [[ $comparison == "le" && $left_version_channel == $right_version_channel ]]; then
return 0
elif [[ $comparison == "ge" && $left_version_channel > $right_version_channel ]]; then
return 0
elif [[ $comparison == "ge" && $left_version_channel == $right_version_channel ]]; then
return 0
elif [[ $comparison == "eq" && $left_version_channel == $right_version_channel ]]; then
return 0
fi
# Compare the versions using sort -V
local result
case $comparison in
"lt")
if [[ $(echo -e "$left_version\n$right_version" | sort -V | head -n1) == "$left_version" && "$left_version" != "$right_version" ]]; then
result=0
else
result=1
fi
;;
"le")
if [[ $(echo -e "$left_version\n$right_version" | sort -V | head -n1) == "$left_version" ]]; then
result=0
else
result=1
fi
;;
"eq")
if [[ "$left_version" == "$right_version" ]]; then
result=0
else
result=1
fi
;;
"ge")
if [[ $(echo -e "$left_version\n$right_version" | sort -V | tail -n1) == "$left_version" ]]; then
result=0
else
result=1
fi
;;
"gt")
if [[ $(echo -e "$left_version\n$right_version" | sort -V | tail -n1) == "$left_version" && "$left_version" != "$right_version" ]]; then
result=0
else
result=1
fi
;;
*)
echo "Unsupported comparison operator: $comparison"
return 1
;;
esac
return $result
}
function versionLessThan() { function versionLessThan() {
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
# Use if-else since strict mode might be enabled # Use if-else since strict mode might be enabled
if compare_version "${VERSION}" "lt" "${1?}"; then if mc-image-helper compare-versions "${VERSION}" lt "${1?}"; then
eval "$oldState"
return 0 return 0
else else
eval "$oldState"
return 1 return 1
fi fi
} }
@@ -452,7 +342,7 @@ function ensureRemoveAllModsOff() {
reason=${1?} reason=${1?}
if isTrue "${REMOVE_OLD_MODS:-false}"; then if isTrue "${REMOVE_OLD_MODS:-false}"; then
log "WARNING using REMOVE_OLD_MODS interferes with $reason -- it is now disabled" log "WARNING using REMOVE_OLDS_MODS interferes with $reason -- it is now disabled"
REMOVE_OLD_MODS=false REMOVE_OLD_MODS=false
fi fi
} }