mc: apply INIT/MAX RAM settings into FTB local settings file

fixes #222
This commit is contained in:
Geoff Bourne 2018-07-13 16:35:56 -05:00
parent 2a1fba1b45
commit a95bfdb192
2 changed files with 28 additions and 7 deletions

View File

@ -0,0 +1,16 @@
version: '3.2'
services:
mc:
image: itzg/minecraft-server
environment:
EULA: "true"
TYPE: FTB
FTB_SERVER_MOD: https://www.feed-the-beast.com/projects/ftb-presents-skyfactory-3/files/2481284
ports:
- 25565:25565
volumes:
- mc-ftb:/data
volumes:
mc-ftb:

View File

@ -73,8 +73,7 @@ if [[ ${GUI} = false || ${GUI} = FALSE ]]; then
fi fi
# put these prior JVM_OPTS at the end to give any memory settings there higher precedence # put these prior JVM_OPTS at the end to give any memory settings there higher precedence
echo "Setting initial memory to ${INIT_MEMORY:-${MEMORY}} and max to ${MAX_MEMORY:-${MEMORY}}" echo "Setting initial memory to ${INIT_MEMORY:=${MEMORY}} and max to ${MAX_MEMORY:=${MEMORY}}"
JVM_OPTS="-Xms${INIT_MEMORY:-${MEMORY}} -Xmx${MAX_MEMORY:-${MEMORY}} ${JVM_OPTS}"
if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
if [ ! -e ${FTB_DIR}/ops.json -a -e /data/ops.txt ]; then if [ ! -e ${FTB_DIR}/ops.json -a -e /data/ops.txt ]; then
@ -89,14 +88,20 @@ if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
cp -f /data/eula.txt ${FTB_DIR}/ cp -f /data/eula.txt ${FTB_DIR}/
fi fi
cat > ${FTB_DIR}/settings-local.sh <<EOF
export MIN_RAM="${INIT_MEMORY}"
export MAX_RAM="${MAX_MEMORY}"
EOF
cd ${FTB_DIR} cd ${FTB_DIR}
echo "Running FTB server modpack start ..." echo "Running FTB server modpack start ..."
exec mc-server-runner ${FTB_SERVER_START} exec mc-server-runner ${FTB_SERVER_START}
else else
# If we have a bootstrap.txt file... feed that in to the server stdin # If we have a bootstrap.txt file... feed that in to the server stdin
if [ -f /data/bootstrap.txt ]; then if [ -f /data/bootstrap.txt ]; then
bootstrapArgs="--bootstrap /data/bootstrap.txt" bootstrapArgs="--bootstrap /data/bootstrap.txt"
fi fi
exec mc-server-runner ${bootstrapArgs} java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
exec mc-server-runner ${bootstrapArgs} java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS
fi fi