Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,7 @@ WORKDIR /data

STOPSIGNAL SIGTERM

ENV UID=1000 GID=1000 \
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
ENV TYPE=VANILLA VERSION=LATEST EULA=""

COPY --chmod=755 scripts/start* /
COPY --chmod=755 bin/ /usr/local/bin/
Expand Down
6 changes: 3 additions & 3 deletions files/autopause/knockd-config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
[unpauseMCServer-server]
sequence = 25565
seq_timeout = 1
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh
command = /autopause/resume.sh
tcpflags = syn
[unpauseMCServer-rcon]
sequence = 25575
seq_timeout = 1
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh
command = /autopause/resume.sh
tcpflags = syn
[unpauseMCServer-bedrock]
sequence = 19132:udp
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh
command = /autopause/resume.sh
12 changes: 12 additions & 0 deletions scripts/start-autopause
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@
. "${SCRIPTS:-/}start-utils"

: "${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 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"

Expand Down
8 changes: 8 additions & 0 deletions scripts/start-autostop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
. "${SCRIPTS:-/}start-utils"

: "${SERVER_PORT:=25565}"
: "${ENABLE_AUTOSTOP:=false}"
: "${AUTOSTOP_TIMEOUT_EST:=3600}"
: "${AUTOSTOP_TIMEOUT_INIT:=1800}"
: "${AUTOSTOP_PERIOD:=10}"
export SERVER_PORT
export ENABLE_AUTOSTOP
export AUTOSTOP_TIMEOUT_EST
export AUTOSTOP_TIMEOUT_INIT
export AUTOSTOP_PERIOD

log "Autostop functionality enabled"

Expand Down
7 changes: 6 additions & 1 deletion scripts/start-configuration
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ IFS=$'\n\t'

: "${EULA:=}"
: "${PROXY:=}"
: "${RCON_PASSWORD_FILE:=}"
: "${ENABLE_AUTOPAUSE:=false}"
: "${ENABLE_AUTOSTOP:=false}"
: "${RCON_CMDS_STARTUP:=}"
: "${RCON_CMDS_ON_CONNECT:=}"
: "${RCON_CMDS_ON_DISCONNECT:=}"
: "${RCON_CMDS_FIRST_CONNECT:=}"
: "${RCON_CMDS_LAST_DISCONNECT:=}"
: "${RCON_CMDS_PERIOD:=10}"
: "${RCON_PASSWORD_FILE:=}"
: "${RCON_PASSWORD:=minecraft}"
: "${RCON_PORT:=25575}"
export RCON_PASSWORD RCON_PORT

shopt -s nullglob

Expand Down
1 change: 1 addition & 0 deletions scripts/start-finalExec
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ if [[ ${GUI,,} = false ]]; then
EXTRA_ARGS+=" nogui"
fi

: "${MEMORY:=1G}"
: "${INIT_MEMORY:=${MEMORY}}"
: "${MAX_MEMORY:=${MEMORY}}"

Expand Down
1 change: 1 addition & 0 deletions scripts/start-setupServerProperties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
. "${SCRIPTS:-/}start-utils"

: "${SERVER_PROPERTIES:=/data/server.properties}"
: "${ENABLE_RCON:=true}"

# FUNCTIONS
function setServerPropValue {
Expand Down
11 changes: 11 additions & 0 deletions tests/setuponlytests/defaults/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions tests/setuponlytests/defaults/verify.sh
Original file line number Diff line number Diff line change
@@ -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