Corrected autopause's resume to work with alpine images (#1464)

This commit is contained in:
Geoff Bourne 2022-04-10 10:58:18 -05:00 committed by GitHub
parent 4af80debe2
commit 97fe6b1f14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 46 additions and 11 deletions

View File

@ -57,13 +57,7 @@ WORKDIR /data
STOPSIGNAL SIGTERM STOPSIGNAL SIGTERM
ENV UID=1000 GID=1000 \ ENV TYPE=VANILLA VERSION=LATEST EULA=""
MEMORY="1G" \
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 \
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/

View File

@ -3,13 +3,13 @@
[unpauseMCServer-server] [unpauseMCServer-server]
sequence = 25565 sequence = 25565
seq_timeout = 1 seq_timeout = 1
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh command = /autopause/resume.sh
tcpflags = syn tcpflags = syn
[unpauseMCServer-rcon] [unpauseMCServer-rcon]
sequence = 25575 sequence = 25575
seq_timeout = 1 seq_timeout = 1
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh command = /autopause/resume.sh
tcpflags = syn tcpflags = syn
[unpauseMCServer-bedrock] [unpauseMCServer-bedrock]
sequence = 19132:udp sequence = 19132:udp
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh command = /autopause/resume.sh

View File

@ -4,7 +4,19 @@
. "${SCRIPTS:-/}start-utils" . "${SCRIPTS:-/}start-utils"
: "${SERVER_PORT:=25565}" : "${SERVER_PORT:=25565}"
: "${ENABLE_AUTOPAUSE:=false}"
: "${AUTOPAUSE_TIMEOUT_EST:=3600}"
: "${AUTOPAUSE_TIMEOUT_KN:=120}"
: "${AUTOPAUSE_TIMEOUT_INIT:=600}"
: "${AUTOPAUSE_PERIOD:=10}"
: "${AUTOPAUSE_KNOCK_INTERFACE:=eth0}"
export SERVER_PORT export SERVER_PORT
export ENABLE_AUTOPAUSE
export AUTOPAUSE_TIMEOUT_EST
export AUTOPAUSE_TIMEOUT_KN
export AUTOPAUSE_TIMEOUT_INIT
export AUTOPAUSE_PERIOD
export AUTOPAUSE_KNOCK_INTERFACE
log "Autopause functionality enabled" log "Autopause functionality enabled"

View File

@ -4,7 +4,15 @@
. "${SCRIPTS:-/}start-utils" . "${SCRIPTS:-/}start-utils"
: "${SERVER_PORT:=25565}" : "${SERVER_PORT:=25565}"
: "${ENABLE_AUTOSTOP:=false}"
: "${AUTOSTOP_TIMEOUT_EST:=3600}"
: "${AUTOSTOP_TIMEOUT_INIT:=1800}"
: "${AUTOSTOP_PERIOD:=10}"
export SERVER_PORT export SERVER_PORT
export ENABLE_AUTOSTOP
export AUTOSTOP_TIMEOUT_EST
export AUTOSTOP_TIMEOUT_INIT
export AUTOSTOP_PERIOD
log "Autostop functionality enabled" log "Autostop functionality enabled"

View File

@ -7,13 +7,18 @@ IFS=$'\n\t'
: "${EULA:=}" : "${EULA:=}"
: "${PROXY:=}" : "${PROXY:=}"
: "${RCON_PASSWORD_FILE:=}" : "${ENABLE_AUTOPAUSE:=false}"
: "${ENABLE_AUTOSTOP:=false}"
: "${RCON_CMDS_STARTUP:=}" : "${RCON_CMDS_STARTUP:=}"
: "${RCON_CMDS_ON_CONNECT:=}" : "${RCON_CMDS_ON_CONNECT:=}"
: "${RCON_CMDS_ON_DISCONNECT:=}" : "${RCON_CMDS_ON_DISCONNECT:=}"
: "${RCON_CMDS_FIRST_CONNECT:=}" : "${RCON_CMDS_FIRST_CONNECT:=}"
: "${RCON_CMDS_LAST_DISCONNECT:=}" : "${RCON_CMDS_LAST_DISCONNECT:=}"
: "${RCON_CMDS_PERIOD:=10}" : "${RCON_CMDS_PERIOD:=10}"
: "${RCON_PASSWORD_FILE:=}"
: "${RCON_PASSWORD:=minecraft}"
: "${RCON_PORT:=25575}"
export RCON_PASSWORD RCON_PORT
shopt -s nullglob shopt -s nullglob

View File

@ -97,6 +97,7 @@ if [[ ${GUI,,} = false ]]; then
EXTRA_ARGS+=" nogui" EXTRA_ARGS+=" nogui"
fi fi
: "${MEMORY:=1G}"
: "${INIT_MEMORY:=${MEMORY}}" : "${INIT_MEMORY:=${MEMORY}}"
: "${MAX_MEMORY:=${MEMORY}}" : "${MAX_MEMORY:=${MEMORY}}"

View File

@ -4,6 +4,7 @@
. "${SCRIPTS:-/}start-utils" . "${SCRIPTS:-/}start-utils"
: "${SERVER_PROPERTIES:=/data/server.properties}" : "${SERVER_PROPERTIES:=/data/server.properties}"
: "${ENABLE_RCON:=true}"
# FUNCTIONS # FUNCTIONS
function setServerPropValue { function setServerPropValue {

View File

@ -0,0 +1,11 @@
version: "3"
services:
mc:
restart: "no"
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
environment:
EULA: "TRUE"
SETUP_ONLY: "TRUE"
volumes:
- ./data:/data

View File

@ -0,0 +1,3 @@
mc-image-helper assert propertyEquals --file=server.properties --property=rcon.password --expect=minecraft
mc-image-helper assert propertyEquals --file=server.properties --property=rcon.port --expect=25575
mc-image-helper assert propertyEquals --file=server.properties --property=enable-rcon --expect=true