Compare commits

..

7 Commits

Author SHA1 Message Date
Geoff Bourne
b5877f6208 Auto-merging via docker-versions-create 2021-06-05 17:54:18 -05:00
Geoff Bourne
d561c026c6 Auto-merging via docker-versions-create 2021-05-24 20:52:34 -05:00
Geoff Bourne
3cd3ca9d88 Merge branch 'master' into java16 2021-05-23 12:27:27 -05:00
Geoff Bourne
b9ef9a46b6 Merge from master 2021-05-22 13:47:15 -05:00
Geoff Bourne
275863f04c Auto-merging via docker-versions-create 2021-05-21 23:03:45 -05:00
Geoff Bourne
ae94a6be3a Auto-merging via docker-versions-create 2021-05-21 22:52:46 -05:00
Geoff Bourne
d08c6e2c46 ci: updated CACHE_NAME 2021-05-21 22:13:59 -05:00
26 changed files with 176 additions and 223 deletions

View File

@@ -23,8 +23,9 @@ on:
jobs:
docker-buildx:
if: github.repository == 'itzg/docker-minecraft-server'
runs-on: ubuntu-20.04
env:
CACHE_NAME: java16
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
@@ -38,8 +39,9 @@ jobs:
tags: |
type=ref,event=branch
type=ref,event=tag
type=edge,branch=master
flavor: |
latest=${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
latest=false
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
@@ -48,8 +50,9 @@ jobs:
uses: actions/cache@v2.1.6
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
key: ${{ runner.os }}-buildx-${{ env.CACHE_NAME }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ env.CACHE_NAME }}-
${{ runner.os }}-buildx-
- name: Set up QEMU
@@ -63,7 +66,7 @@ jobs:
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2.6.1
uses: docker/build-push-action@v2.5.0
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
@@ -72,16 +75,8 @@ jobs:
# ensure latest base image is used
pull: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
cache-to: type=local,dest=/tmp/.buildx-cache
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

View File

@@ -7,7 +7,6 @@ on:
- README.md
jobs:
generate:
if: github.repository == 'itzg/docker-minecraft-server'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:

View File

@@ -29,6 +29,8 @@ jobs:
needs:
- test
runs-on: ubuntu-20.04
env:
CACHE_NAME: java16
steps:
- uses: actions/checkout@v2.3.4
@@ -49,7 +51,9 @@ jobs:
fi
TAGS="${DOCKER_IMAGE}:${VERSION//\//-}"
echo ::set-output name=tags::${TAGS}
echo ::set-output name=cache_from::${TAGS}
echo ::set-output name=version::${VERSION//\//-}
echo ::set-output name=cache_version::${VERSION//\//-}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
@@ -58,8 +62,9 @@ jobs:
uses: actions/cache@v2.1.6
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
key: ${{ runner.os }}-buildx-${{ env.CACHE_NAME }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ env.CACHE_NAME }}-
${{ runner.os }}-buildx-
- name: Login to DockerHub
@@ -70,7 +75,7 @@ jobs:
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2.6.1
uses: docker/build-push-action@v2.5.0
with:
context: .
file: ./Dockerfile
@@ -81,7 +86,7 @@ jobs:
# tags determined by prep step
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
cache-to: type=local,dest=/tmp/.buildx-cache
labels: |
org.opencontainers.image.documentation=https://github.com/itzg/docker-minecraft-server
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
@@ -90,11 +95,3 @@ jobs:
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

View File

@@ -70,5 +70,5 @@ The multiarch images are built and published by [a Github action](https://github
The following git command can be used to provide the bulk of release notes content:
```shell script
git log --invert-grep --grep "^ci:" --grep "^misc:" --grep "^docs:" --grep "^build(deps)" --pretty="- %s" 1.1.0..1.2.0
git log --invert-grep --grep "^ci:" --grep "^misc:" --grep "^docs:" --pretty="- %s" 1.1.0..1.2.0
```

View File

@@ -1,29 +1,29 @@
FROM openjdk:8u212-jre-alpine
FROM adoptopenjdk:16-jre
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
RUN apk add --no-cache -U \
openssl \
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
imagemagick \
lsof \
su-exec \
shadow \
bash \
curl iputils wget \
gosu \
sudo \
net-tools \
curl wget \
git \
jq \
dos2unix \
mysql-client \
tzdata \
rsync \
nano \
sudo \
knock \
ttf-dejavu
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 +31,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 +69,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" \
@@ -84,5 +84,6 @@ RUN dos2unix /start* && chmod +x /start*
RUN dos2unix /health.sh && chmod +x /health.sh
RUN dos2unix /autopause/* && chmod +x /autopause/*.sh
ENTRYPOINT [ "/start" ]
HEALTHCHECK --start-period=1m CMD /health.sh

View File

@@ -119,7 +119,7 @@ By default, the container will download the latest version of the "vanilla" [Min
* [PVP Mode](#pvp-mode)
* [Level Type and Generator Settings](#level-type-and-generator-settings)
* [Custom Server Resource Pack](#custom-server-resource-pack)
* [Level / World Save Name](#level--world-save-name)
* [World Save Name](#world-save-name)
* [Online mode](#online-mode)
* [Allow flight](#allow-flight)
* [Other server property mappings](#other-server-property-mappings)
@@ -145,7 +145,7 @@ By default, the container will download the latest version of the "vanilla" [Min
* [Enabling Autopause](#enabling-autopause)
* [Running on RaspberryPi](#running-on-raspberrypi)
<!-- Added by: runner, at: Thu Jul 15 13:34:00 UTC 2021 -->
<!-- Added by: runner, at: Sun May 23 17:29:02 UTC 2021 -->
<!--te-->
@@ -212,7 +212,7 @@ When attached in this way you can stop the server, edit the configuration under
With Docker Compose, setting up a host attached directory is even easier since relative paths can be configured. For example, with the following `docker-compose.yml` Docker will automatically create/attach the relative directory `minecraft-data` to the container.
```yaml
version: "3"
version: "3.8"
services:
mc:
@@ -221,9 +221,6 @@ services:
- 25565:25565
environment:
EULA: "TRUE"
tty: true
stdin_open: true
restart: unless-stopped
volumes:
# attach a directory relative to the directory containing this compose file
- ./minecraft-data:/data
@@ -252,7 +249,7 @@ docker run -d -it --name mc-new -v mc:/data -p 25565:25565 -e EULA=TRUE -e MEMOR
## Versions
To use a different Minecraft version, pass the `VERSION` environment variable (case sensitive), which can have the value
To use a different Minecraft version, pass the `VERSION` environment variable, which can have the value
- LATEST (the default)
- SNAPSHOT
@@ -346,18 +343,20 @@ every time you want to create new Minecraft server, you can now use
`docker-compose.yml` file like the following:
```yml
version: "3"
version: "3.8"
services:
mc:
image: itzg/minecraft-server
ports:
- 25565:25565
environment:
EULA: "TRUE"
tty: true
stdin_open: true
restart: unless-stopped
minecraft-server:
image: itzg/minecraft-server
ports:
- "25565:25565"
environment:
EULA: "TRUE"
tty: true
stdin_open: true
restart: always
```
and in the same directory as that file run
@@ -451,16 +450,17 @@ An [Airplane](https://github.com/TECHNOVE/Airplane) server, which is a fork of T
-e TYPE=AIRPLANE
> NOTE: The `VERSION` variable is used to select an Airplane branch to download from. The available options are "LATEST" "1.17" "1.16" "PURPUR" and "PURPUR-1.16"
> **NOTE** only `VERSION=LATEST` is supported
> **NOTE** only Java 8 and 11 are supported
Extra variables:
- `AIRPLANE_BUILD=lastSuccessfulBuild` : set a specific Airplane build to use
- `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
A [Purpur](https://purpur.pl3x.net/) server, which is "a drop-in replacement for Paper servers designed for configurability, new fun and exciting gameplay features, and high performance built on top of Tuinity."
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".
-e TYPE=PURPUR
@@ -469,6 +469,7 @@ A [Purpur](https://purpur.pl3x.net/) server, which is "a drop-in replacement for
Extra variables:
- `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
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the [Flare](https://blog.airplane.gg/flare) profiler
### Running a Yatopia server
@@ -789,11 +790,10 @@ To whitelist players for your Minecraft server, pass the Minecraft usernames sep
If the `WHITELIST` environment variable is not used, any user can join your Minecraft server if it's publicly accessible.
> NOTE: When `WHITELIST` is used the server properties `white-list` and `whitelist` will automatically get set to `true`.
> NOTE: When `WHITELIST` is used the server property `white-list` will automatically get set to `true`.
> By default, the players in `WHITELIST` are **added** to the final `whitelist.json` file by the Minecraft server. If you set `OVERRIDE_WHITELIST` to "true" then the `whitelist.json` file will be recreated on each server startup.
Alternatively, you can set `ENABLE_WHITELIST=true` to only set the server properties `white-list` and `whitelist` without modifying the whitelist file. In this case the whitelist is solely managed using the `whitelist add` and `whitelist remove` commands.
### Op/Administrator Players
To add more "op" (aka adminstrator) users to your Minecraft server, pass the Minecraft usernames separated by commas via the `OPS` environment variable, such as
@@ -1009,18 +1009,16 @@ You can set a link to a custom resource pack and set it's checksum using the `RE
**NOTE:** `:` and `=` must be escaped using `\`. The checksum plain-text hexadecimal.
### Level / World Save Name
### World Save Name
You can either switch between world saves or run multiple containers with different saves by using the `LEVEL` option,
where the default is "world":
docker run -d -e LEVEL=bonus ...
> **NOTE:** if running multiple containers be sure to either specify a different `-v` host directory for each
**NOTE:** if running multiple containers be sure to either specify a different `-v` host directory for each
`LEVEL` in use or don't use `-v` and the container's filesystem will keep things encapsulated.
> **INFO** Refer to the [data directory](#data-directory) section for a visual description of where the `$LEVEL` directory is situated.
### Online mode
By default, server checks connecting players against Minecraft's account database. If you want to create an offline server or your server is not connected to the internet, you can disable the server to try connecting to minecraft.net to authenticate players with environment variable `ONLINE_MODE`, like this
@@ -1050,7 +1048,6 @@ Allows users to use flight on your server while in Survival mode, if they have a
| PREVENT_PROXY_CONNECTIONS | prevent-proxy-connections |
| USE_NATIVE_TRANSPORT | use-native-transport |
| ENFORCE_WHITELIST | enforce-whitelist |
| ENABLE_WHITELIST | white-list and whitelist |
## Miscellaneous Options
@@ -1213,19 +1210,13 @@ For some cases, if e.g. after removing mods, it could be necessary to startup mi
### Interactive and Color Console
If you would like to `docker attach` to the Minecraft server console with color and interactive capabilities, then add
If you would like to attach to the Minecraft server console with color and interactive capabilities, then add
```
-e EXEC_DIRECTLY=true
```
> **NOTES**
>
> This feature doesn't work via rcon, so you will need to `docker attach` to the container. Use the sequence Ctrl-P, Ctrl-Q to detach.
>
> This will bypass graceful server shutdown handling when using `docker stop`, so be sure the server console's `stop` command.
>
> Make to enable stdin and tty with `-it` when using `docker run` or `stdin_open: true` and `tty: true` when using docker compose.
> **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
@@ -1303,7 +1294,7 @@ disable that by passing `-e GUI=FALSE`.
### Stop Duration
When the container is signalled to stop, the Minecraft process wrapper will attempt to send a "stop" command via RCON or console and waits for the process to gracefully finish. By default it waits 60 seconds, but that duration can be configured by setting the environment variable `STOP_DURATION` to the number of seconds.
When the container is signalled to stop, the Minecraft process wrapper will attempt to send a "stop" command via RCON or console and waits for the process to gracefully finish. By defaul it waits 60 seconds, but that duration can be configured by setting the environment variable `STOP_DURATION` to the number of seconds.
## Autopause
@@ -1317,7 +1308,7 @@ Of course, even loaded chunks are not ticked when the process is stopped.
**You must greatly increase or disable max-tick-time watchdog functionality.** From the server's point of view, the pausing causes a single tick to take as long as the process is stopped, so the server watchdog might intervene after the process is continued, possibly forcing a container restart. To prevent this, ensure that the `max-tick-time` in the `server.properties` file is set to a very large value or -1 to disable it entirely, which is highly recommended. That can be set with `MAX_TICK_TIME` as described in [the section below](#max-tick-time).
> **NOTE:** Non-vanilla versions might have their own configuration file, you might have to disable their watchdogs separately. For PaperMC servers, you need to send the JVM flag `-Ddisable.watchdog=true`, this can be done with the docker env variable `-e JVM_DD_OPTS=disable.watchdog:true`
> **NOTE:** Non-vanilla versions might have their own configuration file, you might have to disable their watchdogs separately (e.g. PAPER Servers).
On startup the `server.properties` file is checked and, if applicable, a warning is printed to the terminal. When the server is created (no data available in the persistent directory), the properties file is created with the Watchdog disabled.

View File

@@ -1,15 +0,0 @@
version: "3"
services:
mc:
image: ${IMAGE:-itzg/minecraft-server}
environment:
EULA: "true"
TYPE: FABRIC
ports:
- 25565:25565
volumes:
- fabric:/data
volumes:
fabric: {}

View File

@@ -1,17 +0,0 @@
version: "3"
services:
mc:
# Only using IMAGE variable to allow for local testing
image: ${IMAGE:-itzg/minecraft-server}
ports:
- 25565:25565
environment:
EULA: "TRUE"
TYPE: SPIGOT
SPIGET_RESOURCES: 9089,34315,3836
volumes:
- data:/data
volumes:
data: {}

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

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

@@ -56,7 +56,7 @@ fi
if ! which java > /dev/null; then
log "Fixing PATH to include java"
PATH="${PATH}:/usr/bin"
PATH="${PATH}:/opt/java/openjdk/bin"
fi
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
@@ -98,6 +98,12 @@ 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 "$@"
;;
@@ -105,7 +111,17 @@ case "${TYPE^^}" in
exec ${SCRIPTS:-/}start-deployFabric "$@"
;;
FTBA)
exec ${SCRIPTS:-/}start-deployFTBA "$@"
;;
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 "$@"
;;

View File

@@ -5,35 +5,22 @@ IFS=$'\n\t'
. ${SCRIPTS:-/}start-utils
isDebugging && set -x
if [ "${VERSION}" != "LATEST" ] && [ "${VERSION}" != "1.16" ] && [ "${VERSION}" != "1.17" ] && [ "${VERSION}" != "PURPUR" ] && [ "${VERSION}" != "PURPUR-1.16" ] ; then
log "ERROR: Airplane server type only supports VERSION=LATEST, VERSION=1.17, VERSION=1.16, VERSION=PURPUR or VERSION=PURPUR-1.16. Note that these are branches, not #.#.# versions."
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
: ${AIRPLANE_BUILD:=lastSuccessfulBuild}
if [ "${VERSION}" = "LATEST" ] || [ "${VERSION}" = "1.17" ]; then
AIRPLANE_BRANCH="1.17"
if [ "${VERSION}" != "LATEST" ]; then
log "ERROR: Airplane server type only supports VERSION=LATEST"
exit 1
fi
if [ "${VERSION}" = "1.16" ]; then
AIRPLANE_BRANCH="1.16"
fi
export SERVER=airplane-${VANILLA_VERSION}-jdk${JAVA_VER}.jar
if [ "${VERSION}" = "PURPUR" ]; then
AIRPLANE_BRANCH="Purpur-1.17"
fi
if [ "${VERSION}" = "PURPUR-1.16" ]; then
AIRPLANE_BRANCH="Purpur-1.16"
fi
log "Using Airplane-${AIRPLANE_BRANCH} branch"
export SERVER=airplane-${AIRPLANE_BRANCH}-${AIRPLANE_BUILD}.jar
if [ ! -f "$SERVER" ] || isTrue "${FORCE_REDOWNLOAD:-false}"; then
downloadUrl="https://ci.tivy.ca/job/Airplane-${AIRPLANE_BRANCH}/${AIRPLANE_BUILD}/artifact/launcher-airplane.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

View File

@@ -64,11 +64,7 @@ function downloadSpigot {
fi
if [[ -z $downloadUrl ]]; then
if versionLessThan 1.16.5; then
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar"
else
downloadUrl="https://download.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar"
fi
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar"
fi
setServerVar

View File

@@ -84,8 +84,6 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
exit 2
fi
forgeInstallerJar=$(ls -t "${forgeInstallerJar}" | head -1)
log "Installing forge server"
dirOfInstaller=$(dirname "${forgeInstallerJar}")
(cd "${dirOfInstaller}"; java -jar $(basename "${forgeInstallerJar}") --installServer)

View File

@@ -52,14 +52,12 @@ fi
isDebugging && cat version.json
forgeVersion=$(jq -r '.targets|unique[] | select(.name == "forge") | .version' version.json)
fabricVersion=$(jq -r '.targets|unique[] | select(.name == "fabric") | .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
fabric-${mcVersion}-${fabricVersion}-server-launch.jar
)
for f in ${variants[@]}; do
if [ -f $f ]; then
@@ -68,7 +66,7 @@ for f in ${variants[@]}; do
fi
done
if ! [ -v SERVER ]; then
log "ERROR unable to locate the installed FTB server jar"
log "ERROR unable to locate the installed forge server jar"
ls *.jar
exit 2
fi

View File

@@ -3,43 +3,54 @@ set -eu
. ${SCRIPTS:-/}start-utils
requireVar VANILLA_VERSION
export TYPE=FABRIC
export SERVER=fabric-server-${VANILLA_VERSION}.jar
isDebugging && set -x
if [[ ! -e ${SERVER} ]]; then
: ${FABRIC_INSTALLER:=}
: ${FABRIC_INSTALLER_URL:=}
: ${FABRIC_INSTALLER_VERSION:=${FABRICVERSION:-LATEST}}
if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then
log "Checking Fabric version information."
if [[ ${FABRIC_INSTALLER_VERSION^^} = LATEST ]]; then
FABRIC_INSTALLER=${FABRIC_INSTALLER:-}
FABRIC_INSTALLER_URL=${FABRIC_INSTALLER_URL:-}
FABRIC_INSTALLER_VERSION=${FABRIC_INSTALLER_VERSION:-${FABRICVERSION:-LATEST}}
if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then
log "Checking Fabric version information."
case $FABRIC_INSTALLER_VERSION in
LATEST)
FABRIC_INSTALLER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
fi
;;
esac
FABRIC_INSTALLER="fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
FABRIC_INSTALLER_URL="https://maven.fabricmc.net/net/fabricmc/fabric-installer/${FABRIC_INSTALLER_VERSION}/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
elif [[ -z $FABRIC_INSTALLER ]]; then
FABRIC_INSTALLER="fabric-installer.jar"
elif [[ ! -e $FABRIC_INSTALLER ]]; then
log "ERROR: the given Fabric installer doesn't exist : $FABRIC_INSTALLER"
exit 2
fi
FABRIC_INSTALLER="/tmp/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
markerVersion=$FABRIC_INSTALLER_VERSION
elif [[ -z $FABRIC_INSTALLER ]]; then
FABRIC_INSTALLER="/tmp/fabric-installer.jar"
markerVersion=custom
elif [[ ! -e $FABRIC_INSTALLER ]]; then
log "ERROR: the given Fabric installer doesn't exist : $FABRIC_INSTALLER"
exit 2
fi
installMarker="/data/.fabric-installed-${VANILLA_VERSION}-${markerVersion}"
debug Checking for installMarker ${installMarker}
if [[ ! -e $installMarker ]]; then
if [[ ! -e $FABRIC_INSTALLER ]]; then
log "Downloading $FABRIC_INSTALLER_URL ..."
if ! curl -o $FABRIC_INSTALLER -fsSL $FABRIC_INSTALLER_URL; then
log "Failed to download from given location $FABRIC_INSTALLER_URL"
exit 2
if [[ -z $FABRIC_INSTALLER_URL ]]; then
log "Downloading installer version $FABRIC_INSTALLER_VERSION"
downloadUrl="https://maven.fabricmc.net/net/fabricmc/fabric-installer/${FABRIC_INSTALLER_VERSION}/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
log "...trying $downloadUrl"
curl -o $FABRIC_INSTALLER -fsSL $downloadUrl
else
log "Downloading $FABRIC_INSTALLER_URL ..."
if ! curl -o $FABRIC_INSTALLER -fsSL $FABRIC_INSTALLER_URL; then
log "Failed to download from given location $FABRIC_INSTALLER_URL"
exit 2
fi
fi
fi
log "Installing Fabric ${VANILLA_VERSION} using $FABRIC_INSTALLER"
if isDebugging; then
debug "Installing Fabric ${VANILLA_VERSION} using $FABRIC_INSTALLER"
else
log "Installing Fabric using $FABRIC_INSTALLER"
fi
tries=3
set +e
while ((--tries >= 0)); do
@@ -56,9 +67,13 @@ if [[ ! -e ${SERVER} ]]; then
log "Fabric failed to install after several tries." >&2
exit 10
fi
export SERVER=fabric-server-launch.jar
log "Using server $SERVER"
echo $SERVER > $installMarker
mv fabric-server-launch.jar ${SERVER}
else
export SERVER=$(< $installMarker)
fi
# Continue to Final Setup
# Contineut to Final Setup
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@@ -10,7 +10,7 @@ isDebugging && set -x
: ${FORCE_REDOWNLOAD:=false}
if [[ ${PURPUR_BUILD} == LATEST ]]; then
PURPUR_BUILD=$(curl -fsSL "https://api.pl3x.net/v2/purpur/${VANILLA_VERSION}" |
PURPUR_BUILD=$(curl -fsSL "https://purpur.pl3x.net/api/v1/purpur/${VANILLA_VERSION}" |
jq -r '.builds.latest' || echo "")
if [[ -z ${PURPUR_BUILD} ]]; then
log "ERROR: Failed to locate a Purpur build for ${VANILLA_VERSION}."
@@ -22,7 +22,7 @@ fi
export SERVER="purpur-${VANILLA_VERSION}-${PURPUR_BUILD}.jar"
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
downloadUrl="https://api.pl3x.net/v2/purpur/${VANILLA_VERSION}/${PURPUR_BUILD}/download"
downloadUrl="https://purpur.pl3x.net/api/v1/purpur/${VANILLA_VERSION}/${PURPUR_BUILD}/download"
log "Downloading Purpur from $downloadUrl ..."
if ! curl -fsSL -o "$SERVER" "$downloadUrl"; then
log "ERROR: failed to download from $downloadUrl (status=$?)"

View File

@@ -3,16 +3,16 @@
. ${SCRIPTS:-/}start-utils
if [ "${VERSION}" != "LATEST" ]; then
log "ERROR: Tuinity server type only supports VERSION=LATEST"
log "ERROR: Tunity server type only supports VERSION=LATEST"
exit 1
fi
: ${TUINITY_BUILD:=lastSuccessfulBuild}
export SERVER=tuinity-${VANILLA_VERSION}-${TUINITY_BUILD}.jar
: ${TUNITY_BUILD:=lastSuccessfulBuild}
export SERVER=tunity-${VANILLA_VERSION}-${TUNITY_BUILD}.jar
if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
downloadUrl="https://ci.codemc.io/job/Spottedleaf/job/Tuinity/${TUINITY_BUILD}/artifact/tuinity-paperclip.jar"
log "Downloading Tuinity (build $TUINITY_BUILD) from $downloadUrl ..."
downloadUrl="https://ci.codemc.io/job/Spottedleaf/job/Tuinity/${TUNITY_BUILD}/artifact/tuinity-paperclip.jar"
log "Downloading Tunity (build $TUNITY_BUILD) from $downloadUrl ..."
curl -fsSL -o "$SERVER" "$downloadUrl"
if [ ! -f "$SERVER" ]; then
log "ERROR: failed to download from $downloadUrl (status=$?)"

View File

@@ -6,7 +6,7 @@ IFS=$'\n\t'
isDebugging && set -x
: ${VANILLA_VERSION:?}
: ${RELEASE:=latest}
: ${RELEASE:=stable}
: ${FORCE_REDOWNLOAD:=false}
requireEnum RELEASE stable latest

View File

@@ -25,16 +25,16 @@ fi
if [ -d /mods ]; then
log "Copying any mods over..."
mkdir -p "${COPY_MODS_DEST}"
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods/ "${COPY_MODS_DEST}"
mkdir -p $COPY_MODS_DEST
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods/ $COPY_MODS_DEST
fi
: ${COPY_CONFIG_DEST:="/data/config"}
if [ -d /config ]; then
log "Copying any configs from /config to ${COPY_CONFIG_DEST}"
mkdir -p "${COPY_CONFIG_DEST}"
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /config/ "${COPY_CONFIG_DEST}"
log "Copying any configs from /config to $COPY_CONFIG_DEST"
mkdir -p $COPY_CONFIG_DEST
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /config/ $COPY_CONFIG_DEST
fi
exec ${SCRIPTS:-/}start-finalSetupServerProperties $@

View File

@@ -19,7 +19,7 @@ function setServerProp {
sed -i "/^${prop}\s*=/ c ${prop}=${var//\\/\\\\}" "$SERVER_PROPERTIES"
else
log "Adding ${prop} with '${var}' in ${SERVER_PROPERTIES}"
echo "${prop}=${var}" >> "$SERVER_PROPERTIES"
echo "${prop}=${var//\\/\\\\}" >> "$SERVER_PROPERTIES"
fi
else
isDebugging && log "Skip setting ${prop}"
@@ -27,7 +27,7 @@ function setServerProp {
}
function customizeServerProps {
if [ -n "$WHITELIST" ] || isTrue ${ENABLE_WHITELIST:-false}; then
if [ -n "$WHITELIST" ]; then
log "Creating whitelist"
setServerProp "whitelist" "true"
setServerProp "white-list" "true"

View File

@@ -26,28 +26,21 @@ getResourceFromSpiget() {
log "Downloading resource ${resource} ..."
tmpfile="/tmp/${resource}.zip"
url="https://api.spiget.org/v2/resources/${resource}/download"
if ! curl -o "${tmpfile}" -fsSL -H "User-Agent: itzg/minecraft-server" "${extraCurlArgs[@]}" "${url}"; then
log "ERROR failed to download resource '${resource}' from ${url}"
exit 2
fi
mkdir -p /data/plugins
if [ -f /data/plugins/.${resource} ]; then
log "Resource '${resource}' already downloaded"
if containsJars "${tmpfile}"; then
log "Extracting contents of resource ${resource} into plugins"
unzip -o -q -d /data/plugins "${tmpfile}"
rm "${tmpfile}"
else
tmpfile="/tmp/${resource}.zip"
url="https://api.spiget.org/v2/resources/${resource}/download"
if ! curl -o "${tmpfile}" -fsSL -H "User-Agent: itzg/minecraft-server" "${extraCurlArgs[@]}" "${url}"; then
log "ERROR failed to download resource '${resource}' from ${url}"
exit 2
fi
if containsJars "${tmpfile}"; then
log "Extracting contents of resource ${resource} into plugins"
unzip -o -q -d /data/plugins "${tmpfile}"
touch "/data/plugins/.${resource}"
rm "${tmpfile}"
else
log "Moving resource ${resource} into plugins"
mv "${tmpfile}" "/data/plugins/${resource}.jar"
touch "/data/plugins/.${resource}"
fi
log "Moving resource ${resource} into plugins"
mv "${tmpfile}" "/data/plugins/${resource}.jar"
fi
}

View File

@@ -17,5 +17,4 @@ services:
- itzg/minecraft-server:latest
environment:
EULA: "TRUE"
VERSION: "1.16.5"