mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-17 15:13:55 +00:00
Compare commits
84 Commits
2021.17.0-
...
2021.20.0-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0122b74815 | ||
|
|
1f2f33d6c0 | ||
|
|
1a3c454d7f | ||
|
|
fa11d313fb | ||
|
|
20bc2a97d9 | ||
|
|
1b4f26d2e8 | ||
|
|
0cd49c4c81 | ||
|
|
6c1cd2537d | ||
|
|
cf31f24752 | ||
|
|
27523a1c45 | ||
|
|
e1d0fe6b92 | ||
|
|
d3f4a4991e | ||
|
|
296ddbdec5 | ||
|
|
f7cd34b8d8 | ||
|
|
7bafffbd06 | ||
|
|
201ec3be5a | ||
|
|
7d1d5af097 | ||
|
|
f9ce5bce4d | ||
|
|
748768c771 | ||
|
|
f307077636 | ||
|
|
5bf6013d6b | ||
|
|
179cd878a9 | ||
|
|
788548d1f4 | ||
|
|
0ae15c2b3c | ||
|
|
b5b4257032 | ||
|
|
657db124b2 | ||
|
|
f5ea43b3d3 | ||
|
|
01747510d5 | ||
|
|
ff8b160a2b | ||
|
|
28b7afda15 | ||
|
|
ecd253dd3e | ||
|
|
428a7c1875 | ||
|
|
8d0dbcd50e | ||
|
|
3ba8889194 | ||
|
|
327f21f1bb | ||
|
|
c96d6b2958 | ||
|
|
c144da4485 | ||
|
|
da8fb37317 | ||
|
|
4d7e29cb3a | ||
|
|
2a1f5b7500 | ||
|
|
17099320e9 | ||
|
|
f3dbb4dd2d | ||
|
|
1725a6ed14 | ||
|
|
b3b3cdde08 | ||
|
|
8ab55e1ef3 | ||
|
|
b8cd510a0e | ||
|
|
0d5eb2ea9e | ||
|
|
32a5ab5138 | ||
|
|
2b0fd2e5c0 | ||
|
|
4168821ec4 | ||
|
|
6353488db7 | ||
|
|
b446d4cc3f | ||
|
|
fb97af317e | ||
|
|
16b2762025 | ||
|
|
fe758aab61 | ||
|
|
c5a3e2e376 | ||
|
|
4c2868f6c9 | ||
|
|
919aff0080 | ||
|
|
8504cf7caf | ||
|
|
101a7486f2 | ||
|
|
80e576db2d | ||
|
|
3a73e47b83 | ||
|
|
62824051c8 | ||
|
|
c4a2403943 | ||
|
|
2aad0a9407 | ||
|
|
6ead8c3cf0 | ||
|
|
3a18a19583 | ||
|
|
f620b09134 | ||
|
|
2838251c67 | ||
|
|
f7cff34527 | ||
|
|
acdf8c35fa | ||
|
|
c5f2bf1059 | ||
|
|
1f25fae04f | ||
|
|
caffa2fd8d | ||
|
|
8de8eb3104 | ||
|
|
2d3fa3c09e | ||
|
|
f7b3c77f78 | ||
|
|
d968048ef5 | ||
|
|
6d26ca04be | ||
|
|
577eef3631 | ||
|
|
21d7fb476b | ||
|
|
4c3a329e31 | ||
|
|
6c94e49732 | ||
|
|
af77b29509 |
5
.github/FUNDING.yml
vendored
Normal file
5
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
custom:
|
||||
- https://www.buymeacoffee.com/itzg
|
||||
- https://paypal.me/itzg
|
||||
4
.github/workflows/build-multiarch.yml
vendored
4
.github/workflows/build-multiarch.yml
vendored
@@ -63,10 +63,10 @@ jobs:
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2.6.1
|
||||
uses: docker/build-push-action@v2.7.0
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
platforms: linux/amd64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
# ensure latest base image is used
|
||||
|
||||
2
.github/workflows/generate-toc.yml
vendored
2
.github/workflows/generate-toc.yml
vendored
@@ -16,6 +16,6 @@ jobs:
|
||||
curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc
|
||||
chmod a+x gh-md-toc
|
||||
./gh-md-toc --insert --no-backup README.md
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.11.0
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.12.0
|
||||
with:
|
||||
commit_message: "docs: Auto update markdown TOC"
|
||||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -70,7 +70,7 @@ jobs:
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2.6.1
|
||||
uses: docker/build-push-action@v2.7.0
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
46
Dockerfile
46
Dockerfile
@@ -1,29 +1,30 @@
|
||||
FROM openjdk:8u212-jre-alpine
|
||||
FROM adoptopenjdk:11-jre-openj9
|
||||
|
||||
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 \
|
||||
iputils-ping \
|
||||
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 +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
|
||||
@@ -52,13 +53,17 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||
|
||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
--var version=1.5.0 --var app=mc-server-runner --file {{.app}} \
|
||||
--var version=1.7.0 --var app=mc-server-runner --file {{.app}} \
|
||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||
|
||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
--var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \
|
||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||
|
||||
ARG ASCIIFY_VERSION=1.0.1
|
||||
ADD https://jitpack.io/com/github/itzg/asciify/${ASCIIFY_VERSION}/asciify-${ASCIIFY_VERSION}.jar /usr/share/asciify/asciify.jar
|
||||
RUN chmod -R a+r /usr/share/asciify
|
||||
|
||||
COPY mcstatus /usr/local/bin
|
||||
|
||||
VOLUME ["/data"]
|
||||
@@ -69,7 +74,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 +89,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
|
||||
|
||||
103
README.md
103
README.md
@@ -13,30 +13,11 @@ To simply use the latest stable version, run
|
||||
|
||||
docker run -d -it -p 25565:25565 -e EULA=TRUE itzg/minecraft-server
|
||||
|
||||
where the standard server port, 25565, will be exposed on your host machine.
|
||||
where, in this case, the standard server port 25565, will be exposed on your host machine.
|
||||
|
||||
If you want to serve up multiple Minecraft servers or just use an alternate port,
|
||||
change the host-side port mapping such as
|
||||
> If you plan on running a server for a longer amount of time it is highly recommended using a management layer such as [Docker Compose](#using-docker-compose) or [Kubernetes](#deployment-templates-and-examples) to allow for incremental reconfiguration and image upgrades.
|
||||
|
||||
... -p 25566:25565 ...
|
||||
|
||||
will serve your Minecraft server on your host's port 25566 since the `-p` syntax is
|
||||
`host-port`:`container-port`.
|
||||
|
||||
Speaking of multiple servers, it's handy to give your containers explicit names using `--name`, such as naming this one "mc"
|
||||
|
||||
... --name mc itzg/minecraft-server
|
||||
|
||||
With that you can easily view the logs, stop, or re-start the container:
|
||||
|
||||
docker logs -f mc
|
||||
( Ctrl-C to exit logs action )
|
||||
|
||||
docker stop mc
|
||||
|
||||
docker start mc
|
||||
|
||||
> Be sure to always include `-e EULA=TRUE` in your commands, as Mojang/Microsoft requires EULA acceptance.
|
||||
> Be sure to always include `-e EULA=TRUE` in your commands and container definitions, as Mojang/Microsoft requires EULA acceptance.
|
||||
|
||||
By default, the container will download the latest version of the "vanilla" [Minecraft: Java Edition server](https://www.minecraft.net/en-us/download/server) provided by Mojang. The [`VERSION`](#versions) and the [`TYPE`](#server-types) can be configured to create many variations of desired Minecraft server.
|
||||
|
||||
@@ -57,6 +38,7 @@ By default, the container will download the latest version of the "vanilla" [Min
|
||||
* [Examples](#examples)
|
||||
* [Amazon Web Services (AWS) Deployment](#amazon-web-services-aws-deployment)
|
||||
* [Using Docker Compose](#using-docker-compose)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
* [Server types](#server-types)
|
||||
* [Running a Forge Server](#running-a-forge-server)
|
||||
* [Running a Bukkit/Spigot server](#running-a-bukkitspigot-server)
|
||||
@@ -71,13 +53,14 @@ By default, the container will download the latest version of the "vanilla" [Min
|
||||
* [Running an Canyon server](#running-an-canyon-server)
|
||||
* [Running a SpongeVanilla server](#running-a-spongevanilla-server)
|
||||
* [Running a Fabric Server](#running-a-fabric-server)
|
||||
* [Running a Limbo server](#running-a-limbo-server)
|
||||
* [Running a server with a Feed the Beast modpack](#running-a-server-with-a-feed-the-beast-modpack)
|
||||
* [Environment Variables:](#environment-variables)
|
||||
* [Upgrading](#upgrading)
|
||||
* [Example](#example)
|
||||
* [Running a server with a CurseForge modpack](#running-a-server-with-a-curseforge-modpack)
|
||||
* [Modpack data directory](#modpack-data-directory)
|
||||
* [Buggy start scripts](#buggy-start-scripts)
|
||||
* [Modpack data directory](#modpack-data-directory)
|
||||
* [Buggy start scripts](#buggy-start-scripts)
|
||||
* [Fixing "unable to launch forgemodloader"](#fixing-unable-to-launch-forgemodloader)
|
||||
* [Working with mods and plugins](#working-with-mods-and-plugins)
|
||||
* [Optional plugins, mods, and config attach points](#optional-plugins-mods-and-config-attach-points)
|
||||
@@ -131,21 +114,23 @@ By default, the container will download the latest version of the "vanilla" [Min
|
||||
* [Memory Limit](#memory-limit)
|
||||
* [JVM Options](#jvm-options)
|
||||
* [Interactive and Color Console](#interactive-and-color-console)
|
||||
* [Server Shutdown Options](#server-shutdown-options)
|
||||
* [OpenJ9 Specific Options](#openj9-specific-options)
|
||||
* [Enabling rolling logs](#enabling-rolling-logs)
|
||||
* [Timezone Configuration](#timezone-configuration)
|
||||
* [Timezone Configuration](#timezone-configuration)
|
||||
* [Enable Remote JMX for Profiling](#enable-remote-jmx-for-profiling)
|
||||
* [Enable Aikar's Flags](#enable-aikars-flags)
|
||||
* [HTTP Proxy](#http-proxy)
|
||||
* [Using "noconsole" option](#using-noconsole-option)
|
||||
* [Explicitly disable GUI](#explicitly-disable-gui)
|
||||
* [Stop Duration](#stop-duration)
|
||||
* [Setup only](#setup-only)
|
||||
* [Autopause](#autopause)
|
||||
* [Description](#description)
|
||||
* [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: Thu Sep 16 01:45:44 UTC 2021 -->
|
||||
|
||||
<!--te-->
|
||||
|
||||
@@ -287,9 +272,9 @@ To use a different version of Java, please use a docker tag to run your Minecraf
|
||||
| java16-openj9 | 16 | Debian | OpenJ9 | amd64 |
|
||||
| multiarch-latest | 15+ | Debian | Hotspot | amd64,arm64,armv7 |
|
||||
|
||||
For example, to use Java version 15 on any supported architecture:
|
||||
For example, to use Java version 16 on any supported architecture:
|
||||
|
||||
docker run --name mc itzg/minecraft-server:java15
|
||||
docker run --name mc itzg/minecraft-server:java16
|
||||
|
||||
> Keep in mind that some versions of Minecraft server can't work on the newest versions of Java. Also, FORGE doesn't support openj9 JVM implementation.
|
||||
|
||||
@@ -367,6 +352,14 @@ and in the same directory as that file run
|
||||
Now, go play...or adjust the `environment` section to configure
|
||||
this server instance.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
To troubleshoot the container initialization, such as when server files are pre-downloaded, set the environment variable `DEBUG` to `true`. The container logs will include **much more** output, and it is highly recommended including that output when reporting any [issues](https://github.com/itzg/docker-minecraft-server/issues).
|
||||
|
||||
To troubleshoot just the command-line used to start the Minecraft server, set the environment variable `DEBUG_EXEC` to `true`.
|
||||
|
||||
To troubleshoot any issues with memory allocation reported by the JVM, set the environment variable `DEBUG_MEMORY` to `true`.
|
||||
|
||||
## Server types
|
||||
|
||||
### Running a Forge Server
|
||||
@@ -489,7 +482,9 @@ A [Magma](https://magmafoundation.org/) server, which is a combination of Forge
|
||||
|
||||
-e TYPE=MAGMA
|
||||
|
||||
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
|
||||
By default, the "stable" channel is used, but you can set `MAGMA_CHANNEL` to "dev" to access dev channel versions.
|
||||
|
||||
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2", "1.16.5", etc.
|
||||
|
||||
|
||||
### Running a Mohist server
|
||||
@@ -569,6 +564,20 @@ docker run -d -v /path/on/host:/data ... \
|
||||
|
||||
In order to add mods, you have two options:
|
||||
|
||||
### Running a Limbo server
|
||||
|
||||
A [Limbo](https://github.com/LOOHP/Limbo) server can be run by setting `TYPE` to `LIMBO`.
|
||||
|
||||
Configuration options with defaults:
|
||||
|
||||
- `LIMBO_BUILD`=LATEST
|
||||
|
||||
The `VERSION` will be ignored so locate the appropriate value from [here](https://ci.loohpjames.com/job/Limbo/) to match the version expected by clients.
|
||||
|
||||
- `FORCE_REDOWNLOAD`=false
|
||||
- `LIMBO_SCHEMA_FILENAME`=default.schem
|
||||
- `LEVEL`="Default;${LIMBO_SCHEMA_FILENAME}"
|
||||
|
||||
## Running a server with a Feed the Beast modpack
|
||||
|
||||
> **NOTE** requires one of the Debian based images listed in [the Java versions section](#running-minecraft-server-on-different-java-version).
|
||||
@@ -620,13 +629,13 @@ The following example uses `/modpacks` as the container path as the pre-download
|
||||
-e CF_SERVER_MOD=/modpacks/SkyFactory_4_Server_4.1.0.zip \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||
|
||||
#### Modpack data directory
|
||||
### Modpack data directory
|
||||
|
||||
By default, CurseForge modpacks are expanded into the sub-directory `/data/FeedTheBeast` and executed from there. (The default location was chosen for legacy reasons, when Curse and FTB were maintained together.)
|
||||
|
||||
The directory can be changed by setting `CF_BASE_DIR`, such as `-e CF_BASE_DIR=/data`.
|
||||
|
||||
#### Buggy start scripts
|
||||
### Buggy start scripts
|
||||
|
||||
Some modpacks have buggy or overly complex start scripts. You can avoid using the bundled start script and use this image's standard server-starting logic by adding `-e USE_MODPACK_START_SCRIPT=false`.
|
||||
|
||||
@@ -737,6 +746,10 @@ read-only volume attachment to ensure the clone source remains pristine.
|
||||
docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic
|
||||
```
|
||||
|
||||
The following diagram shows how this option can be used in a compose deployment with a relative directory:
|
||||
|
||||

|
||||
|
||||
### Overwrite world on start
|
||||
The world will only be downloaded or copied if it doesn't exist already. Set `FORCE_WORLD_COPY=TRUE` to force overwrite the world on every server start.
|
||||
|
||||
@@ -815,7 +828,7 @@ The server icon which has been set doesn't get overridden by default. It can be
|
||||
|
||||
### Rcon
|
||||
|
||||
To use rcon use the `ENABLE_RCON` and `RCON_PASSORD` variables.
|
||||
To use rcon use the `ENABLE_RCON` and `RCON_PASSWORD` variables.
|
||||
By default rcon port will be `25575` but can easily be changed with the `RCON_PORT` variable.
|
||||
|
||||
docker run -d -e ENABLE_RCON=true -e RCON_PASSWORD=testing
|
||||
@@ -960,7 +973,7 @@ For example:
|
||||
|
||||
### Message of the Day
|
||||
|
||||
The message of the day, shown below each server entry in the UI, can be changed with the `MOTD` environment variable, such as
|
||||
The message of the day, shown below each server entry in the client UI, can be changed with the `MOTD` environment variable, such as
|
||||
|
||||
-e MOTD="My Server"
|
||||
|
||||
@@ -970,6 +983,14 @@ If you leave it off, a default is computed from the server type and version, suc
|
||||
|
||||
That way you can easily differentiate between several servers you may have started.
|
||||
|
||||
The section symbol (§) and other unicode characters are automatically converted to allow [formatting codes](https://minecraft.fandom.com/wiki/Formatting_codes) to be used consistently with all server versions. For example,
|
||||
|
||||
-e MOTD="A §l§cMinecraft§r §nserver"
|
||||
|
||||
renders
|
||||
|
||||

|
||||
|
||||
### PVP Mode
|
||||
|
||||
By default, servers are created with player-vs-player (PVP) mode enabled. You can disable this with the `PVP`
|
||||
@@ -1001,6 +1022,10 @@ For example (just the `-e` bits):
|
||||
|
||||
-e LEVEL_TYPE=flat -e 'GENERATOR_SETTINGS=3;minecraft:bedrock,3*minecraft:stone,52*minecraft:sandstone;2;'
|
||||
|
||||
In Minecraft 1.13+ you need to pass json ([generator site](https://misode.github.io/world/)) like this (details see [here](https://github.com/itzg/docker-minecraft-server/issues/999#issuecomment-907849644)):
|
||||
|
||||
-e LEVEL_TYPE=flat -e 'GENERATOR_SETTINGS={"biome":"minecraft:the_void","layers":[{"block":"minecraft:bedrock","height":1},{"block":"minecraft:stone","height":10},{"block":"minecraft:dirt","height":1}],"structures":{"structures":{}}}'
|
||||
|
||||
### Custom Server Resource Pack
|
||||
|
||||
You can set a link to a custom resource pack and set it's checksum using the `RESOURCE_PACK` and `RESOURCE_PACK_SHA1` options respectively, the default is blank:
|
||||
@@ -1227,6 +1252,12 @@ If you would like to `docker attach` to the Minecraft server console with color
|
||||
>
|
||||
> Make to enable stdin and tty with `-it` when using `docker run` or `stdin_open: true` and `tty: true` when using docker compose.
|
||||
|
||||
### Server Shutdown Options
|
||||
|
||||
To allow time for players to finish what they're doing during a graceful server shutdown, set `STOP_SERVER_ANNOUNCE_DELAY` to a number of seconds to delay after an announcement is posted by the server.
|
||||
|
||||
> **NOTE** be sure to adjust Docker's shutdown timeout accordingly, such as using [the -t option on docker-compose down](https://docs.docker.com/compose/reference/down/).
|
||||
|
||||
### OpenJ9 Specific Options
|
||||
|
||||
The openj9 image tags include specific variables to simplify configuration:
|
||||
@@ -1246,7 +1277,7 @@ By default the vanilla log file will grow without limit. The logger can be recon
|
||||
|
||||
> **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:
|
||||
|
||||
@@ -1305,6 +1336,10 @@ disable that by passing `-e GUI=FALSE`.
|
||||
|
||||
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.
|
||||
|
||||
### Setup only
|
||||
|
||||
If you are using a host-attached data directory, then you can have the image setup the Minecraft server files and stop prior to launching the server process by setting `SETUP_ONLY` to `true`.
|
||||
|
||||
## Autopause
|
||||
|
||||
### Description
|
||||
|
||||
BIN
docs/motd-example.png
Normal file
BIN
docs/motd-example.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 985 B |
27
examples/docker-compose-rlcraft.yml
Normal file
27
examples/docker-compose-rlcraft.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
rlcraft:
|
||||
image: itzg/minecraft-server:java8
|
||||
container_name: rlcraft
|
||||
volumes:
|
||||
- rlcraft-modpack:/modpacks:ro
|
||||
- rlcraft-data:/data
|
||||
environment:
|
||||
EULA: "true"
|
||||
TYPE: "FORGE"
|
||||
VERSION: "1.12.2"
|
||||
FORGEVERSION: "14.23.5.2855"
|
||||
DIFFICULTY: "hard"
|
||||
MAX_TICK_TIME: "-1"
|
||||
VIEW_DISTANCE: "6"
|
||||
ALLOW_FLIGHT: "true"
|
||||
MEMORY: "4G"
|
||||
GENERIC_PACK: "/modpacks/RLCraft_Server_Pack_1.12.2_Beta_v2.8.2.zip"
|
||||
ports:
|
||||
- 25565:25565
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
rlcraft-data:
|
||||
rlcraft-modpack:
|
||||
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
2
start
@@ -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
|
||||
|
||||
@@ -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 "$@"
|
||||
;;
|
||||
|
||||
@@ -153,11 +169,15 @@ case "${TYPE^^}" in
|
||||
exec ${SCRIPTS:-/}start-deployCanyon "$@"
|
||||
;;
|
||||
|
||||
LIMBO)
|
||||
exec ${SCRIPTS:-/}start-deployLimbo "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
log "Invalid type: '$TYPE'"
|
||||
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
||||
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA, TUINITY, PURPUR"
|
||||
log " CUSTOM, MAGMA, MOHIST, CATSERVER, YATOPIA, AIRPLANE, CANYON"
|
||||
log " CUSTOM, MAGMA, MOHIST, CATSERVER, YATOPIA, AIRPLANE, CANYON, LIMBO"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ if [ "${VERSION}" != "LATEST" ] && [ "${VERSION}" != "1.16" ] && [ "${VERSION}"
|
||||
fi
|
||||
|
||||
: ${AIRPLANE_BUILD:=lastSuccessfulBuild}
|
||||
: ${AIRPLANE_TYPE:=airplane}
|
||||
|
||||
if [ "${VERSION}" = "LATEST" ] || [ "${VERSION}" = "1.17" ]; then
|
||||
AIRPLANE_BRANCH="1.17"
|
||||
@@ -22,10 +23,12 @@ fi
|
||||
|
||||
if [ "${VERSION}" = "PURPUR" ]; then
|
||||
AIRPLANE_BRANCH="Purpur-1.17"
|
||||
AIRPLANE_TYPE="airplanepurpur"
|
||||
fi
|
||||
|
||||
if [ "${VERSION}" = "PURPUR-1.16" ]; then
|
||||
AIRPLANE_BRANCH="Purpur-1.16"
|
||||
AIRPLANE_TYPE="airplanepurpur"
|
||||
fi
|
||||
|
||||
log "Using Airplane-${AIRPLANE_BRANCH} branch"
|
||||
@@ -33,7 +36,7 @@ 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"
|
||||
downloadUrl="https://ci.tivy.ca/job/Airplane-${AIRPLANE_BRANCH}/${AIRPLANE_BUILD}/artifact/launcher-${AIRPLANE_TYPE}.jar"
|
||||
log "Downloading Airplane from $downloadUrl ..."
|
||||
curl -fsSL -o "$SERVER" "$downloadUrl"
|
||||
if [ ! -f "$SERVER" ]; then
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -30,7 +30,13 @@ if ! [ -f "${ftbInstallMarker}" ] || [ $(cat "${ftbInstallMarker}") != "${FTB_MO
|
||||
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}"
|
||||
if [ "$(uname -m)" == "aarch64" ]; then
|
||||
log "Downloading ARM installer"
|
||||
curl -fsSL https://api.modpacks.ch/public/modpack/1/1/server/arm/linux -o "${ftbInstaller}"
|
||||
else
|
||||
log "Downloading x86 installer"
|
||||
curl -fsSL https://api.modpacks.ch/public/modpack/1/1/server/linux -o "${ftbInstaller}"
|
||||
fi
|
||||
chmod +x "${ftbInstaller}"
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
export TYPE=FORGE
|
||||
: ${FORGEVERSION:=RECOMMENDED}
|
||||
isDebugging && set -x
|
||||
|
||||
@@ -47,7 +46,7 @@ elif [[ ! -e $FORGE_INSTALLER ]]; then
|
||||
log "ERROR: the given Forge installer doesn't exist : $FORGE_INSTALLER"
|
||||
exit 2
|
||||
else
|
||||
shortForgeVersion=$VANILLA_VERSION-custom
|
||||
shortForgeVersion=$VANILLA_VERSION-${FORGE_INSTALLER_CUSTOM_VERSION:-custom}
|
||||
fi
|
||||
|
||||
installMarker="/data/.forge-installed-$shortForgeVersion"
|
||||
|
||||
64
start-deployLimbo
Normal file
64
start-deployLimbo
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
isDebugging && set -x
|
||||
|
||||
: ${LIMBO_BUILD:=LATEST}
|
||||
: ${FORCE_REDOWNLOAD:=false}
|
||||
: ${LIMBO_SCHEMA_FILENAME:=default.schem}
|
||||
: ${LEVEL:=Default;${LIMBO_SCHEMA_FILENAME}}
|
||||
# defaults to localhost, if this is not set
|
||||
: ${SERVER_IP:=0.0.0.0}
|
||||
|
||||
export LEVEL SERVER_IP
|
||||
|
||||
if [[ ${LIMBO_BUILD^^} == LATEST ]]; then
|
||||
LIMBO_BUILD=lastStableBuild
|
||||
fi
|
||||
|
||||
baseUrl="https://ci.loohpjames.com/job/Limbo/${LIMBO_BUILD}"
|
||||
buildInfoUrl="${baseUrl}/api/json"
|
||||
buildJson=$(curl -fsSL "${buildInfoUrl}")
|
||||
if [ $? != 0 ]; then
|
||||
log "ERROR failed to get build info from ${buildInfoUrl} (status=$?)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ${LIMBO_BUILD} = lastStableBuild ]]; then
|
||||
LIMBO_BUILD=$(jq -r '.number' <<<${buildJson})
|
||||
log "Resolved latest Limbo build to ${LIMBO_BUILD}"
|
||||
fi
|
||||
artifactPath=$(jq -r '.artifacts[] | select(.fileName|test("^Limbo-")) | .relativePath' <<<${buildJson})
|
||||
defaultSchemaPath=$(jq -r '.artifacts[] | select(.fileName|test(".*\\.schem")) | .relativePath' <<<${buildJson})
|
||||
|
||||
export SERVER="limbo-${LIMBO_BUILD}.jar"
|
||||
|
||||
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
||||
downloadUrl="${baseUrl}/artifact/${artifactPath}"
|
||||
log "Downloading Limbo from $downloadUrl ..."
|
||||
if ! curl -fsSL -o "$SERVER" "$downloadUrl"; then
|
||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ ! -f "${LIMBO_SCHEMA_FILENAME}" ]; then
|
||||
log "Downloading default schem file"
|
||||
if ! curl -o "${LIMBO_SCHEMA_FILENAME}" -fsSL "${baseUrl}/artifact/${defaultSchemaPath}"; then
|
||||
log "ERROR: failed to download schema file $baseUrl (status=$?)"
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${LEVEL} != *\;* ]]; then
|
||||
LEVEL="${LEVEL};${LIMBO_SCHEMA_FILENAME}"
|
||||
fi
|
||||
export LEVEL
|
||||
|
||||
export SKIP_LOG4J_CONFIG=true
|
||||
|
||||
# Continue to Final Setup
|
||||
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||
@@ -1,18 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
export SKIP_LOG4J_CONFIG=true
|
||||
|
||||
export SERVER="/data/magma-server-${VANILLA_VERSION}.jar"
|
||||
isDebugging && set -x
|
||||
|
||||
# Always download since new updates of each base version are published frequently
|
||||
if ! curl -o /data/magma-server-${VANILLA_VERSION}.jar -fsSL \
|
||||
https://api.magmafoundation.org/api/resources/Magma/${VANILLA_VERSION}/stable/latest/download; then
|
||||
log "ERROR unable to download version ${VANILLA_VERSION} of Magma"
|
||||
log " Check https://magmafoundation.org/ for available versions"
|
||||
: ${VANILLA_VERSION?}
|
||||
# stable, dev
|
||||
: ${MAGMA_CHANNEL:=stable}
|
||||
|
||||
|
||||
magmaDownloadServer() {
|
||||
url=${1?}
|
||||
tagName=${2?}
|
||||
markerFile=${3?}
|
||||
|
||||
export SERVER="/data/magma-server-${VANILLA_VERSION}.jar"
|
||||
|
||||
log "Downloading Magma server file for ${VANILLA_VERSION} @ ${tagName}"
|
||||
if ! curl -o /data/magma-server-${VANILLA_VERSION}.jar -fsSL "$url"; then
|
||||
log "ERROR failed to download Magma server from $url (status=$?)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "$SERVER" > "$markerFile"
|
||||
}
|
||||
|
||||
magmaHandleInstaller() {
|
||||
url=${1?}
|
||||
tagName=${2?}
|
||||
markerFile=${3?}
|
||||
|
||||
installerFile="magma-installer-${VANILLA_VERSION}-${tagName}.jar"
|
||||
log "Downloading Magma installer file for ${VANILLA_VERSION} @ ${tagName}"
|
||||
if ! curl -o "$installerFile" -fsSL "$url"; then
|
||||
log "ERROR failed to download Magma installer from $url (status=$?)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "forge" > "$markerFile"
|
||||
|
||||
export FORGE_INSTALLER="$installerFile"
|
||||
export FORGE_INSTALLER_CUSTOM_VERSION="$tagName"
|
||||
|
||||
# now hand off the rest to forge
|
||||
exec ${SCRIPTS:-/}start-deployForge "$@"
|
||||
}
|
||||
|
||||
latestMeta=$(curl -fsSL https://api.magmafoundation.org/api/resources/Magma/${VANILLA_VERSION}/${MAGMA_CHANNEL}/latest || exit $?)
|
||||
if [ $? != 0 ]; then
|
||||
log "ERROR failed to locate latest Magma info for ${VANILLA_VERSION} in channel ${MAGMA_CHANNEL} (error=$?)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export SKIP_LOG4J_CONFIG=true
|
||||
tagName=$(echo "${latestMeta}" | jq -r '.tag_name')
|
||||
markerFile=".magma-installed-${VANILLA_VERSION}-${tagName}"
|
||||
if [ -f "${markerFile}" ]; then
|
||||
installedTagName=$(cat "${markerFile}")
|
||||
fi
|
||||
|
||||
if [ ! -f "${markerFile}" ]; then
|
||||
|
||||
if versionLessThan 1.16; then
|
||||
assetType=server
|
||||
else
|
||||
assetType=installer
|
||||
fi
|
||||
|
||||
assetUrl=$(echo "${latestMeta}" | jq -r ".assets | .[].browser_download_url | select(test(\"${assetType}\"))")
|
||||
if [ $? != 0 ] || [ -z "$assetUrl" ]; then
|
||||
log "ERROR failed to extract ${assetType} asset type for ${VANILLA_VERSION} in channel ${MAGMA_CHANNEL}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ${assetType} = server ]]; then
|
||||
magmaDownloadServer "$assetUrl" "$tagName" "$markerFile"
|
||||
else
|
||||
magmaHandleInstaller "$assetUrl" "$tagName" "$markerFile"
|
||||
fi
|
||||
else
|
||||
export SERVER=$(cat "${markerFile}")
|
||||
|
||||
if [[ $SERVER == "forge" ]]; then
|
||||
export FORGE_INSTALLER="magma-installer-${VANILLA_VERSION}-${tagName}.jar"
|
||||
export FORGE_INSTALLER_CUSTOM_VERSION="$tagName"
|
||||
# now hand off the rest to forge
|
||||
exec ${SCRIPTS:-/}start-deployForge "$@"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Continue to Final Setup
|
||||
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||
|
||||
@@ -154,7 +154,10 @@ fi
|
||||
if [[ "${GENERIC_PACK}" ]]; then
|
||||
if isURL "${GENERIC_PACK}"; then
|
||||
log "Downloading generic pack ..."
|
||||
curl -fsSL -o /tmp/generic_pack.zip "${GENERIC_PACK}"
|
||||
if ! curl -fsSL -o /tmp/generic_pack.zip "${GENERIC_PACK}"; then
|
||||
log "ERROR: failed to download ${GENERIC_PACK}"
|
||||
exit 2
|
||||
fi
|
||||
GENERIC_PACK=/tmp/generic_pack.zip
|
||||
fi
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ function customizeServerProps {
|
||||
setServerProp "server-name" "$SERVER_NAME"
|
||||
setServerProp "server-ip" "$SERVER_IP"
|
||||
setServerProp "server-port" "$SERVER_PORT"
|
||||
setServerProp "motd" "$MOTD"
|
||||
setServerProp "motd" "$(echo $MOTD | java -jar /usr/share/asciify/asciify.jar)"
|
||||
setServerProp "allow-nether" "$ALLOW_NETHER"
|
||||
setServerProp "announce-player-achievements" "$ANNOUNCE_PLAYER_ACHIEVEMENTS"
|
||||
setServerProp "enable-command-block" "$ENABLE_COMMAND_BLOCK"
|
||||
|
||||
@@ -173,6 +173,10 @@ function copyFilesForCurseForge() {
|
||||
}
|
||||
|
||||
mcServerRunnerArgs="--stop-duration ${STOP_DURATION:-60}s"
|
||||
if [[ ${STOP_SERVER_ANNOUNCE_DELAY} ]]; then
|
||||
mcServerRunnerArgs="${mcServerRunnerArgs} --stop-server-announce-delay ${STOP_SERVER_ANNOUNCE_DELAY}s"
|
||||
fi
|
||||
|
||||
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
||||
if isTrue ${DEBUG_EXEC}; then
|
||||
set -x
|
||||
@@ -225,6 +229,10 @@ EOF
|
||||
else
|
||||
exec mc-server-runner ${mcServerRunnerArgs} "${finalArgs[@]}"
|
||||
fi
|
||||
elif [[ -x run.sh ]]; then
|
||||
log "Using Forge supplied run.sh script..."
|
||||
echo $JVM_XX_OPTS $JVM_OPTS $expandedDOpts > user_jvm_args.txt
|
||||
exec mc-server-runner ${mcServerRunnerArgs} --shell bash run.sh
|
||||
else
|
||||
# If we have a bootstrap.txt file... feed that in to the server stdin
|
||||
if [ -f /data/bootstrap.txt ]; then
|
||||
|
||||
70
start-spiget
70
start-spiget
@@ -6,6 +6,7 @@ IFS=$'\n\t'
|
||||
handleDebugMode
|
||||
|
||||
: ${SPIGET_RESOURCES:=}
|
||||
: ${SPIGET_DOWNLOAD_TOLERANCE:=5} # in minutes
|
||||
|
||||
containsJars() {
|
||||
file=${1?}
|
||||
@@ -28,26 +29,61 @@ getResourceFromSpiget() {
|
||||
|
||||
mkdir -p /data/plugins
|
||||
|
||||
if [ -f /data/plugins/.${resource} ]; then
|
||||
log "Resource '${resource}' already downloaded"
|
||||
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
|
||||
versionfile="/data/plugins/.${resource}-version.json"
|
||||
versionfileNew="/tmp/.${resource}-version.json"
|
||||
|
||||
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}"
|
||||
if [ -f "$versionfile" ]; then
|
||||
if [[ -n $(find "$versionfile" -mmin +${SPIGET_DOWNLOAD_TOLERANCE}) ]]; then
|
||||
urlVersion="https://api.spiget.org/v2/resources/${resource}/versions/latest"
|
||||
if ! curl -o "${versionfileNew}" -fsSL -H "User-Agent: itzg/minecraft-server" "${extraCurlArgs[@]}" "${urlVersion}"; then
|
||||
log "ERROR failed to download resource version meta data '${resource}' from ${urlVersion}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
installedVersion=$(jq -r '.name' $versionfile)
|
||||
newVersion=$(jq -r '.name' $versionfileNew)
|
||||
|
||||
if [ "$installedVersion" = "$newVersion" ]; then
|
||||
log "resource '${resource}' not downloaded because installed version '${installedVersion}' already up to date ('${newVersion}')"
|
||||
mv "${versionfileNew}" "${versionfile}"
|
||||
else
|
||||
if downloadResourceFromSpiget "${resource}"; then
|
||||
mv "${versionfileNew}" "${versionfile}"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
log "Moving resource ${resource} into plugins"
|
||||
mv "${tmpfile}" "/data/plugins/${resource}.jar"
|
||||
touch "/data/plugins/.${resource}"
|
||||
log "resource '${resource}' not checked because version meta file newer than '${SPIGET_DOWNLOAD_TOLERANCE}' minutes"
|
||||
fi
|
||||
else
|
||||
if downloadResourceFromSpiget "${resource}"; then
|
||||
urlVersion="https://api.spiget.org/v2/resources/${resource}/versions/latest"
|
||||
if ! curl -o "${versionfileNew}" -fsSL -H "User-Agent: itzg/minecraft-server" "${extraCurlArgs[@]}" "${urlVersion}"; then
|
||||
log "ERROR failed to download resource version meta data '${resource}' from ${urlVersion}"
|
||||
exit 2
|
||||
fi
|
||||
mv "${versionfileNew}" "${versionfile}"
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
downloadResourceFromSpiget() {
|
||||
resource=${1?}
|
||||
|
||||
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}"
|
||||
rm "${tmpfile}"
|
||||
else
|
||||
log "Moving resource ${resource} into plugins"
|
||||
mv "${tmpfile}" "/data/plugins/${resource}.jar"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
@@ -17,5 +17,4 @@ services:
|
||||
- itzg/minecraft-server:latest
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
VERSION: "1.16.5"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user