mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-06-06 18:59:44 +00:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d3e461b4c | |||
| ede58d9159 | |||
| b271b529ea | |||
| d24690ab8c | |||
| 89fa3ff8fe | |||
| 5c0a3a64ab | |||
| b66629b951 | |||
| de866a322f | |||
| fd73417411 | |||
| 79ac19937f | |||
| 08e8fcdc7c | |||
| 6941e63a2c | |||
| c68997936a | |||
| 40547439b2 | |||
| 1207b9a685 | |||
| 691fe638e4 | |||
| fbdee6a7a7 | |||
| 664f3d7eaa | |||
| c2846fc586 | |||
| e9b1332119 | |||
| 757a5146a1 | |||
| f9defda106 | |||
| e6a3ca0a1f | |||
| e6259bfd9d | |||
| 1cf478f5b3 | |||
| 9ff94f9bd5 | |||
| 9842a52820 | |||
| dbca9c30b0 | |||
| 220f2fbd79 | |||
| 8dbbdd8cd2 | |||
| 1c2a0c506c | |||
| 90a6707280 | |||
| e7cc54092a | |||
| b5e7b952e4 | |||
| ac5b960182 | |||
| 3299dec733 | |||
| 578f06087f | |||
| fb364e8301 |
+2
-1
@@ -1,4 +1,5 @@
|
|||||||
data
|
data
|
||||||
examples
|
examples
|
||||||
k8s-examples
|
k8s-examples
|
||||||
.idea
|
.idea
|
||||||
|
.git
|
||||||
+6
-7
@@ -1,4 +1,4 @@
|
|||||||
FROM openjdk:8u212-jre-alpine
|
FROM adoptopenjdk/openjdk13:alpine-jre
|
||||||
|
|
||||||
LABEL maintainer "itzg"
|
LABEL maintainer "itzg"
|
||||||
|
|
||||||
@@ -21,8 +21,8 @@ HEALTHCHECK --start-period=1m CMD mc-monitor status --host localhost --port $SER
|
|||||||
|
|
||||||
RUN addgroup -g 1000 minecraft \
|
RUN addgroup -g 1000 minecraft \
|
||||||
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
|
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
|
||||||
&& mkdir -m 777 /data /mods /config /plugins \
|
&& mkdir -m 777 /data \
|
||||||
&& chown minecraft:minecraft /data /config /mods /plugins /home/minecraft
|
&& chown minecraft:minecraft /data /home/minecraft
|
||||||
|
|
||||||
EXPOSE 25565 25575
|
EXPOSE 25565 25575
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
|||||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||||
|
|
||||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||||
--var version=1.3.5 --var app=mc-server-runner --file {{.app}} \
|
--var version=1.4.3 --var app=mc-server-runner --file {{.app}} \
|
||||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||||
|
|
||||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||||
@@ -66,11 +66,10 @@ WORKDIR /data
|
|||||||
ENTRYPOINT [ "/start" ]
|
ENTRYPOINT [ "/start" ]
|
||||||
|
|
||||||
ENV UID=1000 GID=1000 \
|
ENV UID=1000 GID=1000 \
|
||||||
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
MEMORY="1G" \
|
||||||
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 \
|
||||||
RESOURCE_PACK= RESOURCE_PACK_SHA1= \
|
LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
||||||
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= MODS= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true SERVER_NAME="Dedicated Server" \
|
|
||||||
REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_"
|
REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_"
|
||||||
|
|
||||||
COPY start* /
|
COPY start* /
|
||||||
|
|||||||
@@ -93,6 +93,24 @@ such as
|
|||||||
|
|
||||||
docker run -d -it -e EULA=TRUE -p 25565:25565 --name mc itzg/minecraft-server
|
docker run -d -it -e EULA=TRUE -p 25565:25565 --name mc itzg/minecraft-server
|
||||||
|
|
||||||
|
## Timezone Configuration
|
||||||
|
|
||||||
|
You can configure the timezone to match yours by setting the `TZ` environment variable:
|
||||||
|
|
||||||
|
-e TZ=Europe/London
|
||||||
|
|
||||||
|
such as:
|
||||||
|
|
||||||
|
docker run -d -it -e TZ=Europe/London -p 25565:25565 --name mc itzg/minecraft-server
|
||||||
|
|
||||||
|
Or mounting `/etc/timezone` as readonly (not supported on Windows):
|
||||||
|
|
||||||
|
-v /etc/timezone:/etc/timezone:ro
|
||||||
|
|
||||||
|
such as:
|
||||||
|
|
||||||
|
docker run -d -it -v /etc/timezone:/etc/timezone:ro -p 25565:25565 --name mc itzg/minecraft-server
|
||||||
|
|
||||||
## Attaching data directory to host filesystem
|
## Attaching data directory to host filesystem
|
||||||
|
|
||||||
In order to readily access the Minecraft data, use the `-v` argument
|
In order to readily access the Minecraft data, use the `-v` argument
|
||||||
@@ -145,8 +163,8 @@ Keep in mind that some versions of Minecraft server can't work on the newest ver
|
|||||||
|
|
||||||
## Healthcheck
|
## Healthcheck
|
||||||
|
|
||||||
This image contains [Dinnerbone's mcstatus](https://github.com/Dinnerbone/mcstatus) and uses
|
This image contains [mc-monitor](https://github.com/itzg/mc-monitor) and uses
|
||||||
its `ping` command to continually check on the container's. That can be observed
|
its `status` command to continually check on the container's. That can be observed
|
||||||
from the `STATUS` column of `docker ps`
|
from the `STATUS` column of `docker ps`
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -161,16 +179,6 @@ You can also query the container's health in a script friendly way:
|
|||||||
healthy
|
healthy
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, since `mcstatus` is on the `PATH` you can exec into the container
|
|
||||||
and use mcstatus directly and invoke any of its other commands:
|
|
||||||
|
|
||||||
```
|
|
||||||
> docker exec mc mcstatus localhost status
|
|
||||||
version: v1.12 (protocol 335)
|
|
||||||
description: "{u'text': u'A Minecraft Server Powered by Docker'}"
|
|
||||||
players: 0/20 No players online
|
|
||||||
```
|
|
||||||
|
|
||||||
## Deployment Templates and Examples
|
## Deployment Templates and Examples
|
||||||
|
|
||||||
### Helm Charts
|
### Helm Charts
|
||||||
@@ -240,7 +248,7 @@ up:
|
|||||||
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
||||||
or downloading a world with the `WORLD` option.
|
or downloading a world with the `WORLD` option.
|
||||||
|
|
||||||
There are two additional volumes that can be mounted; `/mods` and `/config`.
|
There are two additional volumes that can be mounted; `/mods` and `/config`.
|
||||||
Any files in either of these filesystems will be copied over to the main
|
Any files in either of these filesystems will be copied over to the main
|
||||||
`/data` filesystem before starting Minecraft.
|
`/data` filesystem before starting Minecraft.
|
||||||
|
|
||||||
@@ -269,6 +277,8 @@ Optionally you can also define a prefix to only match predefined enviroment vari
|
|||||||
|
|
||||||
`ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix
|
`ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix
|
||||||
|
|
||||||
|
If you want use file for value (like when use secrets) you can add suffix `_FILE` to your variable name (in run command).
|
||||||
|
|
||||||
There are some limitations to what characters you can use.
|
There are some limitations to what characters you can use.
|
||||||
|
|
||||||
| Type | Allowed Characters |
|
| Type | Allowed Characters |
|
||||||
@@ -315,7 +325,7 @@ services:
|
|||||||
# and here are the actual variables
|
# and here are the actual variables
|
||||||
CFG_DB_HOST: "http://localhost:3306"
|
CFG_DB_HOST: "http://localhost:3306"
|
||||||
CFG_DB_NAME: "minecraft"
|
CFG_DB_NAME: "minecraft"
|
||||||
CFG_DB_PASSWORD: "ug23u3bg39o-ogADSs"
|
CFG_DB_PASSWORD_FILE: "/run/secrets/db_password"
|
||||||
restart: always
|
restart: always
|
||||||
rcon:
|
rcon:
|
||||||
image: itzg/rcon
|
image: itzg/rcon
|
||||||
@@ -328,8 +338,16 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
mc:
|
mc:
|
||||||
rcon:
|
rcon:
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
db_password:
|
||||||
|
file: ./db_password
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The content of `db_password`:
|
||||||
|
|
||||||
|
ug23u3bg39o-ogADSs
|
||||||
|
|
||||||
## Running a Bukkit/Spigot server
|
## Running a Bukkit/Spigot server
|
||||||
|
|
||||||
Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT -e VERSION=1.8` or `-e TYPE=SPIGOT -e VERSION=1.8` to your command-line.
|
Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT -e VERSION=1.8` or `-e TYPE=SPIGOT -e VERSION=1.8` to your command-line.
|
||||||
@@ -384,7 +402,7 @@ up:
|
|||||||
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
||||||
or downloading a world with the `WORLD` option.
|
or downloading a world with the `WORLD` option.
|
||||||
|
|
||||||
There is one additional volume that can be mounted; `/plugins`.
|
There is one additional volume that can be mounted; `/plugins`.
|
||||||
Any files in this filesystem will be copied over to the main
|
Any files in this filesystem will be copied over to the main
|
||||||
`/data/plugins` filesystem before starting Minecraft.
|
`/data/plugins` filesystem before starting Minecraft.
|
||||||
|
|
||||||
@@ -396,6 +414,9 @@ in either persistent volumes or a downloadable archive.
|
|||||||
|
|
||||||
Enable PaperSpigot server mode by adding a `-e TYPE=PAPER -e VERSION=1.9.4` to your command-line.
|
Enable PaperSpigot server mode by adding a `-e TYPE=PAPER -e VERSION=1.9.4` to your command-line.
|
||||||
|
|
||||||
|
By default the container will run the latest build of [Paper server](https://papermc.io/downloads)
|
||||||
|
but you can also choose to run a specific build with `-e PAPERBUILD=205`.
|
||||||
|
|
||||||
docker run -d -v /path/on/host:/data \
|
docker run -d -v /path/on/host:/data \
|
||||||
-e TYPE=PAPER -e VERSION=1.9.4 \
|
-e TYPE=PAPER -e VERSION=1.9.4 \
|
||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
@@ -446,7 +467,7 @@ up:
|
|||||||
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
||||||
or downloading a world with the `WORLD` option.
|
or downloading a world with the `WORLD` option.
|
||||||
|
|
||||||
There is one additional volume that can be mounted; `/plugins`.
|
There is one additional volume that can be mounted; `/plugins`.
|
||||||
Any files in this filesystem will be copied over to the main
|
Any files in this filesystem will be copied over to the main
|
||||||
`/data/plugins` filesystem before starting Minecraft.
|
`/data/plugins` filesystem before starting Minecraft.
|
||||||
|
|
||||||
@@ -454,6 +475,22 @@ 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
|
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.
|
||||||
|
|
||||||
|
## Running a Tuinity server
|
||||||
|
|
||||||
|
A [Tuinity](https://github.com/Spottedleaf/Tuinity) server, which is a fork of Paper aimed at improving server performance at high playercounts.
|
||||||
|
|
||||||
|
-e TYPE=TUINITY
|
||||||
|
|
||||||
|
> **NOTE** only `VERSION=LATEST` is supported
|
||||||
|
|
||||||
|
## Running a Magma server
|
||||||
|
|
||||||
|
A [Magma](https://magmafoundation.org/) server, which is a combination of Forge and PaperMC, can be used with
|
||||||
|
|
||||||
|
-e TYPE=MAGMA
|
||||||
|
|
||||||
|
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
|
||||||
|
|
||||||
## Running a Server with a Feed-The-Beast (FTB) / CurseForge modpack
|
## Running a Server with a Feed-The-Beast (FTB) / CurseForge modpack
|
||||||
|
|
||||||
Enable this server mode by adding a `-e TYPE=FTB` or `-e TYPE=CURSEFORGE` to your command-line,
|
Enable this server mode by adding a `-e TYPE=FTB` or `-e TYPE=CURSEFORGE` to your command-line,
|
||||||
@@ -461,8 +498,8 @@ but note the following additional steps needed...
|
|||||||
|
|
||||||
You need to specify a modpack to run, using the `FTB_SERVER_MOD` or `CF_SERVER_MOD` environment
|
You need to specify a modpack to run, using the `FTB_SERVER_MOD` or `CF_SERVER_MOD` environment
|
||||||
variable. An FTB/CurseForge server modpack is available together with its respective
|
variable. An FTB/CurseForge server modpack is available together with its respective
|
||||||
client modpack on https://www.feed-the-beast.com under "Additional Files." Similar you can
|
client modpack on <https://www.feed-the-beast.com> under "Additional Files." Similar you can
|
||||||
locate the modpacks for CurseForge at https://www.curseforge.com/minecraft/modpacks .
|
locate the modpacks for CurseForge at <https://www.curseforge.com/minecraft/modpacks> .
|
||||||
|
|
||||||
Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line.
|
Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line.
|
||||||
|
|
||||||
@@ -470,7 +507,7 @@ Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line.
|
|||||||
-e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \
|
-e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \
|
||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
|
||||||
If you don't want to keep the pre-download modpacks separate from your data directory,
|
If you want to keep the pre-download modpacks separate from your data directory,
|
||||||
then you can attach another volume at a path of your choosing and reference that.
|
then you can attach another volume at a path of your choosing and reference that.
|
||||||
The following example uses `/modpacks` as the container path as the pre-download area:
|
The following example uses `/modpacks` as the container path as the pre-download area:
|
||||||
|
|
||||||
@@ -500,7 +537,7 @@ To use these packs you will need to:
|
|||||||
- Specify the manifest location with env var `MANIFEST=/data/FeedTheBeast/manifest`
|
- Specify the manifest location with env var `MANIFEST=/data/FeedTheBeast/manifest`
|
||||||
- Pick a relevant ServerStart.sh and potentially settings.cfg and put them in `/data/FeedTheBeast`
|
- Pick a relevant ServerStart.sh and potentially settings.cfg and put them in `/data/FeedTheBeast`
|
||||||
|
|
||||||
An example of the latter would be to use https://github.com/AllTheMods/Server-Scripts
|
An example of the latter would be to use <https://github.com/AllTheMods/Server-Scripts>
|
||||||
There, you'll find that all you have to do is put `ServerStart.sh` and `settings.cfg` into
|
There, you'll find that all you have to do is put `ServerStart.sh` and `settings.cfg` into
|
||||||
`/data/FeedTheBeast`, taking care to update `settings.cfg` to specify your desired version
|
`/data/FeedTheBeast`, taking care to update `settings.cfg` to specify your desired version
|
||||||
of minecraft and forge. You can do this in the cli with something like:
|
of minecraft and forge. You can do this in the cli with something like:
|
||||||
@@ -598,7 +635,7 @@ up:
|
|||||||
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
||||||
or downloading a world with the `WORLD` option.
|
or downloading a world with the `WORLD` option.
|
||||||
|
|
||||||
There are two additional volumes that can be mounted; `/mods` and `/config`.
|
There are two additional volumes that can be mounted; `/mods` and `/config`.
|
||||||
Any files in either of these filesystems will be copied over to the main
|
Any files in either of these filesystems will be copied over to the main
|
||||||
`/data` filesystem before starting Minecraft.
|
`/data` filesystem before starting Minecraft.
|
||||||
|
|
||||||
@@ -997,6 +1034,12 @@ Allows users to use flight on your server while in Survival mode, if they have a
|
|||||||
|
|
||||||
-e ALLOW_FLIGHT=TRUE|FALSE
|
-e ALLOW_FLIGHT=TRUE|FALSE
|
||||||
|
|
||||||
|
### Other server property mappings
|
||||||
|
|
||||||
|
Environment Variable | Server Property
|
||||||
|
---------------------|-----------------
|
||||||
|
PLAYER_IDLE_TIMEOUT | player-idle-timeout
|
||||||
|
|
||||||
## Miscellaneous Options
|
## Miscellaneous Options
|
||||||
|
|
||||||
### Running as alternate user/group ID
|
### Running as alternate user/group ID
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#!/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
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
ports:
|
||||||
|
- 25565:25565
|
||||||
|
volumes:
|
||||||
|
# Attach .../Curse/Minecraft/Instances for use at /instances
|
||||||
|
- ./Instances:/instances:ro
|
||||||
|
# Attach /data as usual
|
||||||
|
- ./ServerData:/data
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
# Modpacks generally need more memory, so let's give at 2 GB
|
||||||
|
MEMORY: 2G
|
||||||
|
# Use new CURSE_INSTANCE type
|
||||||
|
TYPE: CURSE_INSTANCE
|
||||||
|
# Reference directory of or full path to minecraftinstance.json
|
||||||
|
CURSE_INSTANCE_JSON: /instances/FTB Presents SkyFactory 3
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
ports:
|
||||||
|
# expose the Minecraft server port outside of container
|
||||||
|
- 25565:25565
|
||||||
|
environment:
|
||||||
|
# REQUIRED for all types
|
||||||
|
EULA: "TRUE"
|
||||||
|
# Set server type (vs the default of vanilla)
|
||||||
|
TYPE: FORGE
|
||||||
|
volumes:
|
||||||
|
# use a named, managed volume for data volume
|
||||||
|
- mc_forge:/data
|
||||||
|
# attach local host directory "mods" in same directory as this compose file
|
||||||
|
# all mods in this directory get copied into /data/mods at startup
|
||||||
|
- ./mods:/mods:ro
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
# declared the named volume, but use default/local storage engine
|
||||||
|
mc_forge: {}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "WARNING: mcstatus is deprecated; calling mc-monitor instead"
|
||||||
|
|
||||||
##### mcstatus shim for mc-monitor
|
##### mcstatus shim for mc-monitor
|
||||||
# handles translating calls to
|
# handles translating calls to
|
||||||
# mcstatus (host:port) (command)
|
# mcstatus (host:port) (command)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ snooper-enabled=true
|
|||||||
texture-pack=
|
texture-pack=
|
||||||
online-mode=true
|
online-mode=true
|
||||||
resource-pack=
|
resource-pack=
|
||||||
|
resource-pack-sha1=
|
||||||
pvp=true
|
pvp=true
|
||||||
difficulty=1
|
difficulty=1
|
||||||
enable-command-block=true
|
enable-command-block=true
|
||||||
|
|||||||
+29
-16
@@ -19,9 +19,9 @@ if [ ! -e /data/eula.txt ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "# Generated via Docker on $(date)" > eula.txt
|
echo "# Generated via Docker on $(date)" > /data/eula.txt
|
||||||
echo "eula=$EULA" >> eula.txt
|
|
||||||
if [ $? != 0 ]; then
|
if ! echo "eula=$EULA" >> /data/eula.txt; then
|
||||||
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
@@ -49,56 +49,69 @@ export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.js
|
|||||||
|
|
||||||
case "X$VERSION" in
|
case "X$VERSION" in
|
||||||
X|XLATEST|Xlatest)
|
X|XLATEST|Xlatest)
|
||||||
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.release'`
|
VANILLA_VERSION=$(curl -fsSL $VERSIONS_JSON | jq -r '.latest.release')
|
||||||
;;
|
;;
|
||||||
XSNAPSHOT|Xsnapshot)
|
XSNAPSHOT|Xsnapshot)
|
||||||
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.snapshot'`
|
VANILLA_VERSION=$(curl -fsSL $VERSIONS_JSON | jq -r '.latest.snapshot')
|
||||||
;;
|
;;
|
||||||
X[1-9]*)
|
X[1-9]*)
|
||||||
export VANILLA_VERSION=$VERSION
|
VANILLA_VERSION=$VERSION
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.release'`
|
VANILLA_VERSION=$(curl -fsSL $VERSIONS_JSON | jq -r '.latest.release')
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
export VANILLA_VERSION
|
||||||
log "Resolved version given ${VERSION} into ${VANILLA_VERSION}"
|
log "Resolved version given ${VERSION} into ${VANILLA_VERSION}"
|
||||||
|
|
||||||
cd /data
|
cd /data || exit 1
|
||||||
|
|
||||||
export ORIGINAL_TYPE=${TYPE^^}
|
export ORIGINAL_TYPE=${TYPE^^}
|
||||||
|
|
||||||
log "Resolving type given ${TYPE}"
|
log "Resolving type given ${TYPE}"
|
||||||
case "${TYPE^^}" in
|
case "${TYPE^^}" in
|
||||||
*BUKKIT|SPIGOT)
|
*BUKKIT|SPIGOT)
|
||||||
exec /start-deployBukkitSpigot $@
|
exec /start-deployBukkitSpigot "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
PAPER)
|
PAPER)
|
||||||
exec /start-deployPaper $@
|
exec /start-deployPaper "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
|
TUINITY)
|
||||||
|
exec /start-deployTuinity "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
FORGE)
|
FORGE)
|
||||||
exec /start-deployForge $@
|
exec /start-deployForge "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
FABRIC)
|
FABRIC)
|
||||||
exec /start-deployFabric $@
|
exec /start-deployFabric "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
FTB|CURSEFORGE)
|
FTB|CURSEFORGE)
|
||||||
exec /start-deployFTB $@
|
exec /start-deployFTB "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
VANILLA)
|
VANILLA)
|
||||||
exec /start-deployVanilla $@
|
exec /start-deployVanilla "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
SPONGEVANILLA)
|
SPONGEVANILLA)
|
||||||
exec /start-deploySpongeVanilla $@
|
exec /start-deploySpongeVanilla "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
CUSTOM)
|
CUSTOM)
|
||||||
exec /start-deployCustom $@
|
exec /start-deployCustom "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
|
CURSE_INSTANCE)
|
||||||
|
exec /start-validateCurseInstance "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
|
MAGMA)
|
||||||
|
exec /start-magma "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -5,6 +5,11 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
function buildSpigotFromSource {
|
function buildSpigotFromSource {
|
||||||
|
if [[ ${TYPE^^} = *BUKKIT ]] && ! versionLessThan "1.14"; then
|
||||||
|
log "ERR craftbukkit build is only supported for versions less than 1.14"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
log "Building Spigot $VANILLA_VERSION from source, might take a while, get some coffee"
|
log "Building Spigot $VANILLA_VERSION from source, might take a while, get some coffee"
|
||||||
rm -rf /data/temp
|
rm -rf /data/temp
|
||||||
mkdir /data/temp
|
mkdir /data/temp
|
||||||
@@ -15,12 +20,24 @@ function buildSpigotFromSource {
|
|||||||
logn ''
|
logn ''
|
||||||
curl -sSL -o /data/temp/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
|
curl -sSL -o /data/temp/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
|
||||||
java $jvmOpts -jar /data/temp/BuildTools.jar --rev $VANILLA_VERSION 2>&1 |tee /data/spigot_build.log| while read l; do echo -n .; done; log "done"
|
java $jvmOpts -jar /data/temp/BuildTools.jar --rev $VANILLA_VERSION 2>&1 |tee /data/spigot_build.log| while read l; do echo -n .; done; log "done"
|
||||||
if ! mv spigot-*.jar /data/spigot_server.jar; then
|
|
||||||
log "ERR failed to build Spigot"
|
case ${TYPE^^} in
|
||||||
cat /data/spigot_build.log
|
SPIGOT)
|
||||||
exit 1
|
if ! mv spigot-*.jar /data/${SERVER}; then
|
||||||
fi
|
log "ERR failed to build Spigot"
|
||||||
mv craftbukkit-*.jar /data/${SERVER}
|
cat /data/spigot_build.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*BUKKIT)
|
||||||
|
if ! mv craftbukkit-*.jar /data/${SERVER}; then
|
||||||
|
log "ERR failed to build Spigot"
|
||||||
|
cat /data/spigot_build.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
log "Cleaning up"
|
log "Cleaning up"
|
||||||
rm -rf /data/temp
|
rm -rf /data/temp
|
||||||
cd /data
|
cd /data
|
||||||
@@ -57,6 +74,9 @@ ERROR: failed to download from $downloadUrl
|
|||||||
EOF
|
EOF
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
JVM_OPTS="${JVM_OPTS} -DIReallyKnowWhatIAmDoingISwear"
|
||||||
|
export JVM_OPTS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -70,7 +90,7 @@ case "$TYPE" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||||
if [[ "$BUILD_SPIGOT_FROM_SOURCE" = TRUE || "$BUILD_SPIGOT_FROM_SOURCE" = true || "$BUILD_FROM_SOURCE" = TRUE || "$BUILD_FROM_SOURCE" = true ]]; then
|
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
|
||||||
buildSpigotFromSource
|
buildSpigotFromSource
|
||||||
else
|
else
|
||||||
downloadSpigot
|
downloadSpigot
|
||||||
@@ -79,6 +99,7 @@ fi
|
|||||||
|
|
||||||
# Normalize on Spigot for operations below
|
# Normalize on Spigot for operations below
|
||||||
export TYPE=SPIGOT
|
export TYPE=SPIGOT
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec /start-finalSetup01World $@
|
||||||
|
|||||||
@@ -25,5 +25,7 @@ else
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec /start-finalSetup01World $@
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ elif [[ ! -e $FABRIC_INSTALLER ]]; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
installMarker=".fabric-installed-${VANILLA_VERSION}-${FABRIC_VERSION:-manual}"
|
installMarker="/data/.fabric-installed-${VANILLA_VERSION}-${FABRIC_VERSION:-manual}"
|
||||||
|
|
||||||
debug Checking for installMarker ${installMarker}
|
debug Checking for installMarker ${installMarker}
|
||||||
if [[ ! -e $installMarker ]]; then
|
if [[ ! -e $installMarker ]]; then
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ elif [[ ! -e $FORGE_INSTALLER ]]; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
installMarker=".forge-installed-$shortForgeVersion"
|
installMarker="/data/.forge-installed-$shortForgeVersion"
|
||||||
|
|
||||||
if [ ! -e $installMarker ]; then
|
if [ ! -e $installMarker ]; then
|
||||||
if [ ! -e $FORGE_INSTALLER ]; then
|
if [ ! -e $FORGE_INSTALLER ]; then
|
||||||
|
|||||||
+6
-3
@@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
. /start-utils
|
. /start-utils
|
||||||
|
|
||||||
export SERVER=paper_server-${VANILLA_VERSION}.jar
|
: ${PAPERBUILD:=latest}
|
||||||
|
export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar
|
||||||
|
|
||||||
if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||||
downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/latest/download}
|
downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download}
|
||||||
log "Downloading Paper $VANILLA_VERSION from $downloadUrl ..."
|
log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..."
|
||||||
curl -fsSL -o "$SERVER" "$downloadUrl"
|
curl -fsSL -o "$SERVER" "$downloadUrl"
|
||||||
if [ ! -f "$SERVER" ]; then
|
if [ ! -f "$SERVER" ]; then
|
||||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||||
@@ -15,6 +17,7 @@ fi
|
|||||||
|
|
||||||
# Normalize on Spigot for operations below
|
# Normalize on Spigot for operations below
|
||||||
export TYPE=SPIGOT
|
export TYPE=SPIGOT
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec /start-finalSetup01World $@
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /start-utils
|
||||||
|
|
||||||
|
if [ "${VERSION}" != "LATEST" ]; then
|
||||||
|
log "ERROR: Tunity server type only supports VERSION=LATEST"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
: ${TUNITY_BUILD:=lastSuccessfulBuild}
|
||||||
|
export SERVER=tunity-${VANILLA_VERSION}-${TUNITY_BUILD}.jar
|
||||||
|
|
||||||
|
if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||||
|
downloadUrl="https://ci.codemc.io/job/Spottedleaf/job/Tuinity/${TUNITY_BUILD}/artifact/tuinity-paperclip.jar"
|
||||||
|
log "Downloading Tunity (build $TUNITY_BUILD) from $downloadUrl ..."
|
||||||
|
curl -fsSL -o "$SERVER" "$downloadUrl"
|
||||||
|
if [ ! -f "$SERVER" ]; then
|
||||||
|
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Normalize on Spigot for operations below
|
||||||
|
export TYPE=SPIGOT
|
||||||
|
|
||||||
|
# Continue to Final Setup
|
||||||
|
exec /start-finalSetup01World $@
|
||||||
@@ -133,9 +133,22 @@ if [[ "${GENERIC_PACK}" ]]; then
|
|||||||
base_dir=/tmp/generic_pack_base
|
base_dir=/tmp/generic_pack_base
|
||||||
mkdir -p ${base_dir}
|
mkdir -p ${base_dir}
|
||||||
unzip -q -d ${base_dir} ${GENERIC_PACK}
|
unzip -q -d ${base_dir} ${GENERIC_PACK}
|
||||||
depth=$(( ${GENERIC_PACK_STRIP_DIRS:-1} + 1 ))
|
if [ -f /data/manifest.txt ]; then
|
||||||
log "Applying generic pack, stripping $(( depth - 1 )) level ..."
|
log "Manifest exists from older generic pack, cleaning up ..."
|
||||||
find ${base_dir} -type d -mindepth $depth -maxdepth $depth -exec cp -r {} /data/ +
|
while read f; do
|
||||||
|
rm -rf "/data/${f}"
|
||||||
|
done < /data/manifest.txt
|
||||||
|
find /data/* -type d -exec rmdir --ignore-fail-on-non-empty {} +
|
||||||
|
rm -f /data/manifest.txt
|
||||||
|
fi
|
||||||
|
log "Writing generic pack manifest ... "
|
||||||
|
find ${base_dir} -type f -print0 | xargs -0 -I {} echo "{}" | sed "s#${base_dir}/##" > /data/manifest.txt
|
||||||
|
log "Applying generic pack ..."
|
||||||
|
IFS='
|
||||||
|
'
|
||||||
|
set -f
|
||||||
|
for d in $(find ${base_dir} -type d); do mkdir -p "$(sed "s#${base_dir}#/data#" <<< $d)"; done
|
||||||
|
for f in $(find ${base_dir} -type f); do cp -f "$f" "$(sed "s#${base_dir}#/data#" <<< $f)"; done
|
||||||
rm -rf ${base_dir}
|
rm -rf ${base_dir}
|
||||||
sha256sum ${GENERIC_PACK} > ${sum_file}
|
sha256sum ${GENERIC_PACK} > ${sum_file}
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -76,20 +76,37 @@ function customizeServerProps {
|
|||||||
setServerProp "level-type" "${LEVEL_TYPE^^}"
|
setServerProp "level-type" "${LEVEL_TYPE^^}"
|
||||||
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"
|
||||||
|
|
||||||
if [ -n "$DIFFICULTY" ]; then
|
if [ -n "$DIFFICULTY" ]; then
|
||||||
case $DIFFICULTY in
|
case $DIFFICULTY in
|
||||||
peaceful|0)
|
peaceful|0)
|
||||||
DIFFICULTY=0
|
if versionLessThan 1.13; then
|
||||||
|
DIFFICULTY=0
|
||||||
|
else
|
||||||
|
DIFFICULTY=peaceful
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
easy|1)
|
easy|1)
|
||||||
DIFFICULTY=1
|
if versionLessThan 1.13; then
|
||||||
|
DIFFICULTY=1
|
||||||
|
else
|
||||||
|
DIFFICULTY=easy
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
normal|2)
|
normal|2)
|
||||||
DIFFICULTY=2
|
if versionLessThan 1.13; then
|
||||||
|
DIFFICULTY=2
|
||||||
|
else
|
||||||
|
DIFFICULTY=normal
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
hard|3)
|
hard|3)
|
||||||
DIFFICULTY=3
|
if versionLessThan 1.13; then
|
||||||
|
DIFFICULTY=3
|
||||||
|
else
|
||||||
|
DIFFICULTY=hard
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "DIFFICULTY must be peaceful, easy, normal, or hard."
|
log "DIFFICULTY must be peaceful, easy, normal, or hard."
|
||||||
@@ -103,19 +120,33 @@ function customizeServerProps {
|
|||||||
log "Setting mode"
|
log "Setting mode"
|
||||||
MODE_LC=$( echo $MODE | tr '[:upper:]' '[:lower:]' )
|
MODE_LC=$( echo $MODE | tr '[:upper:]' '[:lower:]' )
|
||||||
case $MODE_LC in
|
case $MODE_LC in
|
||||||
0|1|2|3)
|
su*|0)
|
||||||
|
if versionLessThan 1.13; then
|
||||||
|
MODE=0
|
||||||
|
else
|
||||||
|
MODE=survival
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
su*)
|
c*|1)
|
||||||
MODE=0
|
if versionLessThan 1.13; then
|
||||||
|
MODE=1
|
||||||
|
else
|
||||||
|
MODE=creative
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
c*)
|
a*|2)
|
||||||
MODE=1
|
if versionLessThan 1.13; then
|
||||||
|
MODE=2
|
||||||
|
else
|
||||||
|
MODE=adventure
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
a*)
|
sp*|3)
|
||||||
MODE=2
|
if versionLessThan 1.13; then
|
||||||
;;
|
MODE=3
|
||||||
sp*)
|
else
|
||||||
MODE=3
|
MODE=spectator
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "ERROR: Invalid game mode: $MODE"
|
log "ERROR: Invalid game mode: $MODE"
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
|
|||||||
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] \
|
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] \
|
||||||
&& [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] \
|
&& [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] \
|
||||||
&& [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
|
&& [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
|
||||||
|
# Read content from file environment
|
||||||
|
if [[ $name = *"_FILE" ]] && [[ -f $value ]]; then
|
||||||
|
name="${name/_FILE/}"
|
||||||
|
value=$(<$value)
|
||||||
|
fi
|
||||||
|
|
||||||
log "Replacing $name with $value ..."
|
log "Replacing $name with $value ..."
|
||||||
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" \
|
||||||
|
|||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /start-utils
|
||||||
|
|
||||||
|
export SERVER="/data/magma-server-${VANILLA_VERSION}.jar"
|
||||||
|
|
||||||
|
# Always download since new updates of each base version are published frequently
|
||||||
|
if ! curl -o /data/magma-server-${VANILLA_VERSION}.jar -fsSL \
|
||||||
|
https://api.magmafoundation.org/api/resources/Magma/${VANILLA_VERSION}/stable/latest/download; then
|
||||||
|
log "ERROR unable to download version ${VANILLA_VERSION} of Magma"
|
||||||
|
log " Check https://magmafoundation.org/ for available versions"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
|
# Continue to Final Setup
|
||||||
|
exec /start-finalSetup01World $@
|
||||||
+28
-14
@@ -4,14 +4,14 @@
|
|||||||
|
|
||||||
if [ -n "$OPS" ]; then
|
if [ -n "$OPS" ]; then
|
||||||
log "Setting/adding ops"
|
log "Setting/adding ops"
|
||||||
rm -rf ops.txt.converted
|
rm -rf /data/ops.txt.converted
|
||||||
echo $OPS | awk -v RS=, '{print}' > ops.txt
|
echo $OPS | awk -v RS=, '{print}' > /data/ops.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$WHITELIST" ]; then
|
if [ -n "$WHITELIST" ]; then
|
||||||
log "Setting whitelist"
|
log "Setting whitelist"
|
||||||
rm -rf white-list.txt.converted
|
rm -rf /data/white-list.txt.converted
|
||||||
echo $WHITELIST | awk -v RS=, '{print}' > white-list.txt
|
echo $WHITELIST | awk -v RS=, '{print}' > /data/white-list.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$ICON" -a ! -e server-icon.png ]; then
|
if [ -n "$ICON" -a ! -e server-icon.png ]; then
|
||||||
@@ -27,7 +27,7 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${TYPE} != "SPIGOT" ]; then
|
if ! isTrue ${SKIP_LOG4J_CONFIG}; then
|
||||||
# Set up log configuration
|
# Set up log configuration
|
||||||
LOGFILE="/data/log4j2.xml"
|
LOGFILE="/data/log4j2.xml"
|
||||||
if [ ! -e "$LOGFILE" ]; then
|
if [ ! -e "$LOGFILE" ]; then
|
||||||
@@ -41,7 +41,7 @@ fi
|
|||||||
|
|
||||||
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
||||||
log "Checking for JSON files."
|
log "Checking for JSON files."
|
||||||
JSON_FILES=$(find . -maxdepth 1 -name '*.json')
|
JSON_FILES=$(find /data -maxdepth 1 -name '*.json')
|
||||||
for j in $JSON_FILES; do
|
for j in $JSON_FILES; do
|
||||||
if [[ $(cat "$j" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') == "" ]]; then
|
if [[ $(cat "$j" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') == "" ]]; then
|
||||||
log "Fixing JSON $j"
|
log "Fixing JSON $j"
|
||||||
@@ -51,9 +51,9 @@ done
|
|||||||
|
|
||||||
|
|
||||||
# If any modules have been provided, copy them over
|
# If any modules have been provided, copy them over
|
||||||
mkdir -p /data/mods
|
|
||||||
if [ -d /mods ]; then
|
if [ -d /mods ]; then
|
||||||
log "Copying any mods over..."
|
log "Copying any mods over..."
|
||||||
|
mkdir -p /data/mods
|
||||||
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /mods /data
|
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /mods /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ esac
|
|||||||
|
|
||||||
EXTRA_ARGS=""
|
EXTRA_ARGS=""
|
||||||
# Optional disable console
|
# Optional disable console
|
||||||
if [[ ${CONSOLE} = false || ${CONSOLE} = FALSE ]]; then
|
if versionLessThan 1.14 && [[ ${CONSOLE,,} = false ]]; then
|
||||||
EXTRA_ARGS+="--noconsole"
|
EXTRA_ARGS+="--noconsole"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -135,24 +135,25 @@ if isTrue "${USE_AIKAR_FLAGS}"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
JVM_XX_OPTS="${JVM_XX_OPTS}
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
-XX:+UseG1GC -XX:+ParallelRefProcEnabled
|
-XX:+UseG1GC
|
||||||
|
-XX:+ParallelRefProcEnabled
|
||||||
-XX:MaxGCPauseMillis=200
|
-XX:MaxGCPauseMillis=200
|
||||||
-XX:+UnlockExperimentalVMOptions
|
-XX:+UnlockExperimentalVMOptions
|
||||||
-XX:+DisableExplicitGC
|
-XX:+DisableExplicitGC
|
||||||
-XX:-OmitStackTraceInFastThrow
|
|
||||||
-XX:+AlwaysPreTouch
|
-XX:+AlwaysPreTouch
|
||||||
-XX:G1NewSizePercent=${G1NewSizePercent}
|
-XX:G1NewSizePercent=${G1NewSizePercent}
|
||||||
-XX:G1MaxNewSizePercent=${G1MaxNewSizePercent}
|
-XX:G1MaxNewSizePercent=${G1MaxNewSizePercent}
|
||||||
-XX:G1HeapRegionSize=${G1HeapRegionSize}
|
-XX:G1HeapRegionSize=${G1HeapRegionSize}
|
||||||
-XX:G1ReservePercent=${G1ReservePercent}
|
-XX:G1ReservePercent=${G1ReservePercent}
|
||||||
-XX:G1HeapWastePercent=5
|
-XX:G1HeapWastePercent=5
|
||||||
-XX:G1MixedGCCountTarget=8
|
-XX:G1MixedGCCountTarget=4
|
||||||
-XX:InitiatingHeapOccupancyPercent=${InitiatingHeapOccupancyPercent}
|
-XX:InitiatingHeapOccupancyPercent=${InitiatingHeapOccupancyPercent}
|
||||||
-XX:G1MixedGCLiveThresholdPercent=90
|
-XX:G1MixedGCLiveThresholdPercent=90
|
||||||
-XX:G1RSetUpdatingPauseTimePercent=5
|
-XX:G1RSetUpdatingPauseTimePercent=5
|
||||||
-XX:SurvivorRatio=32
|
-XX:SurvivorRatio=32
|
||||||
|
-XX:+PerfDisableSharedMem
|
||||||
-XX:MaxTenuringThreshold=1
|
-XX:MaxTenuringThreshold=1
|
||||||
-Dusing.aikars.flags=true
|
-Dusing.aikars.flags=https://mcflags.emc.gs
|
||||||
-Daikars.new.flags=true
|
-Daikars.new.flags=true
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
@@ -163,9 +164,22 @@ if isTrue "${USE_LARGE_PAGES}"; then
|
|||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mcServerRunnerArgs="--stop-duration 60s"
|
if isTrue "${DEBUG_MEMORY}"; then
|
||||||
|
log "Memory usage and availability (in MB)"
|
||||||
|
uname -a
|
||||||
|
free -m
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
|
mcServerRunnerArgs="--stop-duration 60s"
|
||||||
|
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
||||||
|
JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
|
||||||
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
exec mc-server-runner ${mcServerRunnerArgs} \
|
||||||
|
--cf-instance-file "${CURSE_INSTANCE_JSON}" \
|
||||||
|
java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar _SERVERJAR_ "$@" $EXTRA_ARGS
|
||||||
|
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
|
if [ ! -e "${FTB_DIR}/ops.json" -a -e /data/ops.txt ]; then
|
||||||
|
|||||||
+19
@@ -63,3 +63,22 @@ function normalizeMemSize {
|
|||||||
val=${1:0: -1}
|
val=${1:0: -1}
|
||||||
echo $(( val * scale ))
|
echo $(( val * scale ))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function versionLessThan {
|
||||||
|
local activeParts
|
||||||
|
IFS=. read -ra activeParts <<< "${VANILLA_VERSION}"
|
||||||
|
|
||||||
|
local givenParts
|
||||||
|
IFS=. read -ra givenParts <<< "$1"
|
||||||
|
|
||||||
|
if (( ${#activeParts[@]} < 2 )); then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( activeParts[0] < givenParts[0] )) || \
|
||||||
|
(( activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1] )); then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /start-utils
|
||||||
|
|
||||||
|
if ! [[ -v CURSE_INSTANCE_JSON ]]; then
|
||||||
|
log "ERROR: CURSE_INSTANCE_JSON needs to be set"
|
||||||
|
exit 2
|
||||||
|
elif ! [ -f "${CURSE_INSTANCE_JSON}" ] && [ -f "${CURSE_INSTANCE_JSON}/minecraftinstance.json" ]; then
|
||||||
|
CURSE_INSTANCE_JSON="${CURSE_INSTANCE_JSON}/minecraftinstance.json"
|
||||||
|
elif ! [ -f "${CURSE_INSTANCE_JSON}" ]; then
|
||||||
|
log "ERROR: CURSE_INSTANCE_JSON file does not exist: ${CURSE_INSTANCE_JSON}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}"
|
||||||
|
|
||||||
|
# Continue to Final Setup
|
||||||
|
exec /start-finalSetup01World "$@"
|
||||||
Reference in New Issue
Block a user