For backward compatibility, allow MODS to list plugins for those server types (#2200)

This commit is contained in:
Geoff Bourne 2023-06-11 11:00:39 -05:00 committed by GitHub
parent 8a4dbb53e7
commit c8ffbec928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 86 additions and 74 deletions

View File

@ -14,18 +14,22 @@ The following are some supported mod platforms:
On the left, there are sections describing some download automation options. On the left, there are sections describing some download automation options.
## Mods vs Plugins
The terms "mods" and "plugins" can be quite confusing. Generally, the rule of thumb is that "mods" are used by the types that run client side to modify rendering, add new blocks, and add behaviors server, such as [Forge](../types-and-platforms/server-types/forge.md) and [Fabric](../types-and-platforms/server-types/fabric.md). "Plugins" are used by the types that **only run on servers** to add behaviors, commands, etc such as [Paper](../types-and-platforms/server-types/paper.md) (which derives from [Bukkit/Spigot](../types-and-platforms/server-types/bukkit-spigot.md)). There are also some types that are [hybrids](../types-and-platforms/server-types/hybrids.md), such as Magma, that use both "mods" and "plugins"
## Optional plugins, mods, and config attach points ## Optional plugins, mods, and config attach points
There are optional volume paths that can be attached to supply content to be copied into the data area: There are optional volume paths that can be attached to supply content to be copied into the data area:
`/plugins` `/plugins`
: contents are synchronized into `/data/plugins` for Bukkit related server types. The source can be changed by setting `COPY_PLUGINS_SRC`. The destination can be changed by setting `COPY_PLUGINS_DEST`. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/plugins` to take precedence over newer files in `/data/plugins`. : content in this directory is synchronized into `/data/plugins` for server types that use plugins, [as described above](#mods-vs-plugins). For special cases, the source can be changed by setting `COPY_PLUGINS_SRC` and destination by setting `COPY_PLUGINS_DEST`.
`/mods` `/mods`
: contents are synchronized into `/data/mods` for Fabric and Forge related server types. The source can be changed by setting `COPY_MODS_SRC`. The destination can be changed by setting `COPY_MODS_DEST`. : content in this directory is synchronized into `/data/mods` for server types that use mods, [as described above](#mods-vs-plugins). For special cases, the source can be changed by setting `COPY_MODS_SRC` and destination by setting `COPY_MODS_DEST`.
`/config` `/config`
: contents are synchronized into `/data/config` by default, but can be changed with `COPY_CONFIG_DEST`. The source can be changed by setting `COPY_CONFIG_SRC`. For example, `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over files like `bukkit.yml` and so on directly into the server directory. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/config` to take precedence over newer files in `/data/config`. : contents are synchronized into `/data/config` by default, but can be changed with `COPY_CONFIG_DEST`. For example, `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over files like `bukkit.yml` and so on directly into the server directory. The source can be changed by setting `COPY_CONFIG_SRC`. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/config` to take precedence over newer files in `/data/config`.
By default, the [environment variable processing](../configuration/interpolating.md) is performed on synchronized files that match the expected suffixes in `REPLACE_ENV_SUFFIXES` (by default "yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml") and are not excluded by `REPLACE_ENV_VARIABLES_EXCLUDES` and `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. This processing can be disabled by setting `REPLACE_ENV_DURING_SYNC` to `false`. By default, the [environment variable processing](../configuration/interpolating.md) is performed on synchronized files that match the expected suffixes in `REPLACE_ENV_SUFFIXES` (by default "yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml") and are not excluded by `REPLACE_ENV_VARIABLES_EXCLUDES` and `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. This processing can be disabled by setting `REPLACE_ENV_DURING_SYNC` to `false`.
@ -37,7 +41,9 @@ For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMO
These paths work 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. These paths work 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.
> For more flexibility with mods/plugins preparation, you can declare directories to use in [the `MODS` variable](#modsplugins-list) !!! information ""
For more flexibility with mods/plugins preparation, you can declare other directories, files, and URLs to use in [the `MODS` / `PLUGINS` variables](#modsplugins-list).
## Zip file modpack ## Zip file modpack

View File

@ -1,3 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources: resources:
- statefulset.yml - statefulset.yml
- service.yml - service.yml

View File

@ -22,8 +22,8 @@ CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
# Remove old mods/plugins # Remove old mods/plugins
if isTrue "${REMOVE_OLD_MODS}" && [ -z "${MODS_FILE}" ]; then if isTrue "${REMOVE_OLD_MODS}" && [ -z "${MODS_FILE}" ]; then
removeOldMods /data/mods removeOldMods "$MODS_OUT_DIR"
removeOldMods /data/plugins removeOldMods "$PLUGINS_OUT_DIR"
rm -f "$sum_file" rm -f "$sum_file"
fi fi
@ -66,13 +66,13 @@ if [[ "$MODPACK" ]]; then
fi fi
if [ "$FAMILY" = "SPIGOT" ]; then if [ "$FAMILY" = "SPIGOT" ]; then
mkdir -p /data/plugins mkdir -p "$PLUGINS_OUT_DIR"
if ! unzip -o -d /data/plugins /tmp/modpack.zip; then if ! unzip -o -d "$PLUGINS_OUT_DIR" /tmp/modpack.zip; then
log "ERROR: failed to unzip the modpack from ${MODPACK}" log "ERROR: failed to unzip the modpack from ${MODPACK}"
fi fi
else else
mkdir -p /data/mods mkdir -p "$MODS_OUT_DIR"
if ! unzip -o -d /data/mods /tmp/modpack.zip; then if ! unzip -o -d "$MODS_OUT_DIR" /tmp/modpack.zip; then
log "ERROR: failed to unzip the modpack from ${MODPACK}" log "ERROR: failed to unzip the modpack from ${MODPACK}"
fi fi
fi fi
@ -81,58 +81,65 @@ fi
} }
function handleListings() { function handleListings() {
if [[ "$MODS" ]]; then if usesMods && usesPlugins; then
if usesMods; then if [[ "$MODS" ]]; then
mkdir -p "$MODS_OUT_DIR" mkdir -p "$MODS_OUT_DIR"
mc-image-helper mcopy \ mc-image-helper mcopy \
--glob=*.jar \ --glob=*.jar \
--scope=var-list \ --scope=var-list \
--to="$MODS_OUT_DIR" \ --to="$MODS_OUT_DIR" \
"$MODS" "$MODS"
else fi
log "ERROR: TYPE=$TYPE does not support mods" if [[ "$PLUGINS" ]]; then
exit 1 mkdir -p "$PLUGINS_OUT_DIR"
fi mc-image-helper mcopy \
fi --glob=*.jar \
if [[ "$PLUGINS" ]]; then --scope=var-list \
if usesPlugins; then --to="$PLUGINS_OUT_DIR" \
mkdir -p "$PLUGINS_OUT_DIR" "$PLUGINS"
mc-image-helper mcopy \ fi
--glob=*.jar \
--scope=var-list \
--to="$PLUGINS_OUT_DIR" \
"$PLUGINS"
else
log "ERROR: TYPE=$TYPE does not support plugins"
exit 1
fi
fi
if [[ "$MODS_FILE" ]]; then if [[ "$MODS_FILE" ]]; then
if usesMods; then mkdir -p "$MODS_OUT_DIR"
mkdir -p "$MODS_OUT_DIR" mc-image-helper mcopy \
mc-image-helper mcopy \ --file-is-listing \
--file-is-listing \ --scope=file-list \
--scope=file-list \ --to="$MODS_OUT_DIR" \
--to="$MODS_OUT_DIR" \ "$MODS_FILE"
"$MODS_FILE" fi
else if [[ "$PLUGINS_FILE" ]]; then
log "ERROR: TYPE=$TYPE does not support mods" mkdir -p "$PLUGINS_OUT_DIR"
exit 1 mc-image-helper mcopy \
fi --file-is-listing \
fi --scope=file-list \
if [[ "$PLUGINS_FILE" ]]; then --to="$PLUGINS_OUT_DIR" \
"$PLUGINS_FILE"
fi
elif usesPlugins || usesMods; then
outDir="$MODS_OUT_DIR"
if usesPlugins; then if usesPlugins; then
mkdir -p "$PLUGINS_OUT_DIR" outDir="$PLUGINS_OUT_DIR"
fi
if [[ "$MODS" || "$PLUGINS" ]]; then
mkdir -p "$outDir"
mc-image-helper mcopy \
--glob=*.jar \
--scope=var-list \
--to="$outDir" \
"$MODS" "$PLUGINS"
fi
if [[ "$MODS_FILE" || "$PLUGINS_FILE" ]]; then
mkdir -p "$outDir"
mc-image-helper mcopy \ mc-image-helper mcopy \
--file-is-listing \ --file-is-listing \
--scope=file-list \ --scope=file-list \
--to="$PLUGINS_OUT_DIR" \ --to="$outDir" \
"$PLUGINS_FILE" "$MODS_FILE" "$PLUGINS_FILE"
else
log "ERROR: TYPE=$TYPE does not support plugins"
exit 1
fi fi
fi fi
} }

View File

@ -10,6 +10,8 @@
: "${REPLACE_ENV_VARIABLES_EXCLUDES:=}" : "${REPLACE_ENV_VARIABLES_EXCLUDES:=}"
: "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}" : "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}"
: "${DEBUG:=false}" : "${DEBUG:=false}"
: "${MODS_OUT_DIR:=/data/mods}"
: "${PLUGINS_OUT_DIR:=/data/plugins}"
set -e set -e
isDebugging && set -x isDebugging && set -x
@ -25,29 +27,24 @@ else
fi fi
: "${COPY_PLUGINS_SRC:="/plugins"}" : "${COPY_PLUGINS_SRC:="/plugins"}"
: "${COPY_PLUGINS_DEST:="/data/plugins"}" : "${COPY_PLUGINS_DEST:=${PLUGINS_OUT_DIR}}"
if [ -d "${COPY_PLUGINS_SRC}" ]; then if usesPlugins && [ -d "${COPY_PLUGINS_SRC}" ]; then
case ${FAMILY} in mkdir -p "${COPY_PLUGINS_DEST}"
SPIGOT|HYBRID) log "Copying any plugins from ${COPY_PLUGINS_SRC} to ${COPY_PLUGINS_DEST}"
mkdir -p "${COPY_PLUGINS_DEST}" mc-image-helper \
log "Copying any plugins from ${COPY_PLUGINS_SRC} to ${COPY_PLUGINS_DEST}" ${subcommand} $updateArg \
mc-image-helper \ --replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
${subcommand} $updateArg \ --replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \ --replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \ --replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \ "${COPY_PLUGINS_SRC}" "${COPY_PLUGINS_DEST}"
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
"${COPY_PLUGINS_SRC}" "${COPY_PLUGINS_DEST}"
;;
esac
fi fi
# If any modules have been provided, copy them over
: "${COPY_MODS_SRC:="/mods"}" : "${COPY_MODS_SRC:="/mods"}"
: "${COPY_MODS_DEST:="/data/mods"}" : "${COPY_MODS_DEST:=${MODS_OUT_DIR}}"
if [ -d "${COPY_MODS_SRC}" ]; then if usesMods && [ -d "${COPY_MODS_SRC}" ]; then
log "Copying any mods from ${COPY_MODS_SRC} to ${COPY_MODS_DEST}" log "Copying any mods from ${COPY_MODS_SRC} to ${COPY_MODS_DEST}"
mc-image-helper \ mc-image-helper \
${subcommand} $updateArg \ ${subcommand} $updateArg \