mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-11-25 15:11: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 |
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.7.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.7.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.19.0
|
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.76.1
|
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
|
||||||
|
|||||||
@@ -160,3 +160,7 @@ When `MEMORY` is greater than or equal to 12G, then the Aikar flags will be adju
|
|||||||
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.
|
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):
|
||||||
|
|||||||
@@ -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
|
||||||
|
```
|
||||||
@@ -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.4.1
|
griffe==2.4.1
|
||||||
Jinja2==3.1.6
|
Jinja2==3.1.6
|
||||||
Markdown==3.11.2
|
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.5
|
mkdocs-autorefs==1.4.5
|
||||||
mkdocs-get-deps==0.2.2
|
mkdocs-get-deps==0.2.2
|
||||||
mkdocstrings==1.0.8
|
mkdocstrings==1.0.8
|
||||||
mkdocstrings-python==2.0.10
|
mkdocstrings-python==2.0.11
|
||||||
packaging==26.3
|
packaging==26.3
|
||||||
pathspec==1.1.1
|
pathspec==1.1.1
|
||||||
platformdirs==4.14.2
|
platformdirs==4.14.5
|
||||||
Pygments==2.21.0
|
Pygments==2.21.0
|
||||||
pymdown-extensions==12.3
|
pymdown-extensions==13.1
|
||||||
python-dateutil==3.0.0
|
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.74
|
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.
|
||||||
|
|
||||||
|
|||||||
+3
-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>
|
||||||
|
|||||||
@@ -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,6 +174,7 @@
|
|||||||
"wawla",
|
"wawla",
|
||||||
"welcome-screen",
|
"welcome-screen",
|
||||||
"xaeroplus",
|
"xaeroplus",
|
||||||
|
"you-must-know-this-notice",
|
||||||
"yungs-menu-tweaks",
|
"yungs-menu-tweaks",
|
||||||
"zume"
|
"zume"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
: "${USE_MEOWICE_GRAALVM_FLAGS:=false}"
|
: "${USE_MEOWICE_GRAALVM_FLAGS:=false}"
|
||||||
: "${USE_MEOWICE_ZGC_FLAGS:=false}"
|
: "${USE_MEOWICE_ZGC_FLAGS:=false}"
|
||||||
|
|
||||||
if isTrue "${USE_MEOWICE_FLAGS}" || isTrue "${USE_MEOWICE_GRAALVM_FLAGS}"; then
|
java_major_version=$(mc-image-helper java-release)
|
||||||
java_major_version=$(mc-image-helper java-release)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isTrue "${USE_MEOWICE_FLAGS}"; then
|
if isTrue "${USE_MEOWICE_FLAGS}"; then
|
||||||
if [[ $java_major_version -gt 16 ]]; then
|
if [[ $java_major_version -gt 16 ]]; then
|
||||||
|
|||||||
@@ -67,6 +67,30 @@ elif ${useGeneratedLogs}; then
|
|||||||
ROLLING_LOG_FILE_PATTERN='logs/%d{yyyy-MM-dd}-%i.log.gz'
|
ROLLING_LOG_FILE_PATTERN='logs/%d{yyyy-MM-dd}-%i.log.gz'
|
||||||
fi
|
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)
|
# Pattern format defaults (compatible with vanilla Minecraft)
|
||||||
# Note: Can't use ${VAR:=default} syntax because } in the value breaks parsing
|
# Note: Can't use ${VAR:=default} syntax because } in the value breaks parsing
|
||||||
if [ -z "${LOG_CONSOLE_FORMAT}" ]; then
|
if [ -z "${LOG_CONSOLE_FORMAT}" ]; then
|
||||||
@@ -126,5 +150,10 @@ EOF
|
|||||||
# Apply the log4j2 configuration
|
# Apply the log4j2 configuration
|
||||||
JVM_OPTS="-Dlog4j.configurationFile=log4j2.xml ${JVM_OPTS}"
|
JVM_OPTS="-Dlog4j.configurationFile=log4j2.xml ${JVM_OPTS}"
|
||||||
else
|
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}"
|
rm -f "${LOGFILE}"
|
||||||
fi
|
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"'
|
||||||
Reference in new issue
Block a user