Compare commits

...

73 Commits

Author SHA1 Message Date
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
a2ab0d75ed Fix PATH to include java when needed 2021-02-10 14:46:09 -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
Geoff Bourne
f856276d71 Upgraded multiarch to Java 11 2021-02-06 15:22:15 -06:00
Geoff Bourne
0300854c46 Merge branch 'master' into multiarch 2021-02-06 15:21:53 -06:00
Geoff Bourne
f06e9f5ede Merge branch 'master' into multiarch 2021-02-06 14:52:35 -06:00
Geoff Bourne
8d3ca813ed Auto-merging via docker-versions-create 2021-01-29 21:07:00 -06:00
Geoff Bourne
e97a00e61d Auto-merging via docker-versions-create 2021-01-12 17:28:11 -06:00
Michael Kirsch
b519c43e16 fix multiarch autopause daemon (#722) 2021-01-12 16:05:12 -06:00
Geoff Bourne
02c8393bc6 ci: Added opencontainers labels 2021-01-09 14:07:05 -06:00
Geoff Bourne
9469291731 ci: Switched multiarch build caching to github actions 2021-01-09 12:28:27 -06:00
Geoff Bourne
c29baf446d Auto-merging via docker-versions-create 2021-01-09 11:24:53 -06:00
Geoff Bourne
f9b8db0715 Merged master 2021-01-06 22:14:46 -06:00
ErstBlack
ffb50cfe28 Fixing AUTOPAUSE on Raspberry Pi 4s (#708)
* Replacing killall with pkill and ps -a to ps -ax

* Adding net-tools and removing -q from pkill

* Missed the resume.sh

* Christ there's a lot of ps calls

* Adding -x to health.sh, replacing killall with pkill in sudoers-mv, and replacing su-exec with gosu in knockd-config.cfg

Co-authored-by: sean.sullivan.ctr@progeny.net <sean.sullivan.ctr@progeny.net>
2020-12-31 13:15:44 -06:00
Geoff Bourne
51e6d5dfbd Added install of sudo
For #699
2020-12-28 11:42:54 -06:00
Geoff Bourne
842c69fd80 Auto-merging via docker-versions-create 2020-12-27 22:08:02 -06:00
Andrew Lambeth
c458823014 ignore duplicate entries in the targets array of version.json (#698) 2020-12-26 14:44:37 -06:00
Geoff Bourne
32abf1614f Auto-merging via docker-versions-create 2020-12-19 08:26:24 -06:00
Geoff Bourne
a916cc8320 Auto-merging via docker-versions-create 2020-12-15 14:00:27 -06:00
Geoff Bourne
01130757d6 Reverting FTBA debug change 2020-11-26 08:45:51 -06:00
Geoff Bourne
f97b3bf82e Added error handling of FTB installer download
For #645
2020-11-25 21:36:22 -06:00
Geoff Bourne
b7bcd252d3 ci: Fixed tag extraction 2020-11-25 16:06:01 -06:00
Geoff Bourne
aa43926da2 Merged from master 2020-11-25 15:59:43 -06:00
Geoff Bourne
34c45ec883 Switched to latest Docker buildx github action 2020-10-31 14:59:28 -05:00
Geoff Bourne
9bacaa11d8 Auto-merging via docker-versions-create 2020-08-09 13:07:53 -05:00
Geoff Bourne
c7c4c7497a docs: Added test multiarch build instruction 2020-07-26 13:51:16 -05:00
Geoff Bourne
e442baab31 Added writing of eula file after FTBA modpack is installed (#550) 2020-07-26 13:50:57 -05:00
Geoff Bourne
8101c8b51c Merge branch 'master' into multiarch
Renamed to start-deployFTBA

# Conflicts:
#	start-configuration
#	start-deployCF
2020-07-26 13:47:17 -05:00
Geoff Bourne
eba1ef6ab9 Auto-merging via docker-versions-create
# Conflicts:
#	start-deployFTB
#	start-minecraftFinalSetup
2020-07-26 08:35:13 -05:00
Geoff Bourne
6462e1580c Removed improperly merged apk call 2020-07-18 19:29:49 -05:00
Geoff Bourne
8b5552bb62 Auto-merging via docker-versions-create 2020-07-18 18:41:10 -05:00
Geoff Bourne
3ca514f2b2 Auto-merging via docker-versions-create 2020-07-11 13:14:10 -05:00
Geoff Bourne
c07f899870 Auto-merging via docker-versions-create
# Conflicts:
#	start-deployFTB
2020-07-10 17:13:05 -05:00
Geoff Bourne
e527fd9551 Auto-merging via docker-versions-create 2020-07-04 14:58:40 -05:00
Geoff Bourne
047a477f7b Auto-merging via docker-versions-create 2020-06-20 15:45:29 -05:00
Geoff Bourne
78cb05adda ci: added multiarch tags to triggers 2020-06-19 15:03:29 -05:00
Geoff Bourne
8493252645 Auto-merging via docker-versions-create
# Conflicts:
#	Dockerfile
#	README.md
#	start
#	start-configuration
#	start-deployFTB
2020-06-19 15:01:28 -05:00
Geoff Bourne
aa42633ab2 Added support for FTB application modpacks via modpacks.ch
For #524
2020-05-31 18:18:54 -05:00
Geoff Bourne
9ec336283f Updated to support multiarch/BuiltKit builds 2020-05-21 20:48:54 -05:00
Geoff Bourne
bbdb2c9b36 Auto-merging via docker-versions-create 2020-05-20 08:15:50 -05:00
Geoff Bourne
48e09f42fc Changed base ubuntu to 18.04 2020-05-14 20:09:12 -05:00
Geoff Bourne
ec7d182d38 Avoid touch since rpi mounts default to noatime 2020-05-14 15:21:51 -05:00
Geoff Bourne
9c7c95cf4f Pinned Java version at 11 2020-05-03 11:51:56 -05:00
Geoff Bourne
e32ffd1819 Auto-merging via docker-versions-create 2020-05-02 09:34:58 -05:00
Geoff Bourne
095c6ad099 Auto-merging via docker-versions-create 2020-04-25 12:11:39 -05:00
Geoff Bourne
14342c9632 Auto-merging via docker-versions-create
# Conflicts:
#	Dockerfile
2020-04-17 21:32:03 -05:00
Geoff Bourne
f6df4d6694 Auto-merging via docker-versions-create
# Conflicts:
#	.circleci/config.yml
2020-04-11 08:56:29 -05:00
Geoff Bourne
0406e89c2a Auto-merging via docker-versions-create 2020-04-10 11:09:12 -05:00
Geoff Bourne
5ef21e1ddf Auto-merging via docker-versions-create 2020-04-03 13:31:53 -05:00
Geoff Bourne
414d5bd8ac Auto-merging via docker-versions-create 2020-04-03 13:29:03 -05:00
Geoff Bourne
15ccf03b28 Auto-merging via docker-versions-create 2020-04-02 17:47:52 -05:00
Geoff Bourne
828a48998f Auto-merging via docker-versions-create 2020-03-30 08:32:11 -05:00
Geoff Bourne
4b590e03ff Auto-merging via docker-versions-create 2020-03-26 20:54:25 -05:00
Geoff Bourne
0db8780ad9 Changed base image to arm32v7/adoptopenjdk 2020-03-25 21:05:16 -05:00
Geoff Bourne
5b744176df Merge remote-tracking branch 'origin/master' into multiarch 2020-03-25 20:08:47 -05:00
Geoff Bourne
20b15e0330 Merge remote-tracking branch 'origin/master' into multiarch
# Conflicts:
#	Dockerfile
2020-02-06 16:59:59 -06:00
Geoff Bourne
818539e3de Switched base image to adoptopenjdk (debian) 2020-02-05 21:33:08 -06:00
Geoff Bourne
f48741f65c Try BuildKit via regular setup_remote_docker 2020-02-05 08:21:52 -06:00
Geoff Bourne
e9e5af849f Use docker executor 2020-02-04 20:14:32 -06:00
Geoff Bourne
22d68f5c7c Enable use-remote-docker 2020-02-04 20:13:02 -06:00
Geoff Bourne
690598da60 Try BuildKit/multiarch support on CircleCI 2020-02-04 20:10:45 -06:00
13 changed files with 133 additions and 61 deletions

11
BUILDING.md Normal file
View File

@@ -0,0 +1,11 @@
Ensure buildx/BuildKit support is enabled and run:
```shell script
docker buildx build --platform=linux/arm64 --platform=linux/arm/v7 --platform=linux/amd64 --tag itzg/minecraft-server:multiarch --push .
```
To build for local testing, use:
```shell script
docker buildx build --platform=linux/amd64 --tag mc-multiarch --load .
```

View File

@@ -1,29 +1,30 @@
FROM adoptopenjdk/openjdk11:alpine-jre
FROM ubuntu:18.04
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
RUN apk add --no-cache -U \
openssl \
imagemagick \
lsof \
su-exec \
shadow \
bash \
curl iputils wget \
git \
jq \
mysql-client \
tzdata \
rsync \
nano \
sudo \
knock \
ttf-dejavu
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
openjdk-8-jre-headless \
imagemagick \
gosu \
sudo \
net-tools \
curl wget \
git \
jq \
dos2unix \
mysql-client \
tzdata \
rsync \
nano \
unzip \
knockd \
ttf-dejavu \
&& apt-get clean
RUN addgroup -g 1000 minecraft \
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
&& mkdir -m 777 /data \
&& chown minecraft:minecraft /data /home/minecraft
RUN addgroup --gid 1000 minecraft \
&& adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data minecraft
COPY files/sudoers* /etc/sudoers.d
@@ -31,9 +32,9 @@ EXPOSE 25565 25575
# hook into docker BuildKit --platform support
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETOS=linux
ARG TARGETARCH=amd64
ARG TARGETVARIANT=""
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG EASY_ADD_VER=0.7.1
ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
@@ -69,7 +70,7 @@ WORKDIR /data
STOPSIGNAL SIGTERM
ENV UID=1000 GID=1000 \
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
MEMORY="1G" \
TYPE=VANILLA VERSION=LATEST \
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \

0
docs/.gitkeep Normal file
View File

View File

@@ -5,15 +5,15 @@ current_uptime() {
}
java_running() {
[[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]]
[[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]]
}
java_process_exists() {
[[ -n "$(ps -a -o comm | grep 'java')" ]]
[[ -n "$(ps -ax -o comm | grep 'java')" ]]
}
rcon_client_exists() {
[[ -n "$(ps -a -o comm | grep 'rcon-cli')" ]]
[[ -n "$(ps -ax -o comm | grep 'rcon-cli')" ]]
}
mc_server_listening() {

View File

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

View File

@@ -2,7 +2,7 @@
. /start-utils
if [[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; then
if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; then
# save world
rcon-cli save-all >/dev/null

View File

@@ -2,7 +2,7 @@
. /start-utils
if [[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^T.*$ ]] ; then
if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^T.*$ ]] ; then
logAutopauseAction "Knocked, resuming Java process"
pkill -CONT java
fi

View File

@@ -5,7 +5,7 @@
if isTrue "${DISABLE_HEALTHCHECK}"; then
echo "Healthcheck disabled"
exit 0
elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
echo "Java process suspended by Autopause function"
exit 0
else

2
start
View File

@@ -40,7 +40,7 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then
echo 'hosts: files dns' > /etc/nsswitch.conf
fi
exec su-exec ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
else
exec ${SCRIPTS:-/}start-configuration $@
fi

View File

@@ -13,6 +13,8 @@ shopt -s nullglob
#umask 002
export HOME=/data
log "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
if [ ! -e /data/eula.txt ]; then
if ! isTrue "$EULA"; then
log ""
@@ -28,15 +30,6 @@ if [ ! -e /data/eula.txt ]; then
fi
log "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
if ! touch /data/.verify_access; then
log "ERROR: /data doesn't seem to be writable. Please make sure attached directory is writable by uid=$(id -u)"
exit 2
fi
rm /data/.verify_access || true
if [[ $PROXY ]]; then
export http_proxy="$PROXY"
export https_proxy="$PROXY"
@@ -63,7 +56,7 @@ fi
if ! which java > /dev/null; then
log "Fixing PATH to include java"
PATH="${PATH}:/opt/java/openjdk/bin"
PATH="${PATH}:/usr/bin"
fi
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
@@ -105,12 +98,6 @@ case "${TYPE^^}" in
;;
FORGE)
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-deployForge "$@"
;;
@@ -118,13 +105,11 @@ case "${TYPE^^}" in
exec ${SCRIPTS:-/}start-deployFabric "$@"
;;
FTB|CURSEFORGE)
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 "**********************************************************************"
FTBA)
exec ${SCRIPTS:-/}start-deployFTBA "$@"
;;
CURSEFORGE|FTB)
exec ${SCRIPTS:-/}start-deployCF "$@"
;;

View File

@@ -27,7 +27,7 @@ isDebugging && set -x
export FTB_BASE_DIR
legacyJavaFixerUrl=https://ftb.forgecdn.net/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
export TYPE=FEED-THE-BEAST
export TYPE=CURSEFORGE
FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}

75
start-deployFTBA Normal file
View File

@@ -0,0 +1,75 @@
#!/bin/bash
ftbInstallMarker=".ftb-installed"
. ${SCRIPTS:-/}start-utils
isDebugging && set -x
set -e
if ! [[ -v FTB_MODPACK_ID ]]; then
log "ERROR FTB_MODPACK_ID is required with TYPE=FTB"
exit 1
fi
if ! [[ ${FTB_MODPACK_ID} =~ [0-9]+ ]]; then
log "ERROR FTB_MODPACK_ID needs to be numeric"
exit 1
fi
if ! [[ -v FTB_MODPACK_VERSION_ID ]]; then
if ! FTB_MODPACK_VERSION_ID=$(curl -fsSL https://api.modpacks.ch/public/modpack/${FTB_MODPACK_ID} | jq -r '.versions | sort_by(.updated)[-1].id'); then
log "ERROR unable to resolve latest modpack version ID for modpack ${FTB_MODPACK_ID}"
exit 1
fi
elif ! [[ ${FTB_MODPACK_VERSION_ID} =~ [0-9]+ ]]; then
log "ERROR FTB_MODPACK_VERSION_ID needs to be numeric"
exit 1
fi
if ! [ -f "${ftbInstallMarker}" ] || [ $(cat "${ftbInstallMarker}") != "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" ]; then
ftbInstaller=/data/ftb-installer
if ! [[ -f "${ftbInstaller}" ]]; then
log "Downloading FTB installer"
curl -fsSL https://api.modpacks.ch/public/modpack/1/1/server/linux -o "${ftbInstaller}"
chmod +x "${ftbInstaller}"
fi
rm -rf forge*jar mods config libraries defaultconfigs changelogs
log "Installing modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID}"
${ftbInstaller} ${FTB_MODPACK_ID} ${FTB_MODPACK_VERSION_ID} --noscript --auto
rm -f forge*installer.jar
echo "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" > ${ftbInstallMarker}
writeEula
# some modpacks result in --w----r-- permissions
chmod a+r version.json
else
log "FTB modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID} is ready to go"
fi
isDebugging && cat version.json
forgeVersion=$(jq -r '.targets|unique[] | select(.name == "forge") | .version' version.json)
mcVersion=$(jq -r '.targets|unique[] | select(.name == "minecraft") | .version' version.json)
variants=(
forge-${mcVersion}-${forgeVersion}.jar
forge-${mcVersion}-${forgeVersion}-universal.jar
forge-${mcVersion}-${forgeVersion}-${mcVersion}-universal.jar
)
for f in ${variants[@]}; do
if [ -f $f ]; then
export SERVER=$f
break
fi
done
if ! [ -v SERVER ]; then
log "ERROR unable to locate the installed forge server jar"
ls *.jar
exit 2
fi
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@@ -173,7 +173,7 @@ if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
exec mc-server-runner ${mcServerRunnerArgs} \
--cf-instance-file "${CURSE_INSTANCE_JSON}" \
java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar _SERVERJAR_ "$@" $EXTRA_ARGS
elif [[ ${TYPE} == "FEED-THE-BEAST" && "${SERVER}" ]]; then
elif [[ ${TYPE} == "CURSEFORGE" && "${SERVER}" ]]; then
copyFilesForCurseForge
cd "${FTB_DIR}"
@@ -182,7 +182,7 @@ elif [[ ${TYPE} == "FEED-THE-BEAST" && "${SERVER}" ]]; then
set -x
fi
exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar $(basename "${SERVER}") "$@" $EXTRA_ARGS
elif [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
elif [[ ${TYPE} == "CURSEFORGE" ]]; then
mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash"
copyFilesForCurseForge