diff --git a/README.md b/README.md index 0ff7c610..13e2a4d1 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,24 @@ such as docker run -d -it -e EULA=TRUE -p 25565:25565 --name mc itzg/minecraft-server +## Timezone Configuration + +You can configure the timezone to match yours by setting the `TZ` environment variable: + + -e TZ=Europe/London + +such as: + + docker run -d -it -e TZ=Europe/London -p 25565:25565 --name mc itzg/minecraft-server + +Or mounting `/etc/timezone` as readonly (not supported on Windows): + + -v /etc/timezone:/etc/timezone:ro + +such as: + + docker run -d -it -v /etc/timezone:/etc/timezone:ro -p 25565:25565 --name mc itzg/minecraft-server + ## Attaching data directory to host filesystem In order to readily access the Minecraft data, use the `-v` argument @@ -259,6 +277,8 @@ Optionally you can also define a prefix to only match predefined enviroment vari `ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix +If you want use file for value (like when use secrets) you can add suffix `_FILE` to your variable name (in run command). + There are some limitations to what characters you can use. | Type | Allowed Characters | @@ -305,7 +325,7 @@ services: # and here are the actual variables CFG_DB_HOST: "http://localhost:3306" CFG_DB_NAME: "minecraft" - CFG_DB_PASSWORD: "ug23u3bg39o-ogADSs" + CFG_DB_PASSWORD_FILE: "/run/secrets/db_password" restart: always rcon: image: itzg/rcon @@ -318,8 +338,16 @@ services: volumes: mc: rcon: + +secrets: + db_password: + file: ./db_password ``` +The content of `db_password`: + + ug23u3bg39o-ogADSs + ## Running a Bukkit/Spigot server Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT -e VERSION=1.8` or `-e TYPE=SPIGOT -e VERSION=1.8` to your command-line. @@ -452,7 +480,7 @@ in either persistent volumes or a downloadable archive. 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 @@ -460,7 +488,7 @@ A [Tuinity](https://github.com/Spottedleaf/Tuinity) server, which is a fork of P 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 diff --git a/start-deployPaper b/start-deployPaper index 59026a01..07d77117 100644 --- a/start-deployPaper +++ b/start-deployPaper @@ -17,6 +17,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-finalSetup05EnvVariables b/start-finalSetup05EnvVariables index 8f08d30a..90a85d52 100644 --- a/start-finalSetup05EnvVariables +++ b/start-finalSetup05EnvVariables @@ -10,6 +10,12 @@ if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] \ && [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] \ && [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then + # Read content from file environment + if [[ $name = *"_FILE" ]] && [[ -f $value ]]; then + name="${name/_FILE/}" + value=$(<$value) + fi + log "Replacing $name with $value ..." find /data/ -type f \ \( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \ diff --git a/start-minecraftFinalSetup b/start-minecraftFinalSetup index b89f9718..c17ce18c 100644 --- a/start-minecraftFinalSetup +++ b/start-minecraftFinalSetup @@ -163,6 +163,12 @@ if isTrue "${USE_LARGE_PAGES}"; then " fi +if isTrue "${DEBUG_MEMORY}"; then + log "Memory usage and availability (in MB)" + uname -a + free -m +fi + mcServerRunnerArgs="--stop-duration 60s" if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"