mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-11-25 23:21:20 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0699bd8497 | ||
|
|
dad39111b3 | ||
|
|
f2400958a7 | ||
|
|
2b70dfce94 | ||
|
|
0c04150581 | ||
|
|
0c2d4be97f | ||
|
|
0a313b247b | ||
|
|
22613f0349 | ||
|
|
99f8c589d3 | ||
|
|
cc5205bd44 | ||
|
|
2e867a1046 | ||
|
|
f355e8a718 | ||
|
|
c2b14e7eaa | ||
|
|
30b26426f4 | ||
|
|
58fa0ad96a | ||
|
|
ea0284235e | ||
|
|
2f610eef70 | ||
|
|
5d45bcc72f | ||
|
|
ebcf1153a5 | ||
|
|
e48813eeea | ||
|
|
a25bb2aeaf | ||
|
|
e894a1d394 | ||
|
|
31ab4db856 | ||
|
|
67e4e8bb72 | ||
|
|
0e124927f7 | ||
|
|
3d43aea36b | ||
|
|
926a34b885 | ||
|
|
88cc9d112a | ||
|
|
795d2aee38 | ||
|
|
4b75711f37 | ||
|
|
5692cf852e | ||
|
|
c5d913ad5e | ||
|
|
4197034221 | ||
|
|
2e04d8c973 | ||
|
|
e4a381805e |
No files matched your search
@@ -94,25 +94,25 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
mcVersion: 1.16.5
|
mcVersion: 1.16.5
|
||||||
# Pin version for pre-Java 17
|
# Pin version for pre-Java 17
|
||||||
mcHelperVersion: 1.51.6-java8
|
mcHelperVersion: 1.51.7-java8
|
||||||
# JAVA 11
|
# JAVA 11
|
||||||
- variant: java11
|
- variant: java11
|
||||||
baseImage: adoptopenjdk:11-jre-hotspot
|
baseImage: adoptopenjdk:11-jre-hotspot
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
mcVersion: 1.16.4
|
mcVersion: 1.16.4
|
||||||
# Pin version for pre-Java 17
|
# Pin version for pre-Java 17
|
||||||
mcHelperVersion: 1.51.6-java8
|
mcHelperVersion: 1.51.7-java8
|
||||||
# JAVA 8: NOTE: Unable to go past 8u312 because of Forge dependencies
|
# JAVA 8: NOTE: Unable to go past 8u312 because of Forge dependencies
|
||||||
- variant: java8
|
- variant: java8
|
||||||
baseImage: eclipse-temurin:8-jre
|
baseImage: eclipse-temurin:8-jre
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
mcVersion: 1.12.2
|
mcVersion: 1.12.2
|
||||||
mcHelperVersion: 1.51.6-java8
|
mcHelperVersion: 1.51.7-java8
|
||||||
- variant: java8-jdk
|
- variant: java8-jdk
|
||||||
baseImage: eclipse-temurin:8-jdk
|
baseImage: eclipse-temurin:8-jdk
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
mcVersion: 1.12.2
|
mcVersion: 1.12.2
|
||||||
mcHelperVersion: 1.51.6-java8
|
mcHelperVersion: 1.51.7-java8
|
||||||
env:
|
env:
|
||||||
# Assume they line up, but when forked change to your Docker Hub username
|
# Assume they line up, but when forked change to your Docker Hub username
|
||||||
DOCKER_HUB_ORG: ${{ github.repository_owner }}
|
DOCKER_HUB_ORG: ${{ github.repository_owner }}
|
||||||
@@ -193,14 +193,14 @@ jobs:
|
|||||||
tests/test.sh
|
tests/test.sh
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v4.6.0
|
uses: docker/login-action@v4.8.0
|
||||||
if: env.HAS_IMAGE_REPO_ACCESS == 'true'
|
if: env.HAS_IMAGE_REPO_ACCESS == 'true'
|
||||||
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@v4.6.0
|
uses: docker/login-action@v4.8.0
|
||||||
if: env.HAS_IMAGE_REPO_ACCESS == 'true'
|
if: env.HAS_IMAGE_REPO_ACCESS == 'true'
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
# For GLIBC_2.34 support
|
# For GLIBC_2.34 support
|
||||||
knockdRepoOrg: Metalcape/knock
|
knockdRepoOrg: Metalcape/knock
|
||||||
# Pin version for Java 8, be sure to also set in build.yml
|
# Pin version for Java 8, be sure to also set in build.yml
|
||||||
mcHelperVersion: 1.51.6-java8
|
mcHelperVersion: 1.51.7-java8
|
||||||
env:
|
env:
|
||||||
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
|
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|||||||
+6
-6
@@ -28,36 +28,36 @@ ARG APPS_REV=1
|
|||||||
ARG GITHUB_BASEURL=https://github.com
|
ARG GITHUB_BASEURL=https://github.com
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/easy-add
|
# renovate: datasource=github-releases packageName=itzg/easy-add
|
||||||
ARG EASY_ADD_VERSION=0.8.19
|
ARG EASY_ADD_VERSION=0.8.20
|
||||||
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
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/restify
|
# renovate: datasource=github-releases packageName=itzg/restify
|
||||||
ARG RESTIFY_VERSION=1.7.21
|
ARG RESTIFY_VERSION=1.7.22
|
||||||
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
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/rcon-cli
|
# renovate: datasource=github-releases packageName=itzg/rcon-cli
|
||||||
ARG RCON_CLI_VERSION=1.7.9
|
ARG RCON_CLI_VERSION=1.9.0
|
||||||
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
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/mc-monitor
|
# renovate: datasource=github-releases packageName=itzg/mc-monitor
|
||||||
ARG MC_MONITOR_VERSION=1.18.3
|
ARG MC_MONITOR_VERSION=1.21.0
|
||||||
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
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/mc-server-runner
|
# renovate: datasource=github-releases packageName=itzg/mc-server-runner
|
||||||
ARG MC_SERVER_RUNNER_VERSION=1.16.2
|
ARG MC_SERVER_RUNNER_VERSION=1.17.0
|
||||||
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
|
||||||
|
|
||||||
# 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.74.2
|
ARG MC_HELPER_VERSION=1.78.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
|
||||||
|
|||||||
@@ -158,3 +158,9 @@ When `MEMORY` is greater than or equal to 12G, then the Aikar flags will be adju
|
|||||||
[MeowIce has created an updated set of JVM flags](https://github.com/MeowIce/meowice-flags?tab=readme-ov-file#why-would-i-have-to-switch-) based on Aikar's flags but with support for optimizations for Java 17 and above
|
[MeowIce has created an updated set of JVM flags](https://github.com/MeowIce/meowice-flags?tab=readme-ov-file#why-would-i-have-to-switch-) based on Aikar's flags but with support for optimizations for Java 17 and above
|
||||||
|
|
||||||
The set of flags documented there can be added by setting the environment variable `USE_MEOWICE_FLAGS` to `true`. There is an optional `USE_MEOWICE_GRAALVM_FLAGS` variable to enable GraalVM specific optimizations, defaults to `FALSE`.
|
The set of flags documented there can be added by setting the environment variable `USE_MEOWICE_FLAGS` to `true`. There is an optional `USE_MEOWICE_GRAALVM_FLAGS` variable to enable GraalVM specific optimizations, defaults to `FALSE`.
|
||||||
|
|
||||||
|
MeowIce's flags use the G1 garbage collector by default. MeowIce also provides a [ZGC version of the flags](https://github.com/MeowIce/meowice-flags#zgc-version-for-large-servers-with-32gb-allocated-heap), which is recommended for servers with 32GB or more of allocated memory and many CPU cores. To use it instead, also set `USE_MEOWICE_ZGC_FLAGS` to `true`. When `MAX_MEMORY` (or `MEMORY`) is larger than 2GB, the soft max heap size is set to 2GB below it, as in MeowIce's flags.
|
||||||
|
|
||||||
|
## Mitigating Java4Shell exploit (CVE-2026-114938)
|
||||||
|
|
||||||
|
The latest image now includes a base image that includes the upstream fix [listed here](https://adoptium.net/news/2026/11/temurin-november-2026-cspu-java4shell).
|
||||||
@@ -130,6 +130,30 @@ For full control over how log messages are formatted, you can customize the Log4
|
|||||||
- `LOG_TERMINAL_FORMAT` : Format for interactive terminal console (used with `docker attach`)
|
- `LOG_TERMINAL_FORMAT` : Format for interactive terminal console (used with `docker attach`)
|
||||||
Default: `[%d{HH:mm:ss} %level]: %msg%n`
|
Default: `[%d{HH:mm:ss} %level]: %msg%n`
|
||||||
|
|
||||||
|
### JSON log output
|
||||||
|
|
||||||
|
Set a format variable to `json` to output one JSON object per line instead of text, which suits log pipelines that parse container output, such as Loki, Elasticsearch, or Datadog. For example, to get JSON in `docker logs` while `logs/latest.log` stays plain text:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
environment:
|
||||||
|
GENERATE_LOG4J2_CONFIG: "true"
|
||||||
|
LOG_CONSOLE_FORMAT: json
|
||||||
|
```
|
||||||
|
|
||||||
|
`LOG_FILE_FORMAT` and `LOG_TERMINAL_FORMAT` accept `json` as well. Each line uses field names from the [Elastic Common Schema](https://www.elastic.co/guide/en/ecs/current/index.html), the same ones as Log4j's `EcsLayout.json` template:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"@timestamp":"2026-11-12T13:50:43.459Z","ecs.version":"1.2.0","log.level":"INFO","message":"Done (3.214s)! For help, type \"help\"","process.thread.name":"Server thread","log.logger":"net.minecraft.server.dedicated.DedicatedServer"}
|
||||||
|
```
|
||||||
|
|
||||||
|
When a log event carries an exception, an `error.stack_trace` field holds the stack trace. Timestamps are in UTC.
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
- JSON output requires Minecraft 1.18.1 or newer. For older versions the default text format is used and a warning is logged.
|
||||||
|
- Only the server's log output is JSON. Lines written by the image's startup scripts (prefixed with `[init]`) and output that bypasses Log4j, such as JVM warnings, remain plain text, so a log shipper should skip lines that don't parse as JSON.
|
||||||
|
- Minecraft server jars don't include Log4j's `log4j-layout-template-json` module, so the JSON is built with a pattern layout rather than `JsonTemplateLayout`, and custom event templates aren't supported. For a different JSON shape, set the format variable to your own pattern using `%enc{...}{JSON}` to escape values.
|
||||||
|
|
||||||
### Example configurations
|
### Example configurations
|
||||||
|
|
||||||
Simple timestamp customization (most common use case):
|
Simple timestamp customization (most common use case):
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
[The MASH Playbook](https://github.com/mother-of-all-self-hosting/mash-playbook) is a premade playbook with the option to deploy a [wide variety of open-source services](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/supported-services.md) to your server(s), including [docker-minecraft-server](https://github.com/mother-of-all-self-hosting/ansible-role-minecraft), making it a good option if you want all the bells and whistles alongside your Minecraft server.
|
[The MASH Playbook](https://github.com/mother-of-all-self-hosting/mash-playbook) is a premade playbook with the option to deploy a [wide variety of open-source services](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/supported-services.md) to your server(s), including [docker-minecraft-server](https://github.com/mother-of-all-self-hosting/ansible-role-minecraft), making it a good option if you want all the bells and whistles alongside your Minecraft server.
|
||||||
- Check out the [Installation Guide](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/README.md) for the MASH playbook to get started.
|
- Check out the [Installation Guide](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/README.md) for the MASH playbook to get started.
|
||||||
- You can then enable [Minecraft](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/minecraft.md) in your vars.yml.
|
- You can then enable [Minecraft](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/minecraft/README.md) in your vars.yml.
|
||||||
- Enable any supporting services that you might find useful, such as [user authentication](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/authelia.md), [remote backups](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/backup-borg.md), [email relay](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/exim-relay.md), [cron monitoring](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/healthchecks.md), [audio and video conferencing](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/jitsi.md), databases ([MariaDB](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/mariadb.md), [PostgresSQL](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/postgres.md)), [push notifications](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/ntfy.md), [uptime monitoring](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/uptime-kuma.md), [a website](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/wordpress.md), as well as installing any [extra files, folders, applications, services and running commands](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/auxiliary.md) automatically on deployment.
|
- Enable any supporting services that you might find useful, such as [user authentication](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/authelia/README.md), [remote backups](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/backup_borg/README.md), [email relay](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/exim_relay/README.md), [cron monitoring](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/healthchecks/README.md), [audio and video conferencing](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/jitsi/README.md), databases ([MariaDB](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/mariadb/README.md), [PostgresSQL](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/postgres/README.md)), [push notifications](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/ntfy/README.md), [uptime monitoring](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/uptime_kuma/README.md), [a website](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/wordpress/README.md), as well as installing any [extra files, folders, applications, services and running commands](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/components/auxiliary/README.md) automatically on deployment.
|
||||||
|
|
||||||
## On CloudFormation (AWS)
|
## On CloudFormation (AWS)
|
||||||
|
|
||||||
|
|||||||
@@ -37,3 +37,7 @@ A Velocity plugin that stops idle backend servers and wakes them when players co
|
|||||||
### [Kobblestone](https://github.com/kobblestoneio/kobblestone)
|
### [Kobblestone](https://github.com/kobblestoneio/kobblestone)
|
||||||
|
|
||||||
A Kubernetes operator for Minecraft that supports custom resource types to manage servers, routers, backups and more.
|
A Kubernetes operator for Minecraft that supports custom resource types to manage servers, routers, backups and more.
|
||||||
|
|
||||||
|
### [Minecraft Server Manager (MSM)](https://github.com/anefzaoui/minecraft-server-manager)
|
||||||
|
|
||||||
|
A self-hosted web panel that creates and manages `itzg/minecraft-server` containers, one per server, with modpacks pinned through the image's Modrinth/CurseForge/FTB support, backups, schedules and rollback.
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# Auto-download from Hangar
|
||||||
|
|
||||||
|
[Hangar](https://hangar.papermc.io/) is PaperMC's plugin repository for [Paper](../types-and-platforms/server-types/paper.md) and its derivatives. At startup, the container will automatically locate and download the newest version of each plugin that supports the `VERSION` in use. Older file versions downloaded previously will automatically be cleaned up.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To use this feature, set the environment variable `HANGAR_PROJECTS` to a comma or newline separated list of projects. This is supported when `TYPE` is `PAPER`, `FOLIA`, `PURPUR`, `PUFFERFISH`, or `LEAF`.
|
||||||
|
|
||||||
|
Each project entry can be any of the following combinations where a colon (`:`) is used to separate the different parts:
|
||||||
|
|
||||||
|
```
|
||||||
|
Project
|
||||||
|
Project : Version
|
||||||
|
@ Listing File
|
||||||
|
```
|
||||||
|
|
||||||
|
Where:
|
||||||
|
|
||||||
|
- **Project** is the project slug or ID. The slug is the last part of the project page URL, such as "Maintenance" from <https://hangar.papermc.io/kennytv/Maintenance>
|
||||||
|
- **Version** is the version name, such as "5.1.1". When omitted, the newest version from the channel given by `HANGAR_CHANNEL` that supports the Minecraft `VERSION` is selected. Selecting a specific version skips the Minecraft version check.
|
||||||
|
- **Listing file** is a container path to a file containing a list of projects
|
||||||
|
|
||||||
|
Append a `?` to a project, such as `Maintenance?`, to mark it as optional. An optional project that is not available is skipped with a warning instead of failing the startup.
|
||||||
|
|
||||||
|
By default, the newest version from the "Release" channel will be selected. You can instead choose another channel by setting `HANGAR_CHANNEL`, such as "Snapshot". The channels of a project are listed on its versions page.
|
||||||
|
|
||||||
|
!!! note "External downloads"
|
||||||
|
|
||||||
|
Some projects, such as [Floodgate](https://hangar.papermc.io/GeyserMC/Floodgate), link to a file hosted outside of Hangar. That file is downloaded from the external location and is downloaded again when the external file has been modified.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
environment:
|
||||||
|
TYPE: PAPER
|
||||||
|
HANGAR_PROJECTS: |
|
||||||
|
ViaVersion
|
||||||
|
Maintenance:5.1.1
|
||||||
|
```
|
||||||
@@ -60,9 +60,9 @@ There are optional volume paths that can be attached to supply content to be cop
|
|||||||
|
|
||||||
By default, the [environment variable processing](../configuration/interpolating.md) is performed on synchronized files that match the expected suffixes in `REPLACE_ENV_SUFFIXES` (by default "yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml") and are not excluded by `REPLACE_ENV_VARIABLES_EXCLUDES` and `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. This processing can be disabled by setting `REPLACE_ENV_DURING_SYNC` to `false`.
|
By default, the [environment variable processing](../configuration/interpolating.md) is performed on synchronized files that match the expected suffixes in `REPLACE_ENV_SUFFIXES` (by default "yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml") and are not excluded by `REPLACE_ENV_VARIABLES_EXCLUDES` and `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. This processing can be disabled by setting `REPLACE_ENV_DURING_SYNC` to `false`.
|
||||||
|
|
||||||
If you want old mods/plugins to be removed before the content is brought over from those attach points, then add `-e REMOVE_OLD_MODS=TRUE`. You can fine tune the removal process by specifying the `REMOVE_OLD_MODS_INCLUDE` and `REMOVE_OLD_MODS_EXCLUDE` variables, which are comma separated lists of file glob patterns. If a directory is excluded, then it and all of its contents are excluded. By default, only jars are removed.
|
If you want old mods/plugins to be removed before the content is brought over from those attach points, then add `-e REMOVE_OLD_MODS=TRUE`. You can fine tune the removal process by specifying the `REMOVE_OLD_MODS_INCLUDE` and `REMOVE_OLD_MODS_EXCLUDE` variables, which are comma separated lists of file glob patterns. If a directory is excluded, then it and all of its contents are excluded. By default, `REMOVE_OLD_MODS_INCLUDE` is `*.jar,*-version.json`, so jars and the `*-version.json` files are removed.
|
||||||
|
|
||||||
You can also specify the `REMOVE_OLD_MODS_DEPTH` (default is 16) variable to only delete files up to a certain level.
|
You can also specify the `REMOVE_OLD_MODS_DEPTH` (default is 1) variable to only delete files up to a certain level. With the default, only files directly inside the `plugins/` or `mods/` directory are removed.
|
||||||
|
|
||||||
For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMOVE_OLD_MODS_DEPTH=1` will remove all old jar files that are directly inside the `plugins/` or `mods/` directory.
|
For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMOVE_OLD_MODS_DEPTH=1` will remove all old jar files that are directly inside the `plugins/` or `mods/` directory.
|
||||||
|
|
||||||
@@ -301,4 +301,4 @@ docker run -d -e REMOVE_OLD_MODS=TRUE -e MODPACK=http://www.example.com/mods/mod
|
|||||||
|
|
||||||
!!! danger
|
!!! danger
|
||||||
|
|
||||||
All content of the `mods` or `plugins` directory will be deleted before unpacking new content from the MODPACK or MODS.
|
Files in the `mods` and `plugins` directories that match `REMOVE_OLD_MODS_INCLUDE` (by default, jars and `*-version.json` files directly inside them) will be deleted before unpacking new content from the MODPACK or MODS.
|
||||||
+12
-12
@@ -1,25 +1,25 @@
|
|||||||
click==8.5.0
|
click==8.5.1
|
||||||
colorama==0.4.6
|
colorama==0.4.6
|
||||||
deepmerge==3.0.1
|
deepmerge==4.0.0
|
||||||
ghp-import==2.1.0
|
ghp-import==2.1.0
|
||||||
griffe==2.3.2
|
griffe==2.4.1
|
||||||
Jinja2==3.1.6
|
Jinja2==3.1.6
|
||||||
Markdown==3.11.1
|
Markdown==3.11.3
|
||||||
MarkupSafe==3.0.4
|
MarkupSafe==3.0.4
|
||||||
mergedeep==1.3.4
|
mergedeep==1.3.4
|
||||||
mkdocs==1.6.1
|
mkdocs==1.6.1
|
||||||
mkdocs-autorefs==1.4.4
|
mkdocs-autorefs==1.4.5
|
||||||
mkdocs-get-deps==0.2.2
|
mkdocs-get-deps==0.2.2
|
||||||
mkdocstrings==1.0.7
|
mkdocstrings==1.0.8
|
||||||
mkdocstrings-python==2.0.9
|
mkdocstrings-python==2.0.11
|
||||||
packaging==26.3
|
packaging==26.3
|
||||||
pathspec==1.1.1
|
pathspec==1.1.1
|
||||||
platformdirs==4.13.4
|
platformdirs==4.14.5
|
||||||
Pygments==2.21.0
|
Pygments==2.21.0
|
||||||
pymdown-extensions==12.3
|
pymdown-extensions==13.1
|
||||||
python-dateutil==2.9.0.post0
|
python-dateutil==4.0.0
|
||||||
PyYAML==6.0.3
|
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==7.1.0
|
||||||
zensical==0.0.71
|
zensical==0.1.1
|
||||||
@@ -52,6 +52,8 @@ If you have attached a host directory to the `/data` volume, then you can instal
|
|||||||
|
|
||||||
[You can also auto-download plugins using `SPIGET_RESOURCES`.](../../mods-and-plugins/spiget.md)
|
[You can also auto-download plugins using `SPIGET_RESOURCES`.](../../mods-and-plugins/spiget.md)
|
||||||
|
|
||||||
|
[You can also auto-download plugins from Hangar using `HANGAR_PROJECTS`.](../../mods-and-plugins/hangar.md)
|
||||||
|
|
||||||
## Alternatives
|
## Alternatives
|
||||||
|
|
||||||
### Pufferfish
|
### Pufferfish
|
||||||
@@ -126,6 +128,8 @@ If you have attached a host directory to the `/data` volume, then you can instal
|
|||||||
|
|
||||||
[You can also auto-download plugins using `SPIGET_RESOURCES`.](../../mods-and-plugins/spiget.md)
|
[You can also auto-download plugins using `SPIGET_RESOURCES`.](../../mods-and-plugins/spiget.md)
|
||||||
|
|
||||||
|
[You can also auto-download plugins from Hangar using `HANGAR_PROJECTS`.](../../mods-and-plugins/hangar.md)
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
The Folia type inherits from the Paper type. Paper's variables will override the Folia ones.
|
The Folia type inherits from the Paper type. Paper's variables will override the Folia ones.
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -65,19 +65,19 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>LOG_CONSOLE_FORMAT</code></td>
|
<td><code>LOG_CONSOLE_FORMAT</code></td>
|
||||||
<td>Log4j2 pattern for console output (what you see in <code>docker logs</code>)</td>
|
<td>Log4j2 pattern for console output (what you see in <code>docker logs</code>), or <code>json</code> for <a href="../configuration/misc-options/#json-log-output">JSON lines</a></td>
|
||||||
<td><code>[%d{HH:mm:ss}] [%t/%level]: %msg%n</code></td>
|
<td><code>[%d{HH:mm:ss}] [%t/%level]: %msg%n</code></td>
|
||||||
<td>⬜️</td>
|
<td>⬜️</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>LOG_FILE_FORMAT</code></td>
|
<td><code>LOG_FILE_FORMAT</code></td>
|
||||||
<td>Log4j2 pattern for file logs (written to <code>logs/latest.log</code>)</td>
|
<td>Log4j2 pattern for file logs (written to <code>logs/latest.log</code>), or <code>json</code> for <a href="../configuration/misc-options/#json-log-output">JSON lines</a></td>
|
||||||
<td><code>[%d{HH:mm:ss}] [%t/%level]: %msg%n</code></td>
|
<td><code>[%d{HH:mm:ss}] [%t/%level]: %msg%n</code></td>
|
||||||
<td>⬜️</td>
|
<td>⬜️</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>LOG_TERMINAL_FORMAT</code></td>
|
<td><code>LOG_TERMINAL_FORMAT</code></td>
|
||||||
<td>Log4j2 pattern for interactive terminal console (used with <code>docker attach</code>)</td>
|
<td>Log4j2 pattern for interactive terminal console (used with <code>docker attach</code>), or <code>json</code> for <a href="../configuration/misc-options/#json-log-output">JSON lines</a></td>
|
||||||
<td><code>[%d{HH:mm:ss} %level]: %msg%n</code></td>
|
<td><code>[%d{HH:mm:ss} %level]: %msg%n</code></td>
|
||||||
<td>⬜️</td>
|
<td>⬜️</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -129,6 +129,12 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
|
|||||||
<td><code>true</code></td>
|
<td><code>true</code></td>
|
||||||
<td>⬜️</td>
|
<td>⬜️</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>USE_MEOWICE_ZGC_FLAGS</code></td>
|
||||||
|
<td>uses the ZGC version of MeowIce's flags instead of the G1 version when USE_MEOWICE_FLAGS is also TRUE</td>
|
||||||
|
<td><code>false</code></td>
|
||||||
|
<td>⬜️</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>JVM_OPTS</code></td>
|
<td><code>JVM_OPTS</code></td>
|
||||||
<td>General JVM options can be passed to the Minecraft Server invocation by passing a <code>JVM_OPTS</code> environment variable. The JVM requires -XX options to precede -X options, so those can be declared in <code>JVM_XX_OPTS</code>. Both variables are space-delimited, raw JVM arguments</td>
|
<td>General JVM options can be passed to the Minecraft Server invocation by passing a <code>JVM_OPTS</code> environment variable. The JVM requires -XX options to precede -X options, so those can be declared in <code>JVM_XX_OPTS</code>. Both variables are space-delimited, raw JVM arguments</td>
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
services:
|
||||||
|
minecraft:
|
||||||
|
image: itzg/minecraft-server:java25
|
||||||
|
tty: true
|
||||||
|
stdin_open: true
|
||||||
|
ports:
|
||||||
|
- "25565:25565"
|
||||||
|
environment:
|
||||||
|
EULA: true
|
||||||
|
MOD_PLATFORM: AUTO_CURSEFORGE
|
||||||
|
CF_SLUG: "custom"
|
||||||
|
CF_MODPACK_ZIP: "/downloads/modpacks/PO3-3.5.1.zip"
|
||||||
|
APPLY_CLEANROOM: true
|
||||||
|
# Mod needed for this pack
|
||||||
|
CF_FORCE_INCLUDE_MODS: hwyla
|
||||||
|
MEMORY: 8G
|
||||||
|
OVERRIDE_SERVER_PROPERTIES: true
|
||||||
|
LEVEL_TYPE: botania-skyblock
|
||||||
|
volumes:
|
||||||
|
- ./downloads:/downloads
|
||||||
|
- ./data:/data
|
||||||
|
# Uses managed volume by default
|
||||||
|
#- mc-data:/data
|
||||||
|
|
||||||
|
# Managed volume by default
|
||||||
|
#volumes:
|
||||||
|
#mc-data:
|
||||||
@@ -142,6 +142,7 @@
|
|||||||
"shulkerboxviewer",
|
"shulkerboxviewer",
|
||||||
"skin-layers-3d",
|
"skin-layers-3d",
|
||||||
"smart-hud",
|
"smart-hud",
|
||||||
|
"smart-particles",
|
||||||
"smithing-template-viewer",
|
"smithing-template-viewer",
|
||||||
"smooth-font",
|
"smooth-font",
|
||||||
"smooth-swapping",
|
"smooth-swapping",
|
||||||
@@ -173,14 +174,22 @@
|
|||||||
"wawla",
|
"wawla",
|
||||||
"welcome-screen",
|
"welcome-screen",
|
||||||
"xaeroplus",
|
"xaeroplus",
|
||||||
|
"you-must-know-this-notice",
|
||||||
"yungs-menu-tweaks",
|
"yungs-menu-tweaks",
|
||||||
"zume"
|
"zume"
|
||||||
],
|
],
|
||||||
"globalForceIncludes": ["simply-tooltips"],
|
"globalForceIncludes": [
|
||||||
|
"simply-tooltips",
|
||||||
|
"sdm-ui-lib",
|
||||||
|
"geckolibbetterfps"
|
||||||
|
],
|
||||||
"modpacks": {
|
"modpacks": {
|
||||||
"all-of-fabric-6": {
|
"all-of-fabric-6": {
|
||||||
"forceIncludes": ["revelationary"]
|
"forceIncludes": ["revelationary"]
|
||||||
},
|
},
|
||||||
|
"better-mc-forge-bmc4": {
|
||||||
|
"forceIncludes": ["wakes-reforged"]
|
||||||
|
},
|
||||||
"beyond-depth": {
|
"beyond-depth": {
|
||||||
"forceIncludes": ["particular-reforged"]
|
"forceIncludes": ["particular-reforged"]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{"@timestamp":"%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}{UTC}","ecs.version":"1.2.0","log.level":"%level","message":"%enc{%msg}{JSON}","process.thread.name":"%enc{%t}{JSON}","log.logger":"%enc{%c}{JSON}"%notEmpty{,"error.stack_trace":"%enc{%replace{%ex}{^\s+|\s+$}{}}{JSON}"}}%ex{none}%n
|
||||||
+13
-1
@@ -1,8 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. "/image/scripts/start-utils"
|
. "/image/scripts/start-utils"
|
||||||
|
# The healthcheck runs as root, but /data is writable by the server, so only
|
||||||
|
# known settings are read from this file; it is never sourced.
|
||||||
|
MC_HEALTH_EXTRA_ARGS=()
|
||||||
if [ -f /data/.mc-health.env ]; then
|
if [ -f /data/.mc-health.env ]; then
|
||||||
. /data/.mc-health.env
|
while read -r line; do
|
||||||
|
case "$line" in
|
||||||
|
DISABLE_HEALTHCHECK=true)
|
||||||
|
DISABLE_HEALTHCHECK=true
|
||||||
|
;;
|
||||||
|
--use-old-server-list-ping|--use-server-list-ping|--use-proxy)
|
||||||
|
MC_HEALTH_EXTRA_ARGS+=("$line")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done < /data/.mc-health.env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if isTrue "${DISABLE_HEALTHCHECK}"; then
|
if isTrue "${DISABLE_HEALTHCHECK}"; then
|
||||||
|
|||||||
@@ -21,9 +21,10 @@ case "$(uname -m)" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
pumpkinAsset="pumpkin-${pumpkinArch}-Linux"
|
pumpkinAsset="pumpkin-${pumpkinArch}-Linux"
|
||||||
# The Alpine based image needs the musl linked build
|
|
||||||
if [[ $(getDistro) == alpine ]]; then
|
if [[ $(getDistro) == alpine ]]; then
|
||||||
pumpkinAsset+="-musl"
|
# https://github.com/Pumpkin-MC/Pumpkin/issues/4518#issuecomment-6719704189
|
||||||
|
logError "PumpkinMC is no longer supported for Alpine/musl"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pumpkinReleasesUrl=https://github.com/Pumpkin-MC/Pumpkin/releases
|
pumpkinReleasesUrl=https://github.com/Pumpkin-MC/Pumpkin/releases
|
||||||
|
|||||||
+4
-333
@@ -65,66 +65,11 @@ if [ -n "$ICON" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
useGeneratedLogs=${GENERATE_LOG4J2_CONFIG:-${ENABLE_ROLLING_LOGS:-false}}
|
|
||||||
useFallbackJvmFlag=false
|
|
||||||
|
|
||||||
SERVER_DIR="$baseDataDir"
|
SERVER_DIR="$baseDataDir"
|
||||||
if [[ ${FTB_DIR:-} ]]; then
|
if [[ ${FTB_DIR:-} ]]; then
|
||||||
SERVER_DIR="$FTB_DIR"
|
SERVER_DIR="$FTB_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
patchLog4jConfig() {
|
|
||||||
file=${1?}
|
|
||||||
url=${2?}
|
|
||||||
if ! get -o "${SERVER_DIR}/${file}" "$url"; then
|
|
||||||
logError "Failed to download corrected log4j config, fallback to JVM flag"
|
|
||||||
useFallbackJvmFlag=true
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
JVM_OPTS="-Dlog4j.configurationFile=${file} ${JVM_OPTS}"
|
|
||||||
useGeneratedLogs=false
|
|
||||||
}
|
|
||||||
|
|
||||||
# Temporarily disable debugging output
|
|
||||||
oldState=$(shopt -po xtrace || true)
|
|
||||||
shopt -u -o xtrace
|
|
||||||
# Patch Log4j remote code execution vulnerability
|
|
||||||
# See https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition
|
|
||||||
if isFamily NATIVE; then
|
|
||||||
: # Native server, so there is no log4j to patch
|
|
||||||
elif versionLessThan 1.7; then
|
|
||||||
: # No patch required here.
|
|
||||||
elif isFamily VANILLA && versionLessThan 1.12; then
|
|
||||||
patchLog4jConfig log4j2_17-111.xml https://launcher.mojang.com/v1/objects/dd2b723346a8dcd48e7f4d245f6bf09e98db9696/log4j2_17-111.xml
|
|
||||||
elif isFamily VANILLA && versionLessThan 1.17; then
|
|
||||||
patchLog4jConfig log4j2_112-116.xml https://launcher.mojang.com/v1/objects/02937d122c86ce73319ef9975b58896fc1b491d1/log4j2_112-116.xml
|
|
||||||
# See https://purpurmc.org/docs/Log4j/
|
|
||||||
elif isType PURPUR && versionLessThan 1.17; then
|
|
||||||
patchLog4jConfig purpur_log4j2_1141-1165.xml https://purpurmc.org/docs/xml/purpur_log4j2_1141-1165.xml
|
|
||||||
elif isType PURPUR && versionLessThan 1.18.1; then
|
|
||||||
patchLog4jConfig purpur_log4j2_117.xml https://purpurmc.org/docs/xml/purpur_log4j2_117.xml
|
|
||||||
elif versionLessThan 1.18.1; then
|
|
||||||
useFallbackJvmFlag=true
|
|
||||||
fi
|
|
||||||
eval "$oldState"
|
|
||||||
|
|
||||||
if ${useFallbackJvmFlag}; then
|
|
||||||
JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isFamily NATIVE; then
|
|
||||||
: # Native server, so no Log4jPatcher agent
|
|
||||||
elif versionLessThan 1.7; then
|
|
||||||
: # No patch required here.
|
|
||||||
elif versionLessThan 1.18.1; then
|
|
||||||
if isTrue "${SKIP_LOG4J_PATCHER:-false}"; then
|
|
||||||
log "Skipping Log4jPatcher, make sure you are not affected"
|
|
||||||
else
|
|
||||||
JVM_OPTS="-javaagent:/image/Log4jPatcher.jar ${JVM_OPTS}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
function addAgents() {
|
function addAgents() {
|
||||||
local agents=$1 outDir=$2 glob=$3 option=$4
|
local agents=$1 outDir=$2 glob=$3 option=$4
|
||||||
|
|
||||||
@@ -158,80 +103,8 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set up log4j2 configuration with templating support
|
# shellcheck source=start-finalExec-log4j
|
||||||
LOGFILE="${SERVER_DIR}/log4j2.xml"
|
. "$(dirname "$0")/start-finalExec-log4j"
|
||||||
if isFamily NATIVE; then
|
|
||||||
: # Native server, so no log4j configuration
|
|
||||||
elif ${useGeneratedLogs}; then
|
|
||||||
# Set up log configuration defaults
|
|
||||||
: "${LOG_LEVEL:=info}"
|
|
||||||
: "${ROLLING_LOG_MAX_FILES:=1000}"
|
|
||||||
# Note: Can't use ${VAR:=default} syntax for values containing } as it breaks parsing
|
|
||||||
if [ -z "${ROLLING_LOG_FILE_PATTERN}" ]; then
|
|
||||||
ROLLING_LOG_FILE_PATTERN='logs/%d{yyyy-MM-dd}-%i.log.gz'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Pattern format defaults (compatible with vanilla Minecraft)
|
|
||||||
# Note: Can't use ${VAR:=default} syntax because } in the value breaks parsing
|
|
||||||
if [ -z "${LOG_CONSOLE_FORMAT}" ]; then
|
|
||||||
LOG_CONSOLE_FORMAT='[%d{HH:mm:ss}] [%t/%level]: %msg%n'
|
|
||||||
fi
|
|
||||||
if [ -z "${LOG_TERMINAL_FORMAT}" ]; then
|
|
||||||
LOG_TERMINAL_FORMAT='[%d{HH:mm:ss} %level]: %msg%n'
|
|
||||||
fi
|
|
||||||
if [ -z "${LOG_FILE_FORMAT}" ]; then
|
|
||||||
LOG_FILE_FORMAT='[%d{HH:mm:ss}] [%t/%level]: %msg%n'
|
|
||||||
fi
|
|
||||||
|
|
||||||
export LOG_LEVEL ROLLING_LOG_FILE_PATTERN ROLLING_LOG_MAX_FILES
|
|
||||||
export LOG_CONSOLE_FORMAT LOG_TERMINAL_FORMAT LOG_FILE_FORMAT
|
|
||||||
|
|
||||||
|
|
||||||
# Always regenerate if file doesn't exist
|
|
||||||
if [ ! -e "$LOGFILE" ] || isTrue "${REGENERATE_LOG4J2:-true}"; then
|
|
||||||
log "Generating log4j2.xml from template in ${LOGFILE}"
|
|
||||||
|
|
||||||
# Generate log4j2.xml using heredoc for reliable variable substitution
|
|
||||||
cat > "$LOGFILE" <<EOF
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Configuration status="WARN">
|
|
||||||
<Appenders>
|
|
||||||
<Console name="SysOut" target="SYSTEM_OUT">
|
|
||||||
<PatternLayout pattern="${LOG_CONSOLE_FORMAT}" />
|
|
||||||
</Console>
|
|
||||||
<Queue name="TerminalConsole">
|
|
||||||
<PatternLayout pattern="${LOG_TERMINAL_FORMAT}" />
|
|
||||||
</Queue>
|
|
||||||
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="${ROLLING_LOG_FILE_PATTERN}">
|
|
||||||
<PatternLayout pattern="${LOG_FILE_FORMAT}" />
|
|
||||||
<Policies>
|
|
||||||
<TimeBasedTriggeringPolicy />
|
|
||||||
<OnStartupTriggeringPolicy />
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="${ROLLING_LOG_MAX_FILES}"/>
|
|
||||||
</RollingRandomAccessFile>
|
|
||||||
</Appenders>
|
|
||||||
<Loggers>
|
|
||||||
<Root level="${LOG_LEVEL}">
|
|
||||||
<filters>
|
|
||||||
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
|
|
||||||
</filters>
|
|
||||||
<AppenderRef ref="SysOut"/>
|
|
||||||
<AppenderRef ref="File"/>
|
|
||||||
<AppenderRef ref="TerminalConsole"/>
|
|
||||||
</Root>
|
|
||||||
</Loggers>
|
|
||||||
</Configuration>
|
|
||||||
EOF
|
|
||||||
else
|
|
||||||
log "log4j2.xml already exists and is up to date, skipping generation"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Apply the log4j2 configuration
|
|
||||||
JVM_OPTS="-Dlog4j.configurationFile=log4j2.xml ${JVM_OPTS}"
|
|
||||||
else
|
|
||||||
rm -f "${LOGFILE}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Optional disable console
|
# Optional disable console
|
||||||
if ! isFamily NATIVE && versionLessThan 1.14 && [[ ${CONSOLE,,} = false ]]; then
|
if ! isFamily NATIVE && versionLessThan 1.14 && [[ ${CONSOLE,,} = false ]]; then
|
||||||
@@ -265,210 +138,8 @@ if isTrue "${ENABLE_JMX}"; then
|
|||||||
log "JMX is enabled. Make sure you have port forwarding for ${JMX_PORT}"
|
log "JMX is enabled. Make sure you have port forwarding for ${JMX_PORT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
: "${USE_AIKAR_FLAGS:=false}"
|
# shellcheck source=start-finalExec-jvmFlags
|
||||||
: "${USE_MEOWICE_FLAGS:=false}"
|
. "$(dirname "$0")/start-finalExec-jvmFlags"
|
||||||
: "${USE_MEOWICE_GRAALVM_FLAGS:=false}"
|
|
||||||
|
|
||||||
if isTrue "${USE_MEOWICE_FLAGS}" || isTrue "${USE_MEOWICE_GRAALVM_FLAGS}"; then
|
|
||||||
java_major_version=$(mc-image-helper java-release)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isTrue "${USE_MEOWICE_FLAGS}"; then
|
|
||||||
if [[ $java_major_version -gt 16 ]]; then
|
|
||||||
log "Java version $java_major_version using MeowIce's flags for Java 17+"
|
|
||||||
else
|
|
||||||
log "Your Java version is $java_major_version, MeowIce's flags are for Java 17+ falling back to Aikar's"
|
|
||||||
USE_MEOWICE_FLAGS=FALSE
|
|
||||||
USE_AIKAR_FLAGS=TRUE
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isTrue "${USE_AIKAR_FLAGS}" || isTrue "${USE_MEOWICE_FLAGS}"; then
|
|
||||||
# From https://mcflags.emc.gs/
|
|
||||||
if isTrue "${USE_MEOWICE_FLAGS}"; then
|
|
||||||
log "Using MeowIce's flags"
|
|
||||||
G1NewSizePercent=28
|
|
||||||
G1MaxNewSizePercent=50
|
|
||||||
G1HeapRegionSize=16M
|
|
||||||
G1ReservePercent=15
|
|
||||||
InitiatingHeapOccupancyPercent=20
|
|
||||||
G1MixedGCCountTarget=3
|
|
||||||
G1RSetUpdatingPauseTimePercent=0
|
|
||||||
elif [[ $MAX_MEMORY ]] && (( $(normalizeMemSize "${MAX_MEMORY}") >= $(normalizeMemSize 12g) )); then
|
|
||||||
log "Using Aikar's >12GB flags"
|
|
||||||
G1NewSizePercent=40
|
|
||||||
G1MaxNewSizePercent=50
|
|
||||||
G1HeapRegionSize=16M
|
|
||||||
G1ReservePercent=15
|
|
||||||
InitiatingHeapOccupancyPercent=20
|
|
||||||
G1MixedGCCountTarget=4
|
|
||||||
G1RSetUpdatingPauseTimePercent=5
|
|
||||||
else
|
|
||||||
log "Using Aikar's flags"
|
|
||||||
G1NewSizePercent=30
|
|
||||||
G1MaxNewSizePercent=40
|
|
||||||
G1HeapRegionSize=8M
|
|
||||||
G1ReservePercent=20
|
|
||||||
InitiatingHeapOccupancyPercent=15
|
|
||||||
G1MixedGCCountTarget=4
|
|
||||||
G1RSetUpdatingPauseTimePercent=5
|
|
||||||
fi
|
|
||||||
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
|
||||||
-XX:+UseG1GC
|
|
||||||
-XX:+ParallelRefProcEnabled
|
|
||||||
-XX:MaxGCPauseMillis=200
|
|
||||||
-XX:+UnlockExperimentalVMOptions
|
|
||||||
-XX:+DisableExplicitGC
|
|
||||||
-XX:+AlwaysPreTouch
|
|
||||||
-XX:G1NewSizePercent=${G1NewSizePercent}
|
|
||||||
-XX:G1MaxNewSizePercent=${G1MaxNewSizePercent}
|
|
||||||
-XX:G1HeapRegionSize=${G1HeapRegionSize}
|
|
||||||
-XX:G1ReservePercent=${G1ReservePercent}
|
|
||||||
-XX:G1HeapWastePercent=5
|
|
||||||
-XX:G1MixedGCCountTarget=${G1MixedGCCountTarget}
|
|
||||||
-XX:InitiatingHeapOccupancyPercent=${InitiatingHeapOccupancyPercent}
|
|
||||||
-XX:G1MixedGCLiveThresholdPercent=90
|
|
||||||
-XX:G1RSetUpdatingPauseTimePercent=${G1RSetUpdatingPauseTimePercent}
|
|
||||||
-XX:SurvivorRatio=32
|
|
||||||
-XX:+PerfDisableSharedMem
|
|
||||||
-XX:MaxTenuringThreshold=1
|
|
||||||
"
|
|
||||||
if isTrue "${USE_AIKAR_FLAGS}"; then
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
|
||||||
-Dusing.aikars.flags=https://mcflags.emc.gs
|
|
||||||
-Daikars.new.flags=true
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isTrue "${USE_MEOWICE_FLAGS}"; then
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
|
||||||
-XX:+UnlockDiagnosticVMOptions
|
|
||||||
-XX:+UnlockExperimentalVMOptions
|
|
||||||
-XX:G1SATBBufferEnqueueingThresholdPercent=30
|
|
||||||
-XX:G1ConcMarkStepDurationMillis=5
|
|
||||||
-XX:+UseNUMA
|
|
||||||
-XX:-DontCompileHugeMethods
|
|
||||||
-XX:MaxNodeLimit=240000
|
|
||||||
-XX:NodeLimitFudgeFactor=8000
|
|
||||||
-XX:ReservedCodeCacheSize=400M
|
|
||||||
-XX:NonNMethodCodeHeapSize=12M
|
|
||||||
-XX:ProfiledCodeHeapSize=194M
|
|
||||||
-XX:NonProfiledCodeHeapSize=194M
|
|
||||||
-XX:NmethodSweepActivity=1
|
|
||||||
-XX:+UseFastUnorderedTimeStamps
|
|
||||||
-XX:+UseCriticalJavaThreadPriority
|
|
||||||
-XX:AllocatePrefetchStyle=3
|
|
||||||
-XX:+AlwaysActAsServerClassMachine
|
|
||||||
-XX:+UseTransparentHugePages
|
|
||||||
-XX:LargePageSizeInBytes=2M
|
|
||||||
-XX:+UseLargePages
|
|
||||||
-XX:+EagerJVMCI
|
|
||||||
-XX:+UseStringDeduplication
|
|
||||||
-XX:+UseAES
|
|
||||||
-XX:+UseAESIntrinsics
|
|
||||||
-XX:+UseFMA
|
|
||||||
-XX:+UseLoopPredicate
|
|
||||||
-XX:+RangeCheckElimination
|
|
||||||
-XX:+OptimizeStringConcat
|
|
||||||
-XX:+UseCompressedOops
|
|
||||||
-XX:+UseThreadPriorities
|
|
||||||
-XX:+OmitStackTraceInFastThrow
|
|
||||||
-XX:+RewriteBytecodes
|
|
||||||
-XX:+RewriteFrequentPairs
|
|
||||||
-XX:+UseFPUForSpilling
|
|
||||||
-XX:+UseVectorCmov
|
|
||||||
-XX:+UseXMMForArrayCopy
|
|
||||||
-XX:+EliminateLocks
|
|
||||||
-XX:+DoEscapeAnalysis
|
|
||||||
-XX:+AlignVector
|
|
||||||
-XX:+OptimizeFill
|
|
||||||
-XX:+EnableVectorSupport
|
|
||||||
-XX:+UseCharacterCompareIntrinsics
|
|
||||||
-XX:+UseCopySignIntrinsic
|
|
||||||
-XX:+UseVectorStubs
|
|
||||||
"
|
|
||||||
if [[ $(arch) == "x86_64" ]]; then
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
|
||||||
-XX:+UseFastStosb
|
|
||||||
-XX:+UseNewLongLShift
|
|
||||||
-XX:+UseXmmI2D
|
|
||||||
-XX:+UseXmmI2F
|
|
||||||
-XX:+UseXmmLoadAndClearUpper
|
|
||||||
-XX:+UseXmmRegToRegMoveAll
|
|
||||||
-XX:UseAVX=2
|
|
||||||
-XX:UseSSE=4
|
|
||||||
"
|
|
||||||
else
|
|
||||||
log "cpu not x86_64, disabling architecture specific flags"
|
|
||||||
fi
|
|
||||||
if [[ $java_major_version -gt 23 ]]; then
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
|
||||||
-XX:+UseCompactObjectHeaders
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isTrue "${USE_MEOWICE_GRAALVM_FLAGS}"; then
|
|
||||||
if [[ $java_major_version -gt 23 ]]; then
|
|
||||||
log "Java 24 or higher detected, using modified GraalVM flags"
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
|
||||||
-XX:+UseFastJNIAccessors
|
|
||||||
-XX:+UseInlineCaches
|
|
||||||
-XX:+SegmentedCodeCache
|
|
||||||
-Djdk.nio.maxCachedBufferSize=262144
|
|
||||||
-Djdk.graal.UsePriorityInlining=true
|
|
||||||
-Djdk.graal.Vectorization=true
|
|
||||||
-Djdk.graal.OptDuplication=true
|
|
||||||
-Djdk.graal.DetectInvertedLoopsAsCounted=true
|
|
||||||
-Djdk.graal.LoopInversion=true
|
|
||||||
-Djdk.graal.VectorizeHashes=true
|
|
||||||
-Djdk.graal.EnterprisePartialUnroll=true
|
|
||||||
-Djdk.graal.VectorizeSIMD=true
|
|
||||||
-Djdk.graal.StripMineNonCountedLoops=true
|
|
||||||
-Djdk.graal.SpeculativeGuardMovement=true
|
|
||||||
-Djdk.graal.TuneInlinerExploration=1
|
|
||||||
-Djdk.graal.LoopRotation=true
|
|
||||||
-Djdk.graal.CompilerConfiguration=enterprise
|
|
||||||
"
|
|
||||||
else
|
|
||||||
log "Using MeowIce's flags for Graalvm"
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
|
||||||
-XX:+UseFastJNIAccessors
|
|
||||||
-XX:+UseInlineCaches
|
|
||||||
-XX:+SegmentedCodeCache
|
|
||||||
-Djdk.nio.maxCachedBufferSize=262144
|
|
||||||
-Dgraal.UsePriorityInlining=true
|
|
||||||
-Dgraal.Vectorization=true
|
|
||||||
-Dgraal.OptDuplication=true
|
|
||||||
-Dgraal.DetectInvertedLoopsAsCounted=true
|
|
||||||
-Dgraal.LoopInversion=true
|
|
||||||
-Dgraal.VectorizeHashes=true
|
|
||||||
-Dgraal.EnterprisePartialUnroll=true
|
|
||||||
-Dgraal.VectorizeSIMD=true
|
|
||||||
-Dgraal.StripMineNonCountedLoops=true
|
|
||||||
-Dgraal.SpeculativeGuardMovement=true
|
|
||||||
-Dgraal.TuneInlinerExploration=1
|
|
||||||
-Dgraal.LoopRotation=true
|
|
||||||
-Dgraal.OptWriteMotion=true
|
|
||||||
-Dgraal.CompilerConfiguration=enterprise
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isTrue "${USE_FLARE_FLAGS}"; then
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
|
||||||
-XX:+UnlockDiagnosticVMOptions
|
|
||||||
-XX:+DebugNonSafepoints
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isTrue "${USE_SIMD_FLAGS}"; then
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
|
||||||
--add-modules=jdk.incubator.vector
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Handle GTNH args
|
# Handle GTNH args
|
||||||
if isType "GTNH"; then
|
if isType "GTNH"; then
|
||||||
|
|||||||
Executable
+235
@@ -0,0 +1,235 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
: "${USE_AIKAR_FLAGS:=false}"
|
||||||
|
: "${USE_MEOWICE_FLAGS:=false}"
|
||||||
|
: "${USE_MEOWICE_GRAALVM_FLAGS:=false}"
|
||||||
|
: "${USE_MEOWICE_ZGC_FLAGS:=false}"
|
||||||
|
|
||||||
|
java_major_version=$(mc-image-helper java-release)
|
||||||
|
|
||||||
|
if isTrue "${USE_MEOWICE_FLAGS}"; then
|
||||||
|
if [[ $java_major_version -gt 16 ]]; then
|
||||||
|
log "Java version $java_major_version using MeowIce's flags for Java 17+"
|
||||||
|
else
|
||||||
|
log "Your Java version is $java_major_version, MeowIce's flags are for Java 17+ falling back to Aikar's"
|
||||||
|
USE_MEOWICE_FLAGS=FALSE
|
||||||
|
USE_AIKAR_FLAGS=TRUE
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
use_meowice_zgc=false
|
||||||
|
if isTrue "${USE_MEOWICE_FLAGS}" && isTrue "${USE_MEOWICE_ZGC_FLAGS}"; then
|
||||||
|
use_meowice_zgc=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if isTrue "${use_meowice_zgc}"; then
|
||||||
|
log "Using MeowIce's ZGC flags"
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UseZGC
|
||||||
|
-XX:-ZProactive
|
||||||
|
-XX:+UnlockExperimentalVMOptions
|
||||||
|
-XX:+DisableExplicitGC
|
||||||
|
-XX:+AlwaysPreTouch
|
||||||
|
-XX:+PerfDisableSharedMem
|
||||||
|
"
|
||||||
|
# MeowIce sets the soft max heap size to 2GB below the max heap size
|
||||||
|
if [[ $MAX_MEMORY ]] && max_memory_bytes=$(normalizeMemSize "${MAX_MEMORY}") \
|
||||||
|
&& (( max_memory_bytes > $(normalizeMemSize 2048m) )); then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:SoftMaxHeapSize=$(( max_memory_bytes / 1048576 - 2048 ))M
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
elif isTrue "${USE_AIKAR_FLAGS}" || isTrue "${USE_MEOWICE_FLAGS}"; then
|
||||||
|
# From https://mcflags.emc.gs/
|
||||||
|
if isTrue "${USE_MEOWICE_FLAGS}"; then
|
||||||
|
log "Using MeowIce's flags"
|
||||||
|
G1NewSizePercent=28
|
||||||
|
G1MaxNewSizePercent=50
|
||||||
|
G1HeapRegionSize=16M
|
||||||
|
G1ReservePercent=15
|
||||||
|
InitiatingHeapOccupancyPercent=20
|
||||||
|
G1MixedGCCountTarget=3
|
||||||
|
G1RSetUpdatingPauseTimePercent=0
|
||||||
|
elif [[ $MAX_MEMORY ]] && (( $(normalizeMemSize "${MAX_MEMORY}") >= $(normalizeMemSize 12g) )); then
|
||||||
|
log "Using Aikar's >12GB flags"
|
||||||
|
G1NewSizePercent=40
|
||||||
|
G1MaxNewSizePercent=50
|
||||||
|
G1HeapRegionSize=16M
|
||||||
|
G1ReservePercent=15
|
||||||
|
InitiatingHeapOccupancyPercent=20
|
||||||
|
G1MixedGCCountTarget=4
|
||||||
|
G1RSetUpdatingPauseTimePercent=5
|
||||||
|
else
|
||||||
|
log "Using Aikar's flags"
|
||||||
|
G1NewSizePercent=30
|
||||||
|
G1MaxNewSizePercent=40
|
||||||
|
G1HeapRegionSize=8M
|
||||||
|
G1ReservePercent=20
|
||||||
|
InitiatingHeapOccupancyPercent=15
|
||||||
|
G1MixedGCCountTarget=4
|
||||||
|
G1RSetUpdatingPauseTimePercent=5
|
||||||
|
fi
|
||||||
|
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UseG1GC
|
||||||
|
-XX:+ParallelRefProcEnabled
|
||||||
|
-XX:MaxGCPauseMillis=200
|
||||||
|
-XX:+UnlockExperimentalVMOptions
|
||||||
|
-XX:+DisableExplicitGC
|
||||||
|
-XX:+AlwaysPreTouch
|
||||||
|
-XX:G1NewSizePercent=${G1NewSizePercent}
|
||||||
|
-XX:G1MaxNewSizePercent=${G1MaxNewSizePercent}
|
||||||
|
-XX:G1HeapRegionSize=${G1HeapRegionSize}
|
||||||
|
-XX:G1ReservePercent=${G1ReservePercent}
|
||||||
|
-XX:G1HeapWastePercent=5
|
||||||
|
-XX:G1MixedGCCountTarget=${G1MixedGCCountTarget}
|
||||||
|
-XX:InitiatingHeapOccupancyPercent=${InitiatingHeapOccupancyPercent}
|
||||||
|
-XX:G1MixedGCLiveThresholdPercent=90
|
||||||
|
-XX:G1RSetUpdatingPauseTimePercent=${G1RSetUpdatingPauseTimePercent}
|
||||||
|
-XX:SurvivorRatio=32
|
||||||
|
-XX:+PerfDisableSharedMem
|
||||||
|
-XX:MaxTenuringThreshold=1
|
||||||
|
"
|
||||||
|
if isTrue "${USE_AIKAR_FLAGS}"; then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-Dusing.aikars.flags=https://mcflags.emc.gs
|
||||||
|
-Daikars.new.flags=true
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if isTrue "${USE_MEOWICE_FLAGS}"; then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UnlockDiagnosticVMOptions
|
||||||
|
-XX:+UnlockExperimentalVMOptions
|
||||||
|
-XX:+UseNUMA
|
||||||
|
-XX:-DontCompileHugeMethods
|
||||||
|
-XX:MaxNodeLimit=240000
|
||||||
|
-XX:NodeLimitFudgeFactor=8000
|
||||||
|
-XX:ReservedCodeCacheSize=400M
|
||||||
|
-XX:NonNMethodCodeHeapSize=12M
|
||||||
|
-XX:ProfiledCodeHeapSize=194M
|
||||||
|
-XX:NonProfiledCodeHeapSize=194M
|
||||||
|
-XX:NmethodSweepActivity=1
|
||||||
|
-XX:+UseFastUnorderedTimeStamps
|
||||||
|
-XX:+UseCriticalJavaThreadPriority
|
||||||
|
-XX:+AlwaysActAsServerClassMachine
|
||||||
|
-XX:+UseTransparentHugePages
|
||||||
|
-XX:LargePageSizeInBytes=2M
|
||||||
|
-XX:+UseLargePages
|
||||||
|
-XX:+EagerJVMCI
|
||||||
|
-XX:+UseStringDeduplication
|
||||||
|
-XX:+UseAES
|
||||||
|
-XX:+UseAESIntrinsics
|
||||||
|
-XX:+UseFMA
|
||||||
|
-XX:+UseLoopPredicate
|
||||||
|
-XX:+RangeCheckElimination
|
||||||
|
-XX:+OptimizeStringConcat
|
||||||
|
-XX:+UseCompressedOops
|
||||||
|
-XX:+UseThreadPriorities
|
||||||
|
-XX:+OmitStackTraceInFastThrow
|
||||||
|
-XX:+RewriteBytecodes
|
||||||
|
-XX:+RewriteFrequentPairs
|
||||||
|
-XX:+UseFPUForSpilling
|
||||||
|
-XX:+UseVectorCmov
|
||||||
|
-XX:+UseXMMForArrayCopy
|
||||||
|
-XX:+EliminateLocks
|
||||||
|
-XX:+DoEscapeAnalysis
|
||||||
|
-XX:+AlignVector
|
||||||
|
-XX:+OptimizeFill
|
||||||
|
-XX:+EnableVectorSupport
|
||||||
|
-XX:+UseCharacterCompareIntrinsics
|
||||||
|
-XX:+UseCopySignIntrinsic
|
||||||
|
-XX:+UseVectorStubs
|
||||||
|
"
|
||||||
|
if isTrue "${use_meowice_zgc}"; then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:AllocatePrefetchStyle=1
|
||||||
|
"
|
||||||
|
else
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:G1SATBBufferEnqueueingThresholdPercent=30
|
||||||
|
-XX:G1ConcMarkStepDurationMillis=5
|
||||||
|
-XX:AllocatePrefetchStyle=3
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
if [[ $(arch) == "x86_64" ]]; then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UseFastStosb
|
||||||
|
-XX:+UseNewLongLShift
|
||||||
|
-XX:+UseXmmI2D
|
||||||
|
-XX:+UseXmmI2F
|
||||||
|
-XX:+UseXmmLoadAndClearUpper
|
||||||
|
-XX:+UseXmmRegToRegMoveAll
|
||||||
|
-XX:UseAVX=2
|
||||||
|
-XX:UseSSE=4
|
||||||
|
"
|
||||||
|
else
|
||||||
|
log "cpu not x86_64, disabling architecture specific flags"
|
||||||
|
fi
|
||||||
|
if [[ $java_major_version -gt 23 ]]; then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UseCompactObjectHeaders
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if isTrue "${USE_MEOWICE_GRAALVM_FLAGS}"; then
|
||||||
|
if [[ $java_major_version -gt 23 ]]; then
|
||||||
|
log "Java 24 or higher detected, using modified GraalVM flags"
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UseFastJNIAccessors
|
||||||
|
-XX:+UseInlineCaches
|
||||||
|
-XX:+SegmentedCodeCache
|
||||||
|
-Djdk.nio.maxCachedBufferSize=262144
|
||||||
|
-Djdk.graal.UsePriorityInlining=true
|
||||||
|
-Djdk.graal.Vectorization=true
|
||||||
|
-Djdk.graal.OptDuplication=true
|
||||||
|
-Djdk.graal.DetectInvertedLoopsAsCounted=true
|
||||||
|
-Djdk.graal.LoopInversion=true
|
||||||
|
-Djdk.graal.VectorizeHashes=true
|
||||||
|
-Djdk.graal.EnterprisePartialUnroll=true
|
||||||
|
-Djdk.graal.VectorizeSIMD=true
|
||||||
|
-Djdk.graal.StripMineNonCountedLoops=true
|
||||||
|
-Djdk.graal.SpeculativeGuardMovement=true
|
||||||
|
-Djdk.graal.TuneInlinerExploration=1
|
||||||
|
-Djdk.graal.LoopRotation=true
|
||||||
|
-Djdk.graal.CompilerConfiguration=enterprise
|
||||||
|
"
|
||||||
|
else
|
||||||
|
log "Using MeowIce's flags for Graalvm"
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UseFastJNIAccessors
|
||||||
|
-XX:+UseInlineCaches
|
||||||
|
-XX:+SegmentedCodeCache
|
||||||
|
-Djdk.nio.maxCachedBufferSize=262144
|
||||||
|
-Dgraal.UsePriorityInlining=true
|
||||||
|
-Dgraal.Vectorization=true
|
||||||
|
-Dgraal.OptDuplication=true
|
||||||
|
-Dgraal.DetectInvertedLoopsAsCounted=true
|
||||||
|
-Dgraal.LoopInversion=true
|
||||||
|
-Dgraal.VectorizeHashes=true
|
||||||
|
-Dgraal.EnterprisePartialUnroll=true
|
||||||
|
-Dgraal.VectorizeSIMD=true
|
||||||
|
-Dgraal.StripMineNonCountedLoops=true
|
||||||
|
-Dgraal.SpeculativeGuardMovement=true
|
||||||
|
-Dgraal.TuneInlinerExploration=1
|
||||||
|
-Dgraal.LoopRotation=true
|
||||||
|
-Dgraal.OptWriteMotion=true
|
||||||
|
-Dgraal.CompilerConfiguration=enterprise
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if isTrue "${USE_FLARE_FLAGS}"; then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UnlockDiagnosticVMOptions
|
||||||
|
-XX:+DebugNonSafepoints
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if isTrue "${USE_SIMD_FLAGS}"; then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
--add-modules=jdk.incubator.vector
|
||||||
|
"
|
||||||
|
fi
|
||||||
Executable
+159
@@ -0,0 +1,159 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
useGeneratedLogs=${GENERATE_LOG4J2_CONFIG:-${ENABLE_ROLLING_LOGS:-false}}
|
||||||
|
useFallbackJvmFlag=false
|
||||||
|
|
||||||
|
patchLog4jConfig() {
|
||||||
|
file=${1?}
|
||||||
|
url=${2?}
|
||||||
|
if ! get -o "${SERVER_DIR}/${file}" "$url"; then
|
||||||
|
logError "Failed to download corrected log4j config, fallback to JVM flag"
|
||||||
|
useFallbackJvmFlag=true
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
JVM_OPTS="-Dlog4j.configurationFile=${file} ${JVM_OPTS}"
|
||||||
|
useGeneratedLogs=false
|
||||||
|
}
|
||||||
|
|
||||||
|
# Temporarily disable debugging output
|
||||||
|
oldState=$(shopt -po xtrace || true)
|
||||||
|
shopt -u -o xtrace
|
||||||
|
# Patch Log4j remote code execution vulnerability
|
||||||
|
# See https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition
|
||||||
|
if isFamily NATIVE; then
|
||||||
|
: # Native server, so there is no log4j to patch
|
||||||
|
elif versionLessThan 1.7; then
|
||||||
|
: # No patch required here.
|
||||||
|
elif isFamily VANILLA && versionLessThan 1.12; then
|
||||||
|
patchLog4jConfig log4j2_17-111.xml https://launcher.mojang.com/v1/objects/dd2b723346a8dcd48e7f4d245f6bf09e98db9696/log4j2_17-111.xml
|
||||||
|
elif isFamily VANILLA && versionLessThan 1.17; then
|
||||||
|
patchLog4jConfig log4j2_112-116.xml https://launcher.mojang.com/v1/objects/02937d122c86ce73319ef9975b58896fc1b491d1/log4j2_112-116.xml
|
||||||
|
# See https://purpurmc.org/docs/Log4j/
|
||||||
|
elif isType PURPUR && versionLessThan 1.17; then
|
||||||
|
patchLog4jConfig purpur_log4j2_1141-1165.xml https://purpurmc.org/docs/xml/purpur_log4j2_1141-1165.xml
|
||||||
|
elif isType PURPUR && versionLessThan 1.18.1; then
|
||||||
|
patchLog4jConfig purpur_log4j2_117.xml https://purpurmc.org/docs/xml/purpur_log4j2_117.xml
|
||||||
|
elif versionLessThan 1.18.1; then
|
||||||
|
useFallbackJvmFlag=true
|
||||||
|
fi
|
||||||
|
eval "$oldState"
|
||||||
|
|
||||||
|
if ${useFallbackJvmFlag}; then
|
||||||
|
JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if isFamily NATIVE; then
|
||||||
|
: # Native server, so no Log4jPatcher agent
|
||||||
|
elif versionLessThan 1.7; then
|
||||||
|
: # No patch required here.
|
||||||
|
elif versionLessThan 1.18.1; then
|
||||||
|
if isTrue "${SKIP_LOG4J_PATCHER:-false}"; then
|
||||||
|
log "Skipping Log4jPatcher, make sure you are not affected"
|
||||||
|
else
|
||||||
|
JVM_OPTS="-javaagent:/image/Log4jPatcher.jar ${JVM_OPTS}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set up log4j2 configuration with templating support
|
||||||
|
LOGFILE="${SERVER_DIR}/log4j2.xml"
|
||||||
|
if isFamily NATIVE; then
|
||||||
|
: # Native server, so no log4j configuration
|
||||||
|
elif ${useGeneratedLogs}; then
|
||||||
|
# Set up log configuration defaults
|
||||||
|
: "${LOG_LEVEL:=info}"
|
||||||
|
: "${ROLLING_LOG_MAX_FILES:=1000}"
|
||||||
|
# Note: Can't use ${VAR:=default} syntax for values containing } as it breaks parsing
|
||||||
|
if [ -z "${ROLLING_LOG_FILE_PATTERN}" ]; then
|
||||||
|
ROLLING_LOG_FILE_PATTERN='logs/%d{yyyy-MM-dd}-%i.log.gz'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# A format of "json" selects one JSON object per line with ECS field names.
|
||||||
|
# Minecraft server jars don't bundle log4j-layout-template-json, and their launchers
|
||||||
|
# load Log4j in an isolated class loader, so the JSON is produced by PatternLayout
|
||||||
|
# with JSON-encoded fields. %enc{...}{JSON} is available in all Log4j versions
|
||||||
|
# bundled since Minecraft 1.18.1 (Log4j 2.17).
|
||||||
|
LOG_JSON_FORMAT=$(</image/log4j2-json-pattern.txt)
|
||||||
|
# The format goes into an XML attribute, so escape it.
|
||||||
|
# Replacements are quoted so bash 5.2's patsub_replacement doesn't expand "&".
|
||||||
|
LOG_JSON_FORMAT=${LOG_JSON_FORMAT//&/"&"}
|
||||||
|
LOG_JSON_FORMAT=${LOG_JSON_FORMAT//</"<"}
|
||||||
|
LOG_JSON_FORMAT=${LOG_JSON_FORMAT//>/">"}
|
||||||
|
LOG_JSON_FORMAT=${LOG_JSON_FORMAT//\"/"""}
|
||||||
|
|
||||||
|
for logFormatVar in LOG_CONSOLE_FORMAT LOG_TERMINAL_FORMAT LOG_FILE_FORMAT; do
|
||||||
|
if [[ ${!logFormatVar:-} && ${!logFormatVar,,} == json ]]; then
|
||||||
|
if versionLessThan 1.18.1; then
|
||||||
|
logWarning "${logFormatVar}=json requires Minecraft 1.18.1 or newer, using the default format"
|
||||||
|
printf -v "$logFormatVar" '%s' ''
|
||||||
|
else
|
||||||
|
printf -v "$logFormatVar" '%s' "$LOG_JSON_FORMAT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Pattern format defaults (compatible with vanilla Minecraft)
|
||||||
|
# Note: Can't use ${VAR:=default} syntax because } in the value breaks parsing
|
||||||
|
if [ -z "${LOG_CONSOLE_FORMAT}" ]; then
|
||||||
|
LOG_CONSOLE_FORMAT='[%d{HH:mm:ss}] [%t/%level]: %msg%n'
|
||||||
|
fi
|
||||||
|
if [ -z "${LOG_TERMINAL_FORMAT}" ]; then
|
||||||
|
LOG_TERMINAL_FORMAT='[%d{HH:mm:ss} %level]: %msg%n'
|
||||||
|
fi
|
||||||
|
if [ -z "${LOG_FILE_FORMAT}" ]; then
|
||||||
|
LOG_FILE_FORMAT='[%d{HH:mm:ss}] [%t/%level]: %msg%n'
|
||||||
|
fi
|
||||||
|
|
||||||
|
export LOG_LEVEL ROLLING_LOG_FILE_PATTERN ROLLING_LOG_MAX_FILES
|
||||||
|
export LOG_CONSOLE_FORMAT LOG_TERMINAL_FORMAT LOG_FILE_FORMAT
|
||||||
|
|
||||||
|
|
||||||
|
# Always regenerate if file doesn't exist
|
||||||
|
if [ ! -e "$LOGFILE" ] || isTrue "${REGENERATE_LOG4J2:-true}"; then
|
||||||
|
log "Generating log4j2.xml from template in ${LOGFILE}"
|
||||||
|
|
||||||
|
# Generate log4j2.xml using heredoc for reliable variable substitution
|
||||||
|
cat > "$LOGFILE" <<EOF
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Configuration status="WARN">
|
||||||
|
<Appenders>
|
||||||
|
<Console name="SysOut" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout pattern="${LOG_CONSOLE_FORMAT}" />
|
||||||
|
</Console>
|
||||||
|
<Queue name="TerminalConsole">
|
||||||
|
<PatternLayout pattern="${LOG_TERMINAL_FORMAT}" />
|
||||||
|
</Queue>
|
||||||
|
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="${ROLLING_LOG_FILE_PATTERN}">
|
||||||
|
<PatternLayout pattern="${LOG_FILE_FORMAT}" />
|
||||||
|
<Policies>
|
||||||
|
<TimeBasedTriggeringPolicy />
|
||||||
|
<OnStartupTriggeringPolicy />
|
||||||
|
</Policies>
|
||||||
|
<DefaultRolloverStrategy max="${ROLLING_LOG_MAX_FILES}"/>
|
||||||
|
</RollingRandomAccessFile>
|
||||||
|
</Appenders>
|
||||||
|
<Loggers>
|
||||||
|
<Root level="${LOG_LEVEL}">
|
||||||
|
<filters>
|
||||||
|
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
|
||||||
|
</filters>
|
||||||
|
<AppenderRef ref="SysOut"/>
|
||||||
|
<AppenderRef ref="File"/>
|
||||||
|
<AppenderRef ref="TerminalConsole"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
log "log4j2.xml already exists and is up to date, skipping generation"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Apply the log4j2 configuration
|
||||||
|
JVM_OPTS="-Dlog4j.configurationFile=log4j2.xml ${JVM_OPTS}"
|
||||||
|
else
|
||||||
|
for logFormatVar in LOG_CONSOLE_FORMAT LOG_TERMINAL_FORMAT LOG_FILE_FORMAT; do
|
||||||
|
if [[ ${!logFormatVar:-} && ${!logFormatVar,,} == json ]]; then
|
||||||
|
logWarning "${logFormatVar}=json is ignored since the image is not generating the log4j2 configuration. Set GENERATE_LOG4J2_CONFIG=true to use it."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
rm -f "${LOGFILE}"
|
||||||
|
fi
|
||||||
@@ -332,6 +332,30 @@ function handleModrinthProjects() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleHangarProjects() {
|
||||||
|
: "${HANGAR_CHANNEL:=Release}"
|
||||||
|
|
||||||
|
if [[ -v HANGAR_PROJECTS ]]; then
|
||||||
|
# Older helper builds, including Java 8, don't have the hangar command
|
||||||
|
if ! mc-image-helper has-feature hangar; then
|
||||||
|
logError "HANGAR_PROJECTS is not supported by this image variant"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! isType PAPER FOLIA PURPUR PUFFERFISH LEAF; then
|
||||||
|
logError "HANGAR_PROJECTS requires a Paper based TYPE, such as PAPER, FOLIA, or PURPUR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mc-image-helper hangar \
|
||||||
|
--output-directory=/data \
|
||||||
|
--projects="${HANGAR_PROJECTS}" \
|
||||||
|
--game-version="${VERSION}" \
|
||||||
|
--platform=PAPER \
|
||||||
|
--channel="$HANGAR_CHANNEL"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function handleCurseForgeFiles() {
|
function handleCurseForgeFiles() {
|
||||||
args=(
|
args=(
|
||||||
--use-http2="$CF_USE_HTTP2"
|
--use-http2="$CF_USE_HTTP2"
|
||||||
@@ -387,6 +411,8 @@ handleGenericPacks
|
|||||||
|
|
||||||
handleModrinthProjects
|
handleModrinthProjects
|
||||||
|
|
||||||
|
handleHangarProjects
|
||||||
|
|
||||||
if usesMods || usesPlugins; then
|
if usesMods || usesPlugins; then
|
||||||
handleCurseForgeFiles
|
handleCurseForgeFiles
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
services:
|
||||||
|
mc:
|
||||||
|
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||||
|
environment:
|
||||||
|
EULA: "true"
|
||||||
|
SETUP_ONLY: "true"
|
||||||
|
TYPE: PAPER
|
||||||
|
VERSION: 1.21.4
|
||||||
|
HANGAR_PROJECTS: ViaVersion
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
mc-image-helper has-feature hangar || exit 1
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
mc-image-helper assert fileExists "plugins/ViaVersion-*.jar"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
services:
|
||||||
|
mc:
|
||||||
|
restart: "no"
|
||||||
|
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
SETUP_ONLY: "TRUE"
|
||||||
|
GENERATE_LOG4J2_CONFIG: "true"
|
||||||
|
LOG_CONSOLE_FORMAT: json
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
mc-image-helper assert fileExists /data/log4j2.xml
|
||||||
|
# console appender uses the JSON pattern
|
||||||
|
grep -A1 '<Console name="SysOut"' /data/log4j2.xml | grep -q '"ecs.version"'
|
||||||
|
# file appender keeps the default text pattern
|
||||||
|
grep -A1 '<RollingRandomAccessFile name="File"' /data/log4j2.xml | grep -qF 'pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n"'
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# PumpkinMC is no longer supported for Alpine/musl
|
||||||
|
[[ "$VARIANT" != *-alpine ]]
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# PumpkinMC is no longer supported for Alpine/musl
|
||||||
|
[[ "$VARIANT" != *-alpine ]]
|
||||||
Reference in new issue
Block a user