mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-18 15:36:22 +00:00
Compare commits
8 Commits
2021.6.0-j
...
2021.3.0-j
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ceee9eddc9 | ||
|
|
60ba668743 | ||
|
|
fd1b15e01f | ||
|
|
f856276d71 | ||
|
|
0300854c46 | ||
|
|
f06e9f5ede | ||
|
|
8d3ca813ed | ||
|
|
e97a00e61d |
2
.github/workflows/build-multiarch.yml
vendored
2
.github/workflows/build-multiarch.yml
vendored
@@ -68,8 +68,6 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.prep.outputs.tags }}
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
# ensure latest base image is used
|
|
||||||
pull: true
|
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
labels: |
|
labels: |
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
FROM adoptopenjdk:15-jre
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& DEBIAN_FRONTEND=noninteractive \
|
&& DEBIAN_FRONTEND=noninteractive \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
|
openjdk-8-jre-headless \
|
||||||
imagemagick \
|
imagemagick \
|
||||||
gosu \
|
gosu \
|
||||||
sudo \
|
sudo \
|
||||||
@@ -67,9 +68,9 @@ WORKDIR /data
|
|||||||
|
|
||||||
ENV UID=1000 GID=1000 \
|
ENV UID=1000 GID=1000 \
|
||||||
MEMORY="1G" \
|
MEMORY="1G" \
|
||||||
TYPE=VANILLA VERSION=LATEST \
|
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
|
||||||
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||||
SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
||||||
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 \
|
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 \
|
||||||
AUTOPAUSE_PERIOD=10 AUTOPAUSE_KNOCK_INTERFACE=eth0
|
AUTOPAUSE_PERIOD=10 AUTOPAUSE_KNOCK_INTERFACE=eth0
|
||||||
|
|
||||||
|
|||||||
54
README.md
54
README.md
@@ -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
|
||||||
@@ -487,30 +487,6 @@ A [Tuinity](https://github.com/Spottedleaf/Tuinity) server, which is a fork of P
|
|||||||
|
|
||||||
> **NOTE** only `VERSION=LATEST` is supported
|
> **NOTE** only `VERSION=LATEST` is supported
|
||||||
|
|
||||||
## Running a Purpur server
|
|
||||||
|
|
||||||
A [Purpur](https://purpur.pl3x.net/) server, which is "a fork of Paper and Tuinity with the goal of providing new and interesting configuration options".
|
|
||||||
|
|
||||||
-e TYPE=PURPUR
|
|
||||||
|
|
||||||
> NOTE: the `VERSION` variable is used to lookup a build of Purpur to download
|
|
||||||
|
|
||||||
Extra variables:
|
|
||||||
- `PURPUR_BUILD=LATEST` : set a specific Purpur build to use
|
|
||||||
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
|
||||||
|
|
||||||
## Running a Yatopia server
|
|
||||||
|
|
||||||
A [Yatopia](https://github.com/YatopiaMC/Yatopia) server, which is a "blazing fast Tuinity fork with best in class performance".
|
|
||||||
|
|
||||||
-e TYPE=YATOPIA
|
|
||||||
|
|
||||||
> NOTE: the `VERSION` variable is used to locate the Yatopia version to download
|
|
||||||
|
|
||||||
Extra variables:
|
|
||||||
- `RELEASE=stable` : set to `stable` or `latest`
|
|
||||||
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
|
||||||
|
|
||||||
## Running a Magma server
|
## Running a Magma server
|
||||||
|
|
||||||
A [Magma](https://magmafoundation.org/) server, which is a combination of Forge and PaperMC, can be used with
|
A [Magma](https://magmafoundation.org/) server, which is a combination of Forge and PaperMC, can be used with
|
||||||
@@ -528,9 +504,6 @@ 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
|
||||||
|
|
||||||
@@ -732,14 +705,16 @@ 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
|
||||||
@@ -947,11 +922,7 @@ 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
|
||||||
|
|
||||||
-e SEED=1785852800490497919
|
docker run -d -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
|
||||||
|
|
||||||
@@ -973,13 +944,16 @@ 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
|
||||||
|
|
||||||
-e MOTD="My Server"
|
docker run -d -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
|
||||||
|
|
||||||
That way you can easily differentiate between several servers you may have started.
|
when `TYPE` is `PAPER`. 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
|
||||||
|
|
||||||
@@ -1154,11 +1128,9 @@ 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`, set `JMX_HOST` to the IP/host running the Docker container, 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` 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
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ version: '3.2'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
mc:
|
mc:
|
||||||
image: itzg/minecraft-server:java8
|
image: itzg/minecraft-server
|
||||||
volumes:
|
volumes:
|
||||||
- ./modpacks:/modpacks:ro
|
- ./modpacks:/modpacks:ro
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
20
examples/docker-compose-curseinstance.yml
Normal file
20
examples/docker-compose-curseinstance.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
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
|
||||||
@@ -2,7 +2,7 @@ version: "3.7"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
mc:
|
mc:
|
||||||
image: itzg/minecraft-server:java8
|
image: itzg/minecraft-server
|
||||||
ports:
|
ports:
|
||||||
# expose the Minecraft server port outside of container
|
# expose the Minecraft server port outside of container
|
||||||
- 25565:25565
|
- 25565:25565
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ version: "3.7"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
mc:
|
mc:
|
||||||
# FTBA support is only available in non-Alpine images
|
# FTBA support is only available in multiarch image tag
|
||||||
image: itzg/minecraft-server:java8-multiarch
|
image: itzg/minecraft-server:multiarch
|
||||||
ports:
|
ports:
|
||||||
# expose the Minecraft server port outside of container
|
# expose the Minecraft server port outside of container
|
||||||
- 25565:25565
|
- 25565:25565
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ version: '3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
minecraft:
|
minecraft:
|
||||||
image: itzg/minecraft-server:java8
|
image: itzg/minecraft-server
|
||||||
ports:
|
ports:
|
||||||
- "25565:25565"
|
- "25565:25565"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
|
||||||
IFS=$'\n\t'
|
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
: ${EULA:=}
|
|
||||||
: ${PROXY:=}
|
|
||||||
: ${RCON_PASSWORD_FILE:=}
|
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
#umask 002
|
#umask 002
|
||||||
@@ -54,6 +48,7 @@ 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
|
||||||
@@ -108,11 +103,7 @@ case "${TYPE^^}" in
|
|||||||
exec ${SCRIPTS:-/}start-deployFTBA "$@"
|
exec ${SCRIPTS:-/}start-deployFTBA "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
FTB|CURSEFORGE)
|
CURSEFORGE|FTB)
|
||||||
log "**********************************************************************"
|
|
||||||
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
|
|
||||||
log " since some mods require Java 8"
|
|
||||||
log "**********************************************************************"
|
|
||||||
exec ${SCRIPTS:-/}start-deployCF "$@"
|
exec ${SCRIPTS:-/}start-deployCF "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -144,19 +135,11 @@ case "${TYPE^^}" in
|
|||||||
exec ${SCRIPTS:-/}start-deployCatserver "$@"
|
exec ${SCRIPTS:-/}start-deployCatserver "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
PURPUR)
|
|
||||||
exec ${SCRIPTS:-/}start-deployPurpur "$@"
|
|
||||||
;;
|
|
||||||
|
|
||||||
YATOPIA)
|
|
||||||
exec ${SCRIPTS:-/}start-deployYatopia "$@"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
log "Invalid type: '$TYPE'"
|
log "Invalid type: '$TYPE'"
|
||||||
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
||||||
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA, TUINITY, PURPUR"
|
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA,"
|
||||||
log " CUSTOM, MAGMA, MOHIST, CATSERVER, YATOPIA"
|
log " CUSTOM, MAGMA, MOHIST, CATSERVER"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ if ! [ -f "${ftbInstallMarker}" ] || [ $(cat "${ftbInstallMarker}") != "${FTB_MO
|
|||||||
echo "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" > ${ftbInstallMarker}
|
echo "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" > ${ftbInstallMarker}
|
||||||
|
|
||||||
writeEula
|
writeEula
|
||||||
|
|
||||||
# some modpacks result in --w----r-- permissions
|
|
||||||
chmod a+r version.json
|
|
||||||
else
|
else
|
||||||
log "FTB modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID} is ready to go"
|
log "FTB modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID} is ready to go"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
export TYPE=FORGE
|
export TYPE=FORGE
|
||||||
: ${FORGEVERSION:=RECOMMENDED}
|
|
||||||
|
|
||||||
if [[ -z $FORGE_INSTALLER && -z $FORGE_INSTALLER_URL ]]; then
|
if [[ -z $FORGE_INSTALLER && -z $FORGE_INSTALLER_URL ]]; then
|
||||||
norm=$VANILLA_VERSION
|
norm=$VANILLA_VERSION
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ 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}/
|
||||||
@@ -18,12 +17,12 @@ if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
buildRelPath=$(
|
latestBuildRelPath=$(
|
||||||
curl -fsSL "${mohistJob}${MOHIST_BUILD}/api/json" |
|
curl -fsSL "${mohistJob}lastSuccessfulBuild/api/json" |
|
||||||
jq -r '.artifacts[0].relativePath'
|
jq -r '.artifacts[0].relativePath'
|
||||||
)
|
)
|
||||||
|
|
||||||
baseName=$(basename "${buildRelPath}")
|
baseName=$(basename "${latestBuildRelPath}")
|
||||||
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"
|
||||||
@@ -35,7 +34,7 @@ export SERVER="/data/${baseName}"
|
|||||||
|
|
||||||
if [ ! -f ${SERVER} ]; then
|
if [ ! -f ${SERVER} ]; then
|
||||||
log "Downloading ${baseName}"
|
log "Downloading ${baseName}"
|
||||||
curl -o "${SERVER}" -fsSL "${mohistJob}${MOHIST_BUILD}/artifact/${buildRelPath}"
|
curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|||||||
@@ -57,9 +57,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log "Removing old PaperMC versions ..."
|
log "Removing old PaperMC versions ..."
|
||||||
for f in paper-*.jar; do
|
paperJarSearchString=${SERVER/$build/[0-9]*}
|
||||||
[[ $f != $SERVER ]] && rm $f
|
find . -name "$paperJarSearchString" ! -name "$SERVER" -delete -print
|
||||||
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[@]}" \
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -euo pipefail
|
|
||||||
IFS=$'\n\t'
|
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
|
||||||
isDebugging && set -x
|
|
||||||
|
|
||||||
: ${VANILLA_VERSION:?}
|
|
||||||
: ${PURPUR_BUILD:=LATEST}
|
|
||||||
: ${FORCE_REDOWNLOAD:=false}
|
|
||||||
|
|
||||||
if [[ ${PURPUR_BUILD} == LATEST ]]; then
|
|
||||||
PURPUR_BUILD=$(curl -fsSL "https://purpur.pl3x.net/api/v1/purpur/${VANILLA_VERSION}" |
|
|
||||||
jq -r '.builds.latest' || echo "")
|
|
||||||
if [[ -z ${PURPUR_BUILD} ]]; then
|
|
||||||
log "ERROR: Failed to locate a Purpur build for ${VANILLA_VERSION}."
|
|
||||||
log " Please check if a download is available at https://purpur.pl3x.net/downloads/"
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
export SERVER="purpur-${VANILLA_VERSION}-${PURPUR_BUILD}.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
|
||||||
downloadUrl="https://purpur.pl3x.net/api/v1/purpur/${VANILLA_VERSION}/${PURPUR_BUILD}/download"
|
|
||||||
log "Downloading Purpur from $downloadUrl ..."
|
|
||||||
if ! curl -fsSL -o "$SERVER" "$downloadUrl"; then
|
|
||||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Normalize on Spigot for later operations
|
|
||||||
export TYPE=SPIGOT
|
|
||||||
export SKIP_LOG4J_CONFIG=true
|
|
||||||
|
|
||||||
# Continue to Final Setup
|
|
||||||
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
|
||||||
@@ -3,8 +3,6 @@
|
|||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
export TYPE=spongevanilla
|
export TYPE=spongevanilla
|
||||||
: ${SPONGEBRANCH:=STABLE}
|
|
||||||
: ${SPONGEVERSION:=}
|
|
||||||
|
|
||||||
# Parse branch
|
# Parse branch
|
||||||
log "Choosing branch for Sponge"
|
log "Choosing branch for Sponge"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Normalize on Spigot for later operations
|
# Normalize on Spigot for operations below
|
||||||
export TYPE=SPIGOT
|
export TYPE=SPIGOT
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -euo pipefail
|
|
||||||
IFS=$'\n\t'
|
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
|
||||||
isDebugging && set -x
|
|
||||||
|
|
||||||
: ${VANILLA_VERSION:?}
|
|
||||||
: ${RELEASE:=stable}
|
|
||||||
: ${FORCE_REDOWNLOAD:=false}
|
|
||||||
|
|
||||||
requireEnum RELEASE stable latest
|
|
||||||
|
|
||||||
export SERVER="yatopia-${RELEASE}-${VANILLA_VERSION}.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
|
||||||
downloadUrl="https://api.yatopiamc.org/v2/${RELEASE}Build/download?branch=ver/${VANILLA_VERSION}"
|
|
||||||
log "Downloading Yatopia from $downloadUrl ..."
|
|
||||||
if ! curl -fsSL -o "$SERVER" "$downloadUrl"; then
|
|
||||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Normalize on Spigot for later operations
|
|
||||||
export TYPE=SPIGOT
|
|
||||||
export SKIP_LOG4J_CONFIG=true
|
|
||||||
|
|
||||||
# Continue to Final Setup
|
|
||||||
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
: ${ENV_VARIABLE_PREFIX:=CFG_}
|
: ${ENV_VARIABLE_PREFIX:=CFG_}
|
||||||
|
|
||||||
if isTrue "${REPLACE_ENV_VARIABLES}"; then
|
if isTrue "${REPLACE_ENV_VARIABLES}"; then
|
||||||
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX ..."
|
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
|
||||||
|
|
||||||
# File excludes
|
# File excludes
|
||||||
fileExcludes=
|
fileExcludes=
|
||||||
@@ -22,30 +22,28 @@ 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"
|
||||||
|
|
||||||
for name in $(compgen -v $ENV_VARIABLE_PREFIX); do
|
while IFS='=' read -r name value ; 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
|
||||||
# Read content from file environment
|
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] \
|
||||||
if [[ $name = *"_FILE" ]]; then
|
&& [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] \
|
||||||
value=$(<${!name})
|
&& [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
|
||||||
name="${name%_FILE}"
|
# Read content from file environment
|
||||||
else
|
if [[ $name = *"_FILE" ]] && [[ -f $value ]]; then
|
||||||
value=${!name}
|
name="${name/_FILE/}"
|
||||||
|
value=$(<$value)
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Replacing $name with $value ..."
|
||||||
|
find /data/ \
|
||||||
|
$dirExcludes \
|
||||||
|
-type f \
|
||||||
|
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
||||||
|
-or -name "*.conf" -or -name "*.properties" \) \
|
||||||
|
$fileExcludes \
|
||||||
|
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
||||||
fi
|
fi
|
||||||
|
done < <(env)
|
||||||
log "Replacing $name with $value ..."
|
|
||||||
|
|
||||||
value=${value//\\/\\\\}
|
|
||||||
value=${value//#/\\#}
|
|
||||||
|
|
||||||
find /data/ \
|
|
||||||
$dirExcludes \
|
|
||||||
-type f \
|
|
||||||
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
|
||||||
-or -name "*.conf" -or -name "*.properties" \) \
|
|
||||||
$fileExcludes \
|
|
||||||
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-minecraftFinalSetup $@
|
exec ${SCRIPTS:-/}start-minecraftFinalSetup $@
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
: ${SERVER_PROPERTIES:=/data/server.properties}
|
|
||||||
|
|
||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
function setServerProp {
|
function setServerProp {
|
||||||
local prop=$1
|
local prop=$1
|
||||||
@@ -14,15 +12,10 @@ 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
|
|
||||||
log "Adding ${prop} with '${var}' in ${SERVER_PROPERTIES}"
|
|
||||||
echo "${prop}=${var//\\/\\\\}" >> "$SERVER_PROPERTIES"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
isDebugging && log "Skip setting ${prop}"
|
log "Skip setting ${prop}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +69,7 @@ function customizeServerProps {
|
|||||||
setServerProp "max-world-size" "$MAX_WORLD_SIZE"
|
setServerProp "max-world-size" "$MAX_WORLD_SIZE"
|
||||||
setServerProp "level-name" "$LEVEL"
|
setServerProp "level-name" "$LEVEL"
|
||||||
setServerProp "level-seed" "$SEED"
|
setServerProp "level-seed" "$SEED"
|
||||||
setServerProp "pvp" "${PVP}"
|
setServerProp "pvp" "$PVP"
|
||||||
setServerProp "generator-settings" "$GENERATOR_SETTINGS"
|
setServerProp "generator-settings" "$GENERATOR_SETTINGS"
|
||||||
setServerProp "online-mode" "$ONLINE_MODE"
|
setServerProp "online-mode" "$ONLINE_MODE"
|
||||||
setServerProp "allow-flight" "$ALLOW_FLIGHT"
|
setServerProp "allow-flight" "$ALLOW_FLIGHT"
|
||||||
|
|||||||
@@ -4,9 +4,6 @@
|
|||||||
set -e
|
set -e
|
||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
: ${LEVEL:=world}
|
|
||||||
export LEVEL
|
|
||||||
|
|
||||||
if [ $TYPE = "FEED-THE-BEAST" ]; then
|
if [ $TYPE = "FEED-THE-BEAST" ]; then
|
||||||
worldDest=$FTB_DIR/$LEVEL
|
worldDest=$FTB_DIR/$LEVEL
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ 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
|
||||||
@@ -91,8 +92,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_BINDING:-0.0.0.0}
|
-Dcom.sun.management.jmxremote.host=${JMX_HOST}
|
||||||
-Djava.rmi.server.hostname=${JMX_HOST:-localhost}"
|
-Djava.rmi.server.hostname=${JMX_HOST}"
|
||||||
|
|
||||||
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
|
||||||
@@ -167,11 +168,6 @@ function copyFilesForCurseForge() {
|
|||||||
cp -f /data/eula.txt "${FTB_DIR}/"
|
cp -f /data/eula.txt "${FTB_DIR}/"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! which java > /dev/null; then
|
|
||||||
log "Fixing PATH to include java"
|
|
||||||
PATH="${PATH}:/opt/java/openjdk/bin"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mcServerRunnerArgs="--stop-duration ${STOP_DURATION:-60}s"
|
mcServerRunnerArgs="--stop-duration ${STOP_DURATION:-60}s"
|
||||||
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
||||||
if isTrue ${DEBUG_EXEC}; then
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
|
|||||||
14
start-utils
14
start-utils
@@ -144,20 +144,6 @@ requireVar() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
requireEnum() {
|
|
||||||
var=${1?}
|
|
||||||
shift
|
|
||||||
|
|
||||||
for allowed in $*; do
|
|
||||||
if [[ ${!var} = $allowed ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
log "ERROR: $var must be set to one of $@"
|
|
||||||
# exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeEula() {
|
function writeEula() {
|
||||||
if ! echo "# Generated via Docker
|
if ! echo "# Generated via Docker
|
||||||
# $(date)
|
# $(date)
|
||||||
|
|||||||
Reference in New Issue
Block a user