Compare commits

...

45 Commits
1.2.0 ... 1.6.0

Author SHA1 Message Date
Paul Zühlcke
747c188824 Use -prune for "REPLACE_ENV_VARIABLES_EXCLUDE_PATHS" feature. (#588) 2020-07-18 18:31:29 -05:00
Geoff Bourne
692087dd25 Ensured ops.txt and white-list.txt are always provided for CURSEFORGE/FTB type (#584) 2020-07-18 13:49:40 -05:00
Geoff Bourne
6fe13e8654 Clarified "invalid type" message for FTBA on multiarch 2020-07-18 13:09:58 -05:00
Geoff Bourne
3b2b98b9fe Upgrade base image packages
For #586
2020-07-14 21:07:57 -05:00
Code Monad
796f2fe14a Add support for rcon password from file (#585) 2020-07-13 21:00:46 -05:00
Geoff Bourne
4fef391b64 misc: Switched maintainer label to opencontainers schema 2020-07-12 11:36:31 -05:00
Geoff Bourne
83f6cebd0b Merge pull request #581 from itzg/dev/add-ci-tests
Added CI tests
2020-07-11 14:29:59 -05:00
Geoff Bourne
90183ae823 ci: Don't restart failed container during test 2020-07-11 14:26:47 -05:00
Geoff Bourne
3c9df03584 ci: Only output server logs when failed 2020-07-11 14:13:51 -05:00
Geoff Bourne
367c6cfd92 ci: Added testing step to github actions 2020-07-11 14:09:08 -05:00
Geoff Bourne
5e75410e7c Confirm latest Paper jar is always downloaded 2020-07-11 13:30:39 -05:00
Geoff Bourne
38028f7d0c Confirm latest Spigot jar is always downloaded 2020-07-11 13:17:28 -05:00
Geoff Bourne
a07ae685e2 Fixed attempted rsync when WORLD not set 2020-07-11 13:09:48 -05:00
Paul Zühlcke
092b530537 Added 'FORCE_WORLD_COPY' environment variable (#580) 2020-07-10 17:06:47 -05:00
Geoff Bourne
cf691499a1 docs: Moved section for DISABLE_HEALTHCHECK to existing healthcheck section 2020-07-09 21:07:26 -05:00
Geoff Bourne
0bb9cccdc6 Added REPLACE_ENV_VARIABLES_EXCLUDE_PATHS
For #575
2020-07-09 21:05:17 -05:00
Geoff Bourne
4cb12f6cae Added DISABLE_HEALTHCHECK 2020-07-09 20:54:34 -05:00
Geoff Bourne
ecbdeb2096 Added option to disable PLUGINS_SYNC_UPDATE
For #576
2020-07-08 19:07:53 -05:00
Geoff Bourne
9a7a532f7b Changed order of /plugins rsync to be before processing env vars
For #577
2020-07-06 17:16:51 -05:00
Geoff Bourne
825833c859 Added REPLACE_ENV_VARIABLES_EXCLUDES
for #575
2020-07-06 16:41:56 -05:00
Geoff Bourne
c4c3613874 misc: added docs to release notes exclusion 2020-07-04 15:02:32 -05:00
Geoff Bourne
3a03156cb3 ci: Adjust pr workflow name 2020-07-04 14:55:45 -05:00
orblazer
b3780186f8 Add some missing properties in env variables (#574) 2020-07-04 14:52:35 -05:00
Kamaroth92
c4654e44d8 Move server-icon.png to FTB_DIR if exists (#573)
Co-authored-by: Tane Barriball <tanebarriball@gmail.com>
2020-07-04 09:08:37 -05:00
Kamaroth92
9c6047e3fc Updated worldDest to use FTB_DIR in order to deal with nested FTB modpacks (#571)
Co-authored-by: Tane Barriball <tanebarriball@gmail.com>
2020-07-01 18:48:41 -05:00
Geoff Bourne
260cc7d180 docs: added recommendation against using SERVER_PORT 2020-06-30 08:40:33 -05:00
Geoff Bourne
bbe930e552 ci: changed gh actions to avoid image push on PR 2020-06-28 12:22:00 -05:00
Geoff Bourne
a655fe860e docs: removed github readme link since Docker Hub docs are manual now 2020-06-28 12:17:07 -05:00
Geoff Bourne
ddf36aa879 docs: updated example compose file for paper to use proper CONSOLE setting 2020-06-28 09:37:55 -05:00
Geoff Bourne
34c31c561d docs: removed most mentions of noconsole since it only applies pre-1.14 2020-06-28 09:36:31 -05:00
Geoff Bourne
3cc7d00d71 docs: added example compose file for autopause
For #569
2020-06-28 09:34:26 -05:00
Geoff Bourne
ed214b1382 docs: updated image tag for running on RaspberryPi 2020-06-28 09:19:38 -05:00
Geoff Bourne
f8405e298c ci: removed tagging image with git SHA since it seemed like too many 2020-06-26 17:17:41 -05:00
Geoff Bourne
539159ba50 docs: simplified top-level example compose file
related to #518
2020-06-25 14:10:21 -05:00
Geoff Bourne
f2c9d2f905 Updated TYPE feedback when invalid choice given
For #561
2020-06-23 17:27:21 -05:00
Geoff Bourne
1b11331881 misc: added github action badge 2020-06-20 16:06:28 -05:00
Geoff Bourne
b71afff29f misc: removed unused multiarch scripts 2020-06-20 16:05:46 -05:00
Geoff Bourne
b4c6950f95 ci: simplified main github action name 2020-06-20 16:01:27 -05:00
Geoff Bourne
ec0329efb1 ci: added option to sign git tags 2020-06-20 15:42:45 -05:00
Geoff Bourne
477caa12c3 ci: switched image push to use Gitub Actions 2020-06-20 15:35:37 -05:00
Geoff Bourne
8f82ff9b1d Added support for Catserver type 2020-06-20 15:28:30 -05:00
Geoff Bourne
7d97fdcbec Clarified setting VERSION for unavailable Mohist builds 2020-06-20 09:07:38 -05:00
Geoff Bourne
5ee0150154 docs: added development note about generating release notes 2020-06-19 16:09:09 -05:00
Geoff Bourne
1bcacfc474 docs: added a bunch more development notes 2020-06-19 15:34:56 -05:00
Geoff Bourne
34603184a4 Activated useSystemProxies java property when proxy config set
Fixes #415
2020-06-19 15:33:33 -05:00
37 changed files with 391 additions and 252 deletions

View File

@@ -1,6 +1,4 @@
# This is a basic workflow to help you get started with Actions name: Build and Publish
name: Build non-multiarch branches/tags
on: on:
push: push:
@@ -16,11 +14,20 @@ on:
- "[0-9]+.[0-9]+.[0-9]+-openj9-nightly" - "[0-9]+.[0-9]+.[0-9]+-openj9-nightly"
- "[0-9]+.[0-9]+.[0-9]+-adopt11" - "[0-9]+.[0-9]+.[0-9]+-adopt11"
- "[0-9]+.[0-9]+.[0-9]+-adopt13" - "[0-9]+.[0-9]+.[0-9]+-adopt13"
pull_request:
branches: [ master ]
jobs: jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: |
tests/test.sh
build: build:
needs:
- test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -33,7 +40,8 @@ jobs:
username: ${{ secrets.DOCKER_USER }} username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
tag_with_ref: true tag_with_ref: true
tag_with_sha: true tag_with_sha: false
cache_froms: itzg/minecraft-server:latest cache_froms: itzg/minecraft-server:latest
add_git_labels: true add_git_labels: true
push: false labels: org.opencontainers.image.url=https://github.com/itzg/docker-minecraft-server,org.opencontainers.image.documentation=https://github.com/itzg/docker-minecraft-server
push: true

16
.github/workflows/pr.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: Validate PR
on:
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: |
tests/test.sh

View File

@@ -1,4 +1,17 @@
Individual scripts can be iteratively developed and tested using the following procedure. ## Adding a server type
Adding a new server `TYPE` can vary due to the complexity of obtaining and configuring each type; however, the addition of any server type includes at least the following steps:
1. Copy an existing "start-deploy*" script, such as [start-deployMohist](start-deployMohist) and rename it accordingly making sure to retain the "start-deploy" prefix
2. Modify the type-specific behavior between the "start-utils" preamble and the hand-off to `start-finalSetupWorld` at the end of the script
3. Develop and test the changes using the [iterative process described below](#iterative-script-development)
4. Add a case-entry to the `case "${TYPE^^}"` in [start-configuration](start-configuration)
5. Add a section to the [README](README.md). It is recommended to copy-modify an existing section to retain a similar wording and level of detail
6. [Submit a pull request](https://github.com/itzg/docker-minecraft-server/pulls)
## Iterative script development
Individual scripts can be iteratively developed, debugged, and tested using the following procedure.
First, build a baseline of the image to include the packages needed by existing or new scripts: First, build a baseline of the image to include the packages needed by existing or new scripts:
@@ -26,3 +39,36 @@ VANILLA_VERSION=1.12.2 /scripts/start-magma
``` ```
> NOTE: You may want to temporarily add an `exit` statement near the end of your script to isolate execution to just the script you're developing. > NOTE: You may want to temporarily add an `exit` statement near the end of your script to isolate execution to just the script you're developing.
## Multi-base-image variants
Several base-image variants are maintained in order to offer choices in JDK provider and version. The variants are maintained in their respective branches:
- openj9
- openj9-nightly
- adopt11
- adopt13
- multiarch
The [docker-versions-create.sh](docker-versions-create.sh) script is configured with the branches to maintain and is used to merge changes from the master branch into the mulit-base variant branches. The script also manages git tagging the master branch along with the merged branches. So a typical use of the script would be like:
```shell script
./docker-versions-create.sh -s -t 1.2.0
```
> Most often the major version will be bumped unless a bug or hotfix needs to be published in which case the patch version should be incremented.
> The build and publishing of those branches and their tags is currently performed within Docker Hub.
## multiarch support
The [multiarch branch](https://github.com/itzg/docker-minecraft-server/tree/multiarch) supports running the image on amd64, arm64, and armv7 (aka RaspberryPi). Unlike the mainline branches, it is based on Ubuntu 18.04 since the openjdk package provided by Ubuntu includes full JIT support on all of the processor types.
The multiarch images are built and published by [a Github action](https://github.com/itzg/docker-minecraft-server/actions?query=workflow%3A%22Build+and+publish+multiarch%22), which [is configured in that branch](https://github.com/itzg/docker-minecraft-server/blob/multiarch/.github/workflows/build-multiarch.yml).
## Generating release notes
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:" --pretty="- %s" 1.1.0..1.2.0
```

View File

@@ -1,6 +1,9 @@
FROM openjdk:8u212-jre-alpine FROM openjdk:8u212-jre-alpine
LABEL maintainer "itzg" LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
# upgrade all packages since alpine jre8 base image tops out at 8u212
RUN apk -U --no-cache upgrade
RUN apk add --no-cache -U \ RUN apk add --no-cache -U \
openssl \ openssl \
@@ -71,7 +74,6 @@ ENV UID=1000 GID=1000 \
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \ TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \ PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \ LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_" \
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 AUTOPAUSE_PERIOD=10 ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 AUTOPAUSE_PERIOD=10
COPY start* / COPY start* /

170
README.md
View File

@@ -2,16 +2,13 @@
[![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/) [![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/)
[![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/docker-minecraft-server.svg)](https://github.com/itzg/docker-minecraft-server/issues) [![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/docker-minecraft-server.svg)](https://github.com/itzg/docker-minecraft-server/issues)
[![Discord](https://img.shields.io/discord/660567679458869252)](https://discord.gg/DXfKpjB) [![Discord](https://img.shields.io/discord/660567679458869252)](https://discord.gg/DXfKpjB)
[![Build and Publish](https://github.com/itzg/docker-minecraft-server/workflows/Build%20and%20Publish/badge.svg)](https://github.com/itzg/docker-minecraft-server/actions)
[![](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-orange.svg)](https://www.buymeacoffee.com/itzg) [![](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-orange.svg)](https://www.buymeacoffee.com/itzg)
This docker image provides a Minecraft Server that will automatically download the latest stable This docker image provides a Minecraft Server that will automatically download the latest stable
version at startup. You can also run/upgrade to any specific version or the version at startup. You can also run/upgrade to any specific version or the
latest snapshot. See the _Versions_ section below for more information. latest snapshot. See the _Versions_ section below for more information.
[![Click for more docs](https://i.imgur.com/jS02ebD.png)](https://github.com/itzg/docker-minecraft-server/blob/master/README.md)
[Full docs available in Github](https://github.com/itzg/docker-minecraft-server/blob/master/README.md)
To simply use the latest stable version, run To simply use the latest stable version, run
docker run -d -p 25565:25565 --name mc itzg/minecraft-server docker run -d -p 25565:25565 --name mc itzg/minecraft-server
@@ -179,11 +176,15 @@ You can also query the container's health in a script friendly way:
healthy healthy
``` ```
## Autopause Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of healthchecks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`.
## Autopause (experimental)
### Description ### Description
> There are various bug reports on [Mojang](https://bugs.mojang.com) about high CPU usage of servers with newer versions, even with few or no clients connected (e.g. [this one](https://bugs.mojang.com/browse/MC-149018), in fact the functionality is based on [this comment in the thread](https://bugs.mojang.com/browse/MC-149018?focusedCommentId=593606&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-593606)). > EXPERIMENTAL: this feature only works with default bridge networking using official Docker distributions. Host networking and container management software, such as Portainer, and NAS solutions do not seem to provide compatible networking.
There are various bug reports on [Mojang](https://bugs.mojang.com) about high CPU usage of servers with newer versions, even with few or no clients connected (e.g. [this one](https://bugs.mojang.com/browse/MC-149018), in fact the functionality is based on [this comment in the thread](https://bugs.mojang.com/browse/MC-149018?focusedCommentId=593606&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-593606)).
An autopause functionality has been added to this image to monitor whether clients are connected to the server. If for a specified time no client is connected, the Java process is stopped. When knocking on the server port (e.g. by the ingame Multiplayer server overview), the process is resumed. The experience for the client does not change. An autopause functionality has been added to this image to monitor whether clients are connected to the server. If for a specified time no client is connected, the Java process is stopped. When knocking on the server port (e.g. by the ingame Multiplayer server overview), the process is resumed. The experience for the client does not change.
@@ -193,7 +194,7 @@ From the server's point of view, the pausing causes a single tick to take as lon
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. 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.
The autopause functionality is not compatible with docker's host network_mode, as the `knockd` utility cannot properly listen for connections in that mode. A starting, example compose file has been provided in [examples/docker-compose-autopause.yml](examples/docker-compose-autopause.yml).
### Enabling Autopause ### Enabling Autopause
@@ -307,7 +308,7 @@ defined environment variables. Variables that you want to replace need to be wra
inside `${YOUR_VARIABLE}` curly brackets and prefixed with a dollar sign. This is the regular inside `${YOUR_VARIABLE}` curly brackets and prefixed with a dollar sign. This is the regular
syntax for enviromment variables inside strings or config files. syntax for enviromment variables inside strings or config files.
Optionally you can also define a prefix to only match predefined enviroment variables. Optionally you can also define a prefix to only match predefined environment variables.
`ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix `ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix
@@ -323,6 +324,14 @@ There are some limitations to what characters you can use.
Variables will be replaced in files with the following extensions: Variables will be replaced in files with the following extensions:
`.yml`, `.yaml`, `.txt`, `.cfg`, `.conf`, `.properties`. `.yml`, `.yaml`, `.txt`, `.cfg`, `.conf`, `.properties`.
Specific files can be excluded by listing their name (without path) in the variable `REPLACE_ENV_VARIABLES_EXCLUDES`.
Paths can be excluded by listing them in the variable `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. Path
excludes are recursive. Here is an example:
```
REPLACE_ENV_VARIABLES_EXCLUDE_PATHS="/data/plugins/Essentials/userdata/ /data/plugins/MyPlugin/"
```
Here is a full example where we want to replace values inside a `database.yml`. Here is a full example where we want to replace values inside a `database.yml`.
```yml ```yml
@@ -397,52 +406,7 @@ If you are hosting your own copy of Bukkit/Spigot you can override the download
You can build spigot from source by adding `-e BUILD_FROM_SOURCE=true` You can build spigot from source by adding `-e BUILD_FROM_SOURCE=true`
**NOTE: to avoid pegging the CPU when running Spigot,** you will need to If you have attached a host directory to the `/data` volume, then you can install plugins within the `plugins` subdirectory. You can also [attach a `/plugins` volume](#deploying-plugins-from-attached-volume). If you add plugins while the container is running, you'll need to restart it to pick those up.
pass `--noconsole` at the very end of the command line and not use `-it`. For example,
docker run -d -v /path/on/host:/data \
-e TYPE=SPIGOT \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server --noconsole
You can install Bukkit plugins in two ways...
### Using the /data volume
This is the easiest way if you are using a persistent `/data` mount.
To do this, you will need to attach the container's `/data` directory
(see "Attaching data directory to host filesystem”).
Then, you can add plugins to the `/path/on/host/plugins` folder you chose. From the example above,
the `/path/on/host` folder contents look like:
```
/path/on/host
├── plugins
│   └── ... INSTALL PLUGINS HERE ...
├── ops.json
├── server.properties
├── whitelist.json
└── ...
```
If you add plugins while the container is running, you'll need to restart it to pick those
up:
docker stop mc
docker start mc
### Using separate mounts
This is the easiest way if you are using an ephemeral `/data` filesystem,
or downloading a world with the `WORLD` option.
There is one additional volume that can be mounted; `/plugins`.
Any files in this filesystem will be copied over to the main
`/data/plugins` filesystem before starting Minecraft.
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.
## Running a PaperSpigot server ## Running a PaperSpigot server
@@ -455,59 +419,14 @@ but you can also choose to run a specific build with `-e PAPERBUILD=205`.
-e TYPE=PAPER \ -e TYPE=PAPER \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
**NOTE: to avoid pegging the CPU when running PaperSpigot,** you will need to
pass `--noconsole` at the very end of the command line and not use `-it`. For example,
docker run -d -v /path/on/host:/data \
-e TYPE=PAPER \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server --noconsole
If you are hosting your own copy of PaperSpigot you can override the download URL with: If you are hosting your own copy of PaperSpigot you can override the download URL with:
- -e PAPER_DOWNLOAD_URL=<url> - -e PAPER_DOWNLOAD_URL=<url>
You can install Bukkit plugins in two ways...
An example compose file is provided at An example compose file is provided at
[examples/docker-compose-paper.yml](examples/docker-compose-paper.yml). [examples/docker-compose-paper.yml](examples/docker-compose-paper.yml).
### Using the /data volume If you have attached a host directory to the `/data` volume, then you can install plugins via the `plugins` subdirectory. You can also [attach a `/plugins` volume](#deploying-plugins-from-attached-volume). If you add plugins while the container is running, you'll need to restart it to pick those up.
This is the easiest way if you are using a persistent `/data` mount.
To do this, you will need to attach the container's `/data` directory
(see "Attaching data directory to host filesystem”).
Then, you can add plugins to the `/path/on/host/plugins` folder you chose. From the example above,
the `/path/on/host` folder contents look like:
```
/path/on/host
├── plugins
│   └── ... INSTALL PLUGINS HERE ...
├── ops.json
├── server.properties
├── whitelist.json
└── ...
```
If you add plugins while the container is running, you'll need to restart it to pick those
up:
docker stop mc
docker start mc
### Using separate mounts
This is the easiest way if you are using an ephemeral `/data` filesystem,
or downloading a world with the `WORLD` option.
There is one additional volume that can be mounted; `/plugins`.
Any files in this filesystem will be copied over to the main
`/data/plugins` filesystem before starting Minecraft.
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.
## Running a Tuinity server ## Running a Tuinity server
@@ -534,6 +453,15 @@ A [Mohist](https://github.com/Mohist-Community/Mohist) server can be used with
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2" > **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
## Running a Catserver type server
A [Catserver](http://catserver.moe/) type server can be used with
-e TYPE=CATSERVER
> **NOTE** Catserver only provides a single release stream, so `VERSION` is ignored
## Running a server with a Feed the Beast modpack ## Running a server with a Feed the Beast modpack
> **NOTE** requires `itzg/minecraft-server:multiarch` image > **NOTE** requires `itzg/minecraft-server:multiarch` image
@@ -676,6 +604,12 @@ This works well if you want to have a common set of modules in a separate
location, but still have multiple worlds with different server requirements location, but still have multiple worlds with different server requirements
in either persistent volumes or a downloadable archive. in either persistent volumes or a downloadable archive.
## Deploying plugins from attached volume
There is one additional volume that can be mounted; `/plugins`. Any files in this filesystem will be copied over to the main `/data/plugins` filesystem 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.
## Running with a custom server JAR ## Running with a custom server JAR
If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server
@@ -753,9 +687,13 @@ The server name (e.g. for bungeecord) can be set like:
### Server port ### Server port
The server port can be set like: > **WARNING:** only change this value if you know what you're doing. It is only needed when using host networking and it is rare that host networking should be used. Use `-p` port mappings instead.
docker run -d -e SERVER_PORT=25565 ... If you must, the server port can be set like:
docker run -d -e SERVER_PORT=25566 ...
**however**, be sure to change your port mapping accordingly and be prepared for some features to break.
### Difficulty ### Difficulty
@@ -977,7 +915,7 @@ For example (just the `-e` bits):
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: 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:
docker run -d -e 'RESROUCE_PACK=http\://link.com/to/pack.zip?\=1' -e 'RESOURCE_PACK_SHA1=d5db29cd03a2ed055086cef9c31c252b4587d6d0' docker run -d -e 'RESOURCE_PACK=http\://link.com/to/pack.zip?\=1' -e 'RESOURCE_PACK_SHA1=d5db29cd03a2ed055086cef9c31c252b4587d6d0'
**NOTE:** `:` and `=` must be escaped using `\`. The checksum plain-text hexadecimal. **NOTE:** `:` and `=` must be escaped using `\`. The checksum plain-text hexadecimal.
@@ -1015,6 +953,9 @@ read-only volume attachment to ensure the clone source remains pristine.
docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic
``` ```
### 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.
### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers ### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers
Like the `WORLD` option above, you can specify the URL of a "mod pack" Like the `WORLD` option above, you can specify the URL of a "mod pack"
@@ -1058,9 +999,21 @@ Allows users to use flight on your server while in Survival mode, if they have a
### Other server property mappings ### Other server property mappings
Environment Variable | Server Property | Environment Variable | Server Property |
---------------------|----------------- | --------------------------------- | --------------------------------- |
PLAYER_IDLE_TIMEOUT | player-idle-timeout | PLAYER_IDLE_TIMEOUT | player-idle-timeout |
| BROADCAST_CONSOLE_TO_OPS | broadcast-console-to-ops |
| BROADCAST_RCON_TO_OPS | broadcast-rcon-to-ops |
| ENABLE_JMX | enable-jmx-monitoring |
| SYNC_CHUNK_WRITES | sync-chunk-writes |
| ENABLE_STATUS | enable-status |
| ENTITY_BROADCAST_RANGE_PERCENTAGE | entity-broadcast-range-percentage |
| FUNCTION_PERMISSION_LEVEL | function-permission-level |
| NETWORK_COMPRESSION_THRESHOLD | network-compression-threshold |
| OP_PERMISSION_LEVEL | op-permission-level |
| PREVENT_PROXY_CONNECTIONS | prevent-proxy-connections |
| USE_NATIVE_TRANSPORT | use-native-transport |
| ENFORCE_WHITELIST | enforce-whitelist |
## Miscellaneous Options ## Miscellaneous Options
@@ -1127,8 +1080,7 @@ a companion squid proxy by setting the equivalent of
### Using "noconsole" option ### Using "noconsole" option
Some older versions of Spigot required `--noconsole` to be passed when detaching stdin. You can Some older versions (pre-1.14) of Spigot required `--noconsole` to be passed when detaching stdin, which can be done by setting `-e CONSOLE=FALSE`.
pass that at the end of `docker run` after the image name or set `-e CONSOLE=FALSE`.
### Explicitly disable GUI ### Explicitly disable GUI
@@ -1139,6 +1091,6 @@ disable that by passing `-e GUI=FALSE`.
To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag
itzg/minecraft-server:armv7 itzg/minecraft-server:multiarch
> NOTE: you may need to lower the memory allocation, such as `-e MEMORY=750m` > NOTE: you may need to lower the memory allocation, such as `-e MEMORY=750m`

View File

@@ -1,34 +0,0 @@
#!/bin/bash
# manually purge any pre-existing manifest list
# since docker manifest command lacks a "remove" operation
rm -rf ~/.docker/manifests/docker.io_itzg_minecraft-server-multiarch
export DOCKER_BUILDKIT=1
docker build --platform linux/arm64 -t itzg/minecraft-server:arm64 .
docker push itzg/minecraft-server:arm64
armv7tag=armv7-buildkit
armv7workDir=/tmp/armv7-$$
git worktree add $armv7workDir armv7
# sub-shell for build of armv7
(
cd $armv7workDir
docker build --platform linux/arm/v7 -t itzg/minecraft-server:$armv7tag .
docker push itzg/minecraft-server:$armv7tag
)
git worktree remove $armv7workDir
docker pull itzg/minecraft-server
# use the rpi build one for now since armv7-buildkit is giving ABI mismatch on curl
docker pull itzg/minecraft-server:armv7
docker manifest create itzg/minecraft-server:multiarch \
itzg/minecraft-server \
itzg/minecraft-server:armv7 \
itzg/minecraft-server:arm64
docker manifest inspect itzg/minecraft-server:multiarch
docker manifest push -p itzg/minecraft-server:multiarch

View File

@@ -1,18 +0,0 @@
#!/bin/bash
manifest="itzg/minecraft-server:multiarch"
for t in latest rpi3 aarch64; do
docker pull itzg/minecraft-server:$t
done
docker manifest create --amend ${manifest} \
itzg/minecraft-server:aarch64 \
itzg/minecraft-server:latest \
itzg/minecraft-server:rpi3
docker manifest annotate --os linux --arch amd64 ${manifest} itzg/minecraft-server:latest
docker manifest annotate --os linux --arch arm64 ${manifest} itzg/minecraft-server:aarch64
docker manifest annotate --os linux --arch arm --variant v7 ${manifest} itzg/minecraft-server:rpi3
docker manifest push ${manifest}

View File

@@ -10,19 +10,7 @@ services:
- "mc:/data" - "mc:/data"
environment: environment:
EULA: "TRUE" EULA: "TRUE"
CONSOLE: "false"
ENABLE_RCON: "true"
RCON_PASSWORD: "testing"
RCON_PORT: 28016
restart: always restart: always
rcon:
image: itzg/rcon
ports:
- "4326:4326"
- "4327:4327"
volumes:
- "rcon:/opt/rcon-web-admin/db"
volumes: volumes:
mc: mc: {}
rcon:

View File

@@ -10,7 +10,7 @@ function TrapExit {
batchMode=false batchMode=false
while getopts "hbt:" arg while getopts "hbt:s" arg
do do
case $arg in case $arg in
b) b)
@@ -19,6 +19,9 @@ do
t) t)
tag=${OPTARG} tag=${OPTARG}
;; ;;
s)
tagArgs="-s -m 'Signed during docker-versions-create"
;;
h) h)
echo " echo "
Usage $0 [options] Usage $0 [options]
@@ -28,6 +31,7 @@ Options:
when any merge fails when any merge fails
-t TAG tag and push the current revision on master with the given tag -t TAG tag and push the current revision on master with the given tag
and apply respective tags to each branch and apply respective tags to each branch
-s enable signed tags
-h display this help and exit -h display this help and exit
" "
exit exit

View File

@@ -0,0 +1,18 @@
version: '3.8'
services:
minecraft:
image: itzg/minecraft-server
ports:
- "25565:25565"
volumes:
- "mc:/data"
environment:
EULA: "TRUE"
ENABLE_AUTOPAUSE: "TRUE"
OVERRIDE_SERVER_PROPERTIES: "TRUE"
MAX_TICK_TIME: "-1"
restart: always
volumes:
mc: {}

View File

@@ -7,7 +7,8 @@ services:
EULA: "true" EULA: "true"
TYPE: PAPER TYPE: PAPER
VERSION: 1.9.4 VERSION: 1.9.4
command: --noconsole # needed for Paper versions before 1.14
CONSOLE: "false"
ports: ports:
- 25565:25565 - 25565:25565
volumes: volumes:

View File

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

View File

@@ -37,3 +37,15 @@ motd=A Minecraft Server powered by Docker
generator-settings= generator-settings=
rcon.password= rcon.password=
max-world-size=29999984 max-world-size=29999984
broadcast-console-to-ops=true
broadcast-rcon-to-ops=true
enable-jmx-monitoring=false
sync-chunk-writes=true
enable-status=true
entity-broadcast-range-percentage=100
function-permission-level=2
network-compression-threshold=256
op-permission-level=4
prevent-proxy-connections=false
use-native-transport=true
enforce-whitelist=false

View File

@@ -40,10 +40,27 @@ 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"
export JAVA_TOOL_OPTIONS+="-Djava.net.useSystemProxies=true"
log "INFO: Giving proxy time to startup..." log "INFO: Giving proxy time to startup..."
sleep 5 sleep 5
fi fi
if [[ $RCON_PASSWORD_FILE ]]; then
log ""
if [ ! -e ${RCON_PASSWORD_FILE} ]; then
log "Initial RCON password file ${RCON_PASSWORD_FILE} does not seems to exist."
log "Please ensure your configuration."
log "If you are using Docker Secrets feature, please check this for further information: "
log " https://docs.docker.com/engine/swarm/secrets"
log ""
exit 1
else
RCON_PASSWORD=$(cat ${RCON_PASSWORD_FILE})
export RCON_PASSWORD
fi
log ""
fi
export SERVER_PROPERTIES=/data/server.properties export SERVER_PROPERTIES=/data/server.properties
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
@@ -115,16 +132,22 @@ case "${TYPE^^}" in
;; ;;
MAGMA) MAGMA)
exec ${SCRIPTS:-/}start-magma "$@" exec ${SCRIPTS:-/}start-deployMagma "$@"
;; ;;
MOHIST) MOHIST)
exec ${SCRIPTS:-/}start-mohist "$@" exec ${SCRIPTS:-/}start-deployMohist "$@"
;;
CATSERVER)
exec ${SCRIPTS:-/}start-deployCatserver "$@"
;; ;;
*) *)
log "Invalid type: '$TYPE'" log "Invalid type: '$TYPE'"
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, CURSEFORGE, SPONGEVANILLA" log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA,"
log " CUSTOM, MAGMA, MOHIST, CATSERVER"
exit 1 exit 1
;; ;;

View File

@@ -62,8 +62,12 @@ function downloadSpigot {
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar" downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar"
fi fi
if [ -f $SERVER ]; then
# tell curl to only download when newer
zarg="-z $SERVER"
fi
log "Downloading $match from $downloadUrl ..." log "Downloading $match from $downloadUrl ..."
curl -fsSL -o $SERVER "$downloadUrl" curl -fsSL -o $SERVER $zarg "$downloadUrl"
if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then
cat <<EOF cat <<EOF
@@ -89,12 +93,12 @@ case "$TYPE" in
;; ;;
esac esac
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
buildSpigotFromSource buildSpigotFromSource
else fi
downloadSpigot else
fi downloadSpigot
fi fi
# Normalize on Spigot for operations below # Normalize on Spigot for operations below
@@ -102,4 +106,4 @@ export TYPE=SPIGOT
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld $@

32
start-deployCatserver Normal file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
. ${SCRIPTS:-/}start-utils
set -o pipefail
set -e
latestAsset=$(
curl -fsSL https://api.github.com/repos/Luohuayu/CatServer/releases/latest | \
jq '.assets[] | select(.name | match(".*-universal.jar"))'
)
if [[ -z "${latestAsset}" ]]; then
log "ERROR: latest release of Catserver is missing universal.jar asset"
exit 1
fi
isDebugging && log "Latest asset ${latestAsset}"
latestJarName=$(echo ${latestAsset} | jq --raw-output '.name')
latestJarId=$(echo ${latestAsset} | jq --raw-output '.id')
export SERVER="/data/${latestJarName}"
if [ ! -f ${SERVER} ]; then
log "Downloading ${latestJarName}"
curl -H "Accept:application/octet-stream" -o "$SERVER" -fsSL https://api.github.com/repos/Luohuayu/CatServer/releases/assets/${latestJarId}
fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetupWorld "$@"

View File

@@ -28,4 +28,4 @@ fi
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@@ -135,4 +135,4 @@ elif [ -e "${FTB_DIR}/Install.sh" ]; then
fi fi
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@@ -75,4 +75,4 @@ else
fi fi
# Contineut to Final Setup # Contineut to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@@ -113,4 +113,4 @@ else
fi fi
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld $@

2
start-magma → start-deployMagma Executable file → Normal file
View File

@@ -15,4 +15,4 @@ fi
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld $@

9
start-mohist → start-deployMohist Executable file → Normal file
View File

@@ -1,17 +1,19 @@
#!/bin/bash #!/bin/bash
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
requireVar VANILLA_VERSION
set -o pipefail set -o pipefail
set -e set -e
isDebugging && set -x isDebugging && set -x
requireVar VANILLA_VERSION
mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/ mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/ mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/
if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then
log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}" log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}"
log " check https://ci.codemc.io/job/Mohist-Community/ for available versions" log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
log " and set VERSION accordingly"
exit 1 exit 1
fi fi
@@ -24,17 +26,18 @@ baseName=$(basename "${latestBuildRelPath}")
if [[ ${baseName} != *-server.jar* ]]; then if [[ ${baseName} != *-server.jar* ]]; then
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}" log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}"
log " check https://ci.codemc.io/job/Mohist-Community/ for available versions" log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
log " and set VERSION accordingly"
exit 1 exit 1
fi fi
export SERVER="/data/${baseName}" export SERVER="/data/${baseName}"
if [ ! -f ${SERVER} ]; then if [ ! -f ${SERVER} ]; then
log "Downloading ${SERVER}" log "Downloading ${baseName}"
curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}" curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}"
fi fi
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld "$@"

View File

@@ -5,19 +5,20 @@
: ${PAPERBUILD:=latest} : ${PAPERBUILD:=latest}
export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar
if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then if [ -f "$SERVER" ] && ! isTrue "$FORCE_REDOWNLOAD"; then
downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download} zarg="-z '$SERVER'"
log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..."
curl -fsSL -o "$SERVER" "$downloadUrl"
if [ ! -f "$SERVER" ]; then
log "ERROR: failed to download from $downloadUrl (status=$?)"
exit 3
fi
fi fi
# Normalize on Spigot for operations below downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download}
log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..."
if ! curl -fsSL -o "$SERVER" $zarg "$downloadUrl"; then
log "ERROR: failed to download from $downloadUrl (status=$?)"
exit 3
fi
# Normalize on Spigot for downstream operations
export TYPE=SPIGOT export TYPE=SPIGOT
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@@ -36,4 +36,4 @@ if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
fi fi
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@@ -24,4 +24,4 @@ fi
export TYPE=SPIGOT export TYPE=SPIGOT
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@@ -43,4 +43,4 @@ fi
isDebugging && ls -l isDebugging && ls -l
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@@ -2,8 +2,25 @@
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then : ${ENV_VARIABLE_PREFIX:=CFG_}
if isTrue "${REPLACE_ENV_VARIABLES}"; then
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..." log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
findExcludes=
# File excludes
for f in ${REPLACE_ENV_VARIABLES_EXCLUDES}; do
findExcludes="${findExcludes} -not -name $f"
done
# Directory excludes (recursive)
dirExcludes=$(join_by " -o -path " ${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS})
if [[ $dirExcludes ]]; then
findExcludes+=" -type d ( -path ${dirExcludes} ) -prune"
fi
isDebugging && echo "Using find exclusions: $findExcludes"
while IFS='=' read -r name value ; do while IFS='=' read -r name value ; do
# check if name of env variable matches the prefix # check if name of env variable matches the prefix
# sanity check environment variables to avoid code injections # sanity check environment variables to avoid code injections
@@ -20,6 +37,7 @@ if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
find /data/ -type f \ find /data/ -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 "*.conf" -or -name "*.properties" \) \
$findExcludes \
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \; -exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
fi fi
done < <(env) done < <(env)

View File

@@ -24,4 +24,4 @@ case "X$MODCONFIG" in
esac esac
fi fi
exec ${SCRIPTS:-/}start-finalSetup04ServerProperties $@ exec ${SCRIPTS:-/}start-finalSetupPlugins $@

View File

@@ -154,4 +154,4 @@ if [[ "${GENERIC_PACK}" ]]; then
fi fi
fi fi
exec ${SCRIPTS:-/}start-finalSetup03Modconfig $@ exec ${SCRIPTS:-/}start-finalSetupModconfig $@

23
start-finalSetupPlugins Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
. ${SCRIPTS:-/}start-utils
: ${PLUGINS_SYNC_UPDATE:=true}
isDebugging && set -x
if [ -d /plugins ]; then
case ${TYPE} in
SPIGOT|BUKKIT|PAPER)
mkdir -p /data/plugins
log "Copying plugins over..."
if isTrue ${PLUGINS_SYNC_UPDATE}; then
updateArg="--update"
fi
# Copy plugins over using rsync to allow deeply nested updates of plugins
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs $updateArg /plugins /data
;;
esac
fi
exec ${SCRIPTS:-/}start-finalSetupServerProperties $@

View File

@@ -77,6 +77,18 @@ function customizeServerProps {
setServerProp "resource-pack" "$RESOURCE_PACK" setServerProp "resource-pack" "$RESOURCE_PACK"
setServerProp "resource-pack-sha1" "$RESOURCE_PACK_SHA1" setServerProp "resource-pack-sha1" "$RESOURCE_PACK_SHA1"
setServerProp "player-idle-timeout" "$PLAYER_IDLE_TIMEOUT" setServerProp "player-idle-timeout" "$PLAYER_IDLE_TIMEOUT"
setServerProp "broadcast-console-to-ops" "$BROADCAST_CONSOLE_TO_OPS"
setServerProp "broadcast-rcon-to-ops" "$BROADCAST_RCON_TO_OPS"
setServerProp "enable-jmx-monitoring" "$ENABLE_JMX"
setServerProp "sync-chunk-writes" "$SYNC_CHUNK_WRITES"
setServerProp "enable-status" "$ENABLE_STATUS"
setServerProp "entity-broadcast-range-percentage" "$ENTITY_BROADCAST_RANGE_PERCENTAGE"
setServerProp "function-permission-level" "$FUNCTION_PERMISSION_LEVEL"
setServerProp "network-compression-threshold" "$NETWORK_COMPRESSION_THRESHOLD"
setServerProp "op-permission-level" "$OP_PERMISSION_LEVEL"
setServerProp "prevent-proxy-connections" "$PREVENT_PROXY_CONNECTIONS"
setServerProp "use-native-transport" "$USE_NATIVE_TRANSPORT"
setServerProp "enforce-whitelist" "$ENFORCE_WHITELIST"
if [ -n "$DIFFICULTY" ]; then if [ -n "$DIFFICULTY" ]; then
case $DIFFICULTY in case $DIFFICULTY in
@@ -194,4 +206,4 @@ if isDebugging; then
cat /data/server.properties cat /data/server.properties
fi fi
exec ${SCRIPTS:-/}start-finalSetup05EnvVariables $@ exec ${SCRIPTS:-/}start-finalSetupEnvVariables $@

View File

@@ -5,12 +5,12 @@ set -e
isDebugging && set -x isDebugging && set -x
if [ $TYPE = "FEED-THE-BEAST" ]; then if [ $TYPE = "FEED-THE-BEAST" ]; then
worldDest=$FTB_BASE_DIR/$LEVEL worldDest=$FTB_DIR/$LEVEL
else else
worldDest=/data/$LEVEL worldDest=/data/$LEVEL
fi fi
if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] ); then
if isURL $WORLD; then if isURL $WORLD; then
curl -fsSL "$WORLD" -o /tmp/world.zip curl -fsSL "$WORLD" -o /tmp/world.zip
zipSrc=/tmp/world.zip zipSrc=/tmp/world.zip
@@ -37,10 +37,10 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
log "ERROR invalid world content" log "ERROR invalid world content"
exit 1 exit 1
fi fi
mv "$baseDir" "$worldDest" rsync --remove-source-files --recursive --delete "$baseDir/" "$worldDest"
else else
log "Cloning world directory from $WORLD ..." log "Cloning world directory from $WORLD ..."
cp -r "$WORLD" "$worldDest" rsync --recursive --delete "${WORLD%/}"/ "$worldDest"
fi fi
if [ "$TYPE" = "SPIGOT" ]; then if [ "$TYPE" = "SPIGOT" ]; then
@@ -51,4 +51,4 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
fi fi
fi fi
exec ${SCRIPTS:-/}start-finalSetup02Modpack $@ exec ${SCRIPTS:-/}start-finalSetupModpack $@

View File

@@ -66,18 +66,6 @@ do
fi fi
done done
case ${TYPE} in
SPIGOT|BUKKIT|PAPER)
mkdir -p /data/plugins
if [ -d /plugins ]; then
log "Copying plugins over..."
# Copy plugins over using rsync to allow deeply nested updates of plugins
# only updates files if the source file is newer and print updated files
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /plugins /data
fi
;;
esac
EXTRA_ARGS="" EXTRA_ARGS=""
# Optional disable console # Optional disable console
if versionLessThan 1.14 && [[ ${CONSOLE,,} = false ]]; then if versionLessThan 1.14 && [[ ${CONSOLE,,} = false ]]; then
@@ -182,12 +170,13 @@ if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
elif [[ ${TYPE} == "FEED-THE-BEAST" ]]; then elif [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash" mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash"
if [ ! -e "${FTB_DIR}/ops.json" -a -e /data/ops.txt ]; then # copy player modification files unconditionally since their
cp -f /data/ops.txt ${FTB_DIR}/ # processing into json is additive anyway
fi [ -f /data/ops.txt ] && cp -f /data/ops.txt ${FTB_DIR}/
[ -f /data/white-list.txt ] && cp -f /data/white-list.txt ${FTB_DIR}/
if [ ! -e "${FTB_DIR}/whitelist.json" -a -e /data/white-list.txt ]; then if [ ! -e "${FTB_DIR}/server-icon.png" -a -e /data/server-icon.png ]; then
cp -f /data/white-list.txt ${FTB_DIR}/ cp -f /data/server-icon.png ${FTB_DIR}/
fi fi
cp -f /data/eula.txt "${FTB_DIR}/" cp -f /data/eula.txt "${FTB_DIR}/"

View File

@@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
function isURL { function isURL {
local value=$1 local value=$1

View File

@@ -15,4 +15,4 @@ fi
log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}" log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}"
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World "$@" exec ${SCRIPTS:-/}start-finalSetupWorld "$@"

View File

@@ -0,0 +1,17 @@
version: "3.8"
services:
sut:
depends_on:
- mc
image: itzg/mc-monitor:0.6.0
command: status --host mc --retry-interval 1s --retry-limit 120
mc:
restart: "no"
build:
context: ..
cache_from:
- itzg/minecraft-server:latest
environment:
EULA: "TRUE"

17
tests/test.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
cd $(dirname $0)
failed=false
args="-f docker-compose.test.yml"
docker-compose $args run sut || failed=true
echo "
Result: failed=$failed"
$failed && docker-compose $args logs mc
docker-compose $args down -v
if $failed; then
exit 1
fi