mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-18 07:26:24 +00:00
Compare commits
119 Commits
2021.26.0-
...
2021.27.0-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1a2175425 | ||
|
|
2f1fed822c | ||
|
|
bf5824b6e5 | ||
|
|
52bf2ae094 | ||
|
|
fa4a0e92ce | ||
|
|
c15e231d7e | ||
|
|
cc885276f5 | ||
|
|
9dee47cb6d | ||
|
|
107bebd34e | ||
|
|
620c35826b | ||
|
|
6729ba462e | ||
|
|
4b28d5e472 | ||
|
|
706709e6fd | ||
|
|
bd4f3a9a48 | ||
|
|
3f2022da40 | ||
|
|
0f7464403c | ||
|
|
417fcface4 | ||
|
|
adde46bc73 | ||
|
|
6510a6f361 | ||
|
|
9204e06b63 | ||
|
|
95b5088c3b | ||
|
|
2c106575f0 | ||
|
|
234d70786e | ||
|
|
7cf7193ef4 | ||
|
|
1d923a5878 | ||
|
|
34125769fa | ||
|
|
c6124bdd01 | ||
|
|
9f0edde0b3 | ||
|
|
1d97fccfdf | ||
|
|
5ad85de964 | ||
|
|
c273e99007 | ||
|
|
72ea47148a | ||
|
|
25782fc63e | ||
|
|
283b5ba431 | ||
|
|
5933fffcca | ||
|
|
de5b7cb601 | ||
|
|
c836e29ac3 | ||
|
|
d9214f0204 | ||
|
|
a7efcfff49 | ||
|
|
618d6236ba | ||
|
|
929eeeedfc | ||
|
|
6494ca8864 | ||
|
|
d964231906 | ||
|
|
1d8c28e024 | ||
|
|
d63c570cf3 | ||
|
|
f7f1855e24 | ||
|
|
8ccf0201a8 | ||
|
|
fa9e59edd8 | ||
|
|
25a2ab6ff3 | ||
|
|
bb780c000d | ||
|
|
cb4691a9ac | ||
|
|
76b8b89295 | ||
|
|
551e4d6346 | ||
|
|
61a660ee48 | ||
|
|
5e9806736c | ||
|
|
d5865cd60c | ||
|
|
2b0b8f8a62 | ||
|
|
e94b40bddf | ||
|
|
2dabf34349 | ||
|
|
eb864c0fb8 | ||
|
|
2e0f469748 | ||
|
|
aa95dc291b | ||
|
|
d22280fae7 | ||
|
|
aac3c1c77a | ||
|
|
61b0eff4ca | ||
|
|
8c5f0a53bf | ||
|
|
fffeb7bb9c | ||
|
|
a060cc88d1 | ||
|
|
4421aaa22d | ||
|
|
3a51db6d24 | ||
|
|
969a23ae27 | ||
|
|
1a62592fe2 | ||
|
|
c316dbb5d2 | ||
|
|
bb64135c9b | ||
|
|
ef98de154c | ||
|
|
3d00077ef8 | ||
|
|
0d3ab75683 | ||
|
|
87681e64bb | ||
|
|
8ce986d3d7 | ||
|
|
67fda61de4 | ||
|
|
7c6ec41822 | ||
|
|
93af2025a2 | ||
|
|
c1b040af77 | ||
|
|
4148325787 | ||
|
|
7083cd15e8 | ||
|
|
7418dab476 | ||
|
|
94bbc8e649 | ||
|
|
3e5e62229a | ||
|
|
fe2a9d56ed | ||
|
|
27571999b2 | ||
|
|
bbd7d9e39a | ||
|
|
ef6f308229 | ||
|
|
49d89d3e73 | ||
|
|
74203b23f4 | ||
|
|
4fb791b490 | ||
|
|
ced25ad50a | ||
|
|
48efc224ba | ||
|
|
467c1d9954 | ||
|
|
9ced230f55 | ||
|
|
f3a8276362 | ||
|
|
b91d63716e | ||
|
|
46cccfd531 | ||
|
|
9fe1cb4a0d | ||
|
|
076038b470 | ||
|
|
aa416729ea | ||
|
|
812c6365ec | ||
|
|
42a5131b19 | ||
|
|
624f6a210f | ||
|
|
1c63cd18b7 | ||
|
|
6266a7e3cc | ||
|
|
871ecd4d9d | ||
|
|
c572c95161 | ||
|
|
f7b58fbbb1 | ||
|
|
eccfa444a9 | ||
|
|
e831d25706 | ||
|
|
12e931332b | ||
|
|
ceee9eddc9 | ||
|
|
60ba668743 | ||
|
|
fd1b15e01f |
4
.github/release.yml
vendored
Normal file
4
.github/release.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
changelog:
|
||||||
|
exclude:
|
||||||
|
authors:
|
||||||
|
- dependabot
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM eclipse-temurin:17-jdk
|
FROM eclipse-temurin:8-jdk
|
||||||
|
|
||||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||||
|
|
||||||
@@ -76,7 +76,8 @@ ENV UID=1000 GID=1000 \
|
|||||||
TYPE=VANILLA VERSION=LATEST \
|
TYPE=VANILLA VERSION=LATEST \
|
||||||
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||||
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 \
|
||||||
|
ENABLE_AUTOSTOP=false AUTOSTOP_TIMEOUT_EST=3600 AUTOSTOP_TIMEOUT_INIT=1800 AUTOSTOP_PERIOD=10
|
||||||
|
|
||||||
COPY --chmod=755 scripts/start* /
|
COPY --chmod=755 scripts/start* /
|
||||||
COPY --chmod=755 bin/ /usr/local/bin/
|
COPY --chmod=755 bin/ /usr/local/bin/
|
||||||
@@ -84,8 +85,9 @@ COPY --chmod=755 bin/mc-health /health.sh
|
|||||||
COPY --chmod=644 files/server.properties /tmp/server.properties
|
COPY --chmod=644 files/server.properties /tmp/server.properties
|
||||||
COPY --chmod=644 files/log4j2.xml /tmp/log4j2.xml
|
COPY --chmod=644 files/log4j2.xml /tmp/log4j2.xml
|
||||||
COPY --chmod=755 files/autopause /autopause
|
COPY --chmod=755 files/autopause /autopause
|
||||||
|
COPY --chmod=755 files/autostop /autostop
|
||||||
|
|
||||||
RUN dos2unix /start* /autopause/*
|
RUN dos2unix /start* /autopause/* /autostop/*
|
||||||
|
|
||||||
ENTRYPOINT [ "/start" ]
|
ENTRYPOINT [ "/start" ]
|
||||||
HEALTHCHECK --start-period=1m CMD mc-health
|
HEALTHCHECK --start-period=1m CMD mc-health
|
||||||
|
|||||||
38
README.md
38
README.md
@@ -73,6 +73,7 @@ By default, the container will download the latest version of the "vanilla" [Min
|
|||||||
* [Downloadable world](#downloadable-world)
|
* [Downloadable world](#downloadable-world)
|
||||||
* [Cloning world from a container path](#cloning-world-from-a-container-path)
|
* [Cloning world from a container path](#cloning-world-from-a-container-path)
|
||||||
* [Overwrite world on start](#overwrite-world-on-start)
|
* [Overwrite world on start](#overwrite-world-on-start)
|
||||||
|
* [Datapacks](#datapacks)
|
||||||
* [Server configuration](#server-configuration)
|
* [Server configuration](#server-configuration)
|
||||||
* [Message of the Day](#message-of-the-day)
|
* [Message of the Day](#message-of-the-day)
|
||||||
* [Difficulty](#difficulty)
|
* [Difficulty](#difficulty)
|
||||||
@@ -131,10 +132,11 @@ By default, the container will download the latest version of the "vanilla" [Min
|
|||||||
* [Autopause](#autopause)
|
* [Autopause](#autopause)
|
||||||
* [Description](#description)
|
* [Description](#description)
|
||||||
* [Enabling Autopause](#enabling-autopause)
|
* [Enabling Autopause](#enabling-autopause)
|
||||||
|
* [Autostop](#autostop)
|
||||||
* [Running on RaspberryPi](#running-on-raspberrypi)
|
* [Running on RaspberryPi](#running-on-raspberrypi)
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
|
|
||||||
<!-- Added by: runner, at: Tue Dec 14 02:14:33 UTC 2021 -->
|
<!-- Added by: runner, at: Wed Dec 22 13:01:43 UTC 2021 -->
|
||||||
|
|
||||||
<!--te-->
|
<!--te-->
|
||||||
|
|
||||||
@@ -275,7 +277,7 @@ When using the image `itzg:/minecraft-server` without a tag, the `latest` image
|
|||||||
|
|
||||||
| Tag name | Java version | Linux | JVM Type | Architecture |
|
| Tag name | Java version | Linux | JVM Type | Architecture |
|
||||||
| -------------- | -------------|--------|----------|-------------------|
|
| -------------- | -------------|--------|----------|-------------------|
|
||||||
| latest | 17 | Debian | Hotspot | amd64,arm64,armv7 |
|
| latest | 16 | Debian | Hotspot | amd64,arm64,armv7 |
|
||||||
| java8 | 8 | Alpine | Hotspot | amd64 |
|
| java8 | 8 | Alpine | Hotspot | amd64 |
|
||||||
| java8-multiarch | 8 | Debian | Hotspot | amd64,arm64,armv7 |
|
| java8-multiarch | 8 | Debian | Hotspot | amd64,arm64,armv7 |
|
||||||
| java8-openj9 | 8 | Debian | OpenJ9 | amd64 |
|
| java8-openj9 | 8 | Debian | OpenJ9 | amd64 |
|
||||||
@@ -792,6 +794,16 @@ The following diagram shows how this option can be used in a compose deployment
|
|||||||
### Overwrite world on start
|
### 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.
|
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.
|
||||||
|
|
||||||
|
### Datapacks
|
||||||
|
Datapacks can be installed in a similar manner to mods/plugins. There are many environment variables which function in the same way they do for [mods](#working-with-mods-and-plugins):
|
||||||
|
* `DATAPACKS`
|
||||||
|
* `DATAPACKS_FILE`
|
||||||
|
* `REMOVE_OLD_DATAPACKS`
|
||||||
|
* `REMOVE_OLD_DATAPACKS_DEPTH`
|
||||||
|
* `REMOVE_OLD_DATAPACKS_INCLUDE`
|
||||||
|
* `REMOVE_OLD_DATAPACKS_EXCLUDE`
|
||||||
|
Datapacks will be placed in `/data/$LEVEL/datapacks`
|
||||||
|
|
||||||
## Server configuration
|
## Server configuration
|
||||||
|
|
||||||
By default, the server configuration will be created and set based on the following environment variables, but only the first time the server is started. If the `server.properties` file already exists, the values in them will not be changed.
|
By default, the server configuration will be created and set based on the following environment variables, but only the first time the server is started. If the `server.properties` file already exists, the values in them will not be changed.
|
||||||
@@ -1459,6 +1471,28 @@ The following environment variables define the behaviour of auto-pausing:
|
|||||||
* `AUTOPAUSE_KNOCK_INTERFACE`, default `eth0`
|
* `AUTOPAUSE_KNOCK_INTERFACE`, default `eth0`
|
||||||
<br>Describes the interface passed to the `knockd` daemon. If the default interface does not work, run the `ifconfig` command inside the container and derive the interface receiving the incoming connection from its output. The passed interface must exist inside the container. Using the loopback interface (`lo`) does likely not yield the desired results.
|
<br>Describes the interface passed to the `knockd` daemon. If the default interface does not work, run the `ifconfig` command inside the container and derive the interface receiving the incoming connection from its output. The passed interface must exist inside the container. Using the loopback interface (`lo`) does likely not yield the desired results.
|
||||||
|
|
||||||
|
## Autostop
|
||||||
|
|
||||||
|
An option to stop the server after a specified time has been added for niche applications (e.g. billing saving on AWS Fargate). The function is incompatible with the Autopause functionality, as they basically cancel out each other.
|
||||||
|
|
||||||
|
Note that the docker container variables have to be set accordingly (restart policy set to "no") and that the container has to be manually restarted.
|
||||||
|
|
||||||
|
A starting, example compose file has been provided in [examples/docker-compose-autostop.yml](examples/docker-compose-autostop.yml).
|
||||||
|
|
||||||
|
Enable the Autostop functionality by setting:
|
||||||
|
|
||||||
|
```
|
||||||
|
-e ENABLE_AUTOSTOP=TRUE
|
||||||
|
```
|
||||||
|
|
||||||
|
The following environment variables define the behaviour of auto-stopping:
|
||||||
|
* `AUTOSTOP_TIMEOUT_EST`, default `3600` (seconds)
|
||||||
|
describes the time between the last client disconnect and the stopping of the server (read as timeout established)
|
||||||
|
* `AUTOSTOP_TIMEOUT_INIT`, default `1800` (seconds)
|
||||||
|
describes the time between server start and the stopping of the server, when no client connects inbetween (read as timeout initialized)
|
||||||
|
* `AUTOSTOP_PERIOD`, default `10` (seconds)
|
||||||
|
describes period of the daemonized state machine, that handles the stopping of the server
|
||||||
|
|
||||||
## Running on RaspberryPi
|
## Running on RaspberryPi
|
||||||
|
|
||||||
To run this image on a RaspberryPi 3 B+, 4, or newer, use any of the image tags [list in the Java version section](#running-minecraft-server-on-different-java-version) that specify `armv7` for the architecture, which includes `itzg/minecraft-server:latest`.
|
To run this image on a RaspberryPi 3 B+, 4, or newer, use any of the image tags [list in the Java version section](#running-minecraft-server-on-different-java-version) that specify `armv7` for the architecture, which includes `itzg/minecraft-server:latest`.
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$@" > "${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}"
|
gosu minecraft bash -c "echo $* > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'"
|
||||||
20
examples/docker-compose-autostop.yml
Normal file
20
examples/docker-compose-autostop.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
minecraft:
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
ports:
|
||||||
|
- "25565:25565"
|
||||||
|
volumes:
|
||||||
|
- "mc:/data"
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
ENABLE_AUTOSTOP: "TRUE"
|
||||||
|
# More aggressive settings for demo purposes
|
||||||
|
AUTOSTOP_TIMEOUT_INIT: "30"
|
||||||
|
AUTOSTOP_TIMEOUT_EST: "20"
|
||||||
|
# Important not to auto-restart the server!!!
|
||||||
|
restart: "no"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mc: {}
|
||||||
69
files/autostop/autostop-daemon.sh
Executable file
69
files/autostop/autostop-daemon.sh
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# needed for the clients connected function residing in autopause
|
||||||
|
. /autopause/autopause-fcns.sh
|
||||||
|
|
||||||
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
|
# wait for java process to be started
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
if java_process_exists ; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
|
||||||
|
STATE=INIT
|
||||||
|
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
case X$STATE in
|
||||||
|
XINIT)
|
||||||
|
# Server startup
|
||||||
|
if mc_server_listening ; then
|
||||||
|
TIME_THRESH=$(($(current_uptime)+$AUTOSTOP_TIMEOUT_INIT))
|
||||||
|
logAutostop "MC Server listening for connections - stopping in $AUTOSTOP_TIMEOUT_INIT seconds"
|
||||||
|
STATE=II
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
XII)
|
||||||
|
# Initial idle
|
||||||
|
if java_clients_connected ; then
|
||||||
|
logAutostop "Client connected - waiting for disconnect"
|
||||||
|
STATE=E
|
||||||
|
else
|
||||||
|
if [[ $(current_uptime) -ge $TIME_THRESH ]] ; then
|
||||||
|
logAutostop "No client connected since startup - stopping server"
|
||||||
|
/autostop/stop.sh
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
XE)
|
||||||
|
# Established
|
||||||
|
if ! java_clients_connected ; then
|
||||||
|
TIME_THRESH=$(($(current_uptime)+$AUTOSTOP_TIMEOUT_EST))
|
||||||
|
logAutostop "All clients disconnected - stopping in $AUTOSTOP_TIMEOUT_EST seconds"
|
||||||
|
STATE=I
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
XI)
|
||||||
|
# Idle
|
||||||
|
if java_clients_connected ; then
|
||||||
|
logAutostop "Client reconnected - waiting for disconnect"
|
||||||
|
STATE=E
|
||||||
|
else
|
||||||
|
if [[ $(current_uptime) -ge $TIME_THRESH ]] ; then
|
||||||
|
logAutostop "No client reconnected - stopping"
|
||||||
|
/autostop/stop.sh
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
logAutostop "Error: invalid state: $STATE"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
sleep $AUTOSTOP_PERIOD
|
||||||
|
done
|
||||||
6
files/autostop/stop.sh
Executable file
6
files/autostop/stop.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /start-utils
|
||||||
|
|
||||||
|
logAutostopAction "Stopping Java process"
|
||||||
|
kill -SIGTERM 1
|
||||||
@@ -40,7 +40,7 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then
|
|||||||
echo 'hosts: files dns' > /etc/nsswitch.conf
|
echo 'hosts: files dns' > /etc/nsswitch.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
|
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration "$@"
|
||||||
else
|
else
|
||||||
exec ${SCRIPTS:-/}start-configuration $@
|
exec ${SCRIPTS:-/}start-configuration "$@"
|
||||||
fi
|
fi
|
||||||
|
|||||||
34
scripts/start-autostop
Executable file
34
scripts/start-autostop
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# shellcheck source=start-utils
|
||||||
|
. "${SCRIPTS:-/}start-utils"
|
||||||
|
|
||||||
|
: "${SERVER_PORT:=25565}"
|
||||||
|
export SERVER_PORT
|
||||||
|
|
||||||
|
log "Autostop functionality enabled"
|
||||||
|
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
|
if ! [[ $AUTOSTOP_PERIOD =~ ^[0-9]+$ ]]; then
|
||||||
|
AUTOSTOP_PERIOD=10
|
||||||
|
export AUTOSTOP_PERIOD
|
||||||
|
log "Warning: AUTOSTOP_PERIOD is not numeric, set to 10 (seconds)"
|
||||||
|
fi
|
||||||
|
if [ "$AUTOSTOP_PERIOD" -eq "0" ] ; then
|
||||||
|
AUTOSTOP_PERIOD=10
|
||||||
|
export AUTOSTOP_PERIOD
|
||||||
|
log "Warning: AUTOSTOP_PERIOD must not be 0, set to 10 (seconds)"
|
||||||
|
fi
|
||||||
|
if ! [[ $AUTOSTOP_TIMEOUT_EST =~ ^[0-9]+$ ]] ; then
|
||||||
|
AUTOSTOP_TIMEOUT_EST=3600
|
||||||
|
export AUTOSTOP_TIMEOUT_EST
|
||||||
|
log "Warning: AUTOSTOP_TIMEOUT_EST is not numeric, set to 3600 (seconds)"
|
||||||
|
fi
|
||||||
|
if ! [[ $AUTOSTOP_TIMEOUT_INIT =~ ^[0-9]+$ ]] ; then
|
||||||
|
AUTOSTOP_TIMEOUT_INIT=1800
|
||||||
|
export AUTOSTOP_TIMEOUT_INIT
|
||||||
|
log "Warning: AUTOSTOP_TIMEOUT_INIT is not numeric, set to 1800 (seconds)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
/autostop/autostop-daemon.sh &
|
||||||
@@ -37,6 +37,11 @@ if isTrue "${ENABLE_AUTOPAUSE}" && isTrue "${EXEC_DIRECTLY:-false}"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if isTrue "${ENABLE_AUTOPAUSE}" && isTrue "${ENABLE_AUTOSTOP}"; then
|
||||||
|
log "ENABLE_AUTOPAUSE=true is incompatible with ENABLE_AUTOSTOP=true"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $PROXY ]]; then
|
if [[ $PROXY ]]; then
|
||||||
export http_proxy="$PROXY"
|
export http_proxy="$PROXY"
|
||||||
export https_proxy="$PROXY"
|
export https_proxy="$PROXY"
|
||||||
@@ -96,6 +101,10 @@ if isTrue "${ENABLE_AUTOPAUSE}"; then
|
|||||||
${SCRIPTS:-/}start-autopause
|
${SCRIPTS:-/}start-autopause
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if isTrue "${ENABLE_AUTOSTOP}"; then
|
||||||
|
${SCRIPTS:-/}start-autostop
|
||||||
|
fi
|
||||||
|
|
||||||
if versionLessThan 1.7; then
|
if versionLessThan 1.7; then
|
||||||
echo "
|
echo "
|
||||||
MC_HEALTH_EXTRA_ARGS=(
|
MC_HEALTH_EXTRA_ARGS=(
|
||||||
@@ -115,14 +124,6 @@ case "${TYPE^^}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
FORGE)
|
FORGE)
|
||||||
if versionLessThan 1.17; then
|
|
||||||
log "**********************************************************************"
|
|
||||||
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
|
|
||||||
log " since some mods require Java 8"
|
|
||||||
log " Exception traces reporting ClassCastException: class jdk.internal.loader.ClassLoaders\$AppClassLoader"
|
|
||||||
log " can be fixed with java8"
|
|
||||||
log "**********************************************************************"
|
|
||||||
fi
|
|
||||||
exec ${SCRIPTS:-/}start-deployForge "$@"
|
exec ${SCRIPTS:-/}start-deployForge "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -135,10 +136,6 @@ case "${TYPE^^}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
FTB|CURSEFORGE)
|
FTB|CURSEFORGE)
|
||||||
log "**********************************************************************"
|
|
||||||
log "NOTE: Some mods and modpacks may require Java 8."
|
|
||||||
log " If so, use itzg/minecraft-server:java8"
|
|
||||||
log "**********************************************************************"
|
|
||||||
exec ${SCRIPTS:-/}start-deployCF "$@"
|
exec ${SCRIPTS:-/}start-deployCF "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -183,12 +180,6 @@ case "${TYPE^^}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
CRUCIBLE)
|
CRUCIBLE)
|
||||||
log "**********************************************************************"
|
|
||||||
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
|
|
||||||
log " since some mods require Java 8"
|
|
||||||
log " Exception traces reporting ClassCastException: class jdk.internal.loader.ClassLoaders\$AppClassLoader"
|
|
||||||
log " can be fixed with java8"
|
|
||||||
log "**********************************************************************"
|
|
||||||
exec "${SCRIPTS:-/}start-deployCrucible" "$@"
|
exec "${SCRIPTS:-/}start-deployCrucible" "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
77
scripts/start-setupDatapack
Executable file
77
scripts/start-setupDatapack
Executable file
@@ -0,0 +1,77 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
: "${REMOVE_OLD_DATAPACKS:=false}"
|
||||||
|
: "${DATAPACKS_FILE:=}"
|
||||||
|
: "${REMOVE_OLD_DATAPACKS_DEPTH:=1} "
|
||||||
|
: "${REMOVE_OLD_DATAPACKS_INCLUDE:=*.zip}"
|
||||||
|
|
||||||
|
# shellcheck source=start-utils
|
||||||
|
. "${SCRIPTS:-/}start-utils"
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
|
out_dir=/data/${LEVEL:-world}/datapacks
|
||||||
|
|
||||||
|
# Remove old datapacks
|
||||||
|
if isTrue "${REMOVE_OLD_DATAPACKS}" && [ -z "${DATAPACKS_FILE}" ]; then
|
||||||
|
if [ -d "$out_dir" ]; then
|
||||||
|
find "$out_dir" -mindepth 1 -maxdepth ${REMOVE_OLD_DATAPACKS_DEPTH:-16} -wholename "${REMOVE_OLD_DATAPACKS_INCLUDE:-*}" -not -wholename "${REMOVE_OLD_DATAPACKS_EXCLUDE:-}" -delete
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$DATAPACKS" ]]; then
|
||||||
|
mkdir -p "$out_dir"
|
||||||
|
|
||||||
|
for i in ${DATAPACKS//,/ }
|
||||||
|
do
|
||||||
|
if isURL "$i"; then
|
||||||
|
log "Downloading datapack $i ..."
|
||||||
|
if ! get -o "${out_dir}" "$i"; then
|
||||||
|
log "ERROR: failed to download from $i into $out_dir"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
elif [[ -f "$i" && "$i" =~ .*\.zip ]]; then
|
||||||
|
log "Copying datapack located at $i ..."
|
||||||
|
out_file=$(basename "$i")
|
||||||
|
if ! cp "$i" "${out_dir}/$out_file"; then
|
||||||
|
log "ERROR: failed to copy from $i into $out_dir"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
elif [[ -d "$i" ]]; then
|
||||||
|
log "Copying datapacks from $i ..."
|
||||||
|
cp "$i"/*.zip "${out_dir}"
|
||||||
|
else
|
||||||
|
log "ERROR Invalid URL or path given in DATAPACKS: $i"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
elif [[ "$DATAPACKS_FILE" ]]; then
|
||||||
|
if [ ! -f "$DATAPACKS_FILE" ]; then
|
||||||
|
log "ERROR: given DATAPACKS_FILE file does not exist"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$out_dir"
|
||||||
|
|
||||||
|
args=(
|
||||||
|
-o "${out_dir}"
|
||||||
|
--log-progress-each
|
||||||
|
--skip-existing
|
||||||
|
--uris-file "${DATAPACKS_FILE}"
|
||||||
|
)
|
||||||
|
if isTrue "${REMOVE_OLD_DATAPACKS}"; then
|
||||||
|
args+=(
|
||||||
|
--prune-others "${REMOVE_OLD_DATAPACKS_INCLUDE}"
|
||||||
|
--prune-depth "${REMOVE_OLD_DATAPACKS_DEPTH}"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! get "${args[@]}" ; then
|
||||||
|
log "ERROR: failed to retrieve one or more datapacks"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "${SCRIPTS:-/}start-setupModpack" "$@"
|
||||||
@@ -69,4 +69,4 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "${SCRIPTS:-/}start-setupModpack" "$@"
|
exec "${SCRIPTS:-/}start-setupDatapack" "$@"
|
||||||
|
|||||||
@@ -22,6 +22,20 @@ containsJars() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
containsPlugin() {
|
||||||
|
file=${1?}
|
||||||
|
|
||||||
|
pat='plugin.yml$'
|
||||||
|
|
||||||
|
while read -r line; do
|
||||||
|
if [[ $line =~ $pat ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done <<<$(unzip -l "$file")
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
getResourceFromSpiget() {
|
getResourceFromSpiget() {
|
||||||
resource=${1?}
|
resource=${1?}
|
||||||
|
|
||||||
@@ -81,9 +95,12 @@ downloadResourceFromSpiget() {
|
|||||||
log "Extracting contents of resource ${resource} into plugins"
|
log "Extracting contents of resource ${resource} into plugins"
|
||||||
unzip -o -q -d /data/plugins "${tmpfile}"
|
unzip -o -q -d /data/plugins "${tmpfile}"
|
||||||
rm "${tmpfile}"
|
rm "${tmpfile}"
|
||||||
else
|
elif containsPlugin "${tmpfile}"; then
|
||||||
log "Moving resource ${resource} into plugins"
|
log "Moving resource ${resource} into plugins"
|
||||||
mv "${tmpfile}" "/data/plugins/${resource}.jar"
|
mv "${tmpfile}" "/data/plugins/${resource}.jar"
|
||||||
|
else
|
||||||
|
log "ERROR downloaded resource '${resource}' seems to be not a valid plugin"
|
||||||
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,14 @@ function logAutopauseAction() {
|
|||||||
echo "[$(date -Iseconds)] [Autopause] $*"
|
echo "[$(date -Iseconds)] [Autopause] $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function logAutostop() {
|
||||||
|
echo "[Autostop loop] $*"
|
||||||
|
}
|
||||||
|
|
||||||
|
function logAutostopAction() {
|
||||||
|
echo "[$(date -Iseconds)] [Autostop] $*"
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeMemSize() {
|
function normalizeMemSize() {
|
||||||
local scale=1
|
local scale=1
|
||||||
case ${1,,} in
|
case ${1,,} in
|
||||||
|
|||||||
Reference in New Issue
Block a user