mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-13 10:11:24 +00:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a486458a08 | ||
|
|
82b8401414 | ||
|
|
8b6ee91ec1 | ||
|
|
06cffd9e15 | ||
|
|
beaccbcf3b | ||
|
|
21ee5e2401 | ||
|
|
747c188824 | ||
|
|
692087dd25 | ||
|
|
6fe13e8654 | ||
|
|
3b2b98b9fe | ||
|
|
796f2fe14a | ||
|
|
4fef391b64 | ||
|
|
83f6cebd0b | ||
|
|
90183ae823 | ||
|
|
3c9df03584 | ||
|
|
367c6cfd92 | ||
|
|
5e75410e7c | ||
|
|
38028f7d0c | ||
|
|
a07ae685e2 | ||
|
|
092b530537 | ||
|
|
cf691499a1 | ||
|
|
0bb9cccdc6 | ||
|
|
4cb12f6cae | ||
|
|
ecbdeb2096 | ||
|
|
9a7a532f7b | ||
|
|
825833c859 | ||
|
|
c4c3613874 | ||
|
|
3a03156cb3 |
12
.github/workflows/main.yml
vendored
12
.github/workflows/main.yml
vendored
@@ -16,7 +16,18 @@ on:
|
|||||||
- "[0-9]+.[0-9]+.[0-9]+-adopt13"
|
- "[0-9]+.[0-9]+.[0-9]+-adopt13"
|
||||||
|
|
||||||
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:
|
||||||
@@ -32,4 +43,5 @@ jobs:
|
|||||||
tag_with_sha: false
|
tag_with_sha: false
|
||||||
cache_froms: itzg/minecraft-server:latest
|
cache_froms: itzg/minecraft-server:latest
|
||||||
add_git_labels: true
|
add_git_labels: true
|
||||||
|
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
|
push: true
|
||||||
|
|||||||
13
.github/workflows/pr.yml
vendored
13
.github/workflows/pr.yml
vendored
@@ -1,19 +1,16 @@
|
|||||||
name: PR validation
|
name: Validate PR
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Run tests
|
||||||
uses: docker/build-push-action@v1.1.0
|
run: |
|
||||||
with:
|
tests/test.sh
|
||||||
tag_with_sha: true
|
|
||||||
cache_froms: itzg/minecraft-server:latest
|
|
||||||
push: false
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
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:
|
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
|
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-finalSetup01World` at the end of the script
|
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)
|
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)
|
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
|
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
|
||||||
@@ -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:
|
The following git command can be used to provide the bulk of release notes content:
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
git log --invert-grep --grep "^ci:" --grep "^misc:" --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
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -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* /
|
||||||
|
|||||||
107
README.md
107
README.md
@@ -176,6 +176,8 @@ You can also query the container's health in a script friendly way:
|
|||||||
healthy
|
healthy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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)
|
## Autopause (experimental)
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
@@ -306,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
|
||||||
|
|
||||||
@@ -322,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
|
||||||
@@ -396,45 +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`
|
||||||
|
|
||||||
You can install Bukkit plugins in two ways...
|
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.
|
||||||
|
|
||||||
### 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
|
||||||
|
|
||||||
@@ -451,48 +423,10 @@ If you are hosting your own copy of PaperSpigot you can override the download UR
|
|||||||
|
|
||||||
- -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
|
||||||
|
|
||||||
@@ -579,6 +513,10 @@ 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 \
|
-e CF_SERVER_MOD=/modpacks/SkyFactory_4_Server_4.1.0.zip \
|
||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
|
||||||
|
#### 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`.
|
||||||
|
|
||||||
### Fixing "unable to launch forgemodloader"
|
### Fixing "unable to launch forgemodloader"
|
||||||
|
|
||||||
If your server's modpack fails to load with an error [like this](https://support.feed-the-beast.com/t/cant-start-crashlanding-server-unable-to-launch-forgemodloader/6028/2):
|
If your server's modpack fails to load with an error [like this](https://support.feed-the-beast.com/t/cant-start-crashlanding-server-unable-to-launch-forgemodloader/6028/2):
|
||||||
@@ -670,6 +608,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
|
||||||
@@ -975,7 +919,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.
|
||||||
|
|
||||||
@@ -1013,6 +957,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"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -45,6 +45,22 @@ if [[ $PROXY ]]; then
|
|||||||
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
|
||||||
|
|
||||||
@@ -55,11 +71,8 @@ case "X$VERSION" in
|
|||||||
XSNAPSHOT|Xsnapshot)
|
XSNAPSHOT|Xsnapshot)
|
||||||
VANILLA_VERSION=$(curl -fsSL $VERSIONS_JSON | jq -r '.latest.snapshot')
|
VANILLA_VERSION=$(curl -fsSL $VERSIONS_JSON | jq -r '.latest.snapshot')
|
||||||
;;
|
;;
|
||||||
X[1-9]*)
|
|
||||||
VANILLA_VERSION=$VERSION
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
VANILLA_VERSION=$(curl -fsSL $VERSIONS_JSON | jq -r '.latest.release')
|
VANILLA_VERSION=$VERSION
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
export VANILLA_VERSION
|
export VANILLA_VERSION
|
||||||
@@ -129,8 +142,9 @@ case "${TYPE^^}" in
|
|||||||
|
|
||||||
*)
|
*)
|
||||||
log "Invalid type: '$TYPE'"
|
log "Invalid type: '$TYPE'"
|
||||||
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA, CURSEFORGE, SPONGEVANILLA,"
|
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
||||||
log " CUSTOM, CURSE_INSTANCE, MAGMA, MOHIST, CATSERVER"
|
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA,"
|
||||||
|
log " CUSTOM, MAGMA, MOHIST, CATSERVER"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
@@ -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 $@
|
||||||
|
|||||||
@@ -29,4 +29,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 "$@"
|
||||||
|
|||||||
@@ -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 $@
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
export FTB_BASE_DIR=/data/FeedTheBeast
|
export FTB_BASE_DIR=/data/FeedTheBeast
|
||||||
@@ -9,18 +11,67 @@ export TYPE=FEED-THE-BEAST
|
|||||||
FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
|
FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
|
||||||
|
|
||||||
log "Looking for Feed-The-Beast / CurseForge server modpack."
|
log "Looking for Feed-The-Beast / CurseForge server modpack."
|
||||||
if [[ -z $FTB_SERVER_MOD ]]; then
|
requireVar FTB_SERVER_MOD
|
||||||
log "Environment variable FTB_SERVER_MOD not set."
|
|
||||||
log "Set FTB_SERVER_MOD to the file name of the FTB server modpack."
|
if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
|
||||||
log "(And place the modpack in the /data directory.)"
|
if ! [ -f ${FTB_SERVER_MOD} ]; then
|
||||||
|
log "ERROR unable to find requested modpack file ${FTB_SERVER_MOD}"
|
||||||
exit 2
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
needsInstall=true
|
||||||
|
installMarker=/data/.curseforge-installed
|
||||||
|
if [ -f $installMarker ]; then
|
||||||
|
if [ "$(cat $installMarker)" != "${FTB_SERVER_MOD}" ]; then
|
||||||
|
log "Upgrading modpack"
|
||||||
|
|
||||||
|
serverJar=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
|
||||||
|
if [[ "${serverJar}" ]]; then
|
||||||
|
rm -rf $(dirname "${serverJar}")/{mods,*.jar,libraries,resources,scripts}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
needsInstall=false
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $needsInstall; then
|
||||||
|
log "Unpacking FTB server modpack ${FTB_SERVER_MOD} ..."
|
||||||
|
mkdir -p ${FTB_BASE_DIR}
|
||||||
|
unzip -o ${FTB_SERVER_MOD} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
||||||
|
|
||||||
|
forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar")
|
||||||
|
if [[ -z "${forgeInstallerJar}" ]]; then
|
||||||
|
log "ERROR Unable to find forge installer in modpack."
|
||||||
|
log " Make sure you downloaded the server files."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Installing forge server"
|
||||||
|
(cd $(dirname "${forgeInstallerJar}"); java -jar $(basename ${forgeInstallerJar}) --installServer) | awk '{printf "."} END {print ""}'
|
||||||
|
|
||||||
|
echo "${FTB_SERVER_MOD}" > $installMarker
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SERVER=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
|
||||||
|
if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then
|
||||||
|
log "ERROR unable to locate installed forge server jar"
|
||||||
|
isDebugging && find ${FTB_BASE_DIR} -name "forge*.jar"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
export FTB_DIR=$(dirname "${SERVER}")
|
||||||
|
|
||||||
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
fi
|
fi
|
||||||
|
|
||||||
entryScriptExpr="
|
entryScriptExpr="
|
||||||
-name ServerStart.sh
|
-name ServerStart.sh
|
||||||
|
-o -name serverstart.sh
|
||||||
-o -name ServerStartLinux.sh
|
-o -name ServerStartLinux.sh
|
||||||
-o -name LaunchServer.sh
|
-o -name LaunchServer.sh
|
||||||
-o -name server-start.sh
|
-o -name server-start.sh
|
||||||
|
-o -name startserver.sh
|
||||||
|
-o -name StartServer.sh
|
||||||
"
|
"
|
||||||
|
|
||||||
if [[ -d ${FTB_BASE_DIR} ]]; then
|
if [[ -d ${FTB_BASE_DIR} ]]; then
|
||||||
@@ -135,4 +186,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 $@
|
||||||
|
|||||||
@@ -75,4 +75,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Contineut to Final Setup
|
# Contineut to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -113,4 +113,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -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 $@
|
||||||
|
|||||||
@@ -40,4 +40,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 "$@"
|
||||||
|
|||||||
@@ -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 $@
|
||||||
|
|||||||
@@ -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 $@
|
||||||
|
|||||||
@@ -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 $@
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
|||||||
if [ $result != 0 ]; then
|
if [ $result != 0 ]; then
|
||||||
log "ERROR failed to obtain version manifest from $versionManifestUrl ($result)"
|
log "ERROR failed to obtain version manifest from $versionManifestUrl ($result)"
|
||||||
exit 1
|
exit 1
|
||||||
|
elif [ $serverDownloadUrl = null ]; then
|
||||||
|
log "ERROR version $VANILLA_VERSION does not provide a server download"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debug "Downloading server from $serverDownloadUrl"
|
debug "Downloading server from $serverDownloadUrl"
|
||||||
@@ -43,4 +46,4 @@ fi
|
|||||||
isDebugging && ls -l
|
isDebugging && ls -l
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -2,8 +2,26 @@
|
|||||||
|
|
||||||
. ${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..."
|
||||||
|
|
||||||
|
# File excludes
|
||||||
|
fileExcludes=
|
||||||
|
for f in ${REPLACE_ENV_VARIABLES_EXCLUDES}; do
|
||||||
|
fileExcludes="${fileExcludes} -not -name $f"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Directory excludes (recursive)
|
||||||
|
dirExcludes=$(join_by " -o -path " ${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS})
|
||||||
|
if [[ $dirExcludes ]]; then
|
||||||
|
dirExcludes=" -type d ( -path ${dirExcludes} ) -prune -o"
|
||||||
|
fi
|
||||||
|
|
||||||
|
isDebugging && echo "Using find file exclusions: $fileExcludes"
|
||||||
|
isDebugging && echo "Using find directory exclusions: $dirExcludes"
|
||||||
|
|
||||||
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
|
||||||
@@ -17,9 +35,12 @@ if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log "Replacing $name with $value ..."
|
log "Replacing $name with $value ..."
|
||||||
find /data/ -type f \
|
find /data/ \
|
||||||
|
$dirExcludes \
|
||||||
|
-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" \) \
|
||||||
|
$fileExcludes \
|
||||||
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
||||||
fi
|
fi
|
||||||
done < <(env)
|
done < <(env)
|
||||||
@@ -24,4 +24,4 @@ case "X$MODCONFIG" in
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-finalSetup04ServerProperties $@
|
exec ${SCRIPTS:-/}start-finalSetupPlugins $@
|
||||||
@@ -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
23
start-finalSetupPlugins
Executable 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 $@
|
||||||
@@ -206,4 +206,4 @@ if isDebugging; then
|
|||||||
cat /data/server.properties
|
cat /data/server.properties
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-finalSetup05EnvVariables $@
|
exec ${SCRIPTS:-/}start-finalSetupEnvVariables $@
|
||||||
@@ -10,7 +10,7 @@ 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 $@
|
||||||
@@ -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
|
||||||
@@ -170,49 +158,60 @@ if isTrue "${DEBUG_MEMORY}"; then
|
|||||||
free -m
|
free -m
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
|
||||||
|
|
||||||
|
function copyFilesForCurseForge() {
|
||||||
|
# copy player modification files unconditionally since their
|
||||||
|
# processing into json is additive anyway
|
||||||
|
[ -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}/server-icon.png" -a -e /data/server-icon.png ]; then
|
||||||
|
cp -f /data/server-icon.png ${FTB_DIR}/
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp -f /data/eula.txt "${FTB_DIR}/"
|
||||||
|
}
|
||||||
|
|
||||||
mcServerRunnerArgs="--stop-duration 60s"
|
mcServerRunnerArgs="--stop-duration 60s"
|
||||||
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
||||||
JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
|
|
||||||
if isTrue ${DEBUG_EXEC}; then
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
exec mc-server-runner ${mcServerRunnerArgs} \
|
exec mc-server-runner ${mcServerRunnerArgs} \
|
||||||
--cf-instance-file "${CURSE_INSTANCE_JSON}" \
|
--cf-instance-file "${CURSE_INSTANCE_JSON}" \
|
||||||
java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar _SERVERJAR_ "$@" $EXTRA_ARGS
|
java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar _SERVERJAR_ "$@" $EXTRA_ARGS
|
||||||
|
elif [[ ${TYPE} == "FEED-THE-BEAST" && "${SERVER}" ]]; then
|
||||||
|
copyFilesForCurseForge
|
||||||
|
|
||||||
|
cd "${FTB_DIR}"
|
||||||
|
log "Starting CurseForge server in ${FTB_DIR}..."
|
||||||
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar $(basename "${SERVER}") "$@" $EXTRA_ARGS
|
||||||
elif [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
|
elif [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
|
||||||
mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash"
|
mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash"
|
||||||
|
|
||||||
if [ ! -e "${FTB_DIR}/ops.json" -a -e /data/ops.txt ]; then
|
copyFilesForCurseForge
|
||||||
cp -f /data/ops.txt ${FTB_DIR}/
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${FTB_DIR}/whitelist.json" -a -e /data/white-list.txt ]; then
|
cat > "${FTB_DIR}/settings-local.sh" <<EOF
|
||||||
cp -f /data/white-list.txt ${FTB_DIR}/
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${FTB_DIR}/server-icon.png" -a -e /data/server-icon.png ]; then
|
|
||||||
cp -f /data/server-icon.png ${FTB_DIR}/
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp -f /data/eula.txt "${FTB_DIR}/"
|
|
||||||
|
|
||||||
cat > "${FTB_DIR}/settings-local.sh" <<EOF
|
|
||||||
export MIN_RAM="${INIT_MEMORY}"
|
export MIN_RAM="${INIT_MEMORY}"
|
||||||
export MAX_RAM="${MAX_MEMORY}"
|
export MAX_RAM="${MAX_MEMORY}"
|
||||||
export JAVA_PARAMETERS="${JVM_XX_OPTS} -Xms${INIT_MEMORY} ${JVM_OPTS} $expandedDOpts"
|
export JAVA_PARAMETERS="${JVM_XX_OPTS} -Xms${INIT_MEMORY} ${JVM_OPTS} $expandedDOpts"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# patch CurseForge cfg file, if present
|
# patch CurseForge cfg file, if present
|
||||||
if [ -f "${FTB_DIR}/settings.cfg" ]; then
|
if [ -f "${FTB_DIR}/settings.cfg" ]; then
|
||||||
sed -i "s/MAX_RAM=[^;]*/MAX_RAM=${MAX_MEMORY}/" "${FTB_DIR}/settings.cfg"
|
sed -i "s/MAX_RAM=[^;]*/MAX_RAM=${MAX_MEMORY}/" "${FTB_DIR}/settings.cfg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${FTB_DIR}"
|
cd "${FTB_DIR}"
|
||||||
log "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
|
log "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
|
||||||
if isTrue ${DEBUG_EXEC}; then
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
exec mc-server-runner ${mcServerRunnerArgs} "${FTB_SERVER_START}"
|
exec mc-server-runner ${mcServerRunnerArgs} "${FTB_SERVER_START}"
|
||||||
else
|
else
|
||||||
# If we have a bootstrap.txt file... feed that in to the server stdin
|
# If we have a bootstrap.txt file... feed that in to the server stdin
|
||||||
if [ -f /data/bootstrap.txt ]; then
|
if [ -f /data/bootstrap.txt ]; then
|
||||||
@@ -220,7 +219,6 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log "Starting the Minecraft server..."
|
log "Starting the Minecraft server..."
|
||||||
JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
|
|
||||||
if isTrue ${DEBUG_EXEC}; then
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
@@ -106,4 +108,8 @@ requireVar() {
|
|||||||
log "ERROR: $1 is required to be set"
|
log "ERROR: $1 is required to be set"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ -z "${!1}" ]; then
|
||||||
|
log "ERROR: $1 is required to be set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 "$@"
|
||||||
|
|||||||
17
tests/docker-compose.test.yml
Normal file
17
tests/docker-compose.test.yml
Normal 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
17
tests/test.sh
Executable 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
|
||||||
|
|
||||||
Reference in New Issue
Block a user