Skip to content

Commit d43ae9f

Browse files
authored
velocity: ensure health check uses bind setting from velocity.toml (#230)
1 parent 6a7e0ef commit d43ae9f

2 files changed

Lines changed: 28 additions & 9 deletions

File tree

Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,35 @@ ARG TARGETVARIANT
1919
ARG APPS_REV=1
2020
ARG GITHUB_BASEURL=https://github.com
2121

22-
ARG EASY_ADD_VERSION=0.8.8
22+
ARG EASY_ADD_VERSION=0.8.9
2323
ADD ${GITHUB_BASEURL}/itzg/easy-add/releases/download/${EASY_ADD_VERSION}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
2424
RUN chmod +x /usr/bin/easy-add
2525

26-
ARG MC_MONITOR_VERSION=0.14.1
26+
ARG MC_MONITOR_VERSION=0.15.3
2727

2828
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
2929
--var version=${MC_MONITOR_VERSION} --var app=mc-monitor --file {{.app}} \
3030
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
3131

32-
ARG RCON_CLI_VERSION=1.6.9
32+
ARG RCON_CLI_VERSION=1.6.11
3333
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
3434
--var version=${RCON_CLI_VERSION} --var app=rcon-cli --file {{.app}} \
3535
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
3636

3737
COPY --chmod=444 templates/ /templates/
3838

39-
ARG MC_HELPER_VERSION=1.39.11
39+
ARG MC_HELPER_VERSION=1.41.1
4040
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
4141
# used for cache busting local copy of mc-image-helper
4242
ARG MC_HELPER_REV=1
4343
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
4444
| tar -C /usr/share -zxf - \
4545
&& ln -s /usr/share/mc-image-helper-${MC_HELPER_VERSION}/bin/mc-image-helper /usr/bin
4646

47-
ENV SERVER_PORT=25577 RCON_PORT=25575 MEMORY=512m
48-
EXPOSE $SERVER_PORT
47+
ENV RCON_PORT=25575 MEMORY=512m
48+
# Bungee defaults to 25577
49+
# Velocity defaults to 25565
50+
EXPOSE 25577 25565
4951

5052
CMD ["/usr/bin/run-bungeecord.sh"]
5153
HEALTHCHECK --start-period=10s CMD /usr/bin/health.sh

scripts/health.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
11
#!/bin/bash
22

3-
: ${HEALTH_USE_PROXY:=false}
3+
: "${HEALTH_USE_PROXY:=false}"
44

55
args=()
66
if [[ "${HEALTH_USE_PROXY^^}" = TRUE ]]; then
7-
args+="--use-proxy"
7+
args+=("--use-proxy")
88
fi
99

10-
mc-monitor status --host ${HEALTH_HOST:-localhost} --port $SERVER_PORT ${args[@]}
10+
function resolveServerPort() {
11+
if [[ ${TYPE^^} = VELOCITY ]]; then
12+
if [[ -f velocity.toml ]]; then
13+
bind="$(mc-image-helper toml-path --file=velocity.toml '.bind')"
14+
if [[ $bind ]]; then
15+
echo "${bind##*:}"
16+
return
17+
fi
18+
fi
19+
echo 25565
20+
else
21+
echo 25577
22+
fi
23+
}
24+
25+
: "${SERVER_PORT:=$(resolveServerPort)}"
26+
27+
mc-monitor status --host "${HEALTH_HOST:-localhost}" --port "$SERVER_PORT" "${args[@]}"
1128
exit $?

0 commit comments

Comments
 (0)