diff --git a/README.md b/README.md index e711bd01..5b9296f0 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,7 @@ up: This is the easiest way if you are using an ephemeral `/data` filesystem, or downloading a world with the `WORLD` option. -There are two additional volumes that can be mounted; `/mods` and `/config`. +There are two additional volumes that can be mounted; `/mods` and `/config`. Any files in either of these filesystems will be copied over to the main `/data` filesystem before starting Minecraft. @@ -374,7 +374,7 @@ up: This is the easiest way if you are using an ephemeral `/data` filesystem, or downloading a world with the `WORLD` option. -There is one additional volume that can be mounted; `/plugins`. +There is one additional volume that can be mounted; `/plugins`. Any files in this filesystem will be copied over to the main `/data/plugins` filesystem before starting Minecraft. @@ -386,6 +386,9 @@ in either persistent volumes or a downloadable archive. Enable PaperSpigot server mode by adding a `-e TYPE=PAPER -e VERSION=1.9.4` to your command-line. +By default the container will run the latest build of [Paper server](https://papermc.io/downloads) +but you can also choose to run a specific build with `-e PAPERBUILD=205`. + docker run -d -v /path/on/host:/data \ -e TYPE=PAPER -e VERSION=1.9.4 \ -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server @@ -436,7 +439,7 @@ up: This is the easiest way if you are using an ephemeral `/data` filesystem, or downloading a world with the `WORLD` option. -There is one additional volume that can be mounted; `/plugins`. +There is one additional volume that can be mounted; `/plugins`. Any files in this filesystem will be copied over to the main `/data/plugins` filesystem before starting Minecraft. @@ -444,6 +447,22 @@ This works well if you want to have a common set of plugins in a separate location, but still have multiple worlds with different server requirements in either persistent volumes or a downloadable archive. +## Running a Tuinity server + +A [Tuinity](https://github.com/Spottedleaf/Tuinity) server, which is a fork of Paper aimed at improving server performance at high playercounts. + + -e TYPE=TUINITY + +> **NOTE** only `VERSION=LATEST` is supported + +## Running a Magma server + +A [Magma](https://magmafoundation.org/) server, which is a combination of Forge and PaperMC, can be used with + + -e TYPE=MAGMA + +> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2" + ## Running a Server with a Feed-The-Beast (FTB) / CurseForge modpack Enable this server mode by adding a `-e TYPE=FTB` or `-e TYPE=CURSEFORGE` to your command-line, @@ -451,8 +470,8 @@ but note the following additional steps needed... You need to specify a modpack to run, using the `FTB_SERVER_MOD` or `CF_SERVER_MOD` environment variable. An FTB/CurseForge server modpack is available together with its respective -client modpack on https://www.feed-the-beast.com under "Additional Files." Similar you can -locate the modpacks for CurseForge at https://www.curseforge.com/minecraft/modpacks . +client modpack on under "Additional Files." Similar you can +locate the modpacks for CurseForge at . Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line. @@ -460,7 +479,7 @@ Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line. -e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \ -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server -If you don't want to keep the pre-download modpacks separate from your data directory, +If you want to keep the pre-download modpacks separate from your data directory, then you can attach another volume at a path of your choosing and reference that. The following example uses `/modpacks` as the container path as the pre-download area: @@ -490,7 +509,7 @@ To use these packs you will need to: - Specify the manifest location with env var `MANIFEST=/data/FeedTheBeast/manifest` - Pick a relevant ServerStart.sh and potentially settings.cfg and put them in `/data/FeedTheBeast` -An example of the latter would be to use https://github.com/AllTheMods/Server-Scripts +An example of the latter would be to use There, you'll find that all you have to do is put `ServerStart.sh` and `settings.cfg` into `/data/FeedTheBeast`, taking care to update `settings.cfg` to specify your desired version of minecraft and forge. You can do this in the cli with something like: @@ -588,7 +607,7 @@ up: This is the easiest way if you are using an ephemeral `/data` filesystem, or downloading a world with the `WORLD` option. -There are two additional volumes that can be mounted; `/mods` and `/config`. +There are two additional volumes that can be mounted; `/mods` and `/config`. Any files in either of these filesystems will be copied over to the main `/data` filesystem before starting Minecraft. @@ -987,7 +1006,7 @@ Allows users to use flight on your server while in Survival mode, if they have a -e ALLOW_FLIGHT=TRUE|FALSE -### Other server property mappings: +### Other server property mappings Environment Variable | Server Property ---------------------|----------------- diff --git a/examples/docker-compose-forge.yml b/examples/docker-compose-forge.yml new file mode 100644 index 00000000..4c9f6c86 --- /dev/null +++ b/examples/docker-compose-forge.yml @@ -0,0 +1,23 @@ +version: "3.7" + +services: + mc: + image: itzg/minecraft-server + 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: FORGE + volumes: + # use a named, managed volume for data volume + - mc_forge:/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: + # declared the named volume, but use default/local storage engine + mc_forge: {} diff --git a/start-configuration b/start-configuration index a79f7471..0d6290c9 100644 --- a/start-configuration +++ b/start-configuration @@ -78,6 +78,10 @@ case "${TYPE^^}" in exec /start-deployPaper "$@" ;; + TUINITY) + exec /start-deployTuinity "$@" + ;; + FORGE) exec /start-deployForge "$@" ;; @@ -106,6 +110,10 @@ case "${TYPE^^}" in exec /start-validateCurseInstance "$@" ;; + MAGMA) + exec /start-magma "$@" + ;; + *) log "Invalid type: '$TYPE'" log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, CURSEFORGE, SPONGEVANILLA" diff --git a/start-deployBukkitSpigot b/start-deployBukkitSpigot index a6e25f19..05e29994 100644 --- a/start-deployBukkitSpigot +++ b/start-deployBukkitSpigot @@ -57,6 +57,9 @@ ERROR: failed to download from $downloadUrl EOF exit 3 fi + + JVM_OPTS="${JVM_OPTS} -DIReallyKnowWhatIAmDoingISwear" + export JVM_OPTS } @@ -79,6 +82,7 @@ fi # Normalize on Spigot for operations below export TYPE=SPIGOT +export SKIP_LOG4J_CONFIG=true # Continue to Final Setup exec /start-finalSetup01World $@ diff --git a/start-deployCustom b/start-deployCustom index 0d64f912..5b7e6f8d 100644 --- a/start-deployCustom +++ b/start-deployCustom @@ -25,5 +25,7 @@ else exit 2 fi +export SKIP_LOG4J_CONFIG=true + # Continue to Final Setup exec /start-finalSetup01World $@ diff --git a/start-deployPaper b/start-deployPaper index bec4016f..59026a01 100644 --- a/start-deployPaper +++ b/start-deployPaper @@ -2,10 +2,12 @@ . /start-utils -export SERVER=paper_server-${VANILLA_VERSION}.jar +: ${PAPERBUILD:=latest} +export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar + if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then - downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/latest/download} - log "Downloading Paper $VANILLA_VERSION from $downloadUrl ..." + downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download} + log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..." curl -fsSL -o "$SERVER" "$downloadUrl" if [ ! -f "$SERVER" ]; then log "ERROR: failed to download from $downloadUrl (status=$?)" diff --git a/start-deployTuinity b/start-deployTuinity new file mode 100644 index 00000000..b998bdd9 --- /dev/null +++ b/start-deployTuinity @@ -0,0 +1,27 @@ +#!/bin/bash + +. /start-utils + +if [ "${VERSION}" != "LATEST" ]; then + log "ERROR: Tunity server type only supports VERSION=LATEST" + exit 1 +fi + +: ${TUNITY_BUILD:=lastSuccessfulBuild} +export SERVER=tunity-${VANILLA_VERSION}-${TUNITY_BUILD}.jar + +if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then + downloadUrl="https://ci.codemc.io/job/Spottedleaf/job/Tuinity/${TUNITY_BUILD}/artifact/tuinity-paperclip.jar" + log "Downloading Tunity (build $TUNITY_BUILD) from $downloadUrl ..." + curl -fsSL -o "$SERVER" "$downloadUrl" + if [ ! -f "$SERVER" ]; then + log "ERROR: failed to download from $downloadUrl (status=$?)" + exit 3 + fi +fi + +# Normalize on Spigot for operations below +export TYPE=SPIGOT + +# Continue to Final Setup +exec /start-finalSetup01World $@ diff --git a/start-finalSetup04ServerProperties b/start-finalSetup04ServerProperties index d5ef5503..bdc02108 100644 --- a/start-finalSetup04ServerProperties +++ b/start-finalSetup04ServerProperties @@ -81,16 +81,32 @@ function customizeServerProps { if [ -n "$DIFFICULTY" ]; then case $DIFFICULTY in peaceful|0) - DIFFICULTY=0 + if versionLessThan 1.13; then + DIFFICULTY=0 + else + DIFFICULTY=peaceful + fi ;; easy|1) - DIFFICULTY=1 + if versionLessThan 1.13; then + DIFFICULTY=1 + else + DIFFICULTY=easy + fi ;; normal|2) - DIFFICULTY=2 + if versionLessThan 1.13; then + DIFFICULTY=2 + else + DIFFICULTY=normal + fi ;; hard|3) - DIFFICULTY=3 + if versionLessThan 1.13; then + DIFFICULTY=3 + else + DIFFICULTY=hard + fi ;; *) log "DIFFICULTY must be peaceful, easy, normal, or hard." @@ -104,19 +120,33 @@ function customizeServerProps { log "Setting mode" MODE_LC=$( echo $MODE | tr '[:upper:]' '[:lower:]' ) case $MODE_LC in - 0|1|2|3) + su*|0) + if versionLessThan 1.13; then + MODE=0 + else + MODE=survival + fi ;; - su*) - MODE=0 + c*|1) + if versionLessThan 1.13; then + MODE=1 + else + MODE=creative + fi ;; - c*) - MODE=1 + a*|2) + if versionLessThan 1.13; then + MODE=2 + else + MODE=adventure + fi ;; - a*) - MODE=2 - ;; - sp*) - MODE=3 + sp*|3) + if versionLessThan 1.13; then + MODE=3 + else + MODE=spectator + fi ;; *) log "ERROR: Invalid game mode: $MODE" diff --git a/start-magma b/start-magma new file mode 100755 index 00000000..70b201f4 --- /dev/null +++ b/start-magma @@ -0,0 +1,18 @@ +#!/bin/bash + +. /start-utils + +export SERVER="/data/magma-server-${VANILLA_VERSION}.jar" + +# Always download since new updates of each base version are published frequently +if ! curl -o /data/magma-server-${VANILLA_VERSION}.jar -fsSL \ + https://api.magmafoundation.org/api/resources/Magma/${VANILLA_VERSION}/stable/latest/download; then + log "ERROR unable to download version ${VANILLA_VERSION} of Magma" + log " Check https://magmafoundation.org/ for available versions" + exit 1 +fi + +export SKIP_LOG4J_CONFIG=true + +# Continue to Final Setup +exec /start-finalSetup01World $@ diff --git a/start-minecraftFinalSetup b/start-minecraftFinalSetup index 1f8c50ed..7a293cb2 100644 --- a/start-minecraftFinalSetup +++ b/start-minecraftFinalSetup @@ -27,7 +27,7 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then fi fi -if [ ${TYPE} != "SPIGOT" ]; then +if ! isTrue ${SKIP_LOG4J_CONFIG}; then # Set up log configuration LOGFILE="/data/log4j2.xml" if [ ! -e "$LOGFILE" ]; then