From c4c3613874011129ff1c54e989660c92abac0de9 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 4 Jul 2020 15:02:32 -0500 Subject: [PATCH 1/8] misc: added docs to release notes exclusion --- DEVELOPMENT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 237baff7..2dde41d3 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -70,5 +70,5 @@ The multiarch images are built and published by [a Github action](https://github The following git command can be used to provide the bulk of release notes content: ```shell script -git log --invert-grep --grep "^ci:" --grep "^misc:" --pretty="- %s" 1.1.0..1.2.0 +git log --invert-grep --grep "^ci:" --grep "^misc:" --grep "^docs:" --pretty="- %s" 1.1.0..1.2.0 ``` From 825833c859e534e779f21a6d83e75cdc914dfa98 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Mon, 6 Jul 2020 16:41:56 -0500 Subject: [PATCH 2/8] Added REPLACE_ENV_VARIABLES_EXCLUDES for #575 --- Dockerfile | 1 - README.md | 4 +++- start-finalSetup05EnvVariables | 12 +++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8b0ec782..eddce74a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -71,7 +71,6 @@ ENV UID=1000 GID=1000 \ TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \ PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \ LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \ - REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_" \ ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 AUTOPAUSE_PERIOD=10 COPY start* / diff --git a/README.md b/README.md index b17fcece..9ed143ac 100644 --- a/README.md +++ b/README.md @@ -306,7 +306,7 @@ defined environment variables. Variables that you want to replace need to be wra inside `${YOUR_VARIABLE}` curly brackets and prefixed with a dollar sign. This is the regular syntax for enviromment variables inside strings or config files. -Optionally you can also define a prefix to only match predefined enviroment variables. +Optionally you can also define a prefix to only match predefined environment variables. `ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix @@ -322,6 +322,8 @@ There are some limitations to what characters you can use. Variables will be replaced in files with the following extensions: `.yml`, `.yaml`, `.txt`, `.cfg`, `.conf`, `.properties`. +Specific files can be excluded by listing their name (without path) in the variable `REPLACE_ENV_VARIABLES_EXCLUDES`. + Here is a full example where we want to replace values inside a `database.yml`. ```yml diff --git a/start-finalSetup05EnvVariables b/start-finalSetup05EnvVariables index 3df6b5a2..4ec1b7ee 100644 --- a/start-finalSetup05EnvVariables +++ b/start-finalSetup05EnvVariables @@ -2,8 +2,17 @@ . ${SCRIPTS:-/}start-utils -if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then +: ${ENV_VARIABLE_PREFIX:=CFG_} + +if isTrue "${REPLACE_ENV_VARIABLES}"; then log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..." + + findExcludes= + for f in ${REPLACE_ENV_VARIABLES_EXCLUDES}; do + findExcludes="${findExcludes} -not -name $f" + done + isDebugging && echo "Using find exclusion: $findExcludes" + while IFS='=' read -r name value ; do # check if name of env variable matches the prefix # sanity check environment variables to avoid code injections @@ -20,6 +29,7 @@ if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then find /data/ -type f \ \( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \ -or -name "*.conf" -or -name "*.properties" \) \ + $findExcludes \ -exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \; fi done < <(env) From 9a7a532f7b1d4cd362dcf46bcaade928d9476a2b Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Mon, 6 Jul 2020 17:16:51 -0500 Subject: [PATCH 3/8] Changed order of /plugins rsync to be before processing env vars For #577 --- DEVELOPMENT.md | 2 +- start-deployBukkitSpigot | 2 +- start-deployCatserver | 2 +- start-deployCustom | 2 +- start-deployFTB | 2 +- start-deployFabric | 2 +- start-deployForge | 2 +- start-deployMagma | 2 +- start-deployMohist | 2 +- start-deployPaper | 2 +- start-deploySpongeVanilla | 2 +- start-deployTuinity | 2 +- start-deployVanilla | 2 +- ...EnvVariables => start-finalSetupEnvVariables | 0 ...etup03Modconfig => start-finalSetupModconfig | 2 +- ...nalSetup02Modpack => start-finalSetupModpack | 2 +- start-finalSetupPlugins | 17 +++++++++++++++++ ...operties => start-finalSetupServerProperties | 2 +- ...t-finalSetup01World => start-finalSetupWorld | 2 +- start-minecraftFinalSetup | 12 ------------ start-validateCurseInstance | 2 +- 21 files changed, 35 insertions(+), 30 deletions(-) rename start-finalSetup05EnvVariables => start-finalSetupEnvVariables (100%) rename start-finalSetup03Modconfig => start-finalSetupModconfig (92%) rename start-finalSetup02Modpack => start-finalSetupModpack (99%) create mode 100755 start-finalSetupPlugins rename start-finalSetup04ServerProperties => start-finalSetupServerProperties (99%) rename start-finalSetup01World => start-finalSetupWorld (96%) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 2dde41d3..55bea272 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -3,7 +3,7 @@ Adding a new server `TYPE` can vary due to the complexity of obtaining and configuring each type; however, the addition of any server type includes at least the following steps: 1. Copy an existing "start-deploy*" script, such as [start-deployMohist](start-deployMohist) and rename it accordingly making sure to retain the "start-deploy" prefix -2. Modify the type-specific behavior between the "start-utils" preamble and the hand-off to `start-finalSetup01World` at the end of the script +2. Modify the type-specific behavior between the "start-utils" preamble and the hand-off to `start-finalSetupWorld` at the end of the script 3. Develop and test the changes using the [iterative process described below](#iterative-script-development) 4. Add a case-entry to the `case "${TYPE^^}"` in [start-configuration](start-configuration) 5. Add a section to the [README](README.md). It is recommended to copy-modify an existing section to retain a similar wording and level of detail diff --git a/start-deployBukkitSpigot b/start-deployBukkitSpigot index d995089a..28b07fd3 100644 --- a/start-deployBukkitSpigot +++ b/start-deployBukkitSpigot @@ -102,4 +102,4 @@ export TYPE=SPIGOT export SKIP_LOG4J_CONFIG=true # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetupWorld $@ diff --git a/start-deployCatserver b/start-deployCatserver index ce9ea6cd..093769ec 100644 --- a/start-deployCatserver +++ b/start-deployCatserver @@ -29,4 +29,4 @@ fi export SKIP_LOG4J_CONFIG=true # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World "$@" +exec ${SCRIPTS:-/}start-finalSetupWorld "$@" diff --git a/start-deployCustom b/start-deployCustom index 31105e4e..571a5a0c 100644 --- a/start-deployCustom +++ b/start-deployCustom @@ -28,4 +28,4 @@ fi export SKIP_LOG4J_CONFIG=true # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetupWorld $@ diff --git a/start-deployFTB b/start-deployFTB index 5006f24b..5e2b5c4f 100644 --- a/start-deployFTB +++ b/start-deployFTB @@ -135,4 +135,4 @@ elif [ -e "${FTB_DIR}/Install.sh" ]; then fi # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetupWorld $@ diff --git a/start-deployFabric b/start-deployFabric index b0bc1329..0c748455 100644 --- a/start-deployFabric +++ b/start-deployFabric @@ -75,4 +75,4 @@ else fi # Contineut to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetupWorld $@ diff --git a/start-deployForge b/start-deployForge index 8feb33ea..e58d885c 100644 --- a/start-deployForge +++ b/start-deployForge @@ -113,4 +113,4 @@ else fi # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetupWorld $@ diff --git a/start-deployMagma b/start-deployMagma index a8c7c6a3..cf590ca5 100644 --- a/start-deployMagma +++ b/start-deployMagma @@ -15,4 +15,4 @@ fi export SKIP_LOG4J_CONFIG=true # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetupWorld $@ diff --git a/start-deployMohist b/start-deployMohist index 9a0ca008..1c67bd08 100644 --- a/start-deployMohist +++ b/start-deployMohist @@ -40,4 +40,4 @@ fi export SKIP_LOG4J_CONFIG=true # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World "$@" +exec ${SCRIPTS:-/}start-finalSetupWorld "$@" diff --git a/start-deployPaper b/start-deployPaper index 018efa63..f3d12472 100644 --- a/start-deployPaper +++ b/start-deployPaper @@ -20,4 +20,4 @@ export TYPE=SPIGOT export SKIP_LOG4J_CONFIG=true # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetupWorld $@ diff --git a/start-deploySpongeVanilla b/start-deploySpongeVanilla index 28c5ab73..199107cb 100644 --- a/start-deploySpongeVanilla +++ b/start-deploySpongeVanilla @@ -36,4 +36,4 @@ if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then fi # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetupWorld $@ diff --git a/start-deployTuinity b/start-deployTuinity index 8e6adc62..f2c6f039 100644 --- a/start-deployTuinity +++ b/start-deployTuinity @@ -24,4 +24,4 @@ fi export TYPE=SPIGOT # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetupWorld $@ diff --git a/start-deployVanilla b/start-deployVanilla index 52dc92e7..59283b15 100644 --- a/start-deployVanilla +++ b/start-deployVanilla @@ -43,4 +43,4 @@ fi isDebugging && ls -l # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetupWorld $@ diff --git a/start-finalSetup05EnvVariables b/start-finalSetupEnvVariables similarity index 100% rename from start-finalSetup05EnvVariables rename to start-finalSetupEnvVariables diff --git a/start-finalSetup03Modconfig b/start-finalSetupModconfig similarity index 92% rename from start-finalSetup03Modconfig rename to start-finalSetupModconfig index 5758a25c..0ba355eb 100644 --- a/start-finalSetup03Modconfig +++ b/start-finalSetupModconfig @@ -24,4 +24,4 @@ case "X$MODCONFIG" in esac fi -exec ${SCRIPTS:-/}start-finalSetup04ServerProperties $@ +exec ${SCRIPTS:-/}start-finalSetupPlugins $@ diff --git a/start-finalSetup02Modpack b/start-finalSetupModpack similarity index 99% rename from start-finalSetup02Modpack rename to start-finalSetupModpack index 15347cf9..40962733 100644 --- a/start-finalSetup02Modpack +++ b/start-finalSetupModpack @@ -154,4 +154,4 @@ if [[ "${GENERIC_PACK}" ]]; then fi fi -exec ${SCRIPTS:-/}start-finalSetup03Modconfig $@ +exec ${SCRIPTS:-/}start-finalSetupModconfig $@ diff --git a/start-finalSetupPlugins b/start-finalSetupPlugins new file mode 100755 index 00000000..5bb2fe83 --- /dev/null +++ b/start-finalSetupPlugins @@ -0,0 +1,17 @@ +#!/bin/bash + +. ${SCRIPTS:-/}start-utils + +if [ -d /plugins ]; then + case ${TYPE} in + SPIGOT|BUKKIT|PAPER) + mkdir -p /data/plugins + log "Copying plugins over..." + # Copy plugins over using rsync to allow deeply nested updates of plugins + # only updates files if the source file is newer and print updated files + rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /plugins /data + ;; + esac +fi + +exec ${SCRIPTS:-/}start-finalSetupServerProperties $@ diff --git a/start-finalSetup04ServerProperties b/start-finalSetupServerProperties similarity index 99% rename from start-finalSetup04ServerProperties rename to start-finalSetupServerProperties index 9f2bad70..32608c47 100644 --- a/start-finalSetup04ServerProperties +++ b/start-finalSetupServerProperties @@ -206,4 +206,4 @@ if isDebugging; then cat /data/server.properties fi -exec ${SCRIPTS:-/}start-finalSetup05EnvVariables $@ +exec ${SCRIPTS:-/}start-finalSetupEnvVariables $@ diff --git a/start-finalSetup01World b/start-finalSetupWorld similarity index 96% rename from start-finalSetup01World rename to start-finalSetupWorld index 1cb3bfff..b55f96cc 100644 --- a/start-finalSetup01World +++ b/start-finalSetupWorld @@ -51,4 +51,4 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then fi fi -exec ${SCRIPTS:-/}start-finalSetup02Modpack $@ +exec ${SCRIPTS:-/}start-finalSetupModpack $@ diff --git a/start-minecraftFinalSetup b/start-minecraftFinalSetup index 0e1edc87..1d20da55 100644 --- a/start-minecraftFinalSetup +++ b/start-minecraftFinalSetup @@ -66,18 +66,6 @@ do fi done -case ${TYPE} in - SPIGOT|BUKKIT|PAPER) - mkdir -p /data/plugins - if [ -d /plugins ]; then - log "Copying plugins over..." - # Copy plugins over using rsync to allow deeply nested updates of plugins - # only updates files if the source file is newer and print updated files - rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /plugins /data - fi - ;; -esac - EXTRA_ARGS="" # Optional disable console if versionLessThan 1.14 && [[ ${CONSOLE,,} = false ]]; then diff --git a/start-validateCurseInstance b/start-validateCurseInstance index 60bb2edd..f3563990 100755 --- a/start-validateCurseInstance +++ b/start-validateCurseInstance @@ -15,4 +15,4 @@ fi log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}" # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World "$@" +exec ${SCRIPTS:-/}start-finalSetupWorld "$@" From ecbdeb20965353d791569fc1031231e10ac5c1ad Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 8 Jul 2020 19:07:53 -0500 Subject: [PATCH 4/8] Added option to disable PLUGINS_SYNC_UPDATE For #576 --- README.md | 88 +++++------------------------------------ start-finalSetupPlugins | 10 ++++- 2 files changed, 17 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index 9ed143ac..711ef3b7 100644 --- a/README.md +++ b/README.md @@ -398,45 +398,7 @@ If you are hosting your own copy of Bukkit/Spigot you can override the download You can build spigot from source by adding `-e BUILD_FROM_SOURCE=true` -You can install Bukkit plugins in two ways... - -### Using the /data volume - -This is the easiest way if you are using a persistent `/data` mount. - -To do this, you will need to attach the container's `/data` directory -(see "Attaching data directory to host filesystem”). -Then, you can add plugins to the `/path/on/host/plugins` folder you chose. From the example above, -the `/path/on/host` folder contents look like: - -``` -/path/on/host -├── plugins -│   └── ... INSTALL PLUGINS HERE ... -├── ops.json -├── server.properties -├── whitelist.json -└── ... -``` - -If you add plugins while the container is running, you'll need to restart it to pick those -up: - - docker stop mc - docker start mc - -### Using separate mounts - -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`. -Any files in this filesystem will be copied over to the main -`/data/plugins` filesystem before starting Minecraft. - -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. +If you have attached a host directory to the `/data` volume, then you can install plugins within the `plugins` subdirectory. You can also [attach a `/plugins` volume](#deploying-plugins-from-attached-volume). If you add plugins while the container is running, you'll need to restart it to pick those up. ## Running a PaperSpigot server @@ -453,48 +415,10 @@ If you are hosting your own copy of PaperSpigot you can override the download UR - -e PAPER_DOWNLOAD_URL= -You can install Bukkit plugins in two ways... - An example compose file is provided at [examples/docker-compose-paper.yml](examples/docker-compose-paper.yml). -### Using the /data volume - -This is the easiest way if you are using a persistent `/data` mount. - -To do this, you will need to attach the container's `/data` directory -(see "Attaching data directory to host filesystem”). -Then, you can add plugins to the `/path/on/host/plugins` folder you chose. From the example above, -the `/path/on/host` folder contents look like: - -``` -/path/on/host -├── plugins -│   └── ... INSTALL PLUGINS HERE ... -├── ops.json -├── server.properties -├── whitelist.json -└── ... -``` - -If you add plugins while the container is running, you'll need to restart it to pick those -up: - - docker stop mc - docker start mc - -### Using separate mounts - -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`. -Any files in this filesystem will be copied over to the main -`/data/plugins` filesystem before starting Minecraft. - -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. +If you have attached a host directory to the `/data` volume, then you can install plugins via the `plugins` subdirectory. You can also [attach a `/plugins` volume](#deploying-plugins-from-attached-volume). If you add plugins while the container is running, you'll need to restart it to pick those up. ## Running a Tuinity server @@ -672,6 +596,12 @@ This works well if you want to have a common set of modules in a separate location, but still have multiple worlds with different server requirements in either persistent volumes or a downloadable archive. +## Deploying plugins from attached volume + +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. Set `PLUGINS_SYNC_UPDATE=false` if you want files from `/plugins` to take precedence over newer files in `/data/plugins`. + +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 with a custom server JAR If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server @@ -977,7 +907,7 @@ For example (just the `-e` bits): You can set a link to a custom resource pack and set it's checksum using the `RESOURCE_PACK` and `RESOURCE_PACK_SHA1` options respectively, the default is blank: - docker run -d -e 'RESROUCE_PACK=http\://link.com/to/pack.zip?\=1' -e 'RESOURCE_PACK_SHA1=d5db29cd03a2ed055086cef9c31c252b4587d6d0' + docker run -d -e 'RESOURCE_PACK=http\://link.com/to/pack.zip?\=1' -e 'RESOURCE_PACK_SHA1=d5db29cd03a2ed055086cef9c31c252b4587d6d0' **NOTE:** `:` and `=` must be escaped using `\`. The checksum plain-text hexadecimal. diff --git a/start-finalSetupPlugins b/start-finalSetupPlugins index 5bb2fe83..d79e449a 100755 --- a/start-finalSetupPlugins +++ b/start-finalSetupPlugins @@ -2,14 +2,20 @@ . ${SCRIPTS:-/}start-utils +: ${PLUGINS_SYNC_UPDATE:=true} + +isDebugging && set -x + if [ -d /plugins ]; then case ${TYPE} in SPIGOT|BUKKIT|PAPER) mkdir -p /data/plugins log "Copying plugins over..." + if isTrue ${PLUGINS_SYNC_UPDATE}; then + updateArg="--update" + fi # Copy plugins over using rsync to allow deeply nested updates of plugins - # only updates files if the source file is newer and print updated files - rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /plugins /data + rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs $updateArg /plugins /data ;; esac fi From 4cb12f6cae66340eafd4a7f19f92136f37a77919 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 9 Jul 2020 20:54:34 -0500 Subject: [PATCH 5/8] Added DISABLE_HEALTHCHECK --- README.md | 4 ++++ health.sh | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 711ef3b7..be14d25a 100644 --- a/README.md +++ b/README.md @@ -1076,6 +1076,10 @@ Some older versions (pre-1.14) of Spigot required `--noconsole` to be passed whe Some older servers get confused and think that the GUI interface is enabled. You can explicitly disable that by passing `-e GUI=FALSE`. +### Disable healthcheck via environment variable + +Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of healthchecks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`. + ## Running on RaspberryPi To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag diff --git a/health.sh b/health.sh index 0ce34be1..e2ad7e72 100644 --- a/health.sh +++ b/health.sh @@ -2,7 +2,10 @@ . ${SCRIPTS:-/}start-utils -if isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then +if isTrue "${DISABLE_HEALTHCHECK}"; then + echo "Healthcheck disabled" + exit 0 +elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then echo "Java process suspended by Autopause function" exit 0 else From 0bb9cccdc67c2a16b4c5ef01d196448d1d407182 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 9 Jul 2020 21:05:17 -0500 Subject: [PATCH 6/8] Added REPLACE_ENV_VARIABLES_EXCLUDE_PATHS For #575 --- README.md | 2 +- start-finalSetupEnvVariables | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index be14d25a..6498f316 100644 --- a/README.md +++ b/README.md @@ -322,7 +322,7 @@ There are some limitations to what characters you can use. Variables will be replaced in files with the following extensions: `.yml`, `.yaml`, `.txt`, `.cfg`, `.conf`, `.properties`. -Specific files can be excluded by listing their name (without path) in the variable `REPLACE_ENV_VARIABLES_EXCLUDES`. +Specific files can be excluded by listing their name (without path) in the variable `REPLACE_ENV_VARIABLES_EXCLUDES`. Paths can be excluded by listing them in the variable `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. Here is a full example where we want to replace values inside a `database.yml`. diff --git a/start-finalSetupEnvVariables b/start-finalSetupEnvVariables index 4ec1b7ee..f64f5ec7 100644 --- a/start-finalSetupEnvVariables +++ b/start-finalSetupEnvVariables @@ -11,6 +11,9 @@ if isTrue "${REPLACE_ENV_VARIABLES}"; then for f in ${REPLACE_ENV_VARIABLES_EXCLUDES}; do findExcludes="${findExcludes} -not -name $f" done + for p in ${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}; do + findExcludes="${findExcludes} -not -path \"*$p*\"" + done isDebugging && echo "Using find exclusion: $findExcludes" while IFS='=' read -r name value ; do From cf691499a10c6999e2326dcbadd0d0b1e780d21f Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 9 Jul 2020 21:07:26 -0500 Subject: [PATCH 7/8] docs: Moved section for DISABLE_HEALTHCHECK to existing healthcheck section --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6498f316..b7068956 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,8 @@ You can also query the container's health in a script friendly way: healthy ``` +Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of healthchecks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`. + ## Autopause (experimental) ### Description @@ -1076,10 +1078,6 @@ Some older versions (pre-1.14) of Spigot required `--noconsole` to be passed whe Some older servers get confused and think that the GUI interface is enabled. You can explicitly disable that by passing `-e GUI=FALSE`. -### Disable healthcheck via environment variable - -Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of healthchecks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`. - ## Running on RaspberryPi To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag From 092b530537159bc09d3e2d9cc9d370916d86a55a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Z=C3=BChlcke?= Date: Sat, 11 Jul 2020 00:06:47 +0200 Subject: [PATCH 8/8] Added 'FORCE_WORLD_COPY' environment variable (#580) --- README.md | 3 +++ start-finalSetupWorld | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b7068956..7b83c20d 100644 --- a/README.md +++ b/README.md @@ -947,6 +947,9 @@ read-only volume attachment to ensure the clone source remains pristine. docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic ``` +### Overwrite world on start +The world will only be downloaded or copied if it doesn't exist already. Set `FORCE_WORLD_COPY=TRUE` to force overwrite the world on every server start. + ### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers Like the `WORLD` option above, you can specify the URL of a "mod pack" diff --git a/start-finalSetupWorld b/start-finalSetupWorld index b55f96cc..d1cd48e6 100644 --- a/start-finalSetupWorld +++ b/start-finalSetupWorld @@ -10,7 +10,7 @@ else worldDest=/data/$LEVEL fi -if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then +if [[ "$WORLD" ]] && isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ]; then if isURL $WORLD; then curl -fsSL "$WORLD" -o /tmp/world.zip zipSrc=/tmp/world.zip @@ -37,10 +37,10 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then log "ERROR invalid world content" exit 1 fi - mv "$baseDir" "$worldDest" + rsync --remove-source-files --recursive --delete "$baseDir/" "$worldDest" else log "Cloning world directory from $WORLD ..." - cp -r "$WORLD" "$worldDest" + rsync --recursive --delete "${WORLD%/}"/ "$worldDest" fi if [ "$TYPE" = "SPIGOT" ]; then