From ecbdeb20965353d791569fc1031231e10ac5c1ad Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 8 Jul 2020 19:07:53 -0500 Subject: [PATCH] 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