mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-18 07:26:24 +00:00
Compare commits
20 Commits
2021.10.0-
...
2021.7.0-j
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45856a1a81 | ||
|
|
1e615e76e8 | ||
|
|
1c85a685de | ||
|
|
7cd207f40b | ||
|
|
140a8aa90c | ||
|
|
76dcff9d18 | ||
|
|
a9a86d249b | ||
|
|
595760d301 | ||
|
|
6d3f194ce3 | ||
|
|
21c1620f0c | ||
|
|
e78e5af96d | ||
|
|
0fb9700fc7 | ||
|
|
18925ef32c | ||
|
|
f06b990f8a | ||
|
|
75844ae81a | ||
|
|
6bb2323c46 | ||
|
|
7814ca21b5 | ||
|
|
b8806629ec | ||
|
|
4a7f838a0f | ||
|
|
2d07dee4df |
11
BUILDING.md
11
BUILDING.md
@@ -1,11 +0,0 @@
|
|||||||
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 .
|
|
||||||
```
|
|
||||||
57
Dockerfile
57
Dockerfile
@@ -1,29 +1,32 @@
|
|||||||
FROM adoptopenjdk:15-jre
|
FROM openjdk:8u212-jre-alpine
|
||||||
|
|
||||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||||
|
|
||||||
RUN apt-get update \
|
# upgrade all packages since alpine jre8 base image tops out at 8u212
|
||||||
&& DEBIAN_FRONTEND=noninteractive \
|
RUN apk -U --no-cache upgrade
|
||||||
apt-get install -y \
|
|
||||||
imagemagick \
|
|
||||||
gosu \
|
|
||||||
sudo \
|
|
||||||
net-tools \
|
|
||||||
curl wget \
|
|
||||||
git \
|
|
||||||
jq \
|
|
||||||
dos2unix \
|
|
||||||
mysql-client \
|
|
||||||
tzdata \
|
|
||||||
rsync \
|
|
||||||
nano \
|
|
||||||
unzip \
|
|
||||||
knockd \
|
|
||||||
ttf-dejavu \
|
|
||||||
&& apt-get clean
|
|
||||||
|
|
||||||
RUN addgroup --gid 1000 minecraft \
|
RUN apk add --no-cache -U \
|
||||||
&& adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data minecraft
|
openssl \
|
||||||
|
imagemagick \
|
||||||
|
lsof \
|
||||||
|
su-exec \
|
||||||
|
shadow \
|
||||||
|
bash \
|
||||||
|
curl iputils wget \
|
||||||
|
git \
|
||||||
|
jq \
|
||||||
|
mysql-client \
|
||||||
|
tzdata \
|
||||||
|
rsync \
|
||||||
|
nano \
|
||||||
|
sudo \
|
||||||
|
knock \
|
||||||
|
ttf-dejavu
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
COPY files/sudoers* /etc/sudoers.d
|
COPY files/sudoers* /etc/sudoers.d
|
||||||
|
|
||||||
@@ -31,9 +34,9 @@ EXPOSE 25565 25575
|
|||||||
|
|
||||||
# hook into docker BuildKit --platform support
|
# hook into docker BuildKit --platform support
|
||||||
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
||||||
ARG TARGETOS
|
ARG TARGETOS=linux
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH=amd64
|
||||||
ARG TARGETVARIANT
|
ARG TARGETVARIANT=""
|
||||||
|
|
||||||
ARG EASY_ADD_VER=0.7.1
|
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
|
ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
|
||||||
@@ -66,10 +69,8 @@ COPY server.properties /tmp/server.properties
|
|||||||
COPY log4j2.xml /tmp/log4j2.xml
|
COPY log4j2.xml /tmp/log4j2.xml
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
|
|
||||||
STOPSIGNAL SIGTERM
|
|
||||||
|
|
||||||
ENV UID=1000 GID=1000 \
|
ENV UID=1000 GID=1000 \
|
||||||
MEMORY="1G" \
|
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
||||||
TYPE=VANILLA VERSION=LATEST \
|
TYPE=VANILLA VERSION=LATEST \
|
||||||
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||||
SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
||||||
|
|||||||
75
README.md
75
README.md
@@ -262,7 +262,7 @@ If you want old mods to be removed as the `/mods` content is updated, then add `
|
|||||||
|
|
||||||
For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMOVE_OLD_MODS_DEPTH=1` will remove all old jar files that are directly inside the `plugins/` or `mods/` directory.
|
For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMOVE_OLD_MODS_DEPTH=1` will remove all old jar files that are directly inside the `plugins/` or `mods/` directory.
|
||||||
|
|
||||||
You can specify the destination of the files that are copied from `/mods` and `/config` by setting the `COPY_MODS_DEST` and `COPY_CONFIG_DEST`, where the default is `/data/mods` and `/data/config`. For example, `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over files like `bukkit.yml` and so on directly into the server directory.
|
You can specify the destination of the files that are copied from `/config` by setting the `COPY_CONFIG_DEST` variable, where the default is `/data/config`. For example, `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over files like `bukkit.yml` and so on directly into the server directory.
|
||||||
|
|
||||||
> NOTE: If a file was updated in the destination path and is newer than the source file from `/config`, then it will not be overwritten.
|
> NOTE: If a file was updated in the destination path and is newer than the source file from `/config`, then it will not be overwritten.
|
||||||
|
|
||||||
@@ -317,23 +317,9 @@ A [Tuinity](https://github.com/Spottedleaf/Tuinity) server, which is a fork of P
|
|||||||
|
|
||||||
> **NOTE** only `VERSION=LATEST` is supported
|
> **NOTE** only `VERSION=LATEST` is supported
|
||||||
|
|
||||||
## Running an Airplane server
|
|
||||||
|
|
||||||
An [Airplane](https://github.com/TECHNOVE/Airplane) server, which is a fork of Tuinity aimed at further improving server performance at high playercounts.
|
|
||||||
|
|
||||||
-e TYPE=AIRPLANE
|
|
||||||
|
|
||||||
> **NOTE** only `VERSION=LATEST` is supported
|
|
||||||
|
|
||||||
> **NOTE** only Java 8 and 11 are supported
|
|
||||||
|
|
||||||
Extra variables:
|
|
||||||
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
|
||||||
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the [Flare](https://blog.airplane.gg/flare) profiler
|
|
||||||
|
|
||||||
## Running a Purpur server
|
## Running a Purpur server
|
||||||
|
|
||||||
A [Purpur](https://purpur.pl3x.net/) server, which is "a fork of Paper, Tuinity, Airplane with the goal of providing new and interesting configuration options".
|
A [Purpur](https://purpur.pl3x.net/) server, which is "a fork of Paper and Tuinity with the goal of providing new and interesting configuration options".
|
||||||
|
|
||||||
-e TYPE=PURPUR
|
-e TYPE=PURPUR
|
||||||
|
|
||||||
@@ -342,7 +328,6 @@ A [Purpur](https://purpur.pl3x.net/) server, which is "a fork of Paper, Tuinity,
|
|||||||
Extra variables:
|
Extra variables:
|
||||||
- `PURPUR_BUILD=LATEST` : set a specific Purpur build to use
|
- `PURPUR_BUILD=LATEST` : set a specific Purpur build to use
|
||||||
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
||||||
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the [Flare](https://blog.airplane.gg/flare) profiler
|
|
||||||
|
|
||||||
## Running a Yatopia server
|
## Running a Yatopia server
|
||||||
|
|
||||||
@@ -355,7 +340,6 @@ A [Yatopia](https://github.com/YatopiaMC/Yatopia) server, which is a "blazing fa
|
|||||||
Extra variables:
|
Extra variables:
|
||||||
- `RELEASE=stable` : set to `stable` or `latest`
|
- `RELEASE=stable` : set to `stable` or `latest`
|
||||||
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
||||||
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the [Flare](https://blog.airplane.gg/flare) profiler
|
|
||||||
|
|
||||||
## Running a Magma server
|
## Running a Magma server
|
||||||
|
|
||||||
@@ -512,9 +496,9 @@ the `/path/on/host` folder contents look like:
|
|||||||
```
|
```
|
||||||
/path/on/host
|
/path/on/host
|
||||||
├── mods
|
├── mods
|
||||||
│ └── ... INSTALL MODS HERE ...
|
│ └── ... INSTALL MODS HERE ...
|
||||||
├── config
|
├── config
|
||||||
│ └── ... CONFIGURE MODS HERE ...
|
│ └── ... CONFIGURE MODS HERE ...
|
||||||
├── ops.json
|
├── ops.json
|
||||||
├── server.properties
|
├── server.properties
|
||||||
├── whitelist.json
|
├── whitelist.json
|
||||||
@@ -527,20 +511,24 @@ up:
|
|||||||
docker stop mc
|
docker stop mc
|
||||||
docker start mc
|
docker start mc
|
||||||
|
|
||||||
## Optional plugins, mods, and config attach points
|
### Using separate mounts
|
||||||
|
|
||||||
There are optional volume paths that can be attached to supply content to be copied into the data area:
|
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
||||||
|
or downloading a world with the `WORLD` option.
|
||||||
|
|
||||||
`/plugins`
|
There are two additional volumes that can be mounted; `/mods` and `/config`.
|
||||||
: contents are copied into `/data/plugins` for Bukkit related server types. Set `PLUGINS_SYNC_UPDATE=false` if you want files from `/plugins` to take precedence over newer files in `/data/plugins`.
|
Any files in either of these filesystems will be copied over to the main
|
||||||
|
`/data` filesystem before starting Minecraft.
|
||||||
|
|
||||||
`/mods`
|
This works well if you want to have a common set of modules in a separate
|
||||||
: contents are copied into `/data/mods` for Forge related server types
|
location, but still have multiple worlds with different server requirements
|
||||||
|
in either persistent volumes or a downloadable archive.
|
||||||
|
|
||||||
`/config`
|
## Deploying plugins from attached volume
|
||||||
: contents are copied into `/data/config` by default, but can be changed with `COPY_CONFIG_DEST`
|
|
||||||
|
|
||||||
These paths work well if you want to have a common set of modules in a separate location, but still have multiple worlds with different server requirements in either persistent volumes or a downloadable archive.
|
If the `/plugins` directory exists in the container, such as from an attached volume, any files in this directory will be copied over to `/data/plugins` before starting Minecraft. Set `PLUGINS_SYNC_UPDATE=false` if you want files from `/plugins` to take precedence over newer files in `/data/plugins`.
|
||||||
|
|
||||||
|
This works well if you want to have a common set of plugins in a separate location, but still have multiple worlds with different server requirements in either persistent volumes or a downloadable archive.
|
||||||
|
|
||||||
## Auto-downloading SpigotMC/Bukkit/PaperMC plugins
|
## Auto-downloading SpigotMC/Bukkit/PaperMC plugins
|
||||||
|
|
||||||
@@ -1109,35 +1097,6 @@ via a `JVM_XX_OPTS` environment variable.
|
|||||||
For some cases, if e.g. after removing mods, it could be necessary to startup minecraft with an additional `-D` parameter like `-Dfml.queryResult=confirm`. To address this you can use the environment variable `JVM_DD_OPTS`, which builds the params from a given list of values separated by space, but without the `-D` prefix. To make things running under systems (e.g. Plesk), which doesn't allow `=` inside values, a `:` (colon) could be used instead. The upper example would look like this:
|
For some cases, if e.g. after removing mods, it could be necessary to startup minecraft with an additional `-D` parameter like `-Dfml.queryResult=confirm`. To address this you can use the environment variable `JVM_DD_OPTS`, which builds the params from a given list of values separated by space, but without the `-D` prefix. To make things running under systems (e.g. Plesk), which doesn't allow `=` inside values, a `:` (colon) could be used instead. The upper example would look like this:
|
||||||
`JVM_DD_OPTS=fml.queryResult:confirm`, and will be converted to `-Dfml.queryResult=confirm`.
|
`JVM_DD_OPTS=fml.queryResult:confirm`, and will be converted to `-Dfml.queryResult=confirm`.
|
||||||
|
|
||||||
### Interactive and Color Console
|
|
||||||
|
|
||||||
If you would like to attach to the Minecraft server console with color and interactive capabilities, then add
|
|
||||||
|
|
||||||
```
|
|
||||||
-e EXEC_DIRECTLY=true
|
|
||||||
```
|
|
||||||
|
|
||||||
> **NOTE** this will bypass graceful server shutdown handling when using `docker stop`, so be sure to use `rcon-cli` or console commands to `stop` the server.
|
|
||||||
|
|
||||||
### OpenJ9 Specific Options
|
|
||||||
|
|
||||||
The openj9 image tags include specific variables to simplify configuration:
|
|
||||||
|
|
||||||
- `-e TUNE_VIRTUALIZED=TRUE` : enables the option to
|
|
||||||
[optimize for virtualized environments](https://www.eclipse.org/openj9/docs/xtunevirtualized/)
|
|
||||||
- `-e TUNE_NURSERY_SIZES=TRUE` : configures nursery sizes where the initial size is 50%
|
|
||||||
of the `MAX_MEMORY` and the max size is 80%.
|
|
||||||
|
|
||||||
### Enabling rolling logs
|
|
||||||
|
|
||||||
By default the vanilla log file will grow without limit. The logger can be reconfigured to use a rolling log files strategy by using:
|
|
||||||
|
|
||||||
```
|
|
||||||
-e ENABLE_ROLLING_LOGS=true
|
|
||||||
```
|
|
||||||
|
|
||||||
> **NOTE** this will interfere with interactive/color consoles [as described in the section above](#interactive-and-color-console)
|
|
||||||
|
|
||||||
## Timezone Configuration
|
## Timezone Configuration
|
||||||
|
|
||||||
You can configure the timezone to match yours by setting the `TZ` environment variable:
|
You can configure the timezone to match yours by setting the `TZ` environment variable:
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ current_uptime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java_running() {
|
java_running() {
|
||||||
[[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]]
|
[[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
java_process_exists() {
|
java_process_exists() {
|
||||||
[[ -n "$(ps -ax -o comm | grep 'java')" ]]
|
[[ -n "$(ps -a -o comm | grep 'java')" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
rcon_client_exists() {
|
rcon_client_exists() {
|
||||||
[[ -n "$(ps -ax -o comm | grep 'rcon-cli')" ]]
|
[[ -n "$(ps -a -o comm | grep 'rcon-cli')" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
mc_server_listening() {
|
mc_server_listening() {
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
[unpauseMCServer-server]
|
[unpauseMCServer-server]
|
||||||
sequence = 25565
|
sequence = 25565
|
||||||
seq_timeout = 1
|
seq_timeout = 1
|
||||||
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh
|
command = /sbin/su-exec minecraft:minecraft /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 = /sbin/su-exec minecraft:minecraft /autopause/resume.sh
|
||||||
tcpflags = syn
|
tcpflags = syn
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. /start-utils
|
. /start-utils
|
||||||
|
|
||||||
if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; then
|
if [[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; then
|
||||||
# save world
|
# save world
|
||||||
rcon-cli save-all >/dev/null
|
rcon-cli save-all >/dev/null
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. /start-utils
|
. /start-utils
|
||||||
|
|
||||||
if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^T.*$ ]] ; then
|
if [[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^T.*$ ]] ; then
|
||||||
logAutopauseAction "Knocked, resuming Java process"
|
logAutopauseAction "Knocked, resuming Java process"
|
||||||
pkill -CONT java
|
pkill -CONT java
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
if isTrue "${DISABLE_HEALTHCHECK}"; then
|
if isTrue "${DISABLE_HEALTHCHECK}"; then
|
||||||
echo "Healthcheck disabled"
|
echo "Healthcheck disabled"
|
||||||
exit 0
|
exit 0
|
||||||
elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
|
elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
|
||||||
echo "Java process suspended by Autopause function"
|
echo "Java process suspended by Autopause function"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
|
|||||||
4
start
4
start
@@ -5,7 +5,7 @@
|
|||||||
umask 0002
|
umask 0002
|
||||||
chmod g+w /data
|
chmod g+w /data
|
||||||
|
|
||||||
if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then
|
if [ $(id -u) = 0 ]; then
|
||||||
runAsUser=minecraft
|
runAsUser=minecraft
|
||||||
runAsGroup=minecraft
|
runAsGroup=minecraft
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then
|
|||||||
echo 'hosts: files dns' > /etc/nsswitch.conf
|
echo 'hosts: files dns' > /etc/nsswitch.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
|
exec su-exec ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
|
||||||
else
|
else
|
||||||
exec ${SCRIPTS:-/}start-configuration $@
|
exec ${SCRIPTS:-/}start-configuration $@
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ shopt -s nullglob
|
|||||||
#umask 002
|
#umask 002
|
||||||
export HOME=/data
|
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 [ ! -e /data/eula.txt ]; then
|
||||||
if ! isTrue "$EULA"; then
|
if ! isTrue "$EULA"; then
|
||||||
log ""
|
log ""
|
||||||
@@ -30,6 +28,15 @@ if [ ! -e /data/eula.txt ]; then
|
|||||||
fi
|
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
|
if [[ $PROXY ]]; then
|
||||||
export http_proxy="$PROXY"
|
export http_proxy="$PROXY"
|
||||||
export https_proxy="$PROXY"
|
export https_proxy="$PROXY"
|
||||||
@@ -56,7 +63,7 @@ fi
|
|||||||
|
|
||||||
if ! which java > /dev/null; then
|
if ! which java > /dev/null; then
|
||||||
log "Fixing PATH to include java"
|
log "Fixing PATH to include java"
|
||||||
PATH="${PATH}:/opt/java/openjdk/bin"
|
PATH="${PATH}:/usr/bin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
||||||
@@ -98,12 +105,6 @@ case "${TYPE^^}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
FORGE)
|
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 "$@"
|
exec ${SCRIPTS:-/}start-deployForge "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -111,17 +112,7 @@ case "${TYPE^^}" in
|
|||||||
exec ${SCRIPTS:-/}start-deployFabric "$@"
|
exec ${SCRIPTS:-/}start-deployFabric "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
FTBA)
|
|
||||||
exec ${SCRIPTS:-/}start-deployFTBA "$@"
|
|
||||||
;;
|
|
||||||
|
|
||||||
FTB|CURSEFORGE)
|
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 "**********************************************************************"
|
|
||||||
exec ${SCRIPTS:-/}start-deployCF "$@"
|
exec ${SCRIPTS:-/}start-deployCF "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -160,16 +151,12 @@ case "${TYPE^^}" in
|
|||||||
YATOPIA)
|
YATOPIA)
|
||||||
exec ${SCRIPTS:-/}start-deployYatopia "$@"
|
exec ${SCRIPTS:-/}start-deployYatopia "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
AIRPLANE)
|
|
||||||
exec ${SCRIPTS:-/}start-deployAirplane "$@"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
log "Invalid type: '$TYPE'"
|
log "Invalid type: '$TYPE'"
|
||||||
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
||||||
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA, TUINITY, PURPUR"
|
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA, TUINITY, PURPUR"
|
||||||
log " CUSTOM, MAGMA, MOHIST, CATSERVER, YATOPIA, AIRPLANE"
|
log " CUSTOM, MAGMA, MOHIST, CATSERVER, YATOPIA"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -euo pipefail
|
|
||||||
IFS=$'\n\t'
|
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
|
||||||
isDebugging && set -x
|
|
||||||
|
|
||||||
JAVA_VER=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
|
|
||||||
|
|
||||||
if [ "${JAVA_VER}" != "8" ] && [ "${JAVA_VER}" != "11" ]; then
|
|
||||||
log "ERROR: Airplane server type only supports Java versions 8 and 11"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${VERSION}" != "LATEST" ]; then
|
|
||||||
log "ERROR: Airplane server type only supports VERSION=LATEST"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
export SERVER=airplane-${VANILLA_VERSION}-jdk${JAVA_VER}.jar
|
|
||||||
|
|
||||||
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
|
||||||
downloadUrl="https://dl.airplane.gg/latest/Airplane-JDK${JAVA_VER}/launcher-airplane.jar"
|
|
||||||
log "Downloading Airplane from $downloadUrl ..."
|
|
||||||
curl -fsSL -o "$SERVER" "$downloadUrl"
|
|
||||||
if [ ! -f "$SERVER" ]; then
|
|
||||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Normalize on Spigot for later operations
|
|
||||||
export TYPE=SPIGOT
|
|
||||||
export SKIP_LOG4J_CONFIG=true
|
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-spiget "$@"
|
|
||||||
@@ -27,7 +27,7 @@ isDebugging && set -x
|
|||||||
export FTB_BASE_DIR
|
export FTB_BASE_DIR
|
||||||
|
|
||||||
legacyJavaFixerUrl=https://ftb.forgecdn.net/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
|
legacyJavaFixerUrl=https://ftb.forgecdn.net/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
|
||||||
export TYPE=CURSEFORGE
|
export TYPE=FEED-THE-BEAST
|
||||||
|
|
||||||
FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
|
FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
|
||||||
|
|
||||||
@@ -167,16 +167,6 @@ if [[ $startScriptCount = 0 ]]; then
|
|||||||
log "Unpacking FTB server modpack ${srv_modpack} ..."
|
log "Unpacking FTB server modpack ${srv_modpack} ..."
|
||||||
mkdir -p ${FTB_BASE_DIR}
|
mkdir -p ${FTB_BASE_DIR}
|
||||||
unzip -o "${srv_modpack}" -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
unzip -o "${srv_modpack}" -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
||||||
|
|
||||||
installScript=$(find "${FTB_BASE_DIR}" -maxdepth 2 -type f -name install.sh)
|
|
||||||
if [[ "$installScript" ]]; then
|
|
||||||
(
|
|
||||||
cd "$(dirname "${installScript}")"
|
|
||||||
chmod +x ./install.sh
|
|
||||||
log "Running included install.sh"
|
|
||||||
./install.sh
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
#!/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 $@
|
|
||||||
@@ -34,4 +34,5 @@ fi
|
|||||||
export TYPE=SPIGOT
|
export TYPE=SPIGOT
|
||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-spiget "$@"
|
# Continue to Final Setup
|
||||||
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -23,4 +23,5 @@ fi
|
|||||||
# Normalize on Spigot for later operations
|
# Normalize on Spigot for later operations
|
||||||
export TYPE=SPIGOT
|
export TYPE=SPIGOT
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-spiget "$@"
|
# Continue to Final Setup
|
||||||
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ if isTrue "${REPLACE_ENV_VARIABLES}"; then
|
|||||||
$dirExcludes \
|
$dirExcludes \
|
||||||
-type f \
|
-type f \
|
||||||
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
||||||
-or -name "*.conf" -or -name "*.properties" -or -name "*.hjson" -or -name "*.json" \) \
|
-or -name "*.conf" -or -name "*.properties" \) \
|
||||||
$fileExcludes \
|
$fileExcludes \
|
||||||
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -21,12 +21,10 @@ if [ -d /plugins ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# If any modules have been provided, copy them over
|
# If any modules have been provided, copy them over
|
||||||
: ${COPY_MODS_DEST:="/data/mods"}
|
|
||||||
|
|
||||||
if [ -d /mods ]; then
|
if [ -d /mods ]; then
|
||||||
log "Copying any mods over..."
|
log "Copying any mods over..."
|
||||||
mkdir -p $COPY_MODS_DEST
|
mkdir -p /data/mods
|
||||||
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods/ $COPY_MODS_DEST
|
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
: ${COPY_CONFIG_DEST:="/data/config"}
|
: ${COPY_CONFIG_DEST:="/data/config"}
|
||||||
|
|||||||
@@ -38,16 +38,16 @@ if [ -n "$ICON" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if isTrue ${ENABLE_ROLLING_LOGS:-false}; then
|
if ! isTrue ${SKIP_LOG4J_CONFIG}; then
|
||||||
# Set up log configuration
|
# Set up log configuration
|
||||||
LOGFILE="/data/log4j2.xml"
|
LOGFILE="/data/log4j2.xml"
|
||||||
if [ ! -e "$LOGFILE" ]; then
|
if [ ! -e "$LOGFILE" ]; then
|
||||||
log "Creating log4j2.xml in ${LOGFILE}"
|
log "Creating log4j2.xml in ${LOGFILE}"
|
||||||
cp /tmp/log4j2.xml "$LOGFILE"
|
cp /tmp/log4j2.xml "$LOGFILE"
|
||||||
else
|
else
|
||||||
log "log4j2.xml already created, skipping"
|
log "log4j2.xml already created, skipping"
|
||||||
fi
|
fi
|
||||||
JVM_OPTS="-Dlog4j.configurationFile=/data/log4j2.xml ${JVM_OPTS}"
|
JVM_OPTS="-Dlog4j.configurationFile=/data/log4j2.xml ${JVM_OPTS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
||||||
@@ -144,13 +144,6 @@ if isTrue "${USE_LARGE_PAGES}"; then
|
|||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if isTrue "${USE_FLARE_FLAGS}"; then
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
|
||||||
-XX:+UnlockDiagnosticVMOptions
|
|
||||||
-XX:+DebugNonSafepoints
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isTrue "${DEBUG_MEMORY}"; then
|
if isTrue "${DEBUG_MEMORY}"; then
|
||||||
log "Memory usage and availability (in MB)"
|
log "Memory usage and availability (in MB)"
|
||||||
uname -a
|
uname -a
|
||||||
@@ -180,7 +173,7 @@ if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
|||||||
exec mc-server-runner ${mcServerRunnerArgs} \
|
exec mc-server-runner ${mcServerRunnerArgs} \
|
||||||
--cf-instance-file "${CURSE_INSTANCE_JSON}" \
|
--cf-instance-file "${CURSE_INSTANCE_JSON}" \
|
||||||
java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar _SERVERJAR_ "$@" $EXTRA_ARGS
|
java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar _SERVERJAR_ "$@" $EXTRA_ARGS
|
||||||
elif [[ ${TYPE} == "CURSEFORGE" && "${SERVER}" ]]; then
|
elif [[ ${TYPE} == "FEED-THE-BEAST" && "${SERVER}" ]]; then
|
||||||
copyFilesForCurseForge
|
copyFilesForCurseForge
|
||||||
|
|
||||||
cd "${FTB_DIR}"
|
cd "${FTB_DIR}"
|
||||||
@@ -189,7 +182,7 @@ elif [[ ${TYPE} == "CURSEFORGE" && "${SERVER}" ]]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar $(basename "${SERVER}") "$@" $EXTRA_ARGS
|
exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar $(basename "${SERVER}") "$@" $EXTRA_ARGS
|
||||||
elif [[ ${TYPE} == "CURSEFORGE" ]]; then
|
elif [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
|
||||||
mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash"
|
mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash"
|
||||||
|
|
||||||
copyFilesForCurseForge
|
copyFilesForCurseForge
|
||||||
@@ -207,19 +200,10 @@ EOF
|
|||||||
|
|
||||||
cd "${FTB_DIR}"
|
cd "${FTB_DIR}"
|
||||||
log "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
|
log "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
|
||||||
|
|
||||||
finalArgs=(
|
|
||||||
"${FTB_SERVER_START}"
|
|
||||||
)
|
|
||||||
|
|
||||||
if isTrue ${DEBUG_EXEC}; then
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
if isTrue ${EXEC_DIRECTLY:-false}; then
|
exec mc-server-runner ${mcServerRunnerArgs} "${FTB_SERVER_START}"
|
||||||
"${finalArgs[@]}"
|
|
||||||
else
|
|
||||||
exec mc-server-runner ${mcServerRunnerArgs} "${finalArgs[@]}"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
# If we have a bootstrap.txt file... feed that in to the server stdin
|
# If we have a bootstrap.txt file... feed that in to the server stdin
|
||||||
if [ -f /data/bootstrap.txt ]; then
|
if [ -f /data/bootstrap.txt ]; then
|
||||||
@@ -227,22 +211,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log "Starting the Minecraft server..."
|
log "Starting the Minecraft server..."
|
||||||
|
|
||||||
finalArgs=(
|
|
||||||
$JVM_XX_OPTS
|
|
||||||
$JVM_OPTS
|
|
||||||
$expandedDOpts
|
|
||||||
-jar $SERVER
|
|
||||||
"$@" $EXTRA_ARGS
|
|
||||||
)
|
|
||||||
|
|
||||||
if isTrue ${DEBUG_EXEC}; then
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar $SERVER "$@" $EXTRA_ARGS
|
||||||
if isTrue ${EXEC_DIRECTLY:-false}; then
|
|
||||||
exec java "${finalArgs[@]}"
|
|
||||||
else
|
|
||||||
exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java "${finalArgs[@]}"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user