mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-17 12:05:56 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ede58d9159 | ||
|
|
b271b529ea | ||
|
|
d24690ab8c | ||
|
|
89fa3ff8fe | ||
|
|
5c0a3a64ab | ||
|
|
b66629b951 | ||
|
|
de866a322f | ||
|
|
79ac19937f | ||
|
|
08e8fcdc7c | ||
|
|
6941e63a2c | ||
|
|
c68997936a | ||
|
|
40547439b2 | ||
|
|
691fe638e4 | ||
|
|
fbdee6a7a7 | ||
|
|
664f3d7eaa | ||
|
|
c2846fc586 | ||
|
|
e9b1332119 | ||
|
|
757a5146a1 | ||
|
|
f9defda106 | ||
|
|
e6a3ca0a1f | ||
|
|
1cf478f5b3 | ||
|
|
9ff94f9bd5 | ||
|
|
9842a52820 | ||
|
|
dbca9c30b0 | ||
|
|
220f2fbd79 |
@@ -21,8 +21,8 @@ HEALTHCHECK --start-period=1m CMD mc-monitor status --host localhost --port $SER
|
|||||||
|
|
||||||
RUN addgroup -g 1000 minecraft \
|
RUN addgroup -g 1000 minecraft \
|
||||||
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
|
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
|
||||||
&& mkdir -m 777 /data /mods /config /plugins \
|
&& mkdir -m 777 /data \
|
||||||
&& chown minecraft:minecraft /data /config /mods /plugins /home/minecraft
|
&& chown minecraft:minecraft /data /home/minecraft
|
||||||
|
|
||||||
EXPOSE 25565 25575
|
EXPOSE 25565 25575
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
|||||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||||
|
|
||||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||||
--var version=1.4.2 --var app=mc-server-runner --file {{.app}} \
|
--var version=1.4.3 --var app=mc-server-runner --file {{.app}} \
|
||||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||||
|
|
||||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||||
@@ -69,8 +69,7 @@ ENV UID=1000 GID=1000 \
|
|||||||
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
||||||
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
|
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 \
|
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||||
RESOURCE_PACK= RESOURCE_PACK_SHA1= \
|
LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
||||||
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= MODS= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true SERVER_NAME="Dedicated Server" \
|
|
||||||
REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_"
|
REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_"
|
||||||
|
|
||||||
COPY start* /
|
COPY start* /
|
||||||
|
|||||||
63
README.md
63
README.md
@@ -93,6 +93,24 @@ such as
|
|||||||
|
|
||||||
docker run -d -it -e EULA=TRUE -p 25565:25565 --name mc itzg/minecraft-server
|
docker run -d -it -e EULA=TRUE -p 25565:25565 --name mc itzg/minecraft-server
|
||||||
|
|
||||||
|
## Timezone Configuration
|
||||||
|
|
||||||
|
You can configure the timezone to match yours by setting the `TZ` environment variable:
|
||||||
|
|
||||||
|
-e TZ=Europe/London
|
||||||
|
|
||||||
|
such as:
|
||||||
|
|
||||||
|
docker run -d -it -e TZ=Europe/London -p 25565:25565 --name mc itzg/minecraft-server
|
||||||
|
|
||||||
|
Or mounting `/etc/timezone` as readonly (not supported on Windows):
|
||||||
|
|
||||||
|
-v /etc/timezone:/etc/timezone:ro
|
||||||
|
|
||||||
|
such as:
|
||||||
|
|
||||||
|
docker run -d -it -v /etc/timezone:/etc/timezone:ro -p 25565:25565 --name mc itzg/minecraft-server
|
||||||
|
|
||||||
## Attaching data directory to host filesystem
|
## Attaching data directory to host filesystem
|
||||||
|
|
||||||
In order to readily access the Minecraft data, use the `-v` argument
|
In order to readily access the Minecraft data, use the `-v` argument
|
||||||
@@ -259,6 +277,8 @@ Optionally you can also define a prefix to only match predefined enviroment vari
|
|||||||
|
|
||||||
`ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix
|
`ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix
|
||||||
|
|
||||||
|
If you want use file for value (like when use secrets) you can add suffix `_FILE` to your variable name (in run command).
|
||||||
|
|
||||||
There are some limitations to what characters you can use.
|
There are some limitations to what characters you can use.
|
||||||
|
|
||||||
| Type | Allowed Characters |
|
| Type | Allowed Characters |
|
||||||
@@ -305,7 +325,7 @@ services:
|
|||||||
# and here are the actual variables
|
# and here are the actual variables
|
||||||
CFG_DB_HOST: "http://localhost:3306"
|
CFG_DB_HOST: "http://localhost:3306"
|
||||||
CFG_DB_NAME: "minecraft"
|
CFG_DB_NAME: "minecraft"
|
||||||
CFG_DB_PASSWORD: "ug23u3bg39o-ogADSs"
|
CFG_DB_PASSWORD_FILE: "/run/secrets/db_password"
|
||||||
restart: always
|
restart: always
|
||||||
rcon:
|
rcon:
|
||||||
image: itzg/rcon
|
image: itzg/rcon
|
||||||
@@ -318,8 +338,16 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
mc:
|
mc:
|
||||||
rcon:
|
rcon:
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
db_password:
|
||||||
|
file: ./db_password
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The content of `db_password`:
|
||||||
|
|
||||||
|
ug23u3bg39o-ogADSs
|
||||||
|
|
||||||
## Running a Bukkit/Spigot server
|
## Running a Bukkit/Spigot server
|
||||||
|
|
||||||
Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT -e VERSION=1.8` or `-e TYPE=SPIGOT -e VERSION=1.8` to your command-line.
|
Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT -e VERSION=1.8` or `-e TYPE=SPIGOT -e VERSION=1.8` to your command-line.
|
||||||
@@ -386,6 +414,9 @@ in either persistent volumes or a downloadable archive.
|
|||||||
|
|
||||||
Enable PaperSpigot server mode by adding a `-e TYPE=PAPER -e VERSION=1.9.4` to your command-line.
|
Enable PaperSpigot server mode by adding a `-e TYPE=PAPER -e VERSION=1.9.4` to your command-line.
|
||||||
|
|
||||||
|
By default the container will run the latest build of [Paper server](https://papermc.io/downloads)
|
||||||
|
but you can also choose to run a specific build with `-e PAPERBUILD=205`.
|
||||||
|
|
||||||
docker run -d -v /path/on/host:/data \
|
docker run -d -v /path/on/host:/data \
|
||||||
-e TYPE=PAPER -e VERSION=1.9.4 \
|
-e TYPE=PAPER -e VERSION=1.9.4 \
|
||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
@@ -444,6 +475,22 @@ 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
|
location, but still have multiple worlds with different server requirements
|
||||||
in either persistent volumes or a downloadable archive.
|
in either persistent volumes or a downloadable archive.
|
||||||
|
|
||||||
|
## Running a Tuinity server
|
||||||
|
|
||||||
|
A [Tuinity](https://github.com/Spottedleaf/Tuinity) server, which is a fork of Paper aimed at improving server performance at high playercounts.
|
||||||
|
|
||||||
|
-e TYPE=TUINITY
|
||||||
|
|
||||||
|
> **NOTE** only `VERSION=LATEST` is supported
|
||||||
|
|
||||||
|
## Running a Magma server
|
||||||
|
|
||||||
|
A [Magma](https://magmafoundation.org/) server, which is a combination of Forge and PaperMC, can be used with
|
||||||
|
|
||||||
|
-e TYPE=MAGMA
|
||||||
|
|
||||||
|
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
|
||||||
|
|
||||||
## Running a Server with a Feed-The-Beast (FTB) / CurseForge modpack
|
## Running a Server with a Feed-The-Beast (FTB) / CurseForge modpack
|
||||||
|
|
||||||
Enable this server mode by adding a `-e TYPE=FTB` or `-e TYPE=CURSEFORGE` to your command-line,
|
Enable this server mode by adding a `-e TYPE=FTB` or `-e TYPE=CURSEFORGE` to your command-line,
|
||||||
@@ -451,8 +498,8 @@ but note the following additional steps needed...
|
|||||||
|
|
||||||
You need to specify a modpack to run, using the `FTB_SERVER_MOD` or `CF_SERVER_MOD` environment
|
You need to specify a modpack to run, using the `FTB_SERVER_MOD` or `CF_SERVER_MOD` environment
|
||||||
variable. An FTB/CurseForge server modpack is available together with its respective
|
variable. An FTB/CurseForge server modpack is available together with its respective
|
||||||
client modpack on https://www.feed-the-beast.com under "Additional Files." Similar you can
|
client modpack on <https://www.feed-the-beast.com> under "Additional Files." Similar you can
|
||||||
locate the modpacks for CurseForge at https://www.curseforge.com/minecraft/modpacks .
|
locate the modpacks for CurseForge at <https://www.curseforge.com/minecraft/modpacks> .
|
||||||
|
|
||||||
Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line.
|
Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line.
|
||||||
|
|
||||||
@@ -460,7 +507,7 @@ Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line.
|
|||||||
-e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \
|
-e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \
|
||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
|
||||||
If you don't want to keep the pre-download modpacks separate from your data directory,
|
If you want to keep the pre-download modpacks separate from your data directory,
|
||||||
then you can attach another volume at a path of your choosing and reference that.
|
then you can attach another volume at a path of your choosing and reference that.
|
||||||
The following example uses `/modpacks` as the container path as the pre-download area:
|
The following example uses `/modpacks` as the container path as the pre-download area:
|
||||||
|
|
||||||
@@ -490,7 +537,7 @@ To use these packs you will need to:
|
|||||||
- Specify the manifest location with env var `MANIFEST=/data/FeedTheBeast/manifest`
|
- Specify the manifest location with env var `MANIFEST=/data/FeedTheBeast/manifest`
|
||||||
- Pick a relevant ServerStart.sh and potentially settings.cfg and put them in `/data/FeedTheBeast`
|
- Pick a relevant ServerStart.sh and potentially settings.cfg and put them in `/data/FeedTheBeast`
|
||||||
|
|
||||||
An example of the latter would be to use https://github.com/AllTheMods/Server-Scripts
|
An example of the latter would be to use <https://github.com/AllTheMods/Server-Scripts>
|
||||||
There, you'll find that all you have to do is put `ServerStart.sh` and `settings.cfg` into
|
There, you'll find that all you have to do is put `ServerStart.sh` and `settings.cfg` into
|
||||||
`/data/FeedTheBeast`, taking care to update `settings.cfg` to specify your desired version
|
`/data/FeedTheBeast`, taking care to update `settings.cfg` to specify your desired version
|
||||||
of minecraft and forge. You can do this in the cli with something like:
|
of minecraft and forge. You can do this in the cli with something like:
|
||||||
@@ -987,6 +1034,12 @@ Allows users to use flight on your server while in Survival mode, if they have a
|
|||||||
|
|
||||||
-e ALLOW_FLIGHT=TRUE|FALSE
|
-e ALLOW_FLIGHT=TRUE|FALSE
|
||||||
|
|
||||||
|
### Other server property mappings
|
||||||
|
|
||||||
|
Environment Variable | Server Property
|
||||||
|
---------------------|-----------------
|
||||||
|
PLAYER_IDLE_TIMEOUT | player-idle-timeout
|
||||||
|
|
||||||
## Miscellaneous Options
|
## Miscellaneous Options
|
||||||
|
|
||||||
### Running as alternate user/group ID
|
### Running as alternate user/group ID
|
||||||
|
|||||||
34
build-multiarch.sh
Normal file
34
build-multiarch.sh
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# manually purge any pre-existing manifest list
|
||||||
|
# since docker manifest command lacks a "remove" operation
|
||||||
|
rm -rf ~/.docker/manifests/docker.io_itzg_minecraft-server-multiarch
|
||||||
|
|
||||||
|
export DOCKER_BUILDKIT=1
|
||||||
|
|
||||||
|
docker build --platform linux/arm64 -t itzg/minecraft-server:arm64 .
|
||||||
|
docker push itzg/minecraft-server:arm64
|
||||||
|
|
||||||
|
armv7tag=armv7-buildkit
|
||||||
|
armv7workDir=/tmp/armv7-$$
|
||||||
|
git worktree add $armv7workDir armv7
|
||||||
|
# sub-shell for build of armv7
|
||||||
|
(
|
||||||
|
cd $armv7workDir
|
||||||
|
docker build --platform linux/arm/v7 -t itzg/minecraft-server:$armv7tag .
|
||||||
|
docker push itzg/minecraft-server:$armv7tag
|
||||||
|
)
|
||||||
|
git worktree remove $armv7workDir
|
||||||
|
|
||||||
|
docker pull itzg/minecraft-server
|
||||||
|
# use the rpi build one for now since armv7-buildkit is giving ABI mismatch on curl
|
||||||
|
docker pull itzg/minecraft-server:armv7
|
||||||
|
|
||||||
|
docker manifest create itzg/minecraft-server:multiarch \
|
||||||
|
itzg/minecraft-server \
|
||||||
|
itzg/minecraft-server:armv7 \
|
||||||
|
itzg/minecraft-server:arm64
|
||||||
|
|
||||||
|
docker manifest inspect itzg/minecraft-server:multiarch
|
||||||
|
|
||||||
|
docker manifest push -p itzg/minecraft-server:multiarch
|
||||||
23
examples/docker-compose-forge.yml
Normal file
23
examples/docker-compose-forge.yml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
ports:
|
||||||
|
# expose the Minecraft server port outside of container
|
||||||
|
- 25565:25565
|
||||||
|
environment:
|
||||||
|
# REQUIRED for all types
|
||||||
|
EULA: "TRUE"
|
||||||
|
# Set server type (vs the default of vanilla)
|
||||||
|
TYPE: FORGE
|
||||||
|
volumes:
|
||||||
|
# use a named, managed volume for data volume
|
||||||
|
- mc_forge:/data
|
||||||
|
# attach local host directory "mods" in same directory as this compose file
|
||||||
|
# all mods in this directory get copied into /data/mods at startup
|
||||||
|
- ./mods:/mods:ro
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
# declared the named volume, but use default/local storage engine
|
||||||
|
mc_forge: {}
|
||||||
@@ -22,6 +22,7 @@ snooper-enabled=true
|
|||||||
texture-pack=
|
texture-pack=
|
||||||
online-mode=true
|
online-mode=true
|
||||||
resource-pack=
|
resource-pack=
|
||||||
|
resource-pack-sha1=
|
||||||
pvp=true
|
pvp=true
|
||||||
difficulty=1
|
difficulty=1
|
||||||
enable-command-block=true
|
enable-command-block=true
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ if [ ! -e /data/eula.txt ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "# Generated via Docker on $(date)" > eula.txt
|
echo "# Generated via Docker on $(date)" > /data/eula.txt
|
||||||
|
|
||||||
if ! echo "eula=$EULA" >> eula.txt; then
|
if ! echo "eula=$EULA" >> /data/eula.txt; then
|
||||||
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
@@ -78,6 +78,10 @@ case "${TYPE^^}" in
|
|||||||
exec /start-deployPaper "$@"
|
exec /start-deployPaper "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
TUINITY)
|
||||||
|
exec /start-deployTuinity "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
FORGE)
|
FORGE)
|
||||||
exec /start-deployForge "$@"
|
exec /start-deployForge "$@"
|
||||||
;;
|
;;
|
||||||
@@ -106,6 +110,10 @@ case "${TYPE^^}" in
|
|||||||
exec /start-validateCurseInstance "$@"
|
exec /start-validateCurseInstance "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
MAGMA)
|
||||||
|
exec /start-magma "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
log "Invalid type: '$TYPE'"
|
log "Invalid type: '$TYPE'"
|
||||||
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, CURSEFORGE, SPONGEVANILLA"
|
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, CURSEFORGE, SPONGEVANILLA"
|
||||||
|
|||||||
@@ -5,6 +5,11 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
function buildSpigotFromSource {
|
function buildSpigotFromSource {
|
||||||
|
if [[ ${TYPE^^} = *BUKKIT ]] && ! versionLessThan "1.14"; then
|
||||||
|
log "ERR craftbukkit build is only supported for versions less than 1.14"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
log "Building Spigot $VANILLA_VERSION from source, might take a while, get some coffee"
|
log "Building Spigot $VANILLA_VERSION from source, might take a while, get some coffee"
|
||||||
rm -rf /data/temp
|
rm -rf /data/temp
|
||||||
mkdir /data/temp
|
mkdir /data/temp
|
||||||
@@ -15,12 +20,24 @@ function buildSpigotFromSource {
|
|||||||
logn ''
|
logn ''
|
||||||
curl -sSL -o /data/temp/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
|
curl -sSL -o /data/temp/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
|
||||||
java $jvmOpts -jar /data/temp/BuildTools.jar --rev $VANILLA_VERSION 2>&1 |tee /data/spigot_build.log| while read l; do echo -n .; done; log "done"
|
java $jvmOpts -jar /data/temp/BuildTools.jar --rev $VANILLA_VERSION 2>&1 |tee /data/spigot_build.log| while read l; do echo -n .; done; log "done"
|
||||||
if ! mv spigot-*.jar /data/spigot_server.jar; then
|
|
||||||
log "ERR failed to build Spigot"
|
case ${TYPE^^} in
|
||||||
cat /data/spigot_build.log
|
SPIGOT)
|
||||||
exit 1
|
if ! mv spigot-*.jar /data/${SERVER}; then
|
||||||
fi
|
log "ERR failed to build Spigot"
|
||||||
mv craftbukkit-*.jar /data/${SERVER}
|
cat /data/spigot_build.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*BUKKIT)
|
||||||
|
if ! mv craftbukkit-*.jar /data/${SERVER}; then
|
||||||
|
log "ERR failed to build Spigot"
|
||||||
|
cat /data/spigot_build.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
log "Cleaning up"
|
log "Cleaning up"
|
||||||
rm -rf /data/temp
|
rm -rf /data/temp
|
||||||
cd /data
|
cd /data
|
||||||
@@ -57,6 +74,9 @@ ERROR: failed to download from $downloadUrl
|
|||||||
EOF
|
EOF
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
JVM_OPTS="${JVM_OPTS} -DIReallyKnowWhatIAmDoingISwear"
|
||||||
|
export JVM_OPTS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -70,7 +90,7 @@ case "$TYPE" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||||
if [[ "$BUILD_SPIGOT_FROM_SOURCE" = TRUE || "$BUILD_SPIGOT_FROM_SOURCE" = true || "$BUILD_FROM_SOURCE" = TRUE || "$BUILD_FROM_SOURCE" = true ]]; then
|
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
|
||||||
buildSpigotFromSource
|
buildSpigotFromSource
|
||||||
else
|
else
|
||||||
downloadSpigot
|
downloadSpigot
|
||||||
@@ -79,6 +99,7 @@ fi
|
|||||||
|
|
||||||
# Normalize on Spigot for operations below
|
# Normalize on Spigot for operations below
|
||||||
export TYPE=SPIGOT
|
export TYPE=SPIGOT
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec /start-finalSetup01World $@
|
||||||
|
|||||||
@@ -25,5 +25,7 @@ else
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec /start-finalSetup01World $@
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ elif [[ ! -e $FABRIC_INSTALLER ]]; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
installMarker=".fabric-installed-${VANILLA_VERSION}-${FABRIC_VERSION:-manual}"
|
installMarker="/data/.fabric-installed-${VANILLA_VERSION}-${FABRIC_VERSION:-manual}"
|
||||||
|
|
||||||
debug Checking for installMarker ${installMarker}
|
debug Checking for installMarker ${installMarker}
|
||||||
if [[ ! -e $installMarker ]]; then
|
if [[ ! -e $installMarker ]]; then
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ elif [[ ! -e $FORGE_INSTALLER ]]; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
installMarker=".forge-installed-$shortForgeVersion"
|
installMarker="/data/.forge-installed-$shortForgeVersion"
|
||||||
|
|
||||||
if [ ! -e $installMarker ]; then
|
if [ ! -e $installMarker ]; then
|
||||||
if [ ! -e $FORGE_INSTALLER ]; then
|
if [ ! -e $FORGE_INSTALLER ]; then
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
. /start-utils
|
. /start-utils
|
||||||
|
|
||||||
export SERVER=paper_server-${VANILLA_VERSION}.jar
|
: ${PAPERBUILD:=latest}
|
||||||
|
export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar
|
||||||
|
|
||||||
if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||||
downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/latest/download}
|
downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download}
|
||||||
log "Downloading Paper $VANILLA_VERSION from $downloadUrl ..."
|
log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..."
|
||||||
curl -fsSL -o "$SERVER" "$downloadUrl"
|
curl -fsSL -o "$SERVER" "$downloadUrl"
|
||||||
if [ ! -f "$SERVER" ]; then
|
if [ ! -f "$SERVER" ]; then
|
||||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||||
@@ -15,6 +17,7 @@ fi
|
|||||||
|
|
||||||
# Normalize on Spigot for operations below
|
# Normalize on Spigot for operations below
|
||||||
export TYPE=SPIGOT
|
export TYPE=SPIGOT
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec /start-finalSetup01World $@
|
||||||
|
|||||||
27
start-deployTuinity
Normal file
27
start-deployTuinity
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /start-utils
|
||||||
|
|
||||||
|
if [ "${VERSION}" != "LATEST" ]; then
|
||||||
|
log "ERROR: Tunity server type only supports VERSION=LATEST"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
: ${TUNITY_BUILD:=lastSuccessfulBuild}
|
||||||
|
export SERVER=tunity-${VANILLA_VERSION}-${TUNITY_BUILD}.jar
|
||||||
|
|
||||||
|
if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||||
|
downloadUrl="https://ci.codemc.io/job/Spottedleaf/job/Tuinity/${TUNITY_BUILD}/artifact/tuinity-paperclip.jar"
|
||||||
|
log "Downloading Tunity (build $TUNITY_BUILD) from $downloadUrl ..."
|
||||||
|
curl -fsSL -o "$SERVER" "$downloadUrl"
|
||||||
|
if [ ! -f "$SERVER" ]; then
|
||||||
|
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Normalize on Spigot for operations below
|
||||||
|
export TYPE=SPIGOT
|
||||||
|
|
||||||
|
# Continue to Final Setup
|
||||||
|
exec /start-finalSetup01World $@
|
||||||
@@ -76,20 +76,37 @@ function customizeServerProps {
|
|||||||
setServerProp "level-type" "${LEVEL_TYPE^^}"
|
setServerProp "level-type" "${LEVEL_TYPE^^}"
|
||||||
setServerProp "resource-pack" "$RESOURCE_PACK"
|
setServerProp "resource-pack" "$RESOURCE_PACK"
|
||||||
setServerProp "resource-pack-sha1" "$RESOURCE_PACK_SHA1"
|
setServerProp "resource-pack-sha1" "$RESOURCE_PACK_SHA1"
|
||||||
|
setServerProp "player-idle-timeout" "$PLAYER_IDLE_TIMEOUT"
|
||||||
|
|
||||||
if [ -n "$DIFFICULTY" ]; then
|
if [ -n "$DIFFICULTY" ]; then
|
||||||
case $DIFFICULTY in
|
case $DIFFICULTY in
|
||||||
peaceful|0)
|
peaceful|0)
|
||||||
DIFFICULTY=0
|
if versionLessThan 1.13; then
|
||||||
|
DIFFICULTY=0
|
||||||
|
else
|
||||||
|
DIFFICULTY=peaceful
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
easy|1)
|
easy|1)
|
||||||
DIFFICULTY=1
|
if versionLessThan 1.13; then
|
||||||
|
DIFFICULTY=1
|
||||||
|
else
|
||||||
|
DIFFICULTY=easy
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
normal|2)
|
normal|2)
|
||||||
DIFFICULTY=2
|
if versionLessThan 1.13; then
|
||||||
|
DIFFICULTY=2
|
||||||
|
else
|
||||||
|
DIFFICULTY=normal
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
hard|3)
|
hard|3)
|
||||||
DIFFICULTY=3
|
if versionLessThan 1.13; then
|
||||||
|
DIFFICULTY=3
|
||||||
|
else
|
||||||
|
DIFFICULTY=hard
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "DIFFICULTY must be peaceful, easy, normal, or hard."
|
log "DIFFICULTY must be peaceful, easy, normal, or hard."
|
||||||
@@ -103,19 +120,33 @@ function customizeServerProps {
|
|||||||
log "Setting mode"
|
log "Setting mode"
|
||||||
MODE_LC=$( echo $MODE | tr '[:upper:]' '[:lower:]' )
|
MODE_LC=$( echo $MODE | tr '[:upper:]' '[:lower:]' )
|
||||||
case $MODE_LC in
|
case $MODE_LC in
|
||||||
0|1|2|3)
|
su*|0)
|
||||||
|
if versionLessThan 1.13; then
|
||||||
|
MODE=0
|
||||||
|
else
|
||||||
|
MODE=survival
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
su*)
|
c*|1)
|
||||||
MODE=0
|
if versionLessThan 1.13; then
|
||||||
|
MODE=1
|
||||||
|
else
|
||||||
|
MODE=creative
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
c*)
|
a*|2)
|
||||||
MODE=1
|
if versionLessThan 1.13; then
|
||||||
|
MODE=2
|
||||||
|
else
|
||||||
|
MODE=adventure
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
a*)
|
sp*|3)
|
||||||
MODE=2
|
if versionLessThan 1.13; then
|
||||||
;;
|
MODE=3
|
||||||
sp*)
|
else
|
||||||
MODE=3
|
MODE=spectator
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "ERROR: Invalid game mode: $MODE"
|
log "ERROR: Invalid game mode: $MODE"
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
|
|||||||
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] \
|
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] \
|
||||||
&& [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] \
|
&& [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] \
|
||||||
&& [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
|
&& [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
|
||||||
|
# Read content from file environment
|
||||||
|
if [[ $name = *"_FILE" ]] && [[ -f $value ]]; then
|
||||||
|
name="${name/_FILE/}"
|
||||||
|
value=$(<$value)
|
||||||
|
fi
|
||||||
|
|
||||||
log "Replacing $name with $value ..."
|
log "Replacing $name with $value ..."
|
||||||
find /data/ -type f \
|
find /data/ -type f \
|
||||||
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
||||||
|
|||||||
18
start-magma
Executable file
18
start-magma
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /start-utils
|
||||||
|
|
||||||
|
export SERVER="/data/magma-server-${VANILLA_VERSION}.jar"
|
||||||
|
|
||||||
|
# Always download since new updates of each base version are published frequently
|
||||||
|
if ! curl -o /data/magma-server-${VANILLA_VERSION}.jar -fsSL \
|
||||||
|
https://api.magmafoundation.org/api/resources/Magma/${VANILLA_VERSION}/stable/latest/download; then
|
||||||
|
log "ERROR unable to download version ${VANILLA_VERSION} of Magma"
|
||||||
|
log " Check https://magmafoundation.org/ for available versions"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
|
# Continue to Final Setup
|
||||||
|
exec /start-finalSetup01World $@
|
||||||
@@ -4,14 +4,14 @@
|
|||||||
|
|
||||||
if [ -n "$OPS" ]; then
|
if [ -n "$OPS" ]; then
|
||||||
log "Setting/adding ops"
|
log "Setting/adding ops"
|
||||||
rm -rf ops.txt.converted
|
rm -rf /data/ops.txt.converted
|
||||||
echo $OPS | awk -v RS=, '{print}' > ops.txt
|
echo $OPS | awk -v RS=, '{print}' > /data/ops.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$WHITELIST" ]; then
|
if [ -n "$WHITELIST" ]; then
|
||||||
log "Setting whitelist"
|
log "Setting whitelist"
|
||||||
rm -rf white-list.txt.converted
|
rm -rf /data/white-list.txt.converted
|
||||||
echo $WHITELIST | awk -v RS=, '{print}' > white-list.txt
|
echo $WHITELIST | awk -v RS=, '{print}' > /data/white-list.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$ICON" -a ! -e server-icon.png ]; then
|
if [ -n "$ICON" -a ! -e server-icon.png ]; then
|
||||||
@@ -27,7 +27,7 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${TYPE} != "SPIGOT" ]; then
|
if ! isTrue ${SKIP_LOG4J_CONFIG}; then
|
||||||
# Set up log configuration
|
# Set up log configuration
|
||||||
LOGFILE="/data/log4j2.xml"
|
LOGFILE="/data/log4j2.xml"
|
||||||
if [ ! -e "$LOGFILE" ]; then
|
if [ ! -e "$LOGFILE" ]; then
|
||||||
@@ -41,7 +41,7 @@ fi
|
|||||||
|
|
||||||
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
||||||
log "Checking for JSON files."
|
log "Checking for JSON files."
|
||||||
JSON_FILES=$(find . -maxdepth 1 -name '*.json')
|
JSON_FILES=$(find /data -maxdepth 1 -name '*.json')
|
||||||
for j in $JSON_FILES; do
|
for j in $JSON_FILES; do
|
||||||
if [[ $(cat "$j" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') == "" ]]; then
|
if [[ $(cat "$j" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') == "" ]]; then
|
||||||
log "Fixing JSON $j"
|
log "Fixing JSON $j"
|
||||||
@@ -51,9 +51,9 @@ done
|
|||||||
|
|
||||||
|
|
||||||
# If any modules have been provided, copy them over
|
# If any modules have been provided, copy them over
|
||||||
mkdir -p /data/mods
|
|
||||||
if [ -d /mods ]; then
|
if [ -d /mods ]; then
|
||||||
log "Copying any mods over..."
|
log "Copying any mods over..."
|
||||||
|
mkdir -p /data/mods
|
||||||
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /mods /data
|
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /mods /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -135,24 +135,25 @@ if isTrue "${USE_AIKAR_FLAGS}"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
-XX:+UseG1GC -XX:+ParallelRefProcEnabled
|
-XX:+UseG1GC
|
||||||
|
-XX:+ParallelRefProcEnabled
|
||||||
-XX:MaxGCPauseMillis=200
|
-XX:MaxGCPauseMillis=200
|
||||||
-XX:+UnlockExperimentalVMOptions
|
-XX:+UnlockExperimentalVMOptions
|
||||||
-XX:+DisableExplicitGC
|
-XX:+DisableExplicitGC
|
||||||
-XX:-OmitStackTraceInFastThrow
|
|
||||||
-XX:+AlwaysPreTouch
|
-XX:+AlwaysPreTouch
|
||||||
-XX:G1NewSizePercent=${G1NewSizePercent}
|
-XX:G1NewSizePercent=${G1NewSizePercent}
|
||||||
-XX:G1MaxNewSizePercent=${G1MaxNewSizePercent}
|
-XX:G1MaxNewSizePercent=${G1MaxNewSizePercent}
|
||||||
-XX:G1HeapRegionSize=${G1HeapRegionSize}
|
-XX:G1HeapRegionSize=${G1HeapRegionSize}
|
||||||
-XX:G1ReservePercent=${G1ReservePercent}
|
-XX:G1ReservePercent=${G1ReservePercent}
|
||||||
-XX:G1HeapWastePercent=5
|
-XX:G1HeapWastePercent=5
|
||||||
-XX:G1MixedGCCountTarget=8
|
-XX:G1MixedGCCountTarget=4
|
||||||
-XX:InitiatingHeapOccupancyPercent=${InitiatingHeapOccupancyPercent}
|
-XX:InitiatingHeapOccupancyPercent=${InitiatingHeapOccupancyPercent}
|
||||||
-XX:G1MixedGCLiveThresholdPercent=90
|
-XX:G1MixedGCLiveThresholdPercent=90
|
||||||
-XX:G1RSetUpdatingPauseTimePercent=5
|
-XX:G1RSetUpdatingPauseTimePercent=5
|
||||||
-XX:SurvivorRatio=32
|
-XX:SurvivorRatio=32
|
||||||
|
-XX:+PerfDisableSharedMem
|
||||||
-XX:MaxTenuringThreshold=1
|
-XX:MaxTenuringThreshold=1
|
||||||
-Dusing.aikars.flags=true
|
-Dusing.aikars.flags=https://mcflags.emc.gs
|
||||||
-Daikars.new.flags=true
|
-Daikars.new.flags=true
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
@@ -163,6 +164,12 @@ if isTrue "${USE_LARGE_PAGES}"; then
|
|||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if isTrue "${DEBUG_MEMORY}"; then
|
||||||
|
log "Memory usage and availability (in MB)"
|
||||||
|
uname -a
|
||||||
|
free -m
|
||||||
|
fi
|
||||||
|
|
||||||
mcServerRunnerArgs="--stop-duration 60s"
|
mcServerRunnerArgs="--stop-duration 60s"
|
||||||
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
||||||
JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
|
JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ function versionLessThan {
|
|||||||
local givenParts
|
local givenParts
|
||||||
IFS=. read -ra givenParts <<< "$1"
|
IFS=. read -ra givenParts <<< "$1"
|
||||||
|
|
||||||
|
if (( ${#activeParts[@]} < 2 )); then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
if (( activeParts[0] < givenParts[0] )) || \
|
if (( activeParts[0] < givenParts[0] )) || \
|
||||||
(( activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1] )); then
|
(( activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1] )); then
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user