diff --git a/minecraft-server/README.md b/minecraft-server/README.md index 65d1fff2..6cb9e052 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -264,6 +264,65 @@ 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 Server with a Feed-The-Beast (FTB) modpack + +Enable this server mode by adding a `-e TYPE=FTB` to your command-line, +but note the following additional steps needed... + +You need to specify a modpack to run, using the `FTB_SERVER_MOD` environment +variable. An FTB server modpack is available together with its respective +client modpack on https://www.feed-the-beast.com under "Additional Files." +Because of the interactive delayed download mechanism on that web site, you +must manually download the server modpack. Copy the modpack to the `/data` +directory (see "Attaching data directory to host filesystem”). + +Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line. + + $ docker run -d -v /path/on/host:/data -e TYPE=FTB \ + -e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \ + -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server + +### Using the /data volume + +You must use a persistent `/data` mount for this type of server. + +To do this, you will need to attach the container's `/data` directory +(see "Attaching data directory to host filesystem”). + +If the modpack is updated and you want to run the new version on your +server, you stop and remove the container: + + docker stop mc + docker rm mc + +Do not erase anything from your /data directory (unless you know of +specific mods that have been removed from the modpack). Download the +updated FTB server modpack and copy it to `/data`. Start a new container +with `FTB_SERVER_MOD` specifying the updated modpack file. + + $ docker run -d -v /path/on/host:/data -e TYPE=FTB \ + -e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.7.zip \ + -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server + +### FTB server JVM options + +An FTB server modpack contains its own startup script that launches the +JVM and it does not use the `JVM_OPTS` environment variable. Instead +you can use `MIN_RAM` and `MAX_RAM` variables. These are appended to +the JVM `-Xms` and `-Xmx` options. For example, `-e MIN_RAM=2G` results +in `-Xms2G` passed to the JVM. + +Additionally, `PERMGEN_SIZE` is passed on to `-XX:PermSize`. Here is an +example: + + $ docker run -d -v /path/on/host:/data -e TYPE=FTB \ + -e MIN_RAM=1G -e MAX_RAM=2G -e PERMGEN_SIZE=512M \ + -e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \ + -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server + +Note: The FTB server start script will also override other options, +like `MOTD`. + ## Using Docker Compose Rather than type the server options below, the port mappings above, etc diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index 02caf3dc..c64372d7 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -157,6 +157,44 @@ function installForge { fi } +function installFTB { + TYPE=FEED-THE-BEAST + + echo "Looking for Feed-The-Beast server modpack." + if [[ -z $FTB_SERVER_MOD ]]; then + echo "Environment variable FTB_SERVER_MOD not set." + echo "Set FTB_SERVER_MOD to the file name of the FTB server modpack." + echo "(And place the modpack in the /data directory.)" + exit 2 + fi + local srv_modpack=${FTB_SERVER_MOD} + if [[ ${srv_modpack:0:5} == "data/" ]]; then + # Prepend with "/" + srv_modpack=/${srv_modpack} + fi + if [[ ! ${srv_modpack:0:1} == "/" ]]; then + # If not an absolute path, assume file is in "/data" + srv_modpack=/data/${srv_modpack} + fi + if [[ ! -f ${srv_modpack} ]]; then + echo "FTB server modpack ${srv_modpack} not found." + exit 2 + fi + if [[ ! ${srv_modpack: -4} == ".zip" ]]; then + echo "FTB server modpack ${srv_modpack} is not a zip archive." + echo "Please set FTB_SERVER_MOD to a file with a .zip extension." + exit 2 + fi + + echo "Unpacking FTB server modpack ${srv_modpack} ..." + local ftb_dir=/data/FeedTheBeast + mkdir -p ${ftb_dir} + unzip -u -o ${srv_modpack} -d ${ftb_dir} + cp -f /data/eula.txt ${ftb_dir}/eula.txt + FTB_SERVER_START=${ftb_dir}/ServerStart.sh + chmod a+x ${FTB_SERVER_START} +} + function installVanilla { SERVER="minecraft_server.$VANILLA_VERSION.jar" @@ -203,6 +241,11 @@ case "$TYPE" in installForge ;; + FTB|ftb) + TYPE=FEED-THE-BEAST + installFTB + ;; + VANILLA|vanilla) installVanilla ;; @@ -447,10 +490,15 @@ else EXTRA_ARGS="" fi -# If we have a bootstrap.txt file... feed that in to the server stdin -if [ -f /data/bootstrap.txt ]; -then - exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt +if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then + echo "Running FTB server modpack start ..." + exec sh ${FTB_SERVER_START} else - exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS + # If we have a bootstrap.txt file... feed that in to the server stdin + if [ -f /data/bootstrap.txt ]; + then + exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt + else + exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS + fi fi