Compare commits

..

1 Commits

Author SHA1 Message Date
Geoff Bourne
78d076e65e modrinth: change MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES default to false 2023-08-21 13:17:34 -05:00
77 changed files with 422 additions and 1278 deletions

View File

@@ -1,24 +1,7 @@
version: 2 version: 2
updates: updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions" - package-ecosystem: "github-actions"
directory: "/" directory: "/"
schedule: schedule:
interval: "weekly" interval: "weekly"
groups:
updates:
patterns:
- "*"
update-types:
- patch
- minor
- package-ecosystem: pip
directory: "/docs"
schedule:
interval: weekly
groups:
patches:
patterns:
- "*"
update-types:
- patch
- minor

View File

@@ -1,4 +1,4 @@
name: Build and Publish name: Test and Build multi-architecture
on: on:
push: push:
branches: branches:
@@ -18,11 +18,10 @@ jobs:
matrix: matrix:
# NOTE: the "latest" variant is identified in the Docker meta step's 'latest' config # NOTE: the "latest" variant is identified in the Docker meta step's 'latest' config
variant: variant:
- java21-graalvm - java20
- java21 - java20-alpine
- java21-alpine
- java17 - java17
- java17-graalvm - java17-graalvm-ce
- java17-jdk - java17-jdk
- java17-openj9 - java17-openj9
- java17-alpine - java17-alpine
@@ -35,17 +34,13 @@ jobs:
- java11-openj9 - java11-openj9
- java11-jdk - java11-jdk
include: include:
# JAVA 21: # JAVA 20:
- variant: java21-graalvm - variant: java20
baseImage: container-registry.oracle.com/graalvm/jdk:21-ol8 baseImage: eclipse-temurin:20-jre
platforms: linux/amd64,linux/arm64
mcVersion: 1.20.2
- variant: java21
baseImage: eclipse-temurin:21-jre
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
mcVersion: 1.19.3 mcVersion: 1.19.3
- variant: java21-alpine - variant: java20-alpine
baseImage: eclipse-temurin:21-jre-alpine baseImage: eclipse-temurin:20-jre-alpine
platforms: linux/amd64 platforms: linux/amd64
mcVersion: 1.19.3 mcVersion: 1.19.3
# JAVA 17: # JAVA 17:
@@ -54,8 +49,8 @@ jobs:
baseImage: eclipse-temurin:17-jre-focal baseImage: eclipse-temurin:17-jre-focal
platforms: linux/amd64,linux/arm/v7,linux/arm64 platforms: linux/amd64,linux/arm/v7,linux/arm64
mcVersion: 1.18.2 mcVersion: 1.18.2
- variant: java17-graalvm - variant: java17-graalvm-ce
baseImage: container-registry.oracle.com/graalvm/jdk:17-ol8 baseImage: ghcr.io/graalvm/graalvm-ce:ol8-java17
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
mcVersion: 1.18.2 mcVersion: 1.18.2
- variant: java17-jdk - variant: java17-jdk
@@ -111,14 +106,14 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4.1.1 uses: actions/checkout@v3
with: with:
# for build-files step # for build-files step
fetch-depth: 0 fetch-depth: 0
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v5.5.0 uses: docker/metadata-action@v4
with: with:
# NOTE for forks: if your Docker Hub organization doesn't match your Github repo's, # NOTE for forks: if your Docker Hub organization doesn't match your Github repo's,
# then the use of ${{ github.repository_owner }} will need to be replaced. # then the use of ${{ github.repository_owner }} will need to be replaced.
@@ -144,13 +139,13 @@ jobs:
org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com> org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.0.0 uses: docker/setup-buildx-action@v2
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0 uses: docker/setup-qemu-action@v2.2.0
- name: Build for test - name: Build for test
uses: docker/build-push-action@v5.1.0 uses: docker/build-push-action@v4.1.1
with: with:
platforms: linux/amd64 platforms: linux/amd64
tags: ${{ env.IMAGE_TO_TEST }} tags: ${{ env.IMAGE_TO_TEST }}
@@ -173,14 +168,14 @@ jobs:
tests/test.sh tests/test.sh
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v3.0.0 uses: docker/login-action@v2
if: env.HAS_IMAGE_REPO_ACCESS if: env.HAS_IMAGE_REPO_ACCESS
with: with:
username: ${{ secrets.DOCKER_USER }} username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR - name: Login to GHCR
uses: docker/login-action@v3.0.0 uses: docker/login-action@v2
if: env.HAS_IMAGE_REPO_ACCESS if: env.HAS_IMAGE_REPO_ACCESS
with: with:
registry: ghcr.io registry: ghcr.io
@@ -188,7 +183,7 @@ jobs:
password: ${{ github.token }} password: ${{ github.token }}
- name: Build and push - name: Build and push
uses: docker/build-push-action@v5.1.0 uses: docker/build-push-action@v4.1.1
if: github.actor == github.repository_owner if: github.actor == github.repository_owner
with: with:
platforms: ${{ matrix.platforms }} platforms: ${{ matrix.platforms }}

View File

@@ -1,11 +1,8 @@
name: Discord notifications name: Discord notifications
on: on:
release:
types:
- published
workflow_run: workflow_run:
workflows: ["Build and Publish"] workflows: ["ContinuousIntegration", "Build and Publish", "Build and publish multiarch" ]
types: types:
- completed - completed
@@ -17,26 +14,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- name: on-publish
if: github.event_name == 'release' && github.event.action == 'published'
uses: SethCohen/github-releases-to-discord@v1.15.0
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
- name: on-success - name: on-success
if: github.event.workflow_run.conclusion == 'success' if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: Ilshidur/action-discord@master uses: Ilshidur/action-discord@master
with: with:
args: | args: "Github repo: ${{ github.repository }}\n- Branch: ${{ github.event.workflow_run.head_branch }}\n- [Link: to Actions](<${{ github.event.workflow_run.html_url }}>)\n- Status: 🎉 ${{ github.event.workflow_run.conclusion }} 🍏"
Github repo: ${{ github.repository }}
- Branch: ${{ github.event.workflow_run.head_branch }}
- [Link: to Actions](<${{ github.event.workflow_run.html_url }}>)
- Status: 🎉 ${{ github.event.workflow_run.conclusion }} 🍏
- name: on-failure - name: on-failure
if: github.event.workflow_run.conclusion == 'failure' if: ${{ github.event.workflow_run.conclusion == 'failure' }}
uses: Ilshidur/action-discord@master uses: Ilshidur/action-discord@master
with: with:
args: | args: "Github repo: ${{ github.repository }}\n- Branch: ${{ github.event.workflow_run.head_branch }}\n- [Link: to Actions](<${{ github.event.workflow_run.html_url }}>)\n- Status: 🤔 ${{ github.event.workflow_run.conclusion }} 💣💥"
Github repo: ${{ github.repository }}
- Branch: ${{ github.event.workflow_run.head_branch }}
- [Link: to Actions](<${{ github.event.workflow_run.html_url }}>)
- Status: 🤔 ${{ github.event.workflow_run.conclusion }} 💣💥

View File

@@ -12,7 +12,7 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- name: Process Stale Issues - name: Process Stale Issues
uses: actions/stale@v9 uses: actions/stale@v8
with: with:
stale-issue-label: status/stale stale-issue-label: status/stale
stale-pr-label: status/stale stale-pr-label: status/stale

View File

@@ -16,14 +16,14 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
variant: variant:
- java21 - java20
- java17 - java17
- java17-alpine - java17-alpine
- java8-multiarch - java8-multiarch
include: include:
# JAVA 21: # JAVA 20:
- variant: java21 - variant: java20
baseImage: eclipse-temurin:21-jre baseImage: eclipse-temurin:20-jre
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
mcVersion: 1.19.4 mcVersion: 1.19.4
# JAVA 17: # JAVA 17:
@@ -45,16 +45,16 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4.1.1 uses: actions/checkout@v3
with: with:
# for build-files step # for build-files step
fetch-depth: 0 fetch-depth: 0
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.0.0 uses: docker/setup-buildx-action@v2
- name: Confirm multi-arch build - name: Confirm multi-arch build
uses: docker/build-push-action@v5.1.0 uses: docker/build-push-action@v4.1.1
with: with:
platforms: ${{ matrix.platforms }} platforms: ${{ matrix.platforms }}
# ensure latest base image is used # ensure latest base image is used
@@ -64,7 +64,7 @@ jobs:
cache-from: type=gha,scope=${{ matrix.variant }} cache-from: type=gha,scope=${{ matrix.variant }}
- name: Build for test - name: Build for test
uses: docker/build-push-action@v5.1.0 uses: docker/build-push-action@v4.1.1
with: with:
# Only build single platform since loading multi-arch image into daemon fails with # Only build single platform since loading multi-arch image into daemon fails with
# "docker exporter does not currently support exporting manifest lists" # "docker exporter does not currently support exporting manifest lists"

View File

@@ -22,35 +22,28 @@ COPY --chmod=644 files/sudoers* /etc/sudoers.d
EXPOSE 25565 EXPOSE 25565
ARG APPS_REV=1 ARG EASY_ADD_VER=0.8.0
ARG GITHUB_BASEURL=https://github.com ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
ARG EASY_ADD_VERSION=0.8.2
ADD ${GITHUB_BASEURL}/itzg/easy-add/releases/download/${EASY_ADD_VERSION}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
RUN chmod +x /usr/bin/easy-add RUN chmod +x /usr/bin/easy-add
ARG RESTIFY_VERSION=1.7.1
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=1.7.0 --var app=restify --file {{.app}} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG RCON_CLI_VERSION=1.6.4
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=1.6.2 --var app=rcon-cli --file {{.app}} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG MC_MONITOR_VERSION=0.12.6
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=0.12.2 --var app=mc-monitor --file {{.app}} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG MC_SERVER_RUNNER_VERSION=1.10.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=1.9.0 --var app=mc-server-runner --file {{.app}} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG MC_HELPER_VERSION=1.37.8 ARG MC_HELPER_VERSION=1.34.5
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION} ARG MC_HELPER_BASE_URL=https://github.com/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
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \ RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
@@ -68,7 +61,9 @@ ENV TYPE=VANILLA VERSION=LATEST EULA="" UID=1000 GID=1000
COPY --chmod=755 scripts/start* / COPY --chmod=755 scripts/start* /
COPY --chmod=755 bin/ /usr/local/bin/ COPY --chmod=755 bin/ /usr/local/bin/
COPY --chmod=755 bin/mc-health /health.sh COPY --chmod=755 bin/mc-health /health.sh
COPY --chmod=644 files/* /image/ COPY --chmod=644 files/log4j2.xml /image/log4j2.xml
# By default this file gets retrieved from repo, but bundle in image as potential fallback
COPY --chmod=644 files/cf-exclude-include.json /image/cf-exclude-include.json
COPY --chmod=755 files/auto /auto COPY --chmod=755 files/auto /auto
RUN curl -fsSL -o /image/Log4jPatcher.jar https://github.com/CreeperHost/Log4jPatcher/releases/download/v1.0.1/Log4jPatcher-1.0.1.jar RUN curl -fsSL -o /image/Log4jPatcher.jar https://github.com/CreeperHost/Log4jPatcher/releases/download/v1.0.1/Log4jPatcher-1.0.1.jar

View File

@@ -2,7 +2,7 @@
[![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/) [![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/)
[![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/docker-minecraft-server.svg)](https://github.com/itzg/docker-minecraft-server/issues) [![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/docker-minecraft-server.svg)](https://github.com/itzg/docker-minecraft-server/issues)
[![Discord](https://img.shields.io/discord/660567679458869252?label=Discord&logo=discord)](https://discord.gg/DXfKpjB) [![Discord](https://img.shields.io/discord/660567679458869252?label=Discord&logo=discord)](https://discord.gg/DXfKpjB)
[![Build and Publish](https://github.com/itzg/docker-minecraft-server/actions/workflows/build-multiarch.yml/badge.svg)](https://github.com/itzg/docker-minecraft-server/actions/workflows/build-multiarch.yml) [![Build and Publish](https://github.com/itzg/docker-minecraft-server/workflows/Build%20and%20Publish/badge.svg)](https://github.com/itzg/docker-minecraft-server/actions)
[![](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-orange.svg)](https://www.buymeacoffee.com/itzg) [![](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-orange.svg)](https://www.buymeacoffee.com/itzg)
[![Documentation Status](https://readthedocs.org/projects/docker-minecraft-server/badge/?version=latest)](https://docker-minecraft-server.readthedocs.io/en/latest/?badge=latest) [![Documentation Status](https://readthedocs.org/projects/docker-minecraft-server/badge/?version=latest)](https://docker-minecraft-server.readthedocs.io/en/latest/?badge=latest)
@@ -585,7 +585,7 @@ Configuration options with defaults:
NAME}" NAME}"
> NOTE: instead of using format codes in the MOTD, Limbo requires [JSON chat content](https://minecraft.wiki/w/Raw_JSON_text_format#Java_Edition). If a plain string is provided, which is the default, then it gets converted into the required JSON structure. > NOTE: instead of using format codes in the MOTD, Limbo requires [JSON chat content](https://minecraft.fandom.com/wiki/Raw_JSON_text_format#Java_Edition). If a plain string is provided, which is the default, then it gets converted into the required JSON structure.
### Running a Crucible server ### Running a Crucible server
@@ -873,7 +873,7 @@ For example, the following will auto-download the [EssentialsX](https://www.spig
``` ```
-e MODRINTH_PROJECTS=fabric-api,fabric-api:PbVeub96,fabric-api:beta -e MODRINTH_PROJECTS=fabric-api,fabric-api:PbVeub96,fabric-api:beta
``` ```
- **MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES**=true : required dependencies of the project will _always_ be downloaded and optional dependencies can also be downloaded by setting this to `true` - **MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES**=false : required dependencies of the project will _always_ be downloaded and optional dependencies can also be downloaded by setting this to `true`
- **MODRINTH_ALLOWED_VERSION_TYPE**=release : the version type is used to determine the newest version to use from each project. The allowed values are `release`, `beta`, `alpha`. - **MODRINTH_ALLOWED_VERSION_TYPE**=release : the version type is used to determine the newest version to use from each project. The allowed values are `release`, `beta`, `alpha`.
### Downloadable mod/plugin pack for Forge, Fabric, and Bukkit-like Servers ### Downloadable mod/plugin pack for Forge, Fabric, and Bukkit-like Servers
@@ -1090,7 +1090,7 @@ If you leave it off, a default is computed from the server type and version, suc
That way you can easily differentiate between several servers you may have started. That way you can easily differentiate between several servers you may have started.
The section symbol (§) and other unicode characters are automatically converted to allow [formatting codes](https://minecraft.wiki/w/Formatting_codes) to be used consistently with all server versions. For example, The section symbol (§) and other unicode characters are automatically converted to allow [formatting codes](https://minecraft.fandom.com/wiki/Formatting_codes) to be used consistently with all server versions. For example,
-e MOTD="A §l§cMinecraft§r §nserver" -e MOTD="A §l§cMinecraft§r §nserver"
@@ -1122,7 +1122,7 @@ To whitelist players for your Minecraft server, you can:
- Provide the url or path to a whitelist file via `WHITELIST_FILE` environment variable - Provide the url or path to a whitelist file via `WHITELIST_FILE` environment variable
`docker run -d -e WHITELIST_FILE=/extra/whitelist.json ...` `docker run -d -e WHITELIST_FILE=/extra/whitelist.json ...`
When either is set, [whitelisting of connecting users](https://minecraft.wiki/w/Server.properties#white-list) is enabled . If managing the list manually, `ENABLE_WHITELIST` can be set to "true" to set the `white-list` property. When either is set, [whitelisting of connecting users](https://minecraft.fandom.com/wiki/Server.properties#white-list) is enabled . If managing the list manually, `ENABLE_WHITELIST` can be set to "true" to set the `white-list` property.
If whitelist configuration already exists, `WHITELIST_FILE` will not be retrieved and any usernames in `WHITELIST` are **added** to the whitelist configuration. You can enforce regeneration of the whitelist on each server startup by setting `OVERRIDE_WHITELIST` to "true". This will delete the whitelist file before processing whitelist configuration. If whitelist configuration already exists, `WHITELIST_FILE` will not be retrieved and any usernames in `WHITELIST` are **added** to the whitelist configuration. You can enforce regeneration of the whitelist on each server startup by setting `OVERRIDE_WHITELIST` to "true". This will delete the whitelist file before processing whitelist configuration.
@@ -1132,7 +1132,7 @@ If whitelist configuration already exists, `WHITELIST_FILE` will not be retrieve
> If running Minecraft 1.7.5 or earlier, these variables will apply to `white-list.txt`, with 1.7.6 implementing support for `whitelist.json`. Make sure your `WHITELIST_FILE` is in the appropriate format. > If running Minecraft 1.7.5 or earlier, these variables will apply to `white-list.txt`, with 1.7.6 implementing support for `whitelist.json`. Make sure your `WHITELIST_FILE` is in the appropriate format.
To [enforce the whitelist changes immediately](https://minecraft.wiki/w/Server.properties#enforce-whitelist) when whitelist commands are used , set `ENFORCE_WHITELIST` to "true". To [enforce the whitelist changes immediately](https://minecraft.fandom.com/wiki/Server.properties#enforce-whitelist) when whitelist commands are used , set `ENFORCE_WHITELIST` to "true".
### Op/Administrator Players ### Op/Administrator Players
@@ -1303,7 +1303,7 @@ If using a negative value for the seed, make sure to quote the value such as:
By default, Minecraft servers are configured to run in Survival mode. You can By default, Minecraft servers are configured to run in Survival mode. You can
change the mode using `MODE` where you can either provide the [standard change the mode using `MODE` where you can either provide the [standard
numerical values](http://minecraft.wiki/Game_mode#Game_modes) or the numerical values](http://minecraft.gamepedia.com/Game_mode#Game_modes) or the
shortcut values: shortcut values:
- creative - creative
@@ -1325,9 +1325,9 @@ environment variable set to `false`, such as
### Level Type and Generator Settings ### Level Type and Generator Settings
By default, a standard world is generated with hills, valleys, water, etc. A different level type can By default, a standard world is generated with hills, valleys, water, etc. A different level type can
be configured by setting `LEVEL_TYPE` to [an expected type listed here](https://minecraft.wiki/w/Server.properties#level-type). be configured by setting `LEVEL_TYPE` to [an expected type listed here](https://minecraft.fandom.com/wiki/Server.properties#level-type).
For some of the level types, `GENERATOR_SETTINGS` can be used to further customize the world generation [as described here](https://minecraft.wiki/w/Server.properties#generator-settings). For some of the level types, `GENERATOR_SETTINGS` can be used to further customize the world generation [as described here](https://minecraft.fandom.com/wiki/Server.properties#generator-settings).
### Custom Server Resource Pack ### Custom Server Resource Pack

View File

@@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
if [[ $(uname -m) == "aarch64" ]]; then if [[ $(uname -m) == "aarch64" ]]; then
curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.16/gosu-arm64 curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.14/gosu-arm64
chmod +x /bin/gosu chmod +x /bin/gosu
elif [[ $(uname -m) == "x86_64" ]]; then elif [[ $(uname -m) == "x86_64" ]]; then
curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.16/gosu-amd64 curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.14/gosu-amd64
chmod +x /bin/gosu chmod +x /bin/gosu
else else
echo "Not supported!" echo "Not supported!"

View File

@@ -36,9 +36,7 @@ dnf install -y ImageMagick \
zstd \ zstd \
lbzip2 \ lbzip2 \
libpcap \ libpcap \
libwebp \ libwebp
findutils \
which
bash /build/ol/install-gosu.sh bash /build/ol/install-gosu.sh

View File

@@ -101,11 +101,11 @@ secrets:
## Patching existing files ## Patching existing files
JSON path based patches can be applied to one or more existing files by setting the variable `PATCH_DEFINITIONS` to the path of a directory that contains one or more [patch definition json files](https://github.com/itzg/mc-image-helper#patchdefinition) or a [patch set json file](https://github.com/itzg/mc-image-helper#patchset). JSON path based patches can be applied to one or more existing files by setting the variable `PATCH_DEFINITIONS` to the path of a directory that contains one or more [patch definition json files](https://github.com/itzg/mc-image-helper#patchdefinition) or a [patch set json file](https://github.com/itzg/mc-image-helper#patchset).
The `file` and `value` fields of the patch definitions may contain `${...}` variable placeholders. The allowed environment variables in placeholders can be restricted by setting `REPLACE_ENV_VARIABLE_PREFIX`, which defaults to "CFG_". Variable placeholders in the patch values can be restricted by setting `REPLACE_ENV_VARIABLE_PREFIX`, which defaults to "CFG_".
The following example shows a patch-set file where various fields in the `paper.yaml` configuration file can be modified and added: The following example shows a patch-set file were various fields in the `paper.yaml` configuration file can be modified and added:
```json ```json
{ {
@@ -139,8 +139,4 @@ The following example shows a patch-set file where various fields in the `paper.
} }
``` ```
Supports the file formats: > **NOTES:** Only JSON and Yaml files can be patched at this time. TOML support is planned to be added next. Removal of comments and other cosmetic changes will occur when patched files are processed.
- JSON
- JSON5
- Yaml
- TOML, but processed output is not pretty

View File

@@ -62,30 +62,11 @@ you can use
## Enable Remote JMX for Profiling ## Enable Remote JMX for Profiling
To enable remote JMX, such as for profiling with VisualVM or JMC, set the environment variable `ENABLE_JMX` to "true", set `JMX_HOST` to the IP/host running the Docker container, and add a port forwarding of TCP port 7091, such as: To enable remote JMX, such as for profiling with VisualVM or JMC, add the environment variable `ENABLE_JMX=true`, set `JMX_HOST` to the IP/host running the Docker container, and add a port forwarding of TCP port 7091, such as:
!!! example ```
-e ENABLE_JMX=true -e JMX_HOST=$HOSTNAME -p 7091:7091
With `docker run` ```
```
-e ENABLE_JMX=true -e JMX_HOST=$HOSTNAME -p 7091:7091
```
If needing to map to a different port, then also set the environment variable `JMX_PORT` to the desired host port.
!!! example
With a compose file:
```yaml
environment:
ENABLE_JMX: true
JMX_HOST: ${HOSTNAME}
JMX_PORT: "7092"
ports:
- "7092:7092"
```
## Enable Aikar's Flags ## Enable Aikar's Flags

View File

@@ -1,74 +1,32 @@
In order to unify management of the Minecraft server container, all of the [`server.properties`](https://minecraft.wiki/w/Server.properties) entries can be managed by the environment variables described in the sections below. Some of the mappings provide additional functionality above and beyond the properties file. By default, the server configuration will be created and set based on the following environment variables, but only the first time the server is started. If the `server.properties` file already exists, the values in them will not be changed.
If you prefer to manually manage the `server.properties` file, set `OVERRIDE_SERVER_PROPERTIES` to "false". Similarly, you can entirely skip the startup script's creation of `server.properties` by setting `SKIP_SERVER_PROPERTIES` to "true". If you prefer to manually manage the `server.properties` file, set `OVERRIDE_SERVER_PROPERTIES` to "false". Similarly, you can entirely skip the startup script's creation of `server.properties` by setting `SKIP_SERVER_PROPERTIES` to "true".
!!! note > NOTE: to clear a server property, set the variable to an empty string, such as `-e RESOURCE_PACK=""`. A variables that maps to a server property that is unset, is ignored and the existing `server.property` is left unchanged.
To clear a server property, set the variable to an empty string, such as `-e RESOURCE_PACK=""`. An unset variable is ignored and the existing `server.property` is left unchanged.
## Placeholders
When declaring a server properties via container environment variables, those values may contain placeholders that are processed when the `server.properties` file is updated.
The syntax of placeholders is DOS-style, `%VAR%`, to avoid being processed by Docker or the shell and the following options are available:
`%VAR%` or `%env:VAR%`
: Replaced with the resolved value or the environment variable `VAR`
`%date:FMT%`
: Formats the current date/time with the given `FMT` string processed by [Java's DateTimeFormatter](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/format/DateTimeFormatter.html).
Any declared or resolved environment variable may be referenced, such as `VERSION` and `TYPE`. Additionally, [Modrinth](../types-and-platforms/mod-platforms/modrinth-modpacks.md) and [Auto CurseForge](../types-and-platforms/mod-platforms/auto-curseforge.md) modpacks will expose the environment variables `MODPACK_NAME` and `MODPACK_VERSION`. The originally declared version, such as "LATEST" or "SNAPSHOT", is available in the variable `DECLARED_VERSION`
!!! example
As a compose file environment entry:
```yaml
MOTD: Running %MODPACK_NAME% version %env:MODPACK_VERSION%
LEVEL: world-%date:yyyy-MM-dd%
```
!!! warning
Placeholders are not supported when manually managing `server.properties`
## Properties
### Message of the Day ### Message of the Day
The message of the day, shown below each server entry in the client UI, can be changed with the `MOTD` environment variable or a default is computed from the server type and version, such as The message of the day, shown below each server entry in the client UI, can be changed with the `MOTD` environment variable, such as
-e MOTD="My Server"
If you leave it off, a default is computed from the server type and version, such as
A Paper Minecraft Server powered by Docker A Paper Minecraft Server powered by Docker
That way you can easily differentiate between several server types you may have started. That way you can easily differentiate between several servers you may have started.
The section symbol (§) and other unicode characters are automatically converted to allow [formatting codes](https://minecraft.wiki/w/Formatting_codes) to be used consistently with all server versions. For Minecraft versions less than 1.20, unicode characters in `server.properties` will be escaped as `\uXXXX`, by default. That behavior can be altered by setting `SERVER_PROPERTIES_ESCAPE_UNICODE` to "true" or "false". The section symbol (§) and other unicode characters are automatically converted to allow [formatting codes](https://minecraft.fandom.com/wiki/Formatting_codes) to be used consistently with all server versions. For example,
!!! example -e MOTD="A §l§cMinecraft§r §nserver"
With `docker run` renders
-e MOTD="A §l§cMinecraft§r §nserver"
or within a compose file
environment:
MOTD: "A §l§cMinecraft§r §nserver"
renders ![](../img/motd-example.png)
![](../img/motd-example.png)
To produce a multi-line MOTD, embed a newline character as `\n` in the string, such as To produce a multi-line MOTD, you will need to double escape the newline such as
-e MOTD="Line one\nLine two" -e MOTD="Line one\\nLine two"
!!! tip
You can also embed configured and resolved environment variables using [placeholders](#placeholders).
### Difficulty ### Difficulty
@@ -82,8 +40,6 @@ Valid values are: `peaceful`, `easy`, `normal`, and `hard`, and an
error message will be output in the logs if it's not one of these error message will be output in the logs if it's not one of these
values. values.
Refer to [the Minecraft wiki](https://minecraft.wiki/w/Difficulty)
### Whitelist Players ### Whitelist Players
!!! warning "For public servers" !!! warning "For public servers"
@@ -106,34 +62,24 @@ To whitelist players for your Minecraft server, you can:
user3 user3
``` ```
When either is set, [whitelisting of connecting users](https://minecraft.wiki/w/Server.properties#white-list) is enabled. When either is set, [whitelisting of connecting users](https://minecraft.fandom.com/wiki/Server.properties#white-list) is enabled.
To change the behavior when the whitelist file already exists, set the variable `EXISTING_WHITELIST_FILE` to one of the following options: Use of `WHITELIST_FILE` will **overwrite** an existing `whitelist.json` file; however, the option can be combined with `WHITELIST` to refine the list.
`SKIP` (default) By default, `WHITELIST` will keep the `whitelist.json` fully synchronized with the given list. All whitelist entries can be removed by setting `WHITELIST` to an empty string. To only append new users, set `APPEND_WHITELIST` to "true".
: Skip processing of the whitelist file when one is already present. This is the same as setting the legacy variable `OVERRIDE_WHITELIST` to "false".
`SYNCHRONIZE`
: Synchronize the list of users in the file with the `WHITELIST` or `WHITELIST_FILE` provided. When using both, `WHITELIST` will take precedence. This is the same as setting the legacy variable `OVERRIDE_WHITELIST` to "true".
`MERGE`
: Merge the list of users from `WHITELIST` into the existing file. `WHITELIST_FILE` cannot be used with this option.
`SYNC_FILE_MERGE_LIST`
: When `WHITELIST_FILE` is provided it will overwrite an existing whitelist file. Also, if `WHITELIST` is provided, then those users will be merged into the newly copied file.
!!! note !!! note
For versions prior to 1.7.3, `white-list.txt` will be maintained instead. Only usernames are supported for those versions. For versions prior to 1.7.3, `white-list.txt` will be maintained instead. Only usernames are supported for those versions.
To [enforce the whitelist changes immediately](https://minecraft.wiki/w/Server.properties#enforce-whitelist) when whitelist commands are used , set `ENFORCE_WHITELIST` to "true". If managing the whitelist file manually, `ENABLE_WHITELIST` can be set to "true" to set the `white-list` property. To [enforce the whitelist changes immediately](https://minecraft.fandom.com/wiki/Server.properties#enforce-whitelist) when whitelist commands are used , set `ENFORCE_WHITELIST` to "true". If managing the whitelist file manually, `ENABLE_WHITELIST` can be set to "true" to set the `white-list` property.
### Op/Administrator Players ### Op/Administrator Players
Similar to the whitelist, users can be provisioned as operators (aka administrators) to your Minecraft server by Similar to the whitelist, to add users as operators (aka administrators) to your Minecraft server, you can:
- Providing a list of usernames and/or UUIDs separated by commas or newlines via the `OPS` environment variable - Provide a list of usernames and/or UUIDs separated by commas or newlines via the `OPS` environment variable
- Providing the URL or container path to an ops file via `OPS_FILE` that will be retrieved/copied into the standard location - Provide the URL or container path to an ops file via `OPS_FILE` that will be retrieved/copied into the standard location
!!! example !!! example
@@ -146,19 +92,9 @@ Similar to the whitelist, users can be provisioned as operators (aka administrat
user3 user3
``` ```
To change the behavior when the ops file already exists, set the variable `EXISTING_OPS_FILE` to one of the following options: Use of `OPS_FILE` will **overwrite** an existing `ops.json` file; however, the option can be combined with `OPS` to refine the list.
`SKIP` (default) By default, `OPS` will keep the `ops.json` fully synchronized with the given list. All ops entries can be removed by setting `OPS` to an empty string. To only append new users, set `APPEND_OPS` to "true". New entries will be assigned [level 4](https://glimpse.me/blog/how-to-op-yourself-in-minecraft/) and not bypass player limit. Manual changes to those fields will be retained.
: Skip processing of the ops file when one is already present. This is the same as setting the legacy variable `OVERRIDE_OPS` to "false".
`SYNCHRONIZE`
: Synchronize the list of users in the file with the `OPS` or `OPS_FILE` provided. When using both, `OPS` will take precedence. The `level` and `bypassesPlayerLimit` will be retained from previous entries. This is the same as setting the legacy variable `OVERRIDE_OPS` to "true".
`MERGE`
: Merge the list of users from `OPS` into the existing file. `OPS_FILE` cannot be used with this option.
`SYNC_FILE_MERGE_LIST`
: When `OPS_FILE` is provided it will overwrite an existing ops file. Also, if `OPS` is provided, then those users will be merged into the newly copied file.
!!! note !!! note
@@ -323,7 +259,7 @@ If using a negative value for the seed, make sure to quote the value such as:
By default, Minecraft servers are configured to run in Survival mode. You can By default, Minecraft servers are configured to run in Survival mode. You can
change the mode using `MODE` where you can either provide the [standard change the mode using `MODE` where you can either provide the [standard
numerical values](http://minecraft.wiki/Game_mode#Game_modes) or the numerical values](http://minecraft.gamepedia.com/Game_mode#Game_modes) or the
shortcut values: shortcut values:
- creative - creative
@@ -345,45 +281,9 @@ environment variable set to `false`, such as
### Level Type and Generator Settings ### Level Type and Generator Settings
By default, a standard world is generated with hills, valleys, water, etc. A different level type can By default, a standard world is generated with hills, valleys, water, etc. A different level type can
be configured by setting `LEVEL_TYPE` to [an expected type listed here](https://minecraft.wiki/w/Server.properties#level-type). be configured by setting `LEVEL_TYPE` to [an expected type listed here](https://minecraft.fandom.com/wiki/Server.properties#level-type).
For some of the level types, `GENERATOR_SETTINGS` can be used to further customize the world generation. For some of the level types, `GENERATOR_SETTINGS` can be used to further customize the world generation [as described here](https://minecraft.fandom.com/wiki/Server.properties#generator-settings).
To configure the `GENERATOR_SEETINGS` you need to add the appropriate `GeneratorOptions` JSON configuration. In the case of a superflat world, you may omit the `flat_world_options`.
The layers are applied from -64 and up and are added in the order of the list
Example for a superflat world:
- 1x bedrock
- 2x stone
- 15x sandstone
- Desert biome
```yaml
LEVEL_TYPE: FLAT
GENERATOR_SETTINGS: >-4
{
"layers": [
{
"block": "minecraft:bedrock",
"height": 1
},
{
"block": "minecraft:stone",
"height": 2
},
{
"block": "minecraft:sandstone",
"height": 15
}
],
"biome": "minecraft:desert"
}
```
For more details, check the [official wiki](https://minecraft.wiki/w/Java_Edition_level_format#generatorOptions_tag_format).
### Custom Server Resource Pack ### Custom Server Resource Pack
@@ -433,28 +333,10 @@ If you must, the server port can be set like:
**however**, be sure to change your port mapping accordingly and be prepared for some features to break. **however**, be sure to change your port mapping accordingly and be prepared for some features to break.
### Custom server properties
Some mods/plugins utilize custom `server.properties` entries which can be declared via the `CUSTOM_SERVER_PROPERTIES` environment variable. The contents must be newline delimited `name=value` pairs.
Within a compose file, newline delimited entries can be declared as shown here:
```yaml
CUSTOM_SERVER_PROPERTIES: |
custom1=value1
defaultworldgenerator-port=f8c04631-f744-11ec-b260-f02f74b094e0
```
When using `docker run` from a bash shell, the entries must be quoted with the `$'` syntax, such as
```
-e CUSTOM_SERVER_PROPERTIES=$'k1=v1\nk2=v2'
```
### Other server property mappings ### Other server property mappings
| Environment Variable | Server Property | | Environment Variable | Server Property |
|-----------------------------------|-----------------------------------| | --------------------------------- | --------------------------------- |
| BROADCAST_CONSOLE_TO_OPS | broadcast-console-to-ops | | BROADCAST_CONSOLE_TO_OPS | broadcast-console-to-ops |
| BROADCAST_RCON_TO_OPS | broadcast-rcon-to-ops | | BROADCAST_RCON_TO_OPS | broadcast-rcon-to-ops |
| ENABLE_STATUS | enable-status | | ENABLE_STATUS | enable-status |

View File

@@ -46,59 +46,49 @@ popd
Using the baseline image, an interactive container can be started to iteratively run the scripts to be developed. By attaching the current workspace directory, you can use the local editor of your choice to iteratively modify scripts while using the container to run them. Using the baseline image, an interactive container can be started to iteratively run the scripts to be developed. By attaching the current workspace directory, you can use the local editor of your choice to iteratively modify scripts while using the container to run them.
```shell ```shell script
docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc-dev docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc-dev
``` ```
From within the container you can run individual scripts via the attached `/scripts/` path; however, be sure to set any environment variables expected by the scripts by either `export`ing them manually: From within the container you can run individual scripts via the attached `/scripts/` path; however, be sure to set any environment variables expected by the scripts by either `export`ing them manually:
```shell ```shell script
export VERSION=1.12.2 export VERSION=1.12.2
/scripts/start-magma /scripts/start-magma
``` ```
...or pre-pending script execution: ...or pre-pending script execution:
```shell ```shell script
VERSION=1.12.2 /scripts/start-magma VERSION=1.12.2 /scripts/start-magma
``` ```
!!! note > NOTE: You may want to temporarily add an `exit` statement near the end of your script to isolate execution to just the script you're developing.
You may want to temporarily add an `exit` statement near the end of your script to isolate execution to just the script you're developing. ## Using development copy of mc-image-helper
## Using development copy of tools In the cloned copy of [`mc-image-helper`](https://github.com/itzg/mc-image-helper), create an up-to-date snapshot build of the tgz distribution using:
In the cloned repo, such as [`mc-image-helper`](https://github.com/itzg/mc-image-helper), create an up-to-date snapshot build of the tgz distribution using:
```shell ```shell
./gradlew distTar ./gradlew distTar
``` ```
!!! note !!! note
The distribution's version will be `0.0.0-<branch>-SNAPSHOT` The distribution's version will be `0.0.0-<branch>-SNAPSHOT`
For Go base tools, run Assuming Java 18 or newer:
```shell ```shell
goreleaser release --snapshot --clean cd build/distributions
jwebserver -b 0.0.0.0 -p 8008
``` ```
Clone [itzg/github-releases-proxy](https://github.com/itzg/github-releases-proxy) and run it according to the instructions shown there.
In the Docker build, configure the following
```shell ```shell
--build-arg GITHUB_BASEURL=http://host.docker.internal:8080 \ --build-arg MC_HELPER_VERSION=1.8.1-SNAPSHOT \
--build-arg APPS_REV=1 --build-arg MC_HELPER_BASE_URL=http://host.docker.internal:8008
``` ```
and declare one or more version overrides, such as Now the image can be built like normal, and it will install mc-image-helper from the locally built copy.
```
--build-arg MC_HELPER_VERSION=1.8.1-SNAPSHOT
```
## Generating release notes ## Generating release notes

View File

@@ -1,22 +1,12 @@
# More Deployment Info # More Deployment Info
## On Kubernetes ## Using Helm
### Using Helm
- itzg Helm Chart: - itzg Helm Chart:
- [GitHub repo](https://github.com/itzg/minecraft-server-charts) - [GitHub repo](https://github.com/itzg/minecraft-server-charts)
- [Helm Chart repo](https://itzg.github.io/minecraft-server-charts/) - [Helm Chart repo](https://itzg.github.io/minecraft-server-charts/)
- [mcsh/server-deployment](https://github.com/mcserverhosting-net/charts) - [mcsh/server-deployment](https://github.com/mcserverhosting-net/charts)
### Using Shulker
[Shulker](https://github.com/jeremylvln/Shulker) is a Kubernetes operator for managing complex and dynamic Minecraft infrastructures, including game servers and proxies. It uses the docker-minecraft-server and docker-bungeecord images under-the-hood.
## On CloudFormation (AWS)
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Minecraft Server Deployment (CloudFormation) repository](https://github.com/vatertime/minecraft-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use.
## Supporting Articles ## Supporting Articles
Below are supporting articles for server deployment. Below are supporting articles for server deployment.
@@ -26,3 +16,7 @@ Below are supporting articles for server deployment.
https://dev.to/rela-v/zero-to-minecraft-server-with-docker-desktop-and-compose-500a https://dev.to/rela-v/zero-to-minecraft-server-with-docker-desktop-and-compose-500a
- This is a reference guide/tutorial on how to set up a vanilla Minecraft server using this project, including step-by-step instructions, and information on topics such as port-forwarding. - This is a reference guide/tutorial on how to set up a vanilla Minecraft server using this project, including step-by-step instructions, and information on topics such as port-forwarding.
## Deploying onto AWS
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Minecraft Server Deployment (CloudFormation) repository](https://github.com/vatertime/minecraft-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use.

View File

@@ -1,74 +0,0 @@
# Examples
Various examples are [maintained in the repository](https://github.com/itzg/docker-minecraft-server/tree/master/examples). The sections below highlight a few particular ones.
## Bedrock compatible server
Using the [GeyserMC plugin](https://geysermc.org/) with a Paper server (or similar) "enables clients from Minecraft Bedrock Edition to join your Minecraft Java server". The example also includes [Floodgate](https://wiki.geysermc.org/floodgate/) which "allows Xbox Live authenticated Bedrock users to join without a Java Edition account".
```yaml
version: "3.8"
services:
mc:
image: itzg/minecraft-server
environment:
EULA: "true"
TYPE: "PAPER"
PLUGINS: |
https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot
https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/spigot
ports:
- "25565:25565"
- "19132:19132/udp"
volumes:
- ./data:/data
```
[Source](https://github.com/itzg/docker-minecraft-server/blob/master/examples/geyser/docker-compose.yml)
## Lazytainer - Stop Minecraft container based on traffic
Monitors network traffic to the Minecraft containers. If there is traffic, the container runs, otherwise the container is stopped/paused.
By using [Lazytainer](https://github.com/vmorganp/Lazytainer) with the [docker-minecraft-server](https://github.com/itzg/docker-minecraft-server) a somehow similar behaviour to [Lazymc](https://github.com/timvisee/lazymc) can be archived.
```yaml
version: "3"
services:
lazytainer:
container_name: lazytainer
image: ghcr.io/vmorganp/lazytainer:master
environment:
- VERBOSE=false
ports:
- 25565:25565
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- lazytainer.group.minecraft.sleepMethod=stop
- lazytainer.group.minecraft.ports=25565
- lazytainer.group.minecraft.minPacketThreshold=2 # Start after two incomming packets
- lazytainer.group.minecraft.inactiveTimeout=600 # 10 minutes, to allow the server to bootstrap. You can probably make this lower later if you want.
restart: unless-stopped
network_mode: bridge
mc:
image: itzg/minecraft-server
environment:
- EULA=TRUE
- TYPE=PURPUR
- MEMORY=4G
- TZ=Europe/Berlin
- OVERRIDE_SERVER_PROPERTIES=TRUE
volumes:
- /opt/container_volumes/minecraft/data:/data
labels:
- lazytainer.group=minecraft
depends_on:
- lazytainer
network_mode: service:lazytainer
tty: true
stdin_open: true
restart: unless-stopped
networks: {}
```
[Source](https://github.com/itzg/docker-minecraft-server/blob/master/examples/lazytainer/docker-compose.yml)

View File

@@ -25,8 +25,3 @@ healthcheck:
``` ```
Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of healthchecks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`. Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of healthchecks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`.
### Healthchecks for older versions
This container disables Healthchecks for Versions before b1.8 as those versions do not support any kind of server pinging.
For more information see [Server List Ping](https://wiki.vg/Server_List_Ping#Beta_1.8_to_1.3)

View File

@@ -10,10 +10,6 @@ A specific file can be omitted from each reference to allow for auto-selecting t
## Project-file references ## Project-file references
!!! tip
Individual project files typically represent a version of the mod/plugin, but CurseForge refers to these items broadly as "files" rather than "versions".
The following formats are supported in the list of project-file references: The following formats are supported in the list of project-file references:
- A project page URL, such as `https://www.curseforge.com/minecraft/mc-mods/jei`. _The newest applicable file will be automatically selected._ - A project page URL, such as `https://www.curseforge.com/minecraft/mc-mods/jei`. _The newest applicable file will be automatically selected._
@@ -21,7 +17,7 @@ The following formats are supported in the list of project-file references:
- Project slug, such as `jei`. _The newest applicable file will be automatically selected._ - Project slug, such as `jei`. _The newest applicable file will be automatically selected._
- Project ID, such as `238222`. _The newest applicable file will be automatically selected._ - Project ID, such as `238222`. _The newest applicable file will be automatically selected._
- Project slug or ID, `:`, and a file ID, such as `jei:4593548` or `238222:4593548` - Project slug or ID, `:`, and a file ID, such as `jei:4593548` or `238222:4593548`
- Project slug or ID, `@`, and a partial filename, such as `jei@10.2.1.1005`. This option is useful to refer to a version of the mod/plugin rather than looking up the file ID. - Project slug or ID, `@`, and a partial filename, such as `jei@10.2.1.1005`
An `@` followed by the container path to a listing file can also be provided as a project-file reference. Each line is processed as a reference where blank lines and comments that start with `#` are ignored. An `@` followed by the container path to a listing file can also be provided as a project-file reference. Each line is processed as a reference where blank lines and comments that start with `#` are ignored.

View File

@@ -47,14 +47,16 @@ These paths work well if you want to have a common set of modules in a separate
## Zip file modpack ## Zip file modpack
Like the `WORLD` option above, you can specify the URL or container path of a "mod pack" to download and install into `mods` for Forge/Fabric or `plugins` for Bukkit/Spigot. To use this option pass the environment variable `MODPACK`, such as Like the `WORLD` option above, you can specify the URL or path of a "mod pack"
to download and install into `mods` for Forge/Fabric or `plugins` for Bukkit/Spigot.
To use this option pass the environment variable `MODPACK`, such as
```shell ```shell
docker run -d -e MODPACK=http://www.example.com/mods/modpack.zip ... docker run -d -e MODPACK=http://www.example.com/mods/modpack.zip ...
``` ```
!!! note !!! note
The referenced URL/file must be a zip file with one or more jar files at the The referenced URL must be a zip file with one or more jar files at the
top level of the zip archive. Make sure the jars are compatible with the top level of the zip archive. Make sure the jars are compatible with the
particular `TYPE` of server you are running. particular `TYPE` of server you are running.

View File

@@ -22,8 +22,8 @@
## Extra options ## Extra options
`MODRINTH_DOWNLOAD_DEPENDENCIES` `MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES`
: Can be set to `none` (the default), `required`, or `optional` to download required and/or optional dependencies. : Required dependencies of the project will _always_ be downloaded and optional dependencies can also be downloaded by setting this to `true`. The default is "false".
`MODRINTH_ALLOWED_VERSION_TYPE` `MODRINTH_ALLOWED_VERSION_TYPE`
: The version type is used to determine the newest version to use from each project. The allowed values are `release` (default), `beta`, `alpha`. : The version type is used to determine the newest version to use from each project. The allowed values are `release` (default), `beta`, `alpha`.

View File

@@ -1,9 +1,9 @@
mkdocs == 1.5.3 mkdocs
mkdocs-material-extensions == 1.3.1 mkdocs-material-extensions
mkdocs-material == 9.5.3 mkdocs-material
mkdocs-autorefs == 0.5.0 mkdocs-autorefs
mkdocstrings == 0.24.0 mkdocstrings
mkdocs-literate-nav == 0.6.1 mkdocs-literate-nav
mdx-gh-links == 0.4 mdx-gh-links
mkdocs-click == 0.8.1 mkdocs-click
mkdocs-static-i18n == 1.2.0 mkdocs-static-i18n

View File

@@ -8,7 +8,7 @@ To manage a CurseForge modpack automatically with upgrade support, pinned or lat
A CurseForge API key is **required** to use this feature. Go to their [developer console](https://console.curseforge.com/), generate an API key, and set the environment variable `CF_API_KEY`. A CurseForge API key is **required** to use this feature. Go to their [developer console](https://console.curseforge.com/), generate an API key, and set the environment variable `CF_API_KEY`.
When entering your API Key in a docker compose file you will need to escape any `$` character with a second `$`. Refer to [this compose file reference section](https://docs.docker.com/compose/compose-file/compose-file-v3/#variable-substitution) for more information. When entering your API Key in a docker compose file you will need to escape any `$` character with a second `$`.
Example if your key is `$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa`: Example if your key is `$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa`:
```yaml ```yaml
@@ -56,6 +56,13 @@ For example:
-e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8 -e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8
``` ```
For mod, modpacks, and world files that are not allowed for automated download, the container path `/downloads` can be attached and matching files will be retrieved from there. The subdirectories `mods`, `modpacks`, and `worlds` will also be checked accordingly. To change the source location of downloaded files, set `CF_DOWNLOADS_REPO` to an existing container path. To disable this feature, set `CF_DOWNLOADS_REPO` to an empty string.
!!! note "Mods need download report"
A file called `MODS_NEED_DOWNLOAD.txt` will be created in the `/data` directory that lists the mods that need to be manually downloaded and where to get them.
If you wish to use a unpublished modpack zip, set the container path to the file in `CF_MODPACK_ZIP`. Similarly, the container path to a modpack manifest JSON can be passed to `CF_MODPACK_MANIFEST`. In either case, **the modpack slug or page URL must still be provided**.
The latest file will be located and used by default, but if a specific version is desired you can use one of the following options. With any of these options **do not select a server file** -- they lack the required manifest and defeat the ability to consistently automate startup. The latest file will be located and used by default, but if a specific version is desired you can use one of the following options. With any of these options **do not select a server file** -- they lack the required manifest and defeat the ability to consistently automate startup.
- Use `CF_PAGE_URL`, but include the full URL to a specific file - Use `CF_PAGE_URL`, but include the full URL to a specific file
@@ -68,95 +75,17 @@ The following shows where to get the URL to the specific file and also shows whe
The following examples all refer to version 1.0.7 of ATM8: The following examples all refer to version 1.0.7 of ATM8:
```yaml ```
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-the-mods-8/files/4248390 -e CF_PAGE_URL=https://www.curseforge.com/minecraft/modpacks/all-the-mods-8/files/4248390
``` ```
```yaml ```
CF_SLUG: all-the-mods-8 -e CF_SLUG=all-the-mods-8 -e CF_FILE_ID=4248390
CF_FILE_ID: "4248390"
``` ```
```yaml
CF_SLUG: all-the-mods-8
CF_FILENAME_MATCHER: 1.0.7
``` ```
-e CF_SLUG=all-the-mods-8 -e CF_FILENAME_MATCHER=1.0.7
## Manual Downloads ```
For mod, modpacks, and world files that are not allowed for automated download, the container path `/downloads` can be attached and matching files will be retrieved from there. The subdirectories `mods`, `modpacks`, and `worlds` will also be checked accordingly. To change the source location of downloaded files, set `CF_DOWNLOADS_REPO` to an existing container path. To disable this feature, set `CF_DOWNLOADS_REPO` to an empty string.
!!! note "Mods need download report"
A file called `MODS_NEED_DOWNLOAD.txt` will be created in the `/data` directory that lists the mods that need to be manually downloaded and where to get them.
!!! example
Assuming Docker compose is being used:
1. Create a directory next to the `docker-compose.yml` file. The name doesn't matter, but "downloads" is the common convention
2. From the "Mods Need Download" output, visit the download page of each, click on the file download and save that file into the directory created in the previous step
3. Add a host directory mount to the volumes section where the container path **must be** `/downloads`. The snippet below shows how that will look
4. Re-run `docker composwe up -d` to apply the changes
```yaml
volumes:
./downloads:/downloads
```
## Unpublished Modpacks
If you wish to use a unpublished modpack zip, set the container path to the file in `CF_MODPACK_ZIP`. Similarly, the container path to a modpack manifest JSON can be passed to `CF_MODPACK_MANIFEST`. In either case, **the modpack slug or page URL must still be provided**.
!!! example
```yaml
services:
mc:
image: itzg/minecraft-server
environment:
EULA: true
MOD_PLATFORM: AUTO_CURSEFORGE
# allocate from https://console.curseforge.com/ and set in .env file
CF_API_KEY: ${CF_API_KEY}
CF_MODPACK_MANIFEST: /manifests/manifest.json
CF_SLUG: "custom"
volumes:
- ./manifests:/manifests:ro
```
where an exported manifest file should look like:
```json
{
"minecraft": {
"version": "1.20.4",
"modLoaders": [
{
"id": "fabric-0.15.3",
"primary": true
}
]
},
"manifestType": "minecraftModpack",
"manifestVersion": 1,
"name": "Custom",
"author": "",
"files": [
{
"projectID": 351725,
"fileID": 4973035,
"required": true
},
{
"projectID": 306612,
"fileID": 5010374,
"required": true
}
],
"overrides": "overrides"
}
```
## Exclude client mods ## Exclude client mods
@@ -174,44 +103,12 @@ If needing to iterate on the options above, set `CF_FORCE_SYNCHRONIZE` to "true"
!!! important !!! important
These options are provided to empower you to get your server up and running quickly. Please help out by reporting an issue with the respective mod project. Ideally mod developers should [use correct registrations for one-sided client mods](https://docs.minecraftforge.net/en/latest/concepts/sides/#writing-one-sided-mods). Understandably, those code changes may be non-trivial, so mod authors can also add "Client" to the game versions when publishing. These options are provided to empower you to get your server up and running quickly. Please help out by reporting an issue with the respective mod project. Ideally mod developers should [use correct registrations for one-sided client mods](https://docs.minecraftforge.net/en/latest/concepts/sides/#writing-one-sided-mods). Understandably, those code changes may be non-trivial, so mod authors can also add "Client" to the game versions when publishing.
## Excluding Overrides Files ## Extra options
Modpack zip files typically include an `overrides` subdirectory that may contain config files, world data, and extra mod files. All of those files will be extracted into the `/data` path of the container. If any of those files, such as incompatible mods, need to be excluded from extraction, then the `CF_OVERRIDES_EXCLUSIONS` variable can be set with a comma or newline delimited list of ant-style paths ([see below](#ant-style-paths)) to exclude, relative to the overrides (or `/data`) directory.
### Ant-style paths
Ant-style paths can include the following globbing/wildcard symbols:
| Symbol | Behavior |
|--------|---------------------------------------------------------|
| `*` | Matches zero, one, or many characters except a slash |
| `**` | Matches zero, one, or many characters including slashes |
| `?` | Matches one character |
!!! example
The following compose `environment` entries show how to exclude Iris and Sodium mods from the overrides
```yaml
CF_OVERRIDES_EXCLUSIONS: mods/iris*.jar,mods/sodium*.jar
```
or using newline delimiter, which improves maintainability
```yaml
CF_OVERRIDES_EXCLUSIONS: |
mods/iris*.jar
mods/sodium*.jar
```
## World/Level Data
Some modpacks come with world/save data via a worlds file and/or the overrides provided with the modpack. Either approach can be selected to set the `LEVEL` to the resulting saves directory by setting `CF_SET_LEVEL_FROM` to either: Some modpacks come with world/save data via a worlds file and/or the overrides provided with the modpack. Either approach can be selected to set the `LEVEL` to the resulting saves directory by setting `CF_SET_LEVEL_FROM` to either:
- `WORLD_FILE` - `WORLD_FILE`
- `OVERRIDES` - `OVERRIDES`
## Extra options
Other configuration available: Other configuration available:
- `CF_PARALLEL_DOWNLOADS` (default is 4): specify how many parallel mod downloads to perform - `CF_PARALLEL_DOWNLOADS` (default is 4): specify how many parallel mod downloads to perform
- `CF_OVERRIDES_SKIP_EXISTING` (default is false): if set, files in the overrides that already exist in the data directory are skipped. **NOTE** world data is always skipped, if present. - `CF_OVERRIDES_SKIP_EXISTING` (default is false): if set, files in the overrides that already exist in the data directory are skipped. **NOTE** world data is always skipped, if present.

View File

@@ -1,9 +1,5 @@
# Manual CurseForge server packs # Manual CurseForge server packs
!!! warning "Deprecated"
This mod platform type is deprecated. Please use [AUTO_CURSEFORGE](auto-curseforge.md) for new deployments.
Enable this server mode by setting `MOD_PLATFORM` or `TYPE` to "CURSEFORGE" along with the following specific variables. Enable this server mode by setting `MOD_PLATFORM` or `TYPE` to "CURSEFORGE" along with the following specific variables.
You need to specify a modpack to run, using the `CF_SERVER_MOD` environment You need to specify a modpack to run, using the `CF_SERVER_MOD` environment

View File

@@ -9,17 +9,11 @@ The desired modpack project is specified with the `MODRINTH_MODPACK` environment
- The project "slug", which is located in the URL shown here: - The project "slug", which is located in the URL shown here:
![](../../img/modrinth-project-slug.drawio.png) ![](../../img/modrinth-project-slug.drawio.png)
- The project ID, which is located in the bottom of the left panel, shown here - The project ID, which is located in the bottom of the left panel, shown here
![](../../img/modrinth-project-id.drawio.png) ![](../../img/modrinth-project-id.drawio.png)
- The project page URL, such as <https://modrinth.com/modpack/cobblemon-fabric>. As described below, this can further be the page URL of a modpack's version page. - The project page URL, such as <https://modrinth.com/modpack/cobblemon-fabric>. As described below, this can further be the page URL of a modpack's version page.
- A custom URL of a hosted [mrpack file](https://support.modrinth.com/en/articles/8802351-modrinth-modpack-format-mrpack)
- The container path to a local [mrpack file](https://support.modrinth.com/en/articles/8802351-modrinth-modpack-format-mrpack)
## Modpack version ## Modpack version
The automatic modpack version resolving can be narrowed in a few ways: The automatic modpack version resolving can be narrowed in a few ways:
@@ -47,16 +41,3 @@ Some mods, such as [MCInstance Loader](https://modrinth.com/mod/mcinstance-loade
config/mcinstanceloader/pack.mcinstance config/mcinstanceloader/pack.mcinstance
``` ```
## Excluding files
To exclude client mods that are incorrectly declared by the modpack as server-compatible, set `MODRINTH_EXCLUDE_FILES` to a comma or newline delimited list of partial file names to exclude. You may need to set `MODRINTH_FORCE_SYNCHRONIZE` to "true" while iterating on a compatible set of mods to use.
!!! example
In a Compose file:
```yaml
MODRINTH_EXCLUDE_FILES: |
notenoughanimations
lambdynamiclights
euphoriapatcher
```

View File

@@ -1,20 +1,12 @@
# Bukkit/Spigot # Bukkit/Spigot
Run a Bukkit/Spigot server type by setting the environment variable `TYPE` to "BUKKIT" or "SPIGOT". Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT` or `-e TYPE=SPIGOT` to your command-line.
!!! example ```
docker run -d -v /path/on/host:/data \
Command-line -e TYPE=SPIGOT \
``` -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
docker run ... -e TYPE=SPIGOT ... ```
```
Compose
```yaml
environment:
...
TYPE: SPIGOT
```
If the downloaded server jar is corrupted, set `FORCE_REDOWNLOAD` to "true" to force a re-download during next container startup. After successfully re-downloading, you should remove that or set to "false". If the downloaded server jar is corrupted, set `FORCE_REDOWNLOAD` to "true" to force a re-download during next container startup. After successfully re-downloading, you should remove that or set to "false".
@@ -23,14 +15,16 @@ If you are hosting your own copy of Bukkit/Spigot you can override the download
- -e BUKKIT_DOWNLOAD_URL=<url> - -e BUKKIT_DOWNLOAD_URL=<url>
- -e SPIGOT_DOWNLOAD_URL=<url> - -e SPIGOT_DOWNLOAD_URL=<url>
You can build spigot from source by adding `-e BUILD_FROM_SOURCE=true`
Plugins can either be managed within the `plugins` subdirectory of the [data directory](../../data-directory.md) or you can also [attach a `/plugins` volume](../../mods-and-plugins/index.md#optional-plugins-mods-and-config-attach-points). If you add plugins while the container is running, you'll need to restart it to pick those up.
[You can also auto-download plugins using `SPIGET_RESOURCES`.](../../mods-and-plugins/spiget.md)
!!! note !!! note
Some of the `VERSION` values are not as intuitive as you would think, so make sure to click into the version entry to find the **exact** version needed for the download. For example, "1.8" is not sufficient since their download naming expects `1.8-R0.1-SNAPSHOT-latest` exactly. Some of the `VERSION` values are not as intuitive as you would think, so make sure to click into the version entry to find the **exact** version needed for the download. For example, "1.8" is not sufficient since their download naming expects `1.8-R0.1-SNAPSHOT-latest` exactly.
## Build from source
You can build spigot from source by setting the environment variable `BUILD_FROM_SOURCE` to "true".
## Alternatives ## Alternatives
### Canyon ### Canyon

View File

@@ -35,23 +35,3 @@ In both of the cases above, there is no need for the `VERSION` or `FORGE_VERSION
!!! note !!! note
If an error occurred while installing Forge, it might be possible to resolve by temporarily setting `FORGE_FORCE_REINSTALL` to "true". Be sure to remove that variable after successfully starting the server. If an error occurred while installing Forge, it might be possible to resolve by temporarily setting `FORGE_FORCE_REINSTALL` to "true". Be sure to remove that variable after successfully starting the server.
## Alternatives
### NeoForge
Support for [NeoForge](https://neoforged.net/) is also provided. A NeoForge server can be automatically managed by setting `TYPE` to "NEOFORGE". `VERSION` specifies the Minecraft version and `NEOFORGE_VERSION` can be set to select a specific version, "latest", or "beta". By default, the latest, non-beta NeoForge version available for the requested Minecraft version will be used.
!!! example
```
docker run -e TYPE=NEOFORGE -e VERSION=1.20.1 -e NEOFORGE_VERSION=47.1.79 ...
```
or in a compose file
```yaml
environment:
TYPE: NEOFORGE
VERSION: "1.20.4"
NEOFORGE_VERSION: "beta"
```

View File

@@ -8,34 +8,7 @@ A [Magma](https://magmafoundation.org/) server, which is a combination of Forge
!!! note !!! note
The Magma project [has been terminated](https://git.magmafoundation.org/magmafoundation/magma-1-20-x/-/commit/4e7abe37403c47d09b74b77bcfc26a19b18f5891). Please use Magma Maintained for 1.12.2, 1.18.2, 1.19.3, and 1.20.1, or Ketting for 1.20.2+. There are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2", "1.16.5", etc.
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2", "1.16.5", etc.
### Magma Maintained
A [Magma Maintained](https://github.com/magmamaintained/) server, which is a alternative project of Magma, can be used with
-e TYPE=MAGMA_MAINTAINED
!!! note
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2", "1.18.2", "1.19.3", or "1.20.1".
In addition, `FORGE_VERSION` and `MAGMA_MAINTAINED_TAG` must be specified. You can find the supported `FORGE_VERSION` and `MAGMA_MAINTAINED_TAG` in a releases page for each repositories.
### Ketting
A [Ketting](https://github.com/kettingpowered/Ketting-1-20-x) server, which is a alternative project of Magma 1.20.2+, can be used with
-e TYPE=KETTING
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.20.2" or later.
In addition, `FORGE_VERSION` and `KETTING_VERSION` must be specified. You can find the supported `FORGE_VERSION` in the [project page](https://github.com/kettingpowered/Ketting-1-20-x), and `KETTING_VERSION` in the [release page](https://github.com/kettingpowered/Ketting-1-20-x/releases).
!!! note
The length of `KETTING_VERSION` is 8, not 7 since it is taken from an abbreviated git commit hash. The value can be found in a jar file link on an Assets section for each releases.
### Mohist ### Mohist
@@ -46,7 +19,7 @@ A [Mohist](https://github.com/MohistMC/Mohist) server can be used with
!!! note !!! note
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2" There are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
By default the latest build will be used; however, a specific build number can be selected by setting `MOHIST_BUILD`, such as By default the latest build will be used; however, a specific build number can be selected by setting `MOHIST_BUILD`, such as

View File

@@ -37,7 +37,7 @@ Configuration options with defaults:
!!! note !!! note
Instead of using format codes in the MOTD, Limbo requires [JSON chat content](https://minecraft.wiki/w/Raw_JSON_text_format#Java_Edition). If a plain string is provided, which is the default, then it gets converted into the required JSON structure. Instead of using format codes in the MOTD, Limbo requires [JSON chat content](https://minecraft.fandom.com/wiki/Raw_JSON_text_format#Java_Edition). If a plain string is provided, which is the default, then it gets converted into the required JSON structure.
## Crucible ## Crucible

View File

@@ -1,11 +1,5 @@
!!! warning ### **OS OPTIONS**
The variables listed on this page are manually documented and may be out-of-date or inaccurate.
All other documentation pages are actively maintained, so please use the search box above to find the desired topic.
### General options
<table> <table>
<thead> <thead>
<tr> <tr>
@@ -54,7 +48,7 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
/etc/timezone:/etc/timezone:ro</code> /etc/timezone:/etc/timezone:ro</code>
</td> </td>
<td><code>UTC</code></td> <td><code>1G</code></td>
<td>⬜️</td> <td>⬜️</td>
</tr> </tr>
<tr> <tr>
@@ -114,7 +108,7 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
</tbody> </tbody>
</table> </table>
### Server ### **SERVER**
<table> <table>
<thead> <thead>
@@ -266,7 +260,7 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
</tr> </tr>
<tr> <tr>
<td><code>MODE</code></td> <td><code>MODE</code></td>
<td>Minecraft servers are configured to run in Survival mode by default. You can change the mode using MODE where you can either provide the <a href="http://minecraft.wiki/Game_mode#Game_modes">standard numerical values</a> or the shortcut values:<br /> <td>Minecraft servers are configured to run in Survival mode by default. You can change the mode using MODE where you can either provide the <a href="http://minecraft.gamepedia.com/Game_mode#Game_modes">standard numerical values</a> or the shortcut values:<br />
<ul> <ul>
<li>creative</li> <li>creative</li>
<li>survival</li> <li>survival</li>
@@ -284,14 +278,14 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
</tr> </tr>
<tr> <tr>
<td><code>LEVEL_TYPE</code></td> <td><code>LEVEL_TYPE</code></td>
<td>By default, a standard world is generated with hills, valleys, water, etc. A different level type can be configured by setting LEVEL_TYPE to <a href="https://minecraft.wiki/w/Server.properties#level-type">an expected type listed here</a>. <td>By default, a standard world is generated with hills, valleys, water, etc. A different level type can be configured by setting LEVEL_TYPE to <a href="https://minecraft.fandom.com/wiki/Server.properties#level-type">an expected type listed here</a>.
</td> </td>
<td><code>minecraft:default</code></td> <td><code>minecraft:default</code></td>
<td>⬜️</td> <td>⬜️</td>
</tr> </tr>
<tr> <tr>
<td><code>GENERATOR_SETTINGS</code></td> <td><code>GENERATOR_SETTINGS</code></td>
<td>For some of the level types, <code>GENERATOR_SETTINGS</code> can be used to further customize the world generation <a href="https://minecraft.wiki/w/Server.properties#generator-settings">as described here</a>.</td> <td>For some of the level types, <code>GENERATOR_SETTINGS</code> can be used to further customize the world generation <a href="https://minecraft.fandom.com/wiki/Server.properties#generator-settings">as described here</a>.</td>
<td><code></code></td> <td><code></code></td>
<td>⬜️</td> <td>⬜️</td>
</tr> </tr>
@@ -454,7 +448,7 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
</tbody> </tbody>
</table> </table>
### Custom resource pack ### **CUSTOM RESOURCE PACK**
<table> <table>
<thead> <thead>
@@ -487,7 +481,7 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
</tbody> </tbody>
</table> </table>
### Whitelist ### **WHITELIST**
<table> <table>
<thead> <thead>
@@ -526,7 +520,7 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
</tbody> </tbody>
</table> </table>
### RCON ### **RCON**
<table> <table>
<thead> <thead>
@@ -595,7 +589,7 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
</tbody> </tbody>
</table> </table>
### Auto-Pause ### **AUTOPAUSE**
!!! note !!! note
@@ -658,7 +652,7 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
### Auto-Stop ### **AUTOSTOP**
!!! note !!! note
@@ -708,11 +702,11 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
</table> </table>
### CurseForge ### **CURSEFORGE**
!!! tip !!! note
Refer to the [main documentation page](types-and-platforms/mod-platforms/auto-curseforge.md) for more details and up-to-date information. A CurseForge API key is required to use a CurseForge type server. Go to their [developer console](https://console.curseforge.com/), generate an API key, and set the environment variable CF_API_KEY
<table> <table>
<thead> <thead>

View File

@@ -13,26 +13,25 @@
When using the image `itzg/minecraft-server` without a tag, the `latest` image tag is implied from the table below. To use a different version of Java, please use an alternate tag to run your Minecraft server container. The `stable` tag is similar to `latest`; however, it tracks [the most recent repository release/tag](https://github.com/itzg/docker-minecraft-server/releases/latest). When using the image `itzg/minecraft-server` without a tag, the `latest` image tag is implied from the table below. To use a different version of Java, please use an alternate tag to run your Minecraft server container. The `stable` tag is similar to `latest`; however, it tracks [the most recent repository release/tag](https://github.com/itzg/docker-minecraft-server/releases/latest).
| Tag name | Java version | Linux | JVM Type | Architecture | | Tag name | Java version | Linux | JVM Type | Architecture |
|------------------|--------------|--------|----------------|-------------------| |-------------------|--------------|--------|-------------|-------------------|
| latest | 17 | Ubuntu | Hotspot | amd64,arm64,armv7 | | latest | 17 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| stable | 17 | Ubuntu | Hotspot | amd64,arm64,armv7 | | stable | 17 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| java8 | 8 | Alpine | Hotspot | amd64 | | java8 | 8 | Alpine | Hotspot | amd64 |
| java8-jdk | 8 | Ubuntu | Hotspot+JDK | amd64 | | java8-jdk | 8 | Ubuntu | Hotspot+JDK | amd64 |
| java8-multiarch | 8 | Ubuntu | Hotspot | amd64,arm64,armv7 | | java8-multiarch | 8 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| java8-openj9 | 8 | Debian | OpenJ9 | amd64 | | java8-openj9 | 8 | Debian | OpenJ9 | amd64 |
| java8-graalvm-ce | 8 | Oracle | GraalVM CE | amd64 | | java8-graalvm-ce | 8 | Oracle | GraalVM CE | amd64 |
| java11 | 11 | Ubuntu | Hotspot | amd64,arm64,armv7 | | java11 | 11 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| java11-jdk | 11 | Ubuntu | Hotspot+JDK | amd64,arm64,armv7 | | java11-jdk | 11 | Ubuntu | Hotspot+JDK | amd64,arm64,armv7 |
| java11-openj9 | 11 | Debian | OpenJ9 | amd64 | | java11-openj9 | 11 | Debian | OpenJ9 | amd64 |
| java17 | 17 | Ubuntu | Hotspot | amd64,arm64,armv7 | | java17 | 17 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| java17-jdk | 17 | Ubuntu | Hotspot+JDK | amd64,arm64,armv7 | | java17-jdk | 17 | Ubuntu | Hotspot+JDK | amd64,arm64,armv7 |
| java17-openj9 | 17 | Debian | OpenJ9 | amd64 | | java17-openj9 | 17 | Debian | OpenJ9 | amd64 |
| java17-graalvm | 17 | Oracle | Oracle GraalVM | amd64,arm64 | | java17-graalvm-ce | 17 | Oracle | GraalVM CE | amd64,arm64 |
| java17-alpine | 17 | Alpine | Hotspot | amd64 | | java17-alpine | 17 | Alpine | Hotspot | amd64 |
| java21-alpine | 21 | Alpine | Hotspot | amd64 | | java20-alpine | 20 | Alpine | Hotspot | amd64 |
| java21 | 21 | Ubuntu | Hotspot | amd64,arm64 | | java20 | 20 | Ubuntu | Hotspot | amd64,arm64 |
| java21-graalvm | 21 | Oracle | Oracle GraalVM | amd64,arm64 |
For example, to use Java version 8 on any supported architecture: For example, to use Java version 8 on any supported architecture:
@@ -54,5 +53,3 @@ The following image tags have been deprecated and are no longer receiving update
- openj9-nightly - openj9-nightly
- multiarch-latest - multiarch-latest
- java16/java16-openj9 - java16/java16-openj9
- java17-graalvm-ce
- java20-graalvm, java20, java20-alpine

View File

@@ -2,8 +2,7 @@ To use a different Minecraft version, pass the `VERSION` environment variable (c
- LATEST (the default) - LATEST (the default)
- SNAPSHOT - SNAPSHOT
- a specific version, such as "1.7.9" - or a specific version, such as "1.7.9"
- or an alpha and beta version, such as "b1.7.3" (server download might not exist)
For example, to use the latest snapshot: For example, to use the latest snapshot:

3
examples/.gitignore vendored
View File

@@ -1,4 +1,3 @@
data/ data/
modpacks/ modpacks/
.env .env
downloads/

View File

@@ -1,37 +0,0 @@
services:
mc:
image: itzg/minecraft-server
environment:
EULA: true
MOD_PLATFORM: AUTO_CURSEFORGE
# from .env
CF_API_KEY: ${CF_API_KEY}
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-of-fabric-7
# CF_FILENAME_MATCHER: 1.2.2
CF_OVERRIDES_EXCLUSIONS: |
mods/iris*.jar
mods/sodium*.jar
MEMORY: 4G
ports:
- "25565:25565"
volumes:
- mc-data:/data
- ./downloads:/downloads
# Manually download the following and put into the 'downloads' directory next to this compose file
#
# Mod Filename Download page
# =========================== ========================================= ====================================================================================
# Fish of Thieves [Fabric 1.20.1] Fish of Thieves v3.0.3 https://www.curseforge.com/minecraft/mc-mods/fish-of-thieves/files/4958329
# Only Hammers [FORGE/FABRIC] OnlyHammers-1.20.1-0.6-Fabric https://www.curseforge.com/minecraft/mc-mods/only-hammers-forge-fabric/files/4832068
# Sprinklerz sprinklerz-0.5_fabric.jar https://www.curseforge.com/minecraft/mc-mods/sprinklerz/files/4835664
# Frog Legs (Fabric/Forge) FrogLegs-v2.0.0-1.20.1-Fabric.jar https://www.curseforge.com/minecraft/mc-mods/froglegs/files/4917818
# TrimsEffects [FABRIC] TrimsEffects - MC 1.20.X - 1.1.0 https://www.curseforge.com/minecraft/mc-mods/trimseffects/files/4954156
# Display Case Display Case-fabric-1.20-1.0.8.jar https://www.curseforge.com/minecraft/mc-mods/displaycase/files/4921333
# Structory: Towers Structory Towers 1.20.4 v1.0.6 https://www.curseforge.com/minecraft/mc-mods/structory-towers/files/4937875
# Packet Fixer Packet Fixer Fabric 1.2.1 https://www.curseforge.com/minecraft/mc-mods/packet-fixer/files/4884316
# Perfect Plushies Perfect Plushies 1.9.0 [Fabric] https://www.curseforge.com/minecraft/mc-mods/perfect-plushies/files/4985767
# Structory Structory 1.20.2 v1.3.4 https://www.curseforge.com/minecraft/mc-mods/structory/files/4937872
volumes:
mc-data: {}

View File

@@ -1,22 +0,0 @@
version: "3.8"
services:
mc:
image: itzg/minecraft-server
ports:
- "25565:25565"
environment:
EULA: "true"
MOD_PLATFORM: AUTO_CURSEFORGE
# allocate from https://console.curseforge.com/ and set in .env file
CF_API_KEY: ${CF_API_KEY}
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-the-mods-9
# Optional: select a specific version/file
#CF_FILENAME_MATCHER: "0.2.34"
MEMORY: 4G
volumes:
- mc-data:/data
- ./downloads:/downloads
volumes:
mc-data: {}

View File

@@ -1,19 +0,0 @@
services:
mc:
image: itzg/minecraft-server
environment:
EULA: true
MOD_PLATFORM: AUTO_CURSEFORGE
# allocate from https://console.curseforge.com/ and set in .env file
CF_API_KEY: ${CF_API_KEY}
CF_MODPACK_MANIFEST: /manifests/manifest.json
CF_SLUG: "custom"
MEMORY: 2G
volumes:
- mc-data:/data
- ./manifests:/manifests:ro
ports:
- "25565:25565"
volumes:
mc-data: {}

View File

@@ -1,28 +0,0 @@
{
"minecraft": {
"version": "1.20.4",
"modLoaders": [
{
"id": "fabric-0.15.3",
"primary": true
}
]
},
"manifestType": "minecraftModpack",
"manifestVersion": 1,
"name": "Custom",
"author": "",
"files": [
{
"projectID": 351725,
"fileID": 4973035,
"required": true
},
{
"projectID": 306612,
"fileID": 5010374,
"required": true
}
],
"overrides": "overrides"
}

View File

@@ -1,51 +0,0 @@
version: "3.8"
services:
mc:
image: itzg/minecraft-server:java8-multiarch
ports:
- "25565:25565"
environment:
EULA: "true"
MOD_PLATFORM: AUTO_CURSEFORGE
# allocate from https://console.curseforge.com/ and set in .env file
CF_API_KEY: ${CF_API_KEY}
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/minecraft-eternal/files/4102634
CF_EXCLUDE_MODS: |
cherished-worlds
controlling
ctm
custom-main-menu
ding
minecraft-rich-presence
enchantment-descriptions
just-enough-harvestcraft
just-enough-resources-jer
menumobs
more-overlays
mouse-tweaks
oldjavawarning
overloaded-armor-bar
reauth
thaumic-jei
tips
armor-toughness-bar
waila-harvestability
ambientsounds
biomeinfo
block-drops-jei-addon
loot-capacitor-tooltips
no-recipe-book
packmodemenu
resource-reloader
# blockdrops
CF_FORCE_SYNCHRONIZE: "true"
MEMORY: 4G
volumes:
- mc-data:/data
- ./downloads:/downloads
volumes:
mc-data: {}

View File

@@ -1,20 +1,18 @@
# NOTE
# This file is named spiget with an "e"
# since it provides an example of the
# feature https://docker-minecraft-server.readthedocs.io/en/latest/mods-and-plugins/spiget/
# which uses the Spiget API at https://spiget.org/
version: "3" version: "3"
services: services:
mc: mc:
# Only using IMAGE variable to allow for local testing
image: itzg/minecraft-server image: itzg/minecraft-server
# image: ${IMAGE:-itzg/minecraft-server}
ports: ports:
- "25565:25565" - "25565:25565"
environment: environment:
EULA: "TRUE" EULA: "TRUE"
TYPE: PAPER TYPE: SPIGOT
SPIGET_RESOURCES: 34315,3836 # SPIGET_RESOURCES: 34315,3836
SPIGET_RESOURCES: ""
REMOVE_OLD_MODS: "true"
volumes: volumes:
- data:/data - data:/data

View File

@@ -19,7 +19,6 @@ spec:
containers: containers:
- name: mc - name: mc
image: itzg/minecraft-server image: itzg/minecraft-server
imagePullPolicy: Always
env: env:
- name: EULA - name: EULA
value: "TRUE" value: "TRUE"

View File

@@ -1,37 +0,0 @@
version: "3"
services:
lazytainer:
container_name: lazytainer
image: ghcr.io/vmorganp/lazytainer:master
environment:
- VERBOSE=false
ports:
- 25565:25565
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- lazytainer.group.minecraft.sleepMethod=stop
- lazytainer.group.minecraft.ports=25565
- lazytainer.group.minecraft.minPacketThreshold=2 # Start after two incomming packets
- lazytainer.group.minecraft.inactiveTimeout=600 # 10 minutes, to allow the server to bootstrap. You can probably make this lower later if you want.
restart: unless-stopped
network_mode: bridge
mc:
image: itzg/minecraft-server
environment:
- EULA=TRUE
- TYPE=PURPUR
- MEMORY=4G
- TZ=Europe/Berlin
- OVERRIDE_SERVER_PROPERTIES=TRUE
volumes:
- /opt/container_volumes/minecraft/data:/data
labels:
- lazytainer.group=minecraft
depends_on:
- lazytainer
network_mode: service:lazytainer
tty: true
stdin_open: true
restart: unless-stopped
networks: {}

View File

@@ -1,15 +0,0 @@
services:
mc:
image: itzg/minecraft-server
environment:
EULA: true
MOD_PLATFORM: MODRINTH
# Download the mrpack file from https://modrinth.com/modpack/cobblemon-fabric/version/1.4.1 and place in
# modpacks directory next to this compose file.
MODRINTH_MODPACK: /modpacks/Cobblemon Modpack [Fabric] 1.4.1.mrpack
volumes:
- mc-data:/data
- ./modpacks:/modpacks:ro
volumes:
mc-data: {}

View File

@@ -706,5 +706,5 @@ update-client-command-list: true
register-command-list-data: true register-command-list-data: true
# If LuckPerms should attempt to resolve Vanilla command target selectors for LP commands. # If LuckPerms should attempt to resolve Vanilla command target selectors for LP commands.
# See here for more info: https://minecraft.wiki/Commands#Target_selectors # See here for more info: https://minecraft.gamepedia.com/Commands#Target_selectors
resolve-command-selectors: false resolve-command-selectors: false

View File

@@ -1,14 +0,0 @@
services:
mc:
image: itzg/minecraft-server
environment:
EULA: true
TYPE: NEOFORGE
VERSION: latest
NEOFORGE_VERSION: beta
ports:
- "25565:25565"
volumes:
- mc:/data
volumes:
mc: {}

View File

@@ -11,7 +11,6 @@
"defensive-measures", "defensive-measures",
"ding", "ding",
"dynamiclights-reforged", "dynamiclights-reforged",
"embeddium",
"enchantment-descriptions", "enchantment-descriptions",
"entity-texture-features-fabric", "entity-texture-features-fabric",
"entityculling", "entityculling",

View File

@@ -1,58 +0,0 @@
{
"motd": {"env": "MOTD"},
"gamemode": {"env": "MODE"},
"difficulty": {"env": "DIFFICULTY"},
"white-list": {"env": "WHITELIST_PROP"},
"enforce-whitelist": {"env": "ENFORCE_WHITELIST"},
"level-type": {"env": "LEVEL_TYPE"},
"server-name": {"env": "SERVER_NAME"},
"server-ip": {"env": "SERVER_IP"},
"server-port": {"env": "SERVER_PORT"},
"allow-nether": {"env": "ALLOW_NETHER"},
"announce-player-achievements": {"env": "ANNOUNCE_PLAYER_ACHIEVEMENTS"},
"enable-command-block": {"env": "ENABLE_COMMAND_BLOCK"},
"spawn-animals": {"env": "SPAWN_ANIMALS"},
"spawn-monsters": {"env": "SPAWN_MONSTERS"},
"spawn-npcs": {"env": "SPAWN_NPCS"},
"spawn-protection": {"env": "SPAWN_PROTECTION"},
"generate-structures": {"env": "GENERATE_STRUCTURES"},
"view-distance": {"env": "VIEW_DISTANCE"},
"hardcore": {"env": "HARDCORE"},
"snooper-enabled": {"env": "SNOOPER_ENABLED"},
"max-build-height": {"env": "MAX_BUILD_HEIGHT"},
"force-gamemode": {"env": "FORCE_GAMEMODE"},
"max-tick-time": {"env": "MAX_TICK_TIME"},
"enable-query": {"env": "ENABLE_QUERY"},
"query.port": {"env": "QUERY_PORT"},
"enable-rcon": {"env": "ENABLE_RCON"},
"rcon.password": {"env": "RCON_PASSWORD"},
"rcon.port": {"env": "RCON_PORT"},
"max-players": {"env": "MAX_PLAYERS"},
"max-world-size": {"env": "MAX_WORLD_SIZE"},
"level-name": {"env": "LEVEL"},
"level-seed": {"env": "SEED"},
"pvp": {"env": "PVP"},
"generator-settings": {"env": "GENERATOR_SETTINGS"},
"online-mode": {"env": "ONLINE_MODE"},
"allow-flight": {"env": "ALLOW_FLIGHT"},
"resource-pack": {"env": "RESOURCE_PACK"},
"resource-pack-sha1": {"env": "RESOURCE_PACK_SHA1"},
"require-resource-pack": {"env": "RESOURCE_PACK_ENFORCE"},
"player-idle-timeout": {"env": "PLAYER_IDLE_TIMEOUT"},
"broadcast-console-to-ops": {"env": "BROADCAST_CONSOLE_TO_OPS"},
"broadcast-rcon-to-ops": {"env": "BROADCAST_RCON_TO_OPS"},
"enable-jmx-monitoring": {"env": "ENABLE_JMX"},
"sync-chunk-writes": {"env": "SYNC_CHUNK_WRITES"},
"enable-status": {"env": "ENABLE_STATUS"},
"entity-broadcast-range-percentage": {"env": "ENTITY_BROADCAST_RANGE_PERCENTAGE"},
"function-permission-level": {"env": "FUNCTION_PERMISSION_LEVEL"},
"network-compression-threshold": {"env": "NETWORK_COMPRESSION_THRESHOLD"},
"op-permission-level": {"env": "OP_PERMISSION_LEVEL"},
"prevent-proxy-connections": {"env": "PREVENT_PROXY_CONNECTIONS"},
"use-native-transport": {"env": "USE_NATIVE_TRANSPORT"},
"simulation-distance": {"env": "SIMULATION_DISTANCE"},
"previews-chat": {"env": "PREVIEWS_CHAT"},
"enforce-secure-profile": {"env": "ENFORCE_SECURE_PROFILE"},
"initial-enabled-packs": {"env": "INITIAL_ENABLED_PACKS"},
"initial-disabled-packs": {"env": "INITIAL_DISABLED_PACKS"}
}

View File

@@ -1,12 +1,13 @@
--- ---
site_name: Minecraft Server on Docker (Java Edition) site_name: Minecraft Server on Docker (Java Edition)
site_url: https://docker-minecraft-server.readthedocs.io/en/latest/ site_url: https://docker-minecraft-server.readthedocs.io/
site_description: Documentation for Minecraft Server on Docker site_description: Documentation for Minecraft Server on Docker
repo_url: https://github.com/itzg/docker-minecraft-server repo_url: https://github.com/itzg/docker-minecraft-server
edit_uri: blob/master/docs/ edit_uri: blob/master/docs/
theme: theme:
name: material name: material
features: features:
- navigation.instant
- navigation.tracking - navigation.tracking
- navigation.tabs - navigation.tabs
- navigation.tabs.sticky - navigation.tabs.sticky
@@ -53,6 +54,9 @@ copyright: Copyright &copy; itzg 2023.
plugins: plugins:
- search - search
- autorefs - autorefs
- literate-nav:
nav_file: README.md
implicit_index: true
- mkdocstrings: - mkdocstrings:
handlers: handlers:
python: python:
@@ -64,11 +68,8 @@ plugins:
show_signature_annotations: true show_signature_annotations: true
# https://github.com/ultrabug/mkdocs-static-i18n # https://github.com/ultrabug/mkdocs-static-i18n
- i18n: - i18n:
default_language: en
languages: languages:
- locale: en en:
name: English name: English
build: true build: true
default: true
- literate-nav:
nav_file: README.md
implicit_index: true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

@@ -7,15 +7,21 @@
: "${UID:=1000}" : "${UID:=1000}"
: "${GID:=1000}" : "${GID:=1000}"
umask "${UMASK:=0002}" umask 0002
chmod g+w /data
# Remove from previous run and do this as elevated user since file used to be created before demoting if isTrue "${ENABLE_RCON:-true}" && ! [ -v RCON_PASSWORD ] && ! [ -v RCON_PASSWORD_FILE ]; then
rm -f "$HOME/.rcon-cli.env" RCON_PASSWORD=$(openssl rand -hex 12)
export RCON_PASSWORD
fi
if ! isTrue "${SKIP_SUDO:-false}" && [ "$(id -u)" = 0 ]; then if ! isTrue "${SKIP_SUDO:-false}" && [ "$(id -u)" = 0 ]; then
runAsUser=minecraft runAsUser=minecraft
runAsGroup=minecraft runAsGroup=minecraft
# For rcon-cli access running via exec, which by default is running as root
echo "password=${RCON_PASSWORD}" > "$HOME/.rcon-cli.env"
if [[ -v UID ]]; then if [[ -v UID ]]; then
if [[ $UID != 0 ]]; then if [[ $UID != 0 ]]; then
if [[ $UID != $(id -u minecraft) ]]; then if [[ $UID != $(id -u minecraft) ]]; then

View File

@@ -15,9 +15,11 @@ IFS=$'\n\t'
: "${RCON_CMDS_FIRST_CONNECT:=}" : "${RCON_CMDS_FIRST_CONNECT:=}"
: "${RCON_CMDS_LAST_DISCONNECT:=}" : "${RCON_CMDS_LAST_DISCONNECT:=}"
: "${RCON_CMDS_PERIOD:=10}" : "${RCON_CMDS_PERIOD:=10}"
: "${RCON_PASSWORD_FILE:=}"
: "${ENABLE_RCON:=true}" : "${ENABLE_RCON:=true}"
: "${RCON_PASSWORD:=minecraft}"
: "${RCON_PORT:=25575}" : "${RCON_PORT:=25575}"
export ENABLE_RCON RCON_PORT export ENABLE_RCON RCON_PASSWORD RCON_PORT
: "${MEMORY=1G}" : "${MEMORY=1G}"
: "${INIT_MEMORY=${MEMORY}}" : "${INIT_MEMORY=${MEMORY}}"
@@ -47,45 +49,6 @@ if [ ! -e /data/eula.txt ]; then
writeEula writeEula
fi fi
if isTrue "${DEBUG_MEMORY:-false}"; then
log "Memory usage and availability (in MB)"
uname -a
free -m
fi
##########################################
# Setup RCON password
if isTrue "${ENABLE_RCON:-true}"; then
if [[ -v RCON_PASSWORD_FILE ]]; then
if [ ! -e "${RCON_PASSWORD_FILE}" ]; then
log ""
log "Initial RCON password file ${RCON_PASSWORD_FILE} does not seems to exist."
log "Please ensure your configuration."
log "If you are using Docker Secrets feature, please check this for further information: "
log " https://docs.docker.com/engine/swarm/secrets"
log ""
exit 1
else
RCON_PASSWORD=$(cat "${RCON_PASSWORD_FILE}")
export RCON_PASSWORD
fi
elif ! [[ -v RCON_PASSWORD ]]; then
RCON_PASSWORD=$(openssl rand -hex 12)
export RCON_PASSWORD
fi
# For rcon-cli access running via exec, which by default is running as root
echo "password=${RCON_PASSWORD}" > "$HOME/.rcon-cli.env"
echo "password: \"${RCON_PASSWORD}\"" > "$HOME/.rcon-cli.yaml"
else
rm -f "$HOME/.rcon-cli.env" "$HOME/.rcon-cli.yaml"
fi
##########################################
# Auto-pause/stop
if isTrue "${ENABLE_AUTOPAUSE}" && isTrue "${EXEC_DIRECTLY:-false}"; then if isTrue "${ENABLE_AUTOPAUSE}" && isTrue "${EXEC_DIRECTLY:-false}"; then
log "EXEC_DIRECTLY=true is incompatible with ENABLE_AUTOPAUSE=true" log "EXEC_DIRECTLY=true is incompatible with ENABLE_AUTOPAUSE=true"
exit 1 exit 1
@@ -104,6 +67,25 @@ if [[ $PROXY ]]; then
sleep 5 sleep 5
fi fi
if [[ $RCON_PASSWORD_FILE ]]; then
log ""
if [ ! -e ${RCON_PASSWORD_FILE} ]; then
log "Initial RCON password file ${RCON_PASSWORD_FILE} does not seems to exist."
log "Please ensure your configuration."
log "If you are using Docker Secrets feature, please check this for further information: "
log " https://docs.docker.com/engine/swarm/secrets"
log ""
exit 1
else
RCON_PASSWORD=$(cat ${RCON_PASSWORD_FILE})
export RCON_PASSWORD
fi
log ""
fi
# For rcon-cli access
echo "password=${RCON_PASSWORD}" > "$HOME/.rcon-cli.env"
function fixJavaPath() { function fixJavaPath() {
# Some Docker management UIs grab all the image declared variables and present them for configuration. # Some Docker management UIs grab all the image declared variables and present them for configuration.
# When upgrading images across Java versions, that creates a mismatch in PATH's expected by base image. # When upgrading images across Java versions, that creates a mismatch in PATH's expected by base image.
@@ -131,8 +113,7 @@ fi
cd /data || exit 1 cd /data || exit 1
export DECLARED_TYPE=${TYPE^^} export ORIGINAL_TYPE=${TYPE^^}
export DECLARED_VERSION="$VERSION"
if isTrue "${ENABLE_AUTOPAUSE}"; then if isTrue "${ENABLE_AUTOPAUSE}"; then
"${SCRIPTS:-/}start-autopause" "${SCRIPTS:-/}start-autopause"
@@ -204,10 +185,6 @@ case "${TYPE^^}" in
exec "${SCRIPTS:-/}start-deployForge" "$@" exec "${SCRIPTS:-/}start-deployForge" "$@"
;; ;;
NEOFORGE|NEOFORGED)
exec "${SCRIPTS:-/}start-deployNeoForge" "$@"
;;
FABRIC) FABRIC)
exec "${SCRIPTS:-/}start-deployFabric" "$@" exec "${SCRIPTS:-/}start-deployFabric" "$@"
;; ;;
@@ -234,16 +211,6 @@ case "${TYPE^^}" in
exec "${SCRIPTS:-/}start-deployMagma" "$@" exec "${SCRIPTS:-/}start-deployMagma" "$@"
;; ;;
MAGMA_MAINTAINED)
evaluateJavaCompatibilityForForge
exec "${SCRIPTS:-/}start-deployMagmaMaintained" "$@"
;;
KETTING)
evaluateJavaCompatibilityForForge
exec "${SCRIPTS:-/}start-deployKetting" "$@"
;;
MOHIST) MOHIST)
evaluateJavaCompatibilityForForge evaluateJavaCompatibilityForForge
exec "${SCRIPTS:-/}start-deployMohist" "$@" exec "${SCRIPTS:-/}start-deployMohist" "$@"

View File

@@ -15,7 +15,6 @@ set -eu
: "${CF_FORCE_INCLUDE_MODS:=}" : "${CF_FORCE_INCLUDE_MODS:=}"
: "${CF_SET_LEVEL_FROM:=}" # --set-level-from : "${CF_SET_LEVEL_FROM:=}" # --set-level-from
: "${CF_OVERRIDES_SKIP_EXISTING:=false}" # --overrides-skip-existing : "${CF_OVERRIDES_SKIP_EXISTING:=false}" # --overrides-skip-existing
: "${CF_OVERRIDES_EXCLUSIONS:=}" # --overrides-exclusions
: "${CF_DOWNLOADS_REPO=$([ -d /downloads ] && echo '/downloads' || echo '')}" : "${CF_DOWNLOADS_REPO=$([ -d /downloads ] && echo '/downloads' || echo '')}"
: "${CF_MODPACK_MANIFEST:=}" : "${CF_MODPACK_MANIFEST:=}"
@@ -44,9 +43,6 @@ fi
if [[ ${CF_SET_LEVEL_FROM} ]]; then if [[ ${CF_SET_LEVEL_FROM} ]]; then
args+=(--set-level-from="$CF_SET_LEVEL_FROM") args+=(--set-level-from="$CF_SET_LEVEL_FROM")
fi fi
if [[ ${CF_OVERRIDES_EXCLUSIONS} ]]; then
args+=(--overrides-exclusions="$CF_OVERRIDES_EXCLUSIONS")
fi
args+=( args+=(
--force-synchronize="$CF_FORCE_SYNCHRONIZE" --force-synchronize="$CF_FORCE_SYNCHRONIZE"
--overrides-skip-existing="$CF_OVERRIDES_SKIP_EXISTING" --overrides-skip-existing="$CF_OVERRIDES_SKIP_EXISTING"

View File

@@ -12,7 +12,7 @@ if isURL "${CUSTOM_SERVER}"; then
filename=$(basename "${CUSTOM_SERVER}") filename=$(basename "${CUSTOM_SERVER}")
export SERVER=/data/${filename} export SERVER=/data/${filename}
if [[ -f ${SERVER} ]] && ! isTrue "$FORCE_REDOWNLOAD"; then if [[ -f ${SERVER} ]] || [ -n "$FORCE_REDOWNLOAD" ]; then
log "Using previously downloaded jar at ${SERVER}" log "Using previously downloaded jar at ${SERVER}"
else else
log "Downloading custom server jar from ${CUSTOM_SERVER} ..." log "Downloading custom server jar from ${CUSTOM_SERVER} ..."

View File

@@ -1,31 +0,0 @@
#!/bin/bash
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
isDebugging && set -x
: "${FORGE_VERSION:=${FORGEVERSION:-RECOMMENDED}}"
: "${KETTING_VERSION:=}"
: "${KETTING_TAG:=${KETTING_VERSION:0:7}}"
resolveVersion
if ! downloadUrl="https://github.com/kettingpowered/Ketting-1-20-x/releases/download/${KETTING_TAG}/ketting-${VERSION}-${FORGE_VERSION}-${KETTING_VERSION}-server.jar"; then
log "ERROR failed to locate latest Ketting download for ${VERSION}. Is that version supported?"
exit 1
fi
if [[ $downloadUrl == null ]]; then
log "ERROR Ketting does not seem to be available for $VERSION"
exit 1
fi
if ! SERVER=$(get --output-filename --skip-up-to-date --output /data "$downloadUrl"); then
log "ERROR: failed to download Ketting server jar from $downloadUrl"
exit 1
fi
export SERVER
export FAMILY=HYBRID
exec "${SCRIPTS:-/}start-spiget" "$@"

View File

@@ -1,38 +0,0 @@
#!/bin/bash
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
isDebugging && set -x
: "${FORGE_VERSION:=}"
: "${MAGMA_MAINTAINED_TAG:=}"
resolveVersion
if [ -z $MAGMA_MAINTAINED_TAG ]; then
log "ERROR the variable MAGMA_MAINTAINED_TAG is not specified"
exit 1
fi
# Magma-1.12.2/releases/download/88659fb/Magma-1.12.2-88659fb-server.jar
# Magma-1.20.1/releases/download/adec9ce/magma-1.20.1-47.2.17-adec9ce-server.jar
if [[ ${VERSION} = "1.12.2" ]]; then
fileName="Magma-${VERSION}-${MAGMA_MAINTAINED_TAG}-server.jar"
else
if [ -z $FORGE_VERSION ]; then
log "ERROR the variable FORGE_VERSION is not specified"
exit 1
fi
fileName="magma-${VERSION}-${FORGE_VERSION}-${MAGMA_MAINTAINED_TAG}-server.jar"
fi
downloadUrl="https://github.com/magmamaintained/Magma-${VERSION}/releases/download/${MAGMA_MAINTAINED_TAG}/${fileName}"
if ! SERVER=$(get --output-filename --skip-up-to-date --output /data "$downloadUrl"); then
log "ERROR: failed to download Magma Maintained server jar from $downloadUrl"
exit 1
fi
export SERVER
export FAMILY=HYBRID
exec "${SCRIPTS:-/}start-spiget" "$@"

View File

@@ -10,7 +10,6 @@ resultsFile=/data/.install-modrinth.env
: "${MODRINTH_LOADER:=}" : "${MODRINTH_LOADER:=}"
: "${MODRINTH_VERSION:=${MODRINTH_VERSION_ID:-}}" : "${MODRINTH_VERSION:=${MODRINTH_VERSION_ID:-}}"
: "${MODRINTH_IGNORE_MISSING_FILES:=}" : "${MODRINTH_IGNORE_MISSING_FILES:=}"
: "${MODRINTH_EXCLUDE_FILES:=}"
if [[ ! $MODRINTH_MODPACK ]]; then if [[ ! $MODRINTH_MODPACK ]]; then
log "ERROR: MODRINTH_MODPACK must be set when using TYPE/MOD_PLATFORM of MODRINTH" log "ERROR: MODRINTH_MODPACK must be set when using TYPE/MOD_PLATFORM of MODRINTH"
@@ -53,7 +52,6 @@ setArg() {
setArg --loader MODRINTH_LOADER setArg --loader MODRINTH_LOADER
setArg --version MODRINTH_VERSION setArg --version MODRINTH_VERSION
setArg --default-version-type MODRINTH_DEFAULT_VERSION_TYPE setArg --default-version-type MODRINTH_DEFAULT_VERSION_TYPE
setArg --exclude-files MODRINTH_EXCLUDE_FILES
if ! mc-image-helper install-modrinth-modpack "${args[@]}"; then if ! mc-image-helper install-modrinth-modpack "${args[@]}"; then
log "ERROR failed to install Modrinth modpack" log "ERROR failed to install Modrinth modpack"

View File

@@ -1,30 +0,0 @@
#!/bin/bash
: "${NEOFORGE_VERSION:=latest}"
: "${NEOFORGE_FORCE_REINSTALL:=false}}"
# shellcheck source=start-utils
. "${SCRIPTS:-$(dirname "$0")}/start-utils"
isDebugging && set -x
resultsFile=/data/.run-neoforge.env
if ! mc-image-helper install-neoforge \
--output-directory=/data \
--results-file=${resultsFile} \
--minecraft-version="${VERSION}" \
--neoforge-version="${NEOFORGE_VERSION}" \
--force-reinstall="${NEOFORGE_FORCE_REINSTALL}"; then
log "ERROR failed to install Forge"
exit 1
fi
# grab SERVER and export it
set -a
# shellcheck disable=SC1090
source ${resultsFile}
set +a
export FAMILY=FORGE
exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@@ -88,7 +88,7 @@ elif versionLessThan 1.18.1; then
fi fi
fi fi
if isTrue "${ENABLE_ROLLING_LOGS:-false}"; then if isTrue ${ENABLE_ROLLING_LOGS:-false}; then
if ! ${canUseRollingLogs}; then if ! ${canUseRollingLogs}; then
log "ERROR: Using rolling logs is currently not possible in the selected version due to CVE-2021-44228" log "ERROR: Using rolling logs is currently not possible in the selected version due to CVE-2021-44228"
exit 1 exit 1
@@ -139,7 +139,7 @@ fi
if isTrue "${USE_AIKAR_FLAGS}"; then if isTrue "${USE_AIKAR_FLAGS}"; then
# From https://mcflags.emc.gs/ # From https://mcflags.emc.gs/
if [[ $MAX_MEMORY ]] && (( $(normalizeMemSize "${MAX_MEMORY}") >= $(normalizeMemSize 12g) )); then if (( $(normalizeMemSize "${MAX_MEMORY}") >= $(normalizeMemSize 12g) )); then
log "Using Aikar's >12GB flags" log "Using Aikar's >12GB flags"
G1NewSizePercent=40 G1NewSizePercent=40
G1MaxNewSizePercent=50 G1MaxNewSizePercent=50
@@ -192,6 +192,12 @@ if isTrue "${USE_SIMD_FLAGS}"; then
" "
fi fi
if isTrue "${DEBUG_MEMORY}"; then
log "Memory usage and availability (in MB)"
uname -a
free -m
fi
if [[ ${INIT_MEMORY} || ${MAX_MEMORY} ]]; then if [[ ${INIT_MEMORY} || ${MAX_MEMORY} ]]; then
log "Setting initial memory to ${INIT_MEMORY:=${MEMORY}} and max to ${MAX_MEMORY:=${MEMORY}}" log "Setting initial memory to ${INIT_MEMORY:=${MEMORY}} and max to ${MAX_MEMORY:=${MEMORY}}"
if [[ ${INIT_MEMORY} ]]; then if [[ ${INIT_MEMORY} ]]; then
@@ -215,11 +221,7 @@ function copyFilesForCurseForge() {
cp -f /data/eula.txt "${FTB_DIR}/" cp -f /data/eula.txt "${FTB_DIR}/"
} }
if versionLessThan 'b1.8'; then if versionLessThan 1.7; then
echo "
DISABLE_HEALTHCHECK=true
" > /data/.mc-health.env
elif versionLessThan 1.7; then
echo " echo "
MC_HEALTH_EXTRA_ARGS=( MC_HEALTH_EXTRA_ARGS=(
--use-server-list-ping --use-server-list-ping
@@ -236,9 +238,6 @@ mcServerRunnerArgs=(
if [[ ${STOP_SERVER_ANNOUNCE_DELAY} ]]; then if [[ ${STOP_SERVER_ANNOUNCE_DELAY} ]]; then
mcServerRunnerArgs+=(--stop-server-announce-delay "${STOP_SERVER_ANNOUNCE_DELAY}s") mcServerRunnerArgs+=(--stop-server-announce-delay "${STOP_SERVER_ANNOUNCE_DELAY}s")
fi fi
if isTrue "${ENABLE_SSH}"; then
mcServerRunnerArgs+=(--remote-console)
fi
if [[ ${TYPE} == "CURSEFORGE" && "${SERVER}" ]]; then if [[ ${TYPE} == "CURSEFORGE" && "${SERVER}" ]]; then
copyFilesForCurseForge copyFilesForCurseForge

28
scripts/start-setupModconfig Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
# If supplied with a URL for a config (simple zip of configurations), download it and unpack
if [[ "$MODCONFIG" ]]; then
case "X$MODCONFIG" in
X[Hh][Tt][Tt][Pp]*[Zz][iI][pP])
log "Downloading mod/plugin configs via HTTP"
log " from $MODCONFIG ..."
curl -sSL -o /tmp/modconfig.zip "$MODCONFIG"
if [ "$FAMILY" = "SPIGOT" ]; then
mkdir -p /data/plugins
unzip -o -d /data/plugins /tmp/modconfig.zip
else
mkdir -p /data/config
unzip -o -d /data/config /tmp/modconfig.zip
fi
rm -f /tmp/modconfig.zip
;;
*)
log "Invalid URL given for modconfig: Must be HTTP or HTTPS and a ZIP file"
;;
esac
fi
exec "${SCRIPTS:-/}start-setupMounts" "$@"

View File

@@ -229,17 +229,16 @@ function handleGenericPacks() {
function handleModrinthProjects() { function handleModrinthProjects() {
: "${MODRINTH_PROJECTS:=}" : "${MODRINTH_PROJECTS:=}"
: "${MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES:=false}"
: "${MODRINTH_ALLOWED_VERSION_TYPE:=release}" : "${MODRINTH_ALLOWED_VERSION_TYPE:=release}"
: "${MODRINTH_DOWNLOAD_DEPENDENCIES:=none}"
if [[ -v MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES ]]; then
log "WARNING The variable MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES is removed."
log " Use MODRINTH_DOWNLOAD_DEPENDENCIES=optional instead"
fi
if [[ $MODRINTH_PROJECTS ]] && isFamily HYBRID FORGE FABRIC SPIGOT; then if [[ $MODRINTH_PROJECTS ]] && isFamily HYBRID FORGE FABRIC SPIGOT; then
if isFamily HYBRID FORGE; then if isFamily HYBRID FORGE; then
loader=forge loader=forge
elif isFamily FABRIC; then
loader=fabric
else else
# we're left with Bukkit/Spigot down-lines where plugins seem to be
loader="${TYPE,,}" loader="${TYPE,,}"
fi fi
mc-image-helper modrinth \ mc-image-helper modrinth \
@@ -247,7 +246,7 @@ function handleModrinthProjects() {
--projects="${MODRINTH_PROJECTS}" \ --projects="${MODRINTH_PROJECTS}" \
--game-version="${VERSION}" \ --game-version="${VERSION}" \
--loader="$loader" \ --loader="$loader" \
--download-dependencies="$MODRINTH_DOWNLOAD_DEPENDENCIES" \ --download-optional-dependencies="$MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES" \
--allowed-version-type="$MODRINTH_ALLOWED_VERSION_TYPE" --allowed-version-type="$MODRINTH_ALLOWED_VERSION_TYPE"
fi fi
} }
@@ -299,26 +298,4 @@ if usesMods || usesPlugins; then
handleCurseForgeFiles handleCurseForgeFiles
fi fi
# If supplied with a URL for a config (simple zip of configurations), download it and unpack exec "${SCRIPTS:-/}start-setupModconfig" "$@"
if [[ "$MODCONFIG" ]]; then
case "X$MODCONFIG" in
X[Hh][Tt][Tt][Pp]*[Zz][iI][pP])
log "Downloading mod/plugin configs via HTTP"
log " from $MODCONFIG ..."
curl -sSL -o /tmp/modconfig.zip "$MODCONFIG"
if [ "$FAMILY" = "SPIGOT" ]; then
mkdir -p /data/plugins
unzip -o -d /data/plugins /tmp/modconfig.zip
else
mkdir -p /data/config
unzip -o -d /data/config /tmp/modconfig.zip
fi
rm -f /tmp/modconfig.zip
;;
*)
log "Invalid URL given for modconfig: Must be HTTP or HTTPS and a ZIP file"
;;
esac
fi
exec "${SCRIPTS:-/}start-setupMounts" "$@"

View File

@@ -2,37 +2,20 @@
set -euo pipefail set -euo pipefail
IFS=$'\n\t' IFS=$'\n\t'
: "${EXISTING_OPS_FILE:=SKIP}"
: "${EXISTING_WHITELIST_FILE:=SKIP}"
# shellcheck source=start-utils # shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils" . "${SCRIPTS:-/}start-utils"
isDebugging && set -x isDebugging && set -x
if [[ -v APPEND_OPS ]] && isTrue "${APPEND_OPS}"; then
EXISTING_OPS_FILE=MERGE
elif [[ -v OVERRIDE_OPS ]] && isTrue "${OVERRIDE_OPS}"; then
EXISTING_OPS_FILE=SYNCHRONIZE
fi
if [[ -v APPEND_WHITELIST ]] && isTrue "${APPEND_WHITELIST}"; then
EXISTING_WHITELIST_FILE=MERGE
elif [[ -v OVERRIDE_WHITELIST ]] && isTrue "${OVERRIDE_WHITELIST}"; then
EXISTING_WHITELIST_FILE=SYNCHRONIZE
fi
sharedArgs=(--version="$VERSION") sharedArgs=(--version="$VERSION")
if isFalse "${ONLINE_MODE:-true}"; then
sharedArgs+=( --offline )
fi
if [[ -v OPS_FILE ]]; then if [[ -v OPS_FILE ]]; then
existing="$EXISTING_OPS_FILE"
if [[ "$EXISTING_OPS_FILE" = SYNC_FILE_MERGE_LIST ]]; then
existing=SYNCHRONIZE
fi
mc-image-helper manage-users \ mc-image-helper manage-users \
"${sharedArgs[@]}" \ "${sharedArgs[@]}" \
--type=JAVA_OPS \ --type=JAVA_OPS \
--input-is-file \ --input-is-file \
--existing="${existing}" \
"$OPS_FILE" "$OPS_FILE"
fi fi
if [[ -v OPS ]]; then if [[ -v OPS ]]; then
@@ -40,44 +23,29 @@ if [[ -v OPS ]]; then
if isTrue "${APPEND_OPS:-false}" || isFalse "${OVERRIDE_OPS:-true}"; then if isTrue "${APPEND_OPS:-false}" || isFalse "${OVERRIDE_OPS:-true}"; then
args+=(--append-only) args+=(--append-only)
fi fi
existing="$EXISTING_OPS_FILE"
if [[ "$EXISTING_OPS_FILE" = SYNC_FILE_MERGE_LIST ]]; then
existing=MERGE
fi
# shellcheck disable=SC2086 # shellcheck disable=SC2086
mc-image-helper manage-users \ mc-image-helper manage-users \
"${sharedArgs[@]}" "${args[@]}" \ "${sharedArgs[@]}" "${args[@]}" \
--type=JAVA_OPS \ --type=JAVA_OPS \
--existing="${existing}" \
$OPS $OPS
fi fi
if [[ -v WHITELIST_FILE ]]; then if [[ -v WHITELIST_FILE ]]; then
existing="$EXISTING_WHITELIST_FILE"
if [[ "$EXISTING_WHITELIST_FILE" = SYNC_FILE_MERGE_LIST ]]; then
existing=SYNCHRONIZE
fi
mc-image-helper manage-users \ mc-image-helper manage-users \
"${sharedArgs[@]}" \ "${sharedArgs[@]}" \
--type=JAVA_WHITELIST \ --type=JAVA_WHITELIST \
--input-is-file \ --input-is-file \
--existing="${existing}" \ "$WHITELIST_FILE"
"$WHITELIST_FILE"
fi fi
if [[ -v WHITELIST ]]; then if [[ -v WHITELIST ]]; then
args=() args=()
if isTrue "${APPEND_WHITELIST:-false}" || isFalse "${OVERRIDE_WHITELIST:-true}"; then if isTrue "${APPEND_WHITELIST:-false}" || isFalse "${OVERRIDE_WHITELIST:-true}"; then
args+=(--append-only) args+=(--append-only)
fi fi
existing="$EXISTING_WHITELIST_FILE"
if [[ "$EXISTING_WHITELIST_FILE" = SYNC_FILE_MERGE_LIST ]]; then
existing=MERGE
fi
# shellcheck disable=SC2086 # shellcheck disable=SC2086
mc-image-helper manage-users \ mc-image-helper manage-users \
"${sharedArgs[@]}" "${args[@]}" \ "${sharedArgs[@]}" "${args[@]}" \
--type=JAVA_WHITELIST \ --type=JAVA_WHITELIST \
--existing="${existing}" \
$WHITELIST $WHITELIST
fi fi

View File

@@ -8,29 +8,152 @@
: "${SKIP_SERVER_PROPERTIES:=false}" : "${SKIP_SERVER_PROPERTIES:=false}"
: "${ENABLE_WHITELIST:=}" : "${ENABLE_WHITELIST:=}"
# FUNCTIONS
function setServerPropValue {
local prop=$1
local value=$2
# normalize booleans
case ${value^^} in
TRUE|FALSE)
value=${value,,} ;;
esac
if [[ $prop =~ password ]]; then
showValue="*****"
else
showValue="$value"
fi
if [ -f "$SERVER_PROPERTIES" ] && grep "${prop}" "$SERVER_PROPERTIES" > /dev/null; then
debug "Setting ${prop} to '${showValue}' in ${SERVER_PROPERTIES}"
sed -i "/^${prop}\s*=/ c ${prop}=${value//\\/\\\\}" "$SERVER_PROPERTIES"
else
debug "Adding ${prop} with '${showValue}' in ${SERVER_PROPERTIES}"
echo "${prop}=${value}" >> "$SERVER_PROPERTIES"
fi
}
function setServerProp {
local prop=$1
local varName=$2
if [ -v $varName ]; then
setServerPropValue "$prop" "${!varName}"
fi
}
function customizeServerProps { function customizeServerProps {
local firstSetup=$1 local firstSetup=$1
# Whitelist processing # Whitelist processing
if [ -n "$WHITELIST" ] || [ -n "$WHITELIST_FILE" ] || isTrue "${ENABLE_WHITELIST}"; then if [ -n "$WHITELIST" ] || [ -n "$WHITELIST_FILE" ] || isTrue "${ENABLE_WHITELIST}"; then
log "Enabling whitelist functionality" log "Enabling whitelist functionality"
WHITELIST_PROP=true setServerPropValue "white-list" "true"
ENFORCE_WHITELIST=true setServerPropValue "enforce-whitelist" "true"
export WHITELIST_PROP ENFORCE_WHITELIST
elif isTrue "$firstSetup" || isFalse "${ENABLE_WHITELIST}"; then elif isTrue "$firstSetup" || isFalse "${ENABLE_WHITELIST}"; then
log "Disabling whitelist functionality" log "Disabling whitelist functionality"
WHITELIST_PROP=false setServerPropValue "white-list" "false"
export WHITELIST_PROP setServerProp "enforce-whitelist" ENFORCE_WHITELIST
fi fi
# normalize MOTD # normalize MOTD
if [[ ${TYPE^^} = LIMBO ]]; then if [[ ${TYPE^^} = LIMBO ]]; then
if [[ $MOTD ]] && ! [[ $MOTD =~ ^{ ]]; then if [[ $MOTD ]] && ! [[ $MOTD =~ ^{ ]]; then
# shellcheck disable=SC2089
MOTD="{\"text\":\"${MOTD}\"}" MOTD="{\"text\":\"${MOTD}\"}"
fi fi
fi fi
if [[ -v MODE ]]; then setServerProp "server-name" SERVER_NAME
setServerProp "server-ip" SERVER_IP
setServerProp "server-port" SERVER_PORT
setServerProp "allow-nether" ALLOW_NETHER
setServerProp "announce-player-achievements" ANNOUNCE_PLAYER_ACHIEVEMENTS
setServerProp "enable-command-block" ENABLE_COMMAND_BLOCK
setServerProp "spawn-animals" SPAWN_ANIMALS
setServerProp "spawn-monsters" SPAWN_MONSTERS
setServerProp "spawn-npcs" SPAWN_NPCS
setServerProp "spawn-protection" SPAWN_PROTECTION
setServerProp "generate-structures" GENERATE_STRUCTURES
setServerProp "view-distance" VIEW_DISTANCE
setServerProp "hardcore" HARDCORE
setServerProp "snooper-enabled" SNOOPER_ENABLED
setServerProp "max-build-height" MAX_BUILD_HEIGHT
setServerProp "force-gamemode" FORCE_GAMEMODE
setServerProp "max-tick-time" MAX_TICK_TIME
setServerProp "enable-query" ENABLE_QUERY
setServerProp "query.port" QUERY_PORT
setServerProp "enable-rcon" ENABLE_RCON
setServerProp "rcon.password" RCON_PASSWORD
setServerProp "rcon.port" RCON_PORT
setServerProp "max-players" MAX_PLAYERS
setServerProp "max-world-size" MAX_WORLD_SIZE
setServerProp "level-name" LEVEL
setServerProp "level-seed" SEED
setServerProp "pvp" PVP
setServerProp "generator-settings" GENERATOR_SETTINGS
setServerProp "online-mode" ONLINE_MODE
setServerProp "allow-flight" ALLOW_FLIGHT
setServerProp "resource-pack" RESOURCE_PACK
setServerProp "resource-pack-sha1" RESOURCE_PACK_SHA1
setServerProp "require-resource-pack" RESOURCE_PACK_ENFORCE
setServerProp "player-idle-timeout" PLAYER_IDLE_TIMEOUT
setServerProp "broadcast-console-to-ops" BROADCAST_CONSOLE_TO_OPS
setServerProp "broadcast-rcon-to-ops" BROADCAST_RCON_TO_OPS
setServerProp "enable-jmx-monitoring" ENABLE_JMX
setServerProp "sync-chunk-writes" SYNC_CHUNK_WRITES
setServerProp "enable-status" ENABLE_STATUS
setServerProp "entity-broadcast-range-percentage" ENTITY_BROADCAST_RANGE_PERCENTAGE
setServerProp "function-permission-level" FUNCTION_PERMISSION_LEVEL
setServerProp "network-compression-threshold" NETWORK_COMPRESSION_THRESHOLD
setServerProp "op-permission-level" OP_PERMISSION_LEVEL
setServerProp "prevent-proxy-connections" PREVENT_PROXY_CONNECTIONS
setServerProp "use-native-transport" USE_NATIVE_TRANSPORT
setServerProp "simulation-distance" SIMULATION_DISTANCE
setServerProp "previews-chat" PREVIEWS_CHAT
setServerProp "enforce-secure-profile" ENFORCE_SECURE_PROFILE
setServerProp "initial-enabled-packs" INITIAL_ENABLED_PACKS
setServerProp "initial-disabled-packs" INITIAL_DISABLED_PACKS
if [[ $MOTD ]]; then
setServerPropValue "motd" "$(echo "$MOTD" | mc-image-helper asciify)"
fi
[[ $LEVEL_TYPE ]] && setServerPropValue "level-type" "${LEVEL_TYPE^^}"
if [ -n "$DIFFICULTY" ]; then
case ${DIFFICULTY,,} in
peaceful|0)
if versionLessThan 1.13; then
DIFFICULTY=0
else
DIFFICULTY=peaceful
fi
;;
easy|1)
if versionLessThan 1.13; then
DIFFICULTY=1
else
DIFFICULTY=easy
fi
;;
normal|2)
if versionLessThan 1.13; then
DIFFICULTY=2
else
DIFFICULTY=normal
fi
;;
hard|3)
if versionLessThan 1.13; then
DIFFICULTY=3
else
DIFFICULTY=hard
fi
;;
*)
log "DIFFICULTY must be peaceful, easy, normal, or hard."
exit 1
;;
esac
setServerPropValue "difficulty" "$DIFFICULTY"
fi
if [ -n "$MODE" ]; then
log "Setting mode" log "Setting mode"
case ${MODE,,} in case ${MODE,,} in
su*|0) su*|0)
@@ -66,69 +189,8 @@ function customizeServerProps {
exit 1 exit 1
;; ;;
esac esac
setServerPropValue "gamemode" "$MODE"
fi fi
if [[ -v DIFFICULTY ]]; then
case ${DIFFICULTY,,} in
peaceful|0)
if versionLessThan 1.13; then
DIFFICULTY=0
else
DIFFICULTY=peaceful
fi
;;
easy|1)
if versionLessThan 1.13; then
DIFFICULTY=1
else
DIFFICULTY=easy
fi
;;
normal|2)
if versionLessThan 1.13; then
DIFFICULTY=2
else
DIFFICULTY=normal
fi
;;
hard|3)
if versionLessThan 1.13; then
DIFFICULTY=3
else
DIFFICULTY=hard
fi
;;
*)
log "DIFFICULTY must be peaceful, easy, normal, or hard."
exit 1
;;
esac
fi
if [[ -v LEVEL_TYPE ]]; then
LEVEL_TYPE="${LEVEL_TYPE^^}"
fi
setPropertiesArgs=(
--definitions "/image/property-definitions.json"
)
if [[ -v CUSTOM_SERVER_PROPERTIES ]]; then
setPropertiesArgs+=(--custom-properties "$CUSTOM_SERVER_PROPERTIES")
fi
if [[ -v SERVER_PROPERTIES_ESCAPE_UNICODE ]]; then
if isTrue "$SERVER_PROPERTIES_ESCAPE_UNICODE"; then
setPropertiesArgs+=(--escape-unicode)
fi
elif versionLessThan '1.20'; then
setPropertiesArgs+=(--escape-unicode)
fi
handleDebugMode
if ! mc-image-helper set-properties "${setPropertiesArgs[@]}" "$SERVER_PROPERTIES"; then
log "ERROR: failed to update server.properties"
exit 1
fi
} }
# Deploy server.properties file # Deploy server.properties file
@@ -145,10 +207,10 @@ if ! isTrue "${SKIP_SERVER_PROPERTIES}"; then
# which shows up in the server listing in the client # which shows up in the server listing in the client
if ! [ -v MOTD ]; then if ! [ -v MOTD ]; then
# snapshot is the odd case where we have to look at version to identify that label # snapshot is the odd case where we have to look at version to identify that label
if [[ ${DECLARED_TYPE} == "VANILLA" && ${VERSION} == "SNAPSHOT" ]]; then if [[ ${ORIGINAL_TYPE} == "VANILLA" && ${VERSION} == "SNAPSHOT" ]]; then
label=SNAPSHOT label=SNAPSHOT
else else
label=${DECLARED_TYPE} label=${ORIGINAL_TYPE}
fi fi
# Convert label to title-case # Convert label to title-case

0
tests/setuponlytests/cf_files/require.sh Executable file → Normal file
View File

View File

View File

0
tests/setuponlytests/curseforge/require.sh Executable file → Normal file
View File

0
tests/setuponlytests/icon-file-exact/require.sh Executable file → Normal file
View File

0
tests/setuponlytests/icon-gif-multiframe/require.sh Executable file → Normal file
View File

0
tests/setuponlytests/icon-png-atscale/require.sh Executable file → Normal file
View File

0
tests/setuponlytests/pufferfish/require.sh Executable file → Normal file
View File

0
tests/setuponlytests/quilt/require.sh Executable file → Normal file
View File

View File

@@ -1 +0,0 @@
[[ $EXTENDED_TESTS ]] || exit 1

View File

View File

0
tests/setuponlytests/test.sh Executable file → Normal file
View File

View File

View File

0
tests/setuponlytests/world_from_tar/require.sh Executable file → Normal file
View File

0
tests/setuponlytests/world_from_tarbz2/require.sh Executable file → Normal file
View File

0
tests/setuponlytests/world_from_tarzst/require.sh Executable file → Normal file
View File