Auto-merging via docker-versions-create

This commit is contained in:
Geoff Bourne 2021-02-27 20:55:30 -06:00
commit 457e9b53c7
12 changed files with 64 additions and 71 deletions

View file

@ -132,7 +132,7 @@ services:
EULA: "TRUE" EULA: "TRUE"
volumes: volumes:
# attach the relative directory 'data' to the container's /data path # attach the relative directory 'data' to the container's /data path
./data:/data - ./data:/data
``` ```
## Versions ## Versions
@ -528,6 +528,9 @@ A [Mohist](https://github.com/Mohist-Community/Mohist) server can be used with
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2" > **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
By default the latest build will be used; however, a specific build number can be selected by setting `MOHIST_BUILD`, such as
-e VERSION=1.16.5 -e MOHIST_BUILD=374
## Running a Catserver type server ## Running a Catserver type server
@ -729,16 +732,14 @@ every time you want to create new Minecraft server, you can now use
``` ```
minecraft-server: minecraft-server:
image: itzg/minecraft-server
ports: ports:
- "25565:25565" - "25565:25565"
environment: environment:
EULA: "TRUE" EULA: "TRUE"
image: itzg/minecraft-server
container_name: mc
tty: true tty: true
stdin_open: true stdin_open: true
restart: always restart: always
@ -946,7 +947,11 @@ It determines the server-side viewing distance.
If you want to create the Minecraft level with a specific seed, use `SEED`, such as If you want to create the Minecraft level with a specific seed, use `SEED`, such as
docker run -d -e SEED=1785852800490497919 ... -e SEED=1785852800490497919
If using a negative value for the seed, make sure to quote the value such as:
-e SEED="-1785852800490497919"
### Game Mode ### Game Mode
@ -968,16 +973,13 @@ For example:
The message of the day, shown below each server entry in the UI, can be changed with the `MOTD` environment variable, such as The message of the day, shown below each server entry in the UI, can be changed with the `MOTD` environment variable, such as
docker run -d -e 'MOTD=My Server' ... -e MOTD="My Server"
If you leave it off, a default is computed from the server type and version, such as If you leave it off, a default is computed from the server type and version, such as
A Paper Minecraft Server powered by Docker A Paper Minecraft Server powered by Docker
when `TYPE` is `PAPER`. That way you can easily differentiate between several servers you may have started. That way you can easily differentiate between several servers you may have started.
_The example shows how to specify a server message of the day that contains spaces by putting quotes
around the whole thing._
### PVP Mode ### PVP Mode
@ -1152,9 +1154,11 @@ For some cases, if e.g. after removing mods, it could be necessary to startup mi
### Enable Remote JMX for Profiling ### Enable Remote JMX for Profiling
To enable remote JMX, such as for profiling with VisualVM or JMC, add the environment variable `ENABLE_JMX=true` and add a port forwarding of TCP port 7091, such as: To enable remote JMX, such as for profiling with VisualVM or JMC, add the environment variable `ENABLE_JMX=true`, set `JMX_HOST` to the IP/host running the Docker container, and add a port forwarding of TCP port 7091, such as:
-e ENABLE_JMX=true -p 7091:7091 ```
-e ENABLE_JMX=true -e JMX_HOST=$HOSTNAME -p 7091:7091
```
### Enable Aikar's Flags ### Enable Aikar's Flags

View file

@ -2,7 +2,7 @@ version: '3.2'
services: services:
mc: mc:
image: itzg/minecraft-server image: itzg/minecraft-server:java8
volumes: volumes:
- ./modpacks:/modpacks:ro - ./modpacks:/modpacks:ro
environment: environment:

View file

@ -1,20 +0,0 @@
version: "3.7"
services:
mc:
image: itzg/minecraft-server
ports:
- 25565:25565
volumes:
# Attach .../Curse/Minecraft/Instances for use at /instances
- ./Instances:/instances:ro
# Attach /data as usual
- ./ServerData:/data
environment:
EULA: "TRUE"
# Modpacks generally need more memory, so let's give at 2 GB
MEMORY: 2G
# Use new CURSE_INSTANCE type
TYPE: CURSE_INSTANCE
# Reference directory of or full path to minecraftinstance.json
CURSE_INSTANCE_JSON: /instances/FTB Presents SkyFactory 3

View file

@ -2,7 +2,7 @@ version: "3.7"
services: services:
mc: mc:
image: itzg/minecraft-server image: itzg/minecraft-server:java8
ports: ports:
# expose the Minecraft server port outside of container # expose the Minecraft server port outside of container
- 25565:25565 - 25565:25565

View file

@ -2,8 +2,8 @@ version: "3.7"
services: services:
mc: mc:
# FTBA support is only available in multiarch image tag # FTBA support is only available in non-Alpine images
image: itzg/minecraft-server:multiarch image: itzg/minecraft-server:java8-multiarch
ports: ports:
# expose the Minecraft server port outside of container # expose the Minecraft server port outside of container
- 25565:25565 - 25565:25565

View file

@ -5,7 +5,7 @@ version: '3'
services: services:
minecraft: minecraft:
image: itzg/minecraft-server image: itzg/minecraft-server:java8
ports: ports:
- "25565:25565" - "25565:25565"
volumes: volumes:

View file

@ -54,7 +54,6 @@ if [[ $RCON_PASSWORD_FILE ]]; then
log "" log ""
fi fi
export SERVER_PROPERTIES=/data/server.properties
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
case "X$VERSION" in case "X$VERSION" in

View file

@ -6,6 +6,7 @@ set -e
isDebugging && set -x isDebugging && set -x
requireVar VANILLA_VERSION requireVar VANILLA_VERSION
: ${MOHIST_BUILD:=lastSuccessfulBuild}
mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/ mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/ mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/
@ -17,12 +18,12 @@ if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then
exit 1 exit 1
fi fi
latestBuildRelPath=$( buildRelPath=$(
curl -fsSL "${mohistJob}lastSuccessfulBuild/api/json" | curl -fsSL "${mohistJob}${MOHIST_BUILD}/api/json" |
jq -r '.artifacts[0].relativePath' jq -r '.artifacts[0].relativePath'
) )
baseName=$(basename "${latestBuildRelPath}") baseName=$(basename "${buildRelPath}")
if [[ ${baseName} != *-server.jar* ]]; then if [[ ${baseName} != *-server.jar* ]]; then
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}" log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}"
log " check https://ci.codemc.io/job/Mohist-Community/ for available versions" log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
@ -34,7 +35,7 @@ export SERVER="/data/${baseName}"
if [ ! -f ${SERVER} ]; then if [ ! -f ${SERVER} ]; then
log "Downloading ${baseName}" log "Downloading ${baseName}"
curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}" curl -o "${SERVER}" -fsSL "${mohistJob}${MOHIST_BUILD}/artifact/${buildRelPath}"
fi fi
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true

View file

@ -57,8 +57,9 @@ else
fi fi
log "Removing old PaperMC versions ..." log "Removing old PaperMC versions ..."
paperJarSearchString=${SERVER/$build/[0-9]*} for f in paper-*.jar; do
find . -maxdepth 1 -name "$paperJarSearchString" ! -name "$SERVER" -delete -print [[ $f != $SERVER ]] && rm $f
done
log "Downloading PaperMC $VANILLA_VERSION (build $build) ..." log "Downloading PaperMC $VANILLA_VERSION (build $build) ..."
curl -fsSL -o "$SERVER" "${zarg[@]}" \ curl -fsSL -o "$SERVER" "${zarg[@]}" \

View file

@ -22,19 +22,22 @@ if isTrue "${REPLACE_ENV_VARIABLES}"; then
isDebugging && echo "Using find file exclusions: $fileExcludes" isDebugging && echo "Using find file exclusions: $fileExcludes"
isDebugging && echo "Using find directory exclusions: $dirExcludes" isDebugging && echo "Using find directory exclusions: $dirExcludes"
while IFS='=' read -r name value ; do for name in $(compgen -v $ENV_VARIABLE_PREFIX); do
# check if name of env variable matches the prefix # check if name of env variable matches the prefix
# sanity check environment variables to avoid code injections # sanity check environment variables to avoid code injections
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] \
&& [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] \
&& [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
# Read content from file environment # Read content from file environment
if [[ $name = *"_FILE" ]] && [[ -f $value ]]; then if [[ $name = *"_FILE" ]]; then
name="${name/_FILE/}" value=$(<${!name})
value=$(<$value) name="${name%_FILE}"
else
value=${!name}
fi fi
log "Replacing $name with $value ..." log "Replacing $name with $value ..."
value=${value//\\/\\\\}
value=${value//#/\\#}
find /data/ \ find /data/ \
$dirExcludes \ $dirExcludes \
-type f \ -type f \
@ -42,8 +45,7 @@ if isTrue "${REPLACE_ENV_VARIABLES}"; then
-or -name "*.conf" -or -name "*.properties" \) \ -or -name "*.conf" -or -name "*.properties" \) \
$fileExcludes \ $fileExcludes \
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \; -exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
fi done
done < <(env)
fi fi
exec ${SCRIPTS:-/}start-minecraftFinalSetup $@ exec ${SCRIPTS:-/}start-minecraftFinalSetup $@

View file

@ -2,6 +2,8 @@
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
: ${SERVER_PROPERTIES:=/data/server.properties}
# FUNCTIONS # FUNCTIONS
function setServerProp { function setServerProp {
local prop=$1 local prop=$1
@ -12,10 +14,15 @@ function setServerProp {
TRUE|FALSE) TRUE|FALSE)
var=${var,,} ;; var=${var,,} ;;
esac esac
if grep "${prop}" "$SERVER_PROPERTIES" > /dev/null; then
log "Setting ${prop} to '${var}' in ${SERVER_PROPERTIES}" log "Setting ${prop} to '${var}' in ${SERVER_PROPERTIES}"
sed -i "/^${prop}\s*=/ c ${prop}=${var//\\/\\\\}" "$SERVER_PROPERTIES" sed -i "/^${prop}\s*=/ c ${prop}=${var//\\/\\\\}" "$SERVER_PROPERTIES"
else else
log "Skip setting ${prop}" log "Adding ${prop} with '${var}' in ${SERVER_PROPERTIES}"
echo "${prop}=${var//\\/\\\\}" >> "$SERVER_PROPERTIES"
fi
else
isDebugging && log "Skip setting ${prop}"
fi fi
} }

View file

@ -84,7 +84,6 @@ if [ -n "$JVM_DD_OPTS" ]; then
fi fi
if isTrue ${ENABLE_JMX}; then if isTrue ${ENABLE_JMX}; then
: ${JMX_HOST:=0.0.0.0}
: ${JMX_PORT:=7091} : ${JMX_PORT:=7091}
JVM_OPTS="${JVM_OPTS} JVM_OPTS="${JVM_OPTS}
-Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.local.only=false
@ -92,8 +91,8 @@ if isTrue ${ENABLE_JMX}; then
-Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT} -Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT}
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.host=${JMX_HOST} -Dcom.sun.management.jmxremote.host=${JMX_BINDING:-0.0.0.0}
-Djava.rmi.server.hostname=${JMX_HOST}" -Djava.rmi.server.hostname=${JMX_HOST:-localhost}"
log "JMX is enabled. Make sure you have port forwarding for ${JMX_PORT}" log "JMX is enabled. Make sure you have port forwarding for ${JMX_PORT}"
fi fi