Add initial support for Quilt server (#1514)

This commit is contained in:
Felix 2022-05-13 14:31:36 +02:00 committed by GitHub
parent 56b9326c09
commit 691be801d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 106 additions and 0 deletions

View File

@ -350,6 +350,33 @@ docker run -d -v /path/on/host:/data ... \
See the [Working with mods and plugins](#working-with-mods-and-plugins) section to set up Fabric mods and configuration.
### Running a Quilt Server
Enable [Quilt server](https://quiltmc.org/) mode by adding a `-e TYPE=QUILT` to your command-line.
```
docker run -d -v /path/on/host:/data \
-e TYPE=QUILT \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
```
By default, the container will install the latest [quilt server launcher](https://quiltmc.org/install/server/), using the latest [quilt-installer](https://github.com/QuiltMC/quilt-installer) against the minecraft version you have defined with `VERSION` (defaulting to the latest vanilla release of the game).
A specific loader or installer version other than the latest can be requested using `QUILT_LOADER_VERSION` and `QUILT_INSTALLER_VERSION` respectively, such as:
```
docker run -d -v /path/on/host:/data ... \
-e TYPE=QUILT \
-e QUILT_LOADER_VERSION=0.16.0 \
-e QUILT_INSTALLER_VERSION=0.4.1
```
> If you wish to use an alternative launcher you can:
> * Provide the path to a custom launcher jar available to the container with `QUILT_LAUNCHER`, relative to `/data` (such as `-e QUILT_LAUNCHER=quilt-server-custom.jar`)
> * Provide the URL to a custom launcher jar with `QUILT_LAUNCHER_URL` (such as `-e QUILT_LAUNCHER_URL=http://HOST/quilt-server-custom.jar`)
See the [Working with mods and plugins](#working-with-mods-and-plugins) section to set up Quilt mods and configuration.
### Running a Bukkit/Spigot server
Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT` or `-e TYPE=SPIGOT` to your command-line.

View File

@ -176,6 +176,10 @@ case "${TYPE^^}" in
exec "${SCRIPTS:-/}start-deployFabric" "$@"
;;
QUILT)
exec "${SCRIPTS:-/}start-deployQuilt" "$@"
;;
FTBA)
evaluateJavaCompatibilityForForge
exec "${SCRIPTS:-/}start-deployFTBA" "$@"

60
scripts/start-deployQuilt Executable file
View File

@ -0,0 +1,60 @@
#!/bin/bash
set -eu
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
requireVar VANILLA_VERSION
export TYPE=QUILT
: "${QUILT_LAUNCHER:=}"
: "${QUILT_LAUNCHER_URL:=}"
: "${QUILT_INSTALLER_URL:=}"
: "${QUILT_INSTALLER_VERSION:=LATEST}"
: "${QUILT_LOADER_VERSION:=LATEST}"
isDebugging && set -x
# Custom quilt jar
if [[ $QUILT_LAUNCHER ]]; then
export SERVER=${QUILT_LAUNCHER}
# Custom quilt jar url
elif [[ $QUILT_LAUNCHER_URL ]]; then
export SERVER=quilt-server-$(echo -n "$QUILT_LAUNCHER_URL" | mc-image-helper hash)
# Official quilt installer
else
if [[ ${QUILT_INSTALLER_VERSION^^} = LATEST ]]; then
log "Checking Quilt Installer version information."
QUILT_INSTALLER_VERSION=$(maven-metadata-release https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/maven-metadata.xml)
fi
if [[ ${QUILT_LOADER_VERSION^^} = LATEST ]]; then
log "Checking Quilt Loader version information."
QUILT_LOADER_VERSION=$(maven-metadata-release https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-loader/maven-metadata.xml)
fi
export INSTALLER=quilt-installer-${QUILT_INSTALLER_VERSION}.jar
export SERVER=quilt-server-${VANILLA_VERSION}-${QUILT_LOADER_VERSION}-launch.jar
export QUILT_INSTALLER_URL="https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/${QUILT_INSTALLER_VERSION}/quilt-installer-${QUILT_INSTALLER_VERSION}.jar"
fi
if [[ ! -e ${SERVER} && ! -z ${QUILT_INSTALLER_URL} ]]; then
log "Downloading and installing $QUILT_INSTALLER_URL ..."
if ! get -o "$INSTALLER" "$QUILT_INSTALLER_URL"; then
log "Failed to download from given location $QUILT_INSTALLER_URL"
exit 2
fi
if ! java -jar ${INSTALLER} install server ${VANILLA_VERSION} ${QUILT_LOADER_VERSION} --install-dir=./ --download-server; then
log "Failed to install $INSTALLER"
exit 2
fi
if ! mv quilt-server-launch.jar ${SERVER}; then
log "Failed to rename $SERVER"
exit 2
fi
fi
if [[ ! -e ${SERVER} ]]; then
log "$SERVER does not exist, cannot launch server!"
exit 1
fi
export FAMILY=FABRIC
exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@ -0,0 +1,13 @@
version: "3"
services:
mc:
restart: "no"
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
environment:
EULA: "TRUE"
SETUP_ONLY: "TRUE"
TYPE: QUILT
VERSION: ${MINECRAFT_VERSION:-LATEST}
volumes:
- ./data:/data

View File

@ -0,0 +1 @@
[[ $MINECRAFT_VERSION == LATEST ]] || exit 1

View File

@ -0,0 +1 @@
mc-image-helper assert fileExists "/data/quilt-server-*-launch.jar"