diff --git a/docs/types-and-platforms/server-types/cleanroom.md b/docs/types-and-platforms/server-types/cleanroom.md new file mode 100644 index 00000000000..cec7b5c4538 --- /dev/null +++ b/docs/types-and-platforms/server-types/cleanroom.md @@ -0,0 +1,67 @@ +A [Cleanroom server](https://cleanroommc.com/) can be automatically downloaded, upgraded, and run by setting the environment variable `TYPE` to "CLEANROOM". + +!!! example + + ```shell + docker run -e TYPE=CLEANROOM ... + ``` + + or in a compose file + ```yaml + environment: + TYPE: CLEANROOM + ``` + +Cleanroom is a loader specified for Minecraft 1.12.2, since then `VERSION` will be ignored. By default, the latest version of Cleanroom will be selected. You can also choose a specific Cleanroom version by setting `CLEANROOM_LOADER_VERSION` with that version, such as "0.6.13-alpha". + +!!! example + + ```shell + docker run -e TYPE=CLEANROOM -e CLEANROOM_LOADER_VERSION=0.6.13-alpha ... + ``` + + or in a compose file + ```yaml + environment: + TYPE: CLEANROOM + CLEANROOM_LOADER_VERSION: "0.6.13-alpha" + ``` + +You can also specify installer version. By default, the latest version of installer will be selected. You can also choose a specific installer version by setting `CLEANROOM_INSTALLER_VERSION` with that version, such as "0.1.4". + +!!! example + + ```shell + docker run -e TYPE=CLEANROOM -e CLEANROOM_INSTALLER_VERSION=0.1.4 ... + ``` + + or in a compose file + ```yaml + environment: + TYPE: CLEANROOM + CLEANROOM_INSTALLER_VERSION: "0.1.4" + ``` + +!!! note + + You do not need to setup this unless required. The installer come from Cleanroom support multi-version installation compare to legacy installer. + +To use a pre-downloaded Cleanroom installer, place it in a location mounted into the container and specify the container path with `CLEANROOM_FROM_FILE`. To download a Cleanroom installer from a custom location, such as your own file repository, specify the URL with `CLEANROOM_FROM_URL`. + +In both of the cases above, there is no need for the `CLEANROOM_LOADER_VERSION` or `CLEANROOM_INSTALLER_VERSION` variables. + +!!! note + + By default, legacy installer are supported but limited support will be provided if asked. + +!!! note + + If an error occurred while installing Cleanroom, it might be possible to resolve by temporarily setting `CLEANROOM_FORCE_REINSTALL` to "true". Be sure to remove that variable after successfully starting the server. + +Specified installer version is configurable via environment variables: + +- `CLEANROOM_INSTALLER_VERSION`: used to specific installer version, default is latest + +URLs configurable via environment variables: + +- `CLEANROOM_MAVEN_URL`: default is https://maven.cleanroommc.com diff --git a/examples/cleanroom/compose.yml b/examples/cleanroom/compose.yml index 8c4c803e742..5539079b24e 100644 --- a/examples/cleanroom/compose.yml +++ b/examples/cleanroom/compose.yml @@ -3,13 +3,30 @@ services: mc: image: itzg/minecraft-server - environment: - EULA: true - TYPE: FORGE - FORGE_INSTALLER_URL: https://github.com/CleanroomMC/Cleanroom/releases/download/0.2.4-alpha/cleanroom-0.2.4-alpha-installer.jar ports: + # expose the Minecraft server port outside of container - "25565:25565" + environment: + # REQUIRED for all types + EULA: "TRUE" + + # Set server type (vs the default of vanilla) + TYPE: CLEANROOM + DEBUG: "true" + + # Optional (check doc for usage) + # CLEANROOM_LOADER_VERSION: 0.0.0-alpha + # CLEANROOM_INSTALLER_VERSION: 0.1.4 + # Using either follow env will ignore 2 above + # CLEANROOM_FROM_LOCAL: ./installer.jar + # CLEANROOM_FROM_URL: https:// volumes: - - mc-data:/data + # use a named, managed volume for data volume + - mc_data:/data + # attach local host directory "mods" in same directory as this compose file + # all mods in this directory get copied into /data/mods at startup + - ./mods:/mods:ro + volumes: - mc-data: \ No newline at end of file + # declared the named volume, but use default/local storage engine + mc-data: {} diff --git a/scripts/start-configuration b/scripts/start-configuration index 48f47475d9b..eb531377f4b 100755 --- a/scripts/start-configuration +++ b/scripts/start-configuration @@ -283,6 +283,10 @@ case "${TYPE^^}" in exec "$(dirname "$0")/start-deployForge" "$@" ;; + CLEANROOM) + exec "$(dirname "$0")/start-deployCleanroom" "$@" + ;; + NEOFORGE|NEOFORGED) exec "$(dirname "$0")/start-deployNeoForge" "$@" ;; @@ -363,7 +367,8 @@ case "${TYPE^^}" in logError "Invalid TYPE: '$TYPE'" logError "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FOLIA, PURPUR, FABRIC, QUILT," logError " SPONGEVANILLA, CUSTOM, MAGMA, MOHIST, GTNH, AIRPLANE, PUFFERFISH," - logError " CANYON, LIMBO, NANOLIMBO, CRUCIBLE, LEAF, YOUER, BANNER, NEOFORGE" + logError " CANYON, LIMBO, NANOLIMBO, CRUCIBLE, LEAF, YOUER, BANNER, NEOFORGE," + logError " CLEANROOM" exit 1 ;; diff --git a/scripts/start-deployCleanroom b/scripts/start-deployCleanroom new file mode 100644 index 00000000000..cb50b7b4282 --- /dev/null +++ b/scripts/start-deployCleanroom @@ -0,0 +1,50 @@ +#!/bin/bash + +: "${CLEANROOM_FORCE_REINSTALL:=false}" + +# shellcheck source=start-utils +. "${SCRIPTS:-$(dirname "$0")}/start-utils" +isDebugging && set -x +resultsFile=/data/.run-cleanroom.env + +declare -a cleanroom_installer_options +cleanroom_installer_options+=(--output-directory=/data) +cleanroom_installer_options+=(--results-file="${resultsFile}") +cleanroom_installer_options+=(--force-reinstall="${CLEANROOM_FORCE_REINSTALL}") + +if [[ ${CLEANROOM_LOADER_VERSION} ]]; then + cleanroom_installer_options+=(--loader-version="${CLEANROOM_LOADER_VERSION}") +fi + +if [[ ${CLEANROOM_INSTALLER_VERSION} ]]; then + cleanroom_installer_options+=(--installer-version="${CLEANROOM_INSTALLER_VERSION}") +fi + +if [[ ${CLEANROOM_FROM_FILE} ]]; then + cleanroom_installer_options+=(--from-local-file="${CLEANROOM_FROM_FILE}") +fi + +if [[ ${CLEANROOM_FROM_URL} ]]; then + cleanroom_installer_options+=(--from-url="${CLEANROOM_FROM_URL}") +fi + +if [[ ${CLEANROOM_MAVEN_URL} ]]; then + cleanroom_installer_options+=(--cleanroom-maven-url="${CLEANROOM_MAVEN_URL}") +fi + +if ! mc-image-helper install-cleanroom "${cleanroom_installer_options[@]}" ; then + if [[ ${CLEANROOM_FROM_FILE} ]]; then + logError "Failed to install Cleanroom given installer ${CLEANROOM_FROM_FILE}" + elif [[ ${CLEANROOM_FROM_URL:-} ]]; then + logError "Failed to install Cleanroom from ${CLEANROOM_FROM_URL}" + else + logError "Failed to install Cleanroom" + fi + exit 1 +fi + +applyResultsFile ${resultsFile} + +export FAMILY=FORGE + +exec "$(dirname "$0")/start-setupWorld" "$@"