Auto-merging via docker-versions-create

# Conflicts:
#	start-deployFTB
This commit is contained in:
Geoff Bourne 2020-07-10 17:13:05 -05:00
commit c07f899870
24 changed files with 80 additions and 117 deletions

View File

@ -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
@ -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
```

View File

@ -69,7 +69,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* /

View File

@ -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
@ -306,7 +308,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 +324,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`. 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`.
```yml
@ -396,45 +400,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
@ -451,48 +417,10 @@ If you are hosting your own copy of PaperSpigot you can override the download UR
- -e PAPER_DOWNLOAD_URL=<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
@ -670,6 +598,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
@ -975,7 +909,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.
@ -1013,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"

View File

@ -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

View File

@ -102,4 +102,4 @@ export TYPE=SPIGOT
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@ -29,4 +29,4 @@ fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World "$@"
exec ${SCRIPTS:-/}start-finalSetupWorld "$@"

View File

@ -28,4 +28,4 @@ fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@ -67,4 +67,4 @@ if ! [ -v SERVER ]; then
fi
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World "$@"
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@ -75,4 +75,4 @@ else
fi
# Contineut to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@ -113,4 +113,4 @@ else
fi
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@ -15,4 +15,4 @@ fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@ -40,4 +40,4 @@ fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World "$@"
exec ${SCRIPTS:-/}start-finalSetupWorld "$@"

View File

@ -20,4 +20,4 @@ export TYPE=SPIGOT
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@ -36,4 +36,4 @@ if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
fi
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@ -24,4 +24,4 @@ fi
export TYPE=SPIGOT
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@ -43,4 +43,4 @@ fi
isDebugging && ls -l
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@ -2,8 +2,20 @@
. ${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
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
# check if name of env variable matches the prefix
# sanity check environment variables to avoid code injections
@ -20,6 +32,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)

View File

@ -24,4 +24,4 @@ case "X$MODCONFIG" in
esac
fi
exec ${SCRIPTS:-/}start-finalSetup04ServerProperties $@
exec ${SCRIPTS:-/}start-finalSetupPlugins $@

View File

@ -154,4 +154,4 @@ if [[ "${GENERIC_PACK}" ]]; then
fi
fi
exec ${SCRIPTS:-/}start-finalSetup03Modconfig $@
exec ${SCRIPTS:-/}start-finalSetupModconfig $@

23
start-finalSetupPlugins Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
. ${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
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs $updateArg /plugins /data
;;
esac
fi
exec ${SCRIPTS:-/}start-finalSetupServerProperties $@

View File

@ -206,4 +206,4 @@ if isDebugging; then
cat /data/server.properties
fi
exec ${SCRIPTS:-/}start-finalSetup05EnvVariables $@
exec ${SCRIPTS:-/}start-finalSetupEnvVariables $@

View File

@ -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
@ -51,4 +51,4 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
fi
fi
exec ${SCRIPTS:-/}start-finalSetup02Modpack $@
exec ${SCRIPTS:-/}start-finalSetupModpack $@

View File

@ -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

View File

@ -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 "$@"