Compare commits

...

119 Commits

Author SHA1 Message Date
Geoff Bourne 4f149f8f40 Auto-merging via docker-versions-create 2021-12-23 16:08:38 -06:00
itzg 2f1fed822c docs: Auto update markdown TOC 2021-12-22 13:01:44 +00:00
Caden Kriese bf5824b6e5 Added support for downloading and installing datapacks (#1214) 2021-12-22 07:01:23 -06:00
itzg 52bf2ae094 docs: Auto update markdown TOC 2021-12-21 00:27:44 +00:00
Michael Kirsch fa4a0e92ce Autostop feature (#1212) 2021-12-20 18:27:27 -06:00
Geoff Bourne c15e231d7e fix: write to console pipe as minecraft user (#1216) 2021-12-20 07:09:29 -06:00
Daniel Hoffend cc885276f5 fix: verify that the downloaded resource is a valid plugin (#1210) 2021-12-19 19:24:02 -06:00
Geoff Bourne 9dee47cb6d docs: exclude dependabot from changelog 2021-12-13 21:35:14 -06:00
Geoff Bourne 88e5b7e135 Auto-merging via docker-versions-create 2021-12-13 21:28:30 -06:00
Geoff Bourne 86190eafc7 Auto-merging via docker-versions-create 2021-12-12 19:51:45 -06:00
Geoff Bourne 6729ba462e Merge branch 'master' of github.com:itzg/docker-minecraft-server 2021-12-12 15:35:14 -06:00
Geoff Bourne 4b28d5e472 fix: qualify Fabric server jar by installer version
Fixes #1191
2021-12-12 15:28:30 -06:00
Geoff Bourne 7983a4a3a2 Merging latest from master 2021-12-12 09:15:05 -06:00
Geoff Bourne 52ac180c77 Auto-merging via docker-versions-create 2021-12-11 16:24:32 -06:00
Geoff Bourne 3f2022da40 Merge branch 'master' of github.com:itzg/docker-minecraft-server 2021-12-11 16:23:25 -06:00
Geoff Bourne 0f7464403c build: added github release creation step to docker-versions-create.sh 2021-12-11 16:09:15 -06:00
Geoff Bourne 32195e71c5 Auto-merging via docker-versions-create 2021-12-10 21:04:32 -06:00
Geoff Bourne a0a578f452 Auto-merging via docker-versions-create 2021-12-10 10:42:16 -06:00
Geoff Bourne ca0ddc80aa Auto-merging via docker-versions-create 2021-12-10 07:57:27 -06:00
Geoff Bourne 1a625f09bb Auto-merging via docker-versions-create 2021-12-06 22:05:02 -06:00
Geoff Bourne 9ab345a727 Auto-merging via docker-versions-create 2021-12-04 10:00:12 -06:00
Geoff Bourne 4e3031cff8 Auto-merging via docker-versions-create 2021-12-02 19:46:55 -06:00
Geoff Bourne 466e1728f6 Auto-merging via docker-versions-create 2021-11-24 15:57:45 -06:00
Geoff Bourne 8dddbc4120 Auto-merging via docker-versions-create 2021-11-24 14:34:30 -06:00
Geoff Bourne 53e9d36a05 Track latest from master 2021-11-16 19:02:30 -06:00
Geoff Bourne 275c2d0c54 Auto-merging via docker-versions-create 2021-11-16 18:52:01 -06:00
Geoff Bourne cf9c40f331 Auto-merging via docker-versions-create 2021-11-15 20:48:30 -06:00
Geoff Bourne 491ffe49bf Auto-merging via docker-versions-create 2021-11-13 19:18:03 -06:00
Geoff Bourne d4a9b367c7 Auto-merging via docker-versions-create 2021-11-13 18:52:36 -06:00
Geoff Bourne 032d94a30f Auto-merging via docker-versions-create 2021-11-12 21:24:26 -06:00
Geoff Bourne 3784d2df54 Auto-merging via docker-versions-create 2021-11-06 21:38:11 -05:00
Geoff Bourne 8a36823843 Auto-merging via docker-versions-create 2021-11-04 21:04:41 -05:00
Geoff Bourne 78c520572a Auto-merging via docker-versions-create 2021-10-31 09:46:11 -05:00
Geoff Bourne 5303105265 Switched base image to JDK
#1064
2021-10-27 21:25:24 -05:00
Geoff Bourne 1f120c5fa4 Auto-merging via docker-versions-create 2021-10-25 19:23:56 -05:00
Geoff Bourne 70ec3b838d Auto-merging via docker-versions-create 2021-10-24 20:28:03 -05:00
Geoff Bourne b248ed342f Auto-merging via docker-versions-create 2021-10-23 09:43:19 -05:00
Geoff Bourne 4c70184804 Merged latest from master 2021-10-22 15:53:10 -05:00
Geoff Bourne b9ba062add Auto-merged latest from master 2021-10-18 22:13:11 -05:00
Geoff Bourne cbb1d0ea52 Added support for Crucible server type
#1052
2021-10-18 22:02:23 -05:00
Geoff Bourne bbad3a3e7a Auto-merging via docker-versions-create 2021-10-17 14:53:04 -05:00
Geoff Bourne 8965397a5a Auto-merging via docker-versions-create 2021-10-15 18:57:28 -05:00
Geoff Bourne c661fe7318 Auto-merging via docker-versions-create 2021-10-15 18:47:46 -05:00
Geoff Bourne bae1feb750 Auto-merging via docker-versions-create 2021-10-10 09:56:39 -05:00
Geoff Bourne edbcf80a70 Auto-merging via docker-versions-create 2021-10-09 15:25:44 -05:00
Geoff Bourne fb23e12680 Auto-merging via docker-versions-create 2021-10-09 12:04:28 -05:00
Geoff Bourne e30a2e6448 Auto-merging via docker-versions-create 2021-10-02 19:22:34 -05:00
Geoff Bourne 03d7babd68 Auto-merging via docker-versions-create 2021-09-29 10:26:54 -05:00
Geoff Bourne 332b929a6d Auto-merging via docker-versions-create 2021-09-27 20:41:23 -05:00
Geoff Bourne c138cabc65 Auto-merging via docker-versions-create 2021-09-20 12:30:46 -05:00
Geoff Bourne 41631e35e8 Auto-merging via docker-versions-create 2021-09-15 21:31:13 -05:00
Geoff Bourne 6f95fa6175 Auto-merging via docker-versions-create 2021-09-15 21:06:58 -05:00
Geoff Bourne 6f16da8309 Auto-merging via docker-versions-create 2021-09-15 20:37:01 -05:00
Geoff Bourne 8cee8d5618 Auto-merging via docker-versions-create 2021-08-30 21:37:26 -05:00
Geoff Bourne 8b76b5776a Auto-merging via docker-versions-create 2021-08-10 12:56:12 -05:00
Geoff Bourne e3af06d2e4 Auto-merging via docker-versions-create 2021-08-01 12:12:49 -05:00
Geoff Bourne 0ac583514c Auto-merging via docker-versions-create 2021-07-31 09:27:29 -05:00
Geoff Bourne bf3f15f5fb Auto-merging via docker-versions-create 2021-07-26 19:35:26 -05:00
Geoff Bourne 4aec2322b5 Merge branch 'master' into java8-openj9 2021-07-25 18:20:13 -05:00
Geoff Bourne 51b2eb6851 Auto-merging via docker-versions-create 2021-07-25 09:36:44 -05:00
Geoff Bourne 846050f41a Auto-merging via docker-versions-create 2021-07-23 21:27:37 -05:00
Geoff Bourne 485ec6a141 Auto-merging via docker-versions-create 2021-07-17 21:14:44 -05:00
Geoff Bourne 0096e41882 Auto-merging via docker-versions-create 2021-07-17 20:57:29 -05:00
Geoff Bourne d45610723a Auto-merging via docker-versions-create 2021-07-17 18:03:56 -05:00
Geoff Bourne 072704b54d Auto-merging via docker-versions-create 2021-07-14 18:43:15 -05:00
Geoff Bourne 0f08e88c5b Auto-merging via docker-versions-create 2021-07-12 19:09:42 -05:00
Geoff Bourne 89604c8d13 Auto-merging via docker-versions-create 2021-07-09 19:58:27 -05:00
Geoff Bourne 58842d444b Auto-merging via docker-versions-create 2021-07-08 17:59:28 -05:00
Geoff Bourne 457d09e14d Auto-merging via docker-versions-create 2021-07-08 08:03:47 -05:00
itzg 7210e81f47 Auto-merging via docker-versions-create 2021-07-08 12:56:00 +00:00
Geoff Bourne ba86534e6e Auto-merging via docker-versions-create 2021-07-08 07:38:39 -05:00
itzg 44bafbff09 Auto-merging via docker-versions-create 2021-07-04 19:54:01 +00:00
Geoff Bourne 75c51bf0c7 Merge branch 'master' into java8-openj9 2021-07-03 14:19:04 -05:00
Geoff Bourne cf651f2279 ci: restored limited image platforms for java8-openj9 2021-07-02 16:23:42 -05:00
Geoff Bourne 6d0d7fe19c ci: auto-merge from master 2021-07-02 15:56:54 -05:00
itzg bb58d7a4c9 Auto-merging via docker-versions-create 2021-07-02 16:55:54 +00:00
itzg 6efaac2861 Auto-merging via docker-versions-create 2021-06-28 12:14:05 +00:00
itzg 806342d74b Auto-merging via docker-versions-create 2021-06-27 13:13:11 +00:00
itzg 926e302595 Auto-merging via docker-versions-create 2021-06-24 12:47:05 +00:00
Geoff Bourne 10e85140ad Auto-merging via docker-versions-create 2021-06-23 22:33:45 -05:00
Geoff Bourne fc2ed9e612 Auto-merging via docker-versions-create 2021-06-20 12:48:15 -05:00
Geoff Bourne edfe58079a Auto-merging via docker-versions-create 2021-06-05 17:51:25 -05:00
Geoff Bourne d423cc3b8d Auto-merging via docker-versions-create 2021-05-24 20:50:52 -05:00
Geoff Bourne 1537e48e29 Merge branch 'master' into java8-openj9 2021-05-23 12:26:56 -05:00
Geoff Bourne 62473771dc Merge from master 2021-05-22 13:00:01 -05:00
Geoff Bourne c4528e8f79 Auto-merging via docker-versions-create 2021-05-21 23:02:00 -05:00
Geoff Bourne 0f797487ab Auto-merging via docker-versions-create 2021-05-21 22:48:32 -05:00
Geoff Bourne 9511e3cc80 Merge branch 'master' into java8-openj9 2021-05-21 22:35:00 -05:00
Geoff Bourne 3aa4dd6c85 ci: added java8-openj9 branch 2021-05-21 22:31:40 -05:00
Geoff Bourne 27571999b2 Merge branch 'master' into java8-multiarch 2021-05-21 17:28:44 -05:00
Geoff Bourne bbd7d9e39a ci: introduced CACHE_NAME 2021-05-21 17:26:42 -05:00
Geoff Bourne ef6f308229 Auto-merging via docker-versions-create 2021-05-19 20:27:42 -05:00
Geoff Bourne 49d89d3e73 Auto-merging via docker-versions-create 2021-05-19 20:25:00 -05:00
Geoff Bourne 74203b23f4 Auto-merging via docker-versions-create 2021-05-15 12:41:22 -05:00
Geoff Bourne 4fb791b490 Merge branch 'multiarch' into java8-multiarch
# Conflicts:
#	Dockerfile
#	start-configuration
2021-05-14 17:59:49 -05:00
Geoff Bourne ced25ad50a Auto-merging via docker-versions-create 2021-05-06 20:12:55 -05:00
Geoff Bourne 48efc224ba Auto-merging via docker-versions-create 2021-04-30 14:28:07 -05:00
Geoff Bourne 467c1d9954 Auto-merging via docker-versions-create 2021-04-30 11:11:46 -05:00
Geoff Bourne 9ced230f55 Auto-merging via docker-versions-create 2021-04-28 16:51:29 -05:00
Geoff Bourne f3a8276362 Auto-merging via docker-versions-create 2021-04-26 08:21:06 -05:00
Geoff Bourne b91d63716e Auto-merging via docker-versions-create 2021-04-24 13:42:37 -05:00
Geoff Bourne 46cccfd531 Auto-merging via docker-versions-create 2021-04-23 21:03:21 -05:00
Geoff Bourne 9fe1cb4a0d ci: Switched multiarch-java8 to be based on adoptopenjdk:8-jre-hotspot 2021-04-21 20:13:22 -05:00
Geoff Bourne 076038b470 Auto-merging via docker-versions-create 2021-04-18 13:29:46 -05:00
Geoff Bourne aa416729ea Auto-merging via docker-versions-create 2021-04-11 10:09:19 -05:00
Geoff Bourne 812c6365ec Merged latest from master 2021-04-08 19:14:45 -05:00
Geoff Bourne 42a5131b19 Merging latest from master 2021-04-01 16:32:55 -05:00
Geoff Bourne 624f6a210f Added git
#819
2021-04-01 16:28:32 -05:00
Geoff Bourne 1c63cd18b7 Merge branch 'master' into java8-multiarch
# Conflicts:
#	start-configuration
2021-03-06 16:24:55 -06:00
Geoff Bourne 6266a7e3cc Shifted PATH-fix earlier in startup 2021-03-06 16:04:31 -06:00
Geoff Bourne 871ecd4d9d Merge branch 'master' into java8-multiarch
# Conflicts:
#	start-minecraftFinalSetup
2021-02-27 20:52:36 -06:00
Geoff Bourne c572c95161 Ensure FTBA version.json is readable
#784
2021-02-27 16:58:25 -06:00
Geoff Bourne f7b58fbbb1 Fix PATH to include java when needed 2021-02-10 14:51:24 -06:00
Geoff Bourne eccfa444a9 Auto-merging via docker-versions-create 2021-02-10 14:02:05 -06:00
Geoff Bourne e831d25706 Merged latest from master 2021-02-08 21:18:28 -06:00
Geoff Bourne 12e931332b Auto-merging via docker-versions-create
CONFLICT (content): Merge conflict in Dockerfile
2021-02-07 18:06:06 -06:00
Geoff Bourne ceee9eddc9 ci: restored base image to ubuntu and install openjdk-8 2021-02-06 15:53:59 -06:00
Geoff Bourne 60ba668743 Merge branch 'master' into java8-multiarch
# Conflicts:
#	Dockerfile
2021-02-06 15:49:16 -06:00
Geoff Bourne fd1b15e01f ci: Added java8 variant of multiarch 2021-02-06 15:44:02 -06:00
15 changed files with 291 additions and 29 deletions
+4
View File
@@ -0,0 +1,4 @@
changelog:
exclude:
authors:
- dependabot
+1 -1
View File
@@ -81,7 +81,7 @@ jobs:
uses: docker/build-push-action@v2.7.0
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
# ensure latest base image is used
+5 -3
View File
@@ -1,4 +1,4 @@
FROM eclipse-temurin:17-jdk
FROM adoptopenjdk:8-jdk-openj9
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
@@ -76,7 +76,8 @@ ENV UID=1000 GID=1000 \
TYPE=VANILLA VERSION=LATEST \
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
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 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/log4j2.xml /tmp/log4j2.xml
COPY --chmod=755 files/autopause /autopause
COPY --chmod=755 files/autostop /autostop
RUN dos2unix /start* /autopause/*
RUN dos2unix /start* /autopause/* /autostop/*
ENTRYPOINT [ "/start" ]
HEALTHCHECK --start-period=1m CMD mc-health
+36 -2
View File
@@ -73,6 +73,7 @@ By default, the container will download the latest version of the "vanilla" [Min
* [Downloadable world](#downloadable-world)
* [Cloning world from a container path](#cloning-world-from-a-container-path)
* [Overwrite world on start](#overwrite-world-on-start)
* [Datapacks](#datapacks)
* [Server configuration](#server-configuration)
* [Message of the Day](#message-of-the-day)
* [Difficulty](#difficulty)
@@ -131,10 +132,11 @@ By default, the container will download the latest version of the "vanilla" [Min
* [Autopause](#autopause)
* [Description](#description)
* [Enabling Autopause](#enabling-autopause)
* [Autostop](#autostop)
* [Running on RaspberryPi](#running-on-raspberrypi)
* [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-->
@@ -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 |
| -------------- | -------------|--------|----------|-------------------|
| latest | 17 | Debian | Hotspot | amd64,arm64,armv7 |
| latest | 16 | Debian | Hotspot | amd64,arm64,armv7 |
| java8 | 8 | Alpine | Hotspot | amd64 |
| java8-multiarch | 8 | Debian | Hotspot | amd64,arm64,armv7 |
| 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
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
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`
<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
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`.
+1 -1
View File
@@ -12,4 +12,4 @@ if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then
exit 1
fi
echo "$@" > "${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}"
gosu minecraft bash -c "echo $* > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'"
+20
View 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
View 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
View File
@@ -0,0 +1,6 @@
#!/bin/bash
. /start-utils
logAutostopAction "Stopping Java process"
kill -SIGTERM 1
+2 -2
View File
@@ -40,7 +40,7 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then
echo 'hosts: files dns' > /etc/nsswitch.conf
fi
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration "$@"
else
exec ${SCRIPTS:-/}start-configuration $@
exec ${SCRIPTS:-/}start-configuration "$@"
fi
+34
View 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 &
+9 -18
View File
@@ -37,6 +37,11 @@ if isTrue "${ENABLE_AUTOPAUSE}" && isTrue "${EXEC_DIRECTLY:-false}"; then
exit 1
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
export http_proxy="$PROXY"
export https_proxy="$PROXY"
@@ -96,6 +101,10 @@ if isTrue "${ENABLE_AUTOPAUSE}"; then
${SCRIPTS:-/}start-autopause
fi
if isTrue "${ENABLE_AUTOSTOP}"; then
${SCRIPTS:-/}start-autostop
fi
if versionLessThan 1.7; then
echo "
MC_HEALTH_EXTRA_ARGS=(
@@ -115,14 +124,6 @@ case "${TYPE^^}" in
;;
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 "$@"
;;
@@ -135,10 +136,6 @@ case "${TYPE^^}" in
;;
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 "$@"
;;
@@ -183,12 +180,6 @@ case "${TYPE^^}" in
;;
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" "$@"
;;
+77
View 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" "$@"
+1 -1
View File
@@ -69,4 +69,4 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
fi
fi
exec "${SCRIPTS:-/}start-setupModpack" "$@"
exec "${SCRIPTS:-/}start-setupDatapack" "$@"
+18 -1
View File
@@ -22,6 +22,20 @@ containsJars() {
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() {
resource=${1?}
@@ -81,9 +95,12 @@ downloadResourceFromSpiget() {
log "Extracting contents of resource ${resource} into plugins"
unzip -o -q -d /data/plugins "${tmpfile}"
rm "${tmpfile}"
else
elif containsPlugin "${tmpfile}"; then
log "Moving resource ${resource} into plugins"
mv "${tmpfile}" "/data/plugins/${resource}.jar"
else
log "ERROR downloaded resource '${resource}' seems to be not a valid plugin"
exit 2
fi
}
+8
View File
@@ -93,6 +93,14 @@ function logAutopauseAction() {
echo "[$(date -Iseconds)] [Autopause] $*"
}
function logAutostop() {
echo "[Autostop loop] $*"
}
function logAutostopAction() {
echo "[$(date -Iseconds)] [Autostop] $*"
}
function normalizeMemSize() {
local scale=1
case ${1,,} in