mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-06 14:56:25 +00:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dbbdd8cd2 | ||
|
|
1c2a0c506c | ||
|
|
90a6707280 | ||
|
|
e7cc54092a | ||
|
|
cd70cbcbea | ||
|
|
7910005086 | ||
|
|
b8ace17b7c | ||
|
|
f70814d6b6 | ||
|
|
8440e57118 | ||
|
|
29eda3530c | ||
|
|
558544f1e4 | ||
|
|
56c2f0b466 | ||
|
|
4bbc7d142f | ||
|
|
26cc3943ce | ||
|
|
6521f45f0b | ||
|
|
d62c2ffb42 | ||
|
|
d131941b62 | ||
|
|
98f0b36cfc | ||
|
|
6465bca640 | ||
|
|
4ad447ba6c | ||
|
|
736979c20b | ||
|
|
0c34a61332 | ||
|
|
67d58678a3 | ||
|
|
fb92a74084 | ||
|
|
8b5430ca44 | ||
|
|
f24827f558 | ||
|
|
f49b967d5a | ||
|
|
111ca85c4f | ||
|
|
c73bedc63c | ||
|
|
6f67f76eef | ||
|
|
002ed4bc77 | ||
|
|
9d48e79c64 | ||
|
|
ba7db26157 | ||
|
|
fc6129261b |
@@ -14,4 +14,9 @@ workflows:
|
|||||||
version: 2
|
version: 2
|
||||||
build:
|
build:
|
||||||
jobs:
|
jobs:
|
||||||
- minecraft_server
|
- minecraft_server:
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore:
|
||||||
|
- armv7
|
||||||
|
- multiarch
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
data
|
data
|
||||||
examples
|
examples
|
||||||
k8s-examples
|
k8s-examples
|
||||||
.idea
|
.idea
|
||||||
|
.git
|
||||||
@@ -32,7 +32,7 @@ ARG TARGETOS=linux
|
|||||||
ARG TARGETARCH=amd64
|
ARG TARGETARCH=amd64
|
||||||
ARG TARGETVARIANT=""
|
ARG TARGETVARIANT=""
|
||||||
|
|
||||||
ARG EASY_ADD_VER=0.7.0
|
ARG EASY_ADD_VER=0.7.1
|
||||||
ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
|
ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
|
||||||
RUN chmod +x /usr/bin/easy-add
|
RUN chmod +x /usr/bin/easy-add
|
||||||
|
|
||||||
@@ -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.3 --var app=mc-server-runner --file {{.app}} \
|
--var version=1.4.2 --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} \
|
||||||
@@ -58,8 +58,9 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
|||||||
|
|
||||||
COPY mcstatus /usr/local/bin
|
COPY mcstatus /usr/local/bin
|
||||||
|
|
||||||
VOLUME ["/data","/mods","/config"]
|
VOLUME ["/data"]
|
||||||
COPY server.properties /tmp/server.properties
|
COPY server.properties /tmp/server.properties
|
||||||
|
COPY log4j2.xml /tmp/log4j2.xml
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
|
|
||||||
ENTRYPOINT [ "/start" ]
|
ENTRYPOINT [ "/start" ]
|
||||||
|
|||||||
218
README.md
218
README.md
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
||||||
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
||||||
[](https://github.com/itzg/docker-minecraft-server/issues)
|
[](https://github.com/itzg/docker-minecraft-server/issues)
|
||||||
@@ -7,10 +6,12 @@
|
|||||||
|
|
||||||
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.
|
||||||
|
|
||||||
[](https://github.com/itzg/docker-minecraft-server/blob/master/README.md)
|
[](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
|
||||||
@@ -106,9 +107,9 @@ and start the server again with `docker start CONTAINERID` to pick up the new co
|
|||||||
|
|
||||||
To use a different Minecraft version, pass the `VERSION` environment variable, which can have the value
|
To use a different Minecraft version, pass the `VERSION` environment variable, which can have the value
|
||||||
|
|
||||||
* LATEST (the default)
|
- LATEST (the default)
|
||||||
* SNAPSHOT
|
- SNAPSHOT
|
||||||
* or a specific version, such as "1.7.9"
|
- or a specific version, such as "1.7.9"
|
||||||
|
|
||||||
For example, to use the latest snapshot:
|
For example, to use the latest snapshot:
|
||||||
|
|
||||||
@@ -127,14 +128,14 @@ the server jar remain in the `/data` directory. It is safe to remove those._
|
|||||||
|
|
||||||
To use a different version of Java, please use a docker tag to run your Minecraft server.
|
To use a different version of Java, please use a docker tag to run your Minecraft server.
|
||||||
|
|
||||||
| Tag name | Description | Linux |
|
| Tag name | Description | Linux |
|
||||||
|---------|-------------|-------|
|
| -------------- | ------------------------------------------- | ------------ |
|
||||||
| latest | **Default**. Uses Java version 8 update 212 | Alpine Linux |
|
| latest | **Default**. Uses Java version 8 update 212 | Alpine Linux |
|
||||||
| adopt13 | Uses Java version 13 latest update | Alpine Linux |
|
| adopt13 | Uses Java version 13 latest update | Alpine Linux |
|
||||||
| adopt11 | Uses Java version 11 latest update | Alpine Linux |
|
| adopt11 | Uses Java version 11 latest update | Alpine Linux |
|
||||||
| openj9 | Uses Eclipse OpenJ9 JVM | Alpine Linux |
|
| openj9 | Uses Eclipse OpenJ9 JVM | Alpine Linux |
|
||||||
| openj9-nightly | Uses Eclipse OpenJ9 JVM testing builds | Alpine Linux |
|
| openj9-nightly | Uses Eclipse OpenJ9 JVM testing builds | Alpine Linux |
|
||||||
| multiarch | Uses Java version 8 latest update | Debian Linux |
|
| multiarch | Uses Java version 8 latest update | Debian Linux |
|
||||||
|
|
||||||
For example, to use a Java version 13:
|
For example, to use a Java version 13:
|
||||||
|
|
||||||
@@ -144,8 +145,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`
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -160,15 +161,16 @@ 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
|
## Deployment Templates and Examples
|
||||||
and use mcstatus directly and invoke any of its other commands:
|
|
||||||
|
|
||||||
```
|
### Helm Charts
|
||||||
> docker exec mc mcstatus localhost status
|
|
||||||
version: v1.12 (protocol 335)
|
- [stable/minecraft](https://hub.helm.sh/charts/stable/minecraft) ([chart source](https://github.com/helm/charts/tree/master/stable/minecraft))
|
||||||
description: "{u'text': u'A Minecraft Server Powered by Docker'}"
|
- [mcsh/server-deployment](https://github.com/mcserverhosting-net/charts)
|
||||||
players: 0/20 No players online
|
|
||||||
```
|
### Examples
|
||||||
|
|
||||||
|
The [examples directory](https://github.com/itzg/docker-minecraft-server/tree/master/examples) also provides examples of deploying the [itzg/minecraft-server](https://hub.docker.com/r/itzg/minecraft-server/) Docker image.
|
||||||
|
|
||||||
## Running a Forge Server
|
## Running a Forge Server
|
||||||
|
|
||||||
@@ -270,17 +272,18 @@ Variables will be replaced in files with the following extensions:
|
|||||||
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
|
||||||
...
|
|
||||||
|
---
|
||||||
database:
|
database:
|
||||||
host: ${CFG_DB_HOST}
|
host: ${CFG_DB_HOST}
|
||||||
name: ${CFG_DB_NAME}
|
name: ${CFG_DB_NAME}
|
||||||
password: ${CFG_DB_PASSWORD}
|
password: ${CFG_DB_PASSWORD}
|
||||||
```
|
```
|
||||||
|
|
||||||
This is how your `docker-compose.yml` file could look like:
|
This is how your `docker-compose.yml` file could look like:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
version: '3'
|
version: "3"
|
||||||
# Other docker-compose examples in /examples
|
# Other docker-compose examples in /examples
|
||||||
|
|
||||||
services:
|
services:
|
||||||
@@ -326,19 +329,19 @@ Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT -e VERSION=1.8` or
|
|||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
|
||||||
If you are hosting your own copy of Bukkit/Spigot you can override the download URLs with:
|
If you are hosting your own copy of Bukkit/Spigot you can override the download URLs with:
|
||||||
* -e BUKKIT_DOWNLOAD_URL=<url>
|
|
||||||
* -e SPIGOT_DOWNLOAD_URL=<url>
|
- -e BUKKIT_DOWNLOAD_URL=<url>
|
||||||
|
- -e SPIGOT_DOWNLOAD_URL=<url>
|
||||||
|
|
||||||
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
|
**NOTE: to avoid pegging the CPU when running Spigot,** you will need to
|
||||||
pass `--noconsole` at the very end of the command line and not use `-it`. For example,
|
pass `--noconsole` at the very end of the command line and not use `-it`. For example,
|
||||||
|
|
||||||
docker run -d -v /path/on/host:/data \
|
docker run -d -v /path/on/host:/data \
|
||||||
-e TYPE=SPIGOT -e VERSION=1.8 \
|
-e TYPE=SPIGOT -e VERSION=1.8 \
|
||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server --noconsole
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server --noconsole
|
||||||
|
|
||||||
|
|
||||||
You can install Bukkit plugins in two ways...
|
You can install Bukkit plugins in two ways...
|
||||||
|
|
||||||
### Using the /data volume
|
### Using the /data volume
|
||||||
@@ -379,15 +382,6 @@ 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.
|
||||||
|
|
||||||
### Building an image with plugins
|
|
||||||
|
|
||||||
You can also create your own Docker images by extending the `itzg/minecraft-server` image.
|
|
||||||
The image contains an `ONBUILD` trigger that will copy a `plugins.yml` file from you build directory and download any plugins specified in it.
|
|
||||||
|
|
||||||
You can read about the [`ToF-BuildTools` and how to use them here](https://git.faldoria.de/tof/server/build-tools).
|
|
||||||
|
|
||||||
You can also find [an example](examples/ToF-build/) with a custom image in the examples dir.
|
|
||||||
|
|
||||||
## Running a PaperSpigot server
|
## Running a PaperSpigot server
|
||||||
|
|
||||||
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.
|
||||||
@@ -396,7 +390,7 @@ Enable PaperSpigot server mode by adding a `-e TYPE=PAPER -e VERSION=1.9.4` to y
|
|||||||
-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
|
||||||
|
|
||||||
__NOTE: to avoid pegging the CPU when running PaperSpigot,__ you will need to
|
**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,
|
pass `--noconsole` at the very end of the command line and not use `-it`. For example,
|
||||||
|
|
||||||
docker run -d -v /path/on/host:/data \
|
docker run -d -v /path/on/host:/data \
|
||||||
@@ -404,7 +398,8 @@ pass `--noconsole` at the very end of the command line and not use `-it`. For ex
|
|||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server --noconsole
|
-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...
|
You can install Bukkit plugins in two ways...
|
||||||
|
|
||||||
@@ -457,11 +452,7 @@ 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://minecraft.curseforge.com/modpacks .
|
locate the modpacks for CurseForge at https://www.curseforge.com/minecraft/modpacks .
|
||||||
|
|
||||||
There are a couple of options for obtaining an FTB/CurseForge modpack.
|
|
||||||
One options is that you can pre-download the **server** modpack and copy the modpack to the `/data`
|
|
||||||
directory (see "Attaching data directory to host filesystem”).
|
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
@@ -469,39 +460,13 @@ 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
|
||||||
|
|
||||||
Instead of pre-downloading a modpack from the FTB/CurseForge site, you
|
If you don't want to keep the pre-download modpacks separate from your data directory,
|
||||||
can you set `FTB_SERVER_MOD` (or `CF_SERVER_MOD`) to the **server** URL of a modpack, such as
|
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:
|
||||||
|
|
||||||
docker run ... \
|
docker run -d -v /path/on/host:/data -v /path/to/modpacks:/modpacks \
|
||||||
-e TYPE=FTB \
|
-e TYPE=FTB \
|
||||||
-e FTB_SERVER_MOD=https://www.feed-the-beast.com/projects/ftb-infinity-lite-1-10/files/2402889
|
-e FTB_SERVER_MOD=/modpacks/FTBPresentsSkyfactory3Server_3.0.6.zip \
|
||||||
|
|
||||||
or for a CurseForce modpack:
|
|
||||||
|
|
||||||
docker run ... \
|
|
||||||
-e TYPE=CURSEFORGE \
|
|
||||||
-e CF_SERVER_MOD=https://minecraft.curseforge.com/projects/enigmatica2expert/files/2663153/download
|
|
||||||
|
|
||||||
### Using the /data volume
|
|
||||||
|
|
||||||
You must use a persistent `/data` mount for this type of server.
|
|
||||||
|
|
||||||
To do this, you will need to attach the container's `/data` directory
|
|
||||||
(see "Attaching data directory to host filesystem”).
|
|
||||||
|
|
||||||
If the modpack is updated and you want to run the new version on your
|
|
||||||
server, you stop and remove the container:
|
|
||||||
|
|
||||||
docker stop mc
|
|
||||||
docker rm mc
|
|
||||||
|
|
||||||
Do not erase anything from your /data directory (unless you know of
|
|
||||||
specific mods that have been removed from the modpack). Download the
|
|
||||||
updated FTB server modpack and copy it to `/data`. Start a new container
|
|
||||||
with `FTB_SERVER_MOD` specifying the updated modpack file.
|
|
||||||
|
|
||||||
$ docker run -d -v /path/on/host:/data -e TYPE=FTB \
|
|
||||||
-e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.7.zip \
|
|
||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
|
||||||
### Fixing "unable to launch forgemodloader"
|
### Fixing "unable to launch forgemodloader"
|
||||||
@@ -516,8 +481,8 @@ then you apply a workaround by adding this to the run invocation:
|
|||||||
|
|
||||||
### Using a client-made curseforge modpack
|
### Using a client-made curseforge modpack
|
||||||
|
|
||||||
If you use something like curseforge, you may end up creating/using modpacks that do not
|
If you use something like CurseForge, you may end up creating/using modpacks that do not
|
||||||
contain server mod jars. Instead, the curseforge setup has `manifest.json` files, which
|
contain server mod jars. Instead, the CurseForge setup has `manifest.json` files, which
|
||||||
will show up under `/data/FeedTheBeast/manifest.json`.
|
will show up under `/data/FeedTheBeast/manifest.json`.
|
||||||
|
|
||||||
To use these packs you will need to:
|
To use these packs you will need to:
|
||||||
@@ -548,7 +513,7 @@ $ docker run -itd --name derpcraft \
|
|||||||
itzg/minecraft-server
|
itzg/minecraft-server
|
||||||
```
|
```
|
||||||
|
|
||||||
Note the `CF_SERVER_MOD` env var should match the url to download the modpack you are targeting.
|
Note the `CF_SERVER_MOD` env var should match the server version of the modpack you are targeting.
|
||||||
|
|
||||||
## Running a SpongeVanilla server
|
## Running a SpongeVanilla server
|
||||||
|
|
||||||
@@ -682,8 +647,8 @@ and in the same directory as that file run
|
|||||||
|
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
|
|
||||||
Now, go play...or adjust the `environment` section to configure
|
Now, go play...or adjust the `environment` section to configure
|
||||||
this server instance.
|
this server instance.
|
||||||
|
|
||||||
## Server configuration
|
## Server configuration
|
||||||
|
|
||||||
@@ -726,7 +691,7 @@ values.
|
|||||||
|
|
||||||
To whitelist players for your Minecraft server, pass the Minecraft usernames separated by commas via the `WHITELIST` environment variable, such as
|
To whitelist players for your Minecraft server, pass the Minecraft usernames separated by commas via the `WHITELIST` environment variable, such as
|
||||||
|
|
||||||
docker run -d -e WHITELIST=user1,user2 ...
|
docker run -d -e WHITELIST=user1,user2 ...
|
||||||
|
|
||||||
If the `WHITELIST` environment variable is not used, any user can join your Minecraft server if it's publicly accessible.
|
If the `WHITELIST` environment variable is not used, any user can join your Minecraft server if it's publicly accessible.
|
||||||
|
|
||||||
@@ -734,7 +699,7 @@ If the `WHITELIST` environment variable is not used, any user can join your Mine
|
|||||||
|
|
||||||
To add more "op" (aka adminstrator) users to your Minecraft server, pass the Minecraft usernames separated by commas via the `OPS` environment variable, such as
|
To add more "op" (aka adminstrator) users to your Minecraft server, pass the Minecraft usernames separated by commas via the `OPS` environment variable, such as
|
||||||
|
|
||||||
docker run -d -e OPS=user1,user2 ...
|
docker run -d -e OPS=user1,user2 ...
|
||||||
|
|
||||||
### Server icon
|
### Server icon
|
||||||
|
|
||||||
@@ -757,19 +722,17 @@ By default the query port will be `25565` (UDP) but can easily be changed with t
|
|||||||
|
|
||||||
docker run -d -e ENABLE_QUERY=true
|
docker run -d -e ENABLE_QUERY=true
|
||||||
|
|
||||||
|
|
||||||
### Max players
|
### Max players
|
||||||
|
|
||||||
By default max players is 20, you can increase this with the `MAX_PLAYERS` variable.
|
By default max players is 20, you can increase this with the `MAX_PLAYERS` variable.
|
||||||
|
|
||||||
docker run -d -e MAX_PLAYERS=50
|
docker run -d -e MAX_PLAYERS=50
|
||||||
|
|
||||||
|
|
||||||
### Max world size
|
### Max world size
|
||||||
|
|
||||||
This sets the maximum possible size in blocks, expressed as a radius, that the world border can obtain.
|
This sets the maximum possible size in blocks, expressed as a radius, that the world border can obtain.
|
||||||
|
|
||||||
docker run -d -e MAX_WORLD_SIZE=10000
|
docker run -d -e MAX_WORLD_SIZE=10000
|
||||||
|
|
||||||
### Allow Nether
|
### Allow Nether
|
||||||
|
|
||||||
@@ -781,9 +744,9 @@ Allows players to travel to the Nether.
|
|||||||
|
|
||||||
Allows server to announce when a player gets an achievement.
|
Allows server to announce when a player gets an achievement.
|
||||||
|
|
||||||
docker run -d -e ANNOUNCE_PLAYER_ACHIEVEMENTS=true
|
docker run -d -e ANNOUNCE_PLAYER_ACHIEVEMENTS=true
|
||||||
|
|
||||||
### Enable Command Block
|
### Enable Command Block
|
||||||
|
|
||||||
Enables command blocks
|
Enables command blocks
|
||||||
|
|
||||||
@@ -793,19 +756,19 @@ Enables command blocks
|
|||||||
|
|
||||||
Force players to join in the default game mode.
|
Force players to join in the default game mode.
|
||||||
|
|
||||||
* false - Players will join in the gamemode they left in.
|
- false - Players will join in the gamemode they left in.
|
||||||
* true - Players will always join in the default gamemode.
|
- true - Players will always join in the default gamemode.
|
||||||
|
|
||||||
`docker run -d -e FORCE_GAMEMODE=false`
|
`docker run -d -e FORCE_GAMEMODE=false`
|
||||||
|
|
||||||
### Generate Structures
|
### Generate Structures
|
||||||
|
|
||||||
Defines whether structures (such as villages) will be generated.
|
Defines whether structures (such as villages) will be generated.
|
||||||
|
|
||||||
* false - Structures will not be generated in new chunks.
|
- false - Structures will not be generated in new chunks.
|
||||||
* true - Structures will be generated in new chunks.
|
- true - Structures will be generated in new chunks.
|
||||||
|
|
||||||
`docker run -d -e GENERATE_STRUCTURES=true`
|
`docker run -d -e GENERATE_STRUCTURES=true`
|
||||||
|
|
||||||
### Hardcore
|
### Hardcore
|
||||||
|
|
||||||
@@ -858,6 +821,7 @@ Sets the area that non-ops can not edit (0 to disable)
|
|||||||
docker run -d -e SPAWN_PROTECTION=0
|
docker run -d -e SPAWN_PROTECTION=0
|
||||||
|
|
||||||
### View Distance
|
### View Distance
|
||||||
|
|
||||||
Sets the amount of world data the server sends the client, measured in chunks in each direction of the player (radius, not diameter).
|
Sets the amount of world data the server sends the client, measured in chunks in each direction of the player (radius, not diameter).
|
||||||
It determines the server-side viewing distance.
|
It determines the server-side viewing distance.
|
||||||
|
|
||||||
@@ -876,10 +840,10 @@ change the mode using `MODE` where you can either provide the [standard
|
|||||||
numerical values](http://minecraft.gamepedia.com/Game_mode#Game_modes) or the
|
numerical values](http://minecraft.gamepedia.com/Game_mode#Game_modes) or the
|
||||||
shortcut values:
|
shortcut values:
|
||||||
|
|
||||||
* creative
|
- creative
|
||||||
* survival
|
- survival
|
||||||
* adventure
|
- adventure
|
||||||
* spectator (only for Minecraft 1.8 or later)
|
- spectator (only for Minecraft 1.8 or later)
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@@ -912,12 +876,12 @@ environment variable set to `false`, such as
|
|||||||
By default, a standard world is generated with hills, valleys, water, etc. A different level type can
|
By default, a standard world is generated with hills, valleys, water, etc. A different level type can
|
||||||
be configured by setting `LEVEL_TYPE` to an expected type, such as
|
be configured by setting `LEVEL_TYPE` to an expected type, such as
|
||||||
|
|
||||||
* DEFAULT
|
- DEFAULT
|
||||||
* FLAT
|
- FLAT
|
||||||
* LARGEBIOMES
|
- LARGEBIOMES
|
||||||
* AMPLIFIED
|
- AMPLIFIED
|
||||||
* CUSTOMIZED
|
- CUSTOMIZED
|
||||||
* BUFFET
|
- BUFFET
|
||||||
|
|
||||||
Descriptions are available at the [gamepedia](http://minecraft.gamepedia.com/Server.properties).
|
Descriptions are available at the [gamepedia](http://minecraft.gamepedia.com/Server.properties).
|
||||||
|
|
||||||
@@ -950,10 +914,10 @@ where the default is "world":
|
|||||||
### Downloadable world
|
### Downloadable world
|
||||||
|
|
||||||
Instead of mounting the `/data` volume, you can instead specify the URL of
|
Instead of mounting the `/data` volume, you can instead specify the URL of
|
||||||
a ZIP file containing an archived world. This will be downloaded, and
|
a ZIP file containing an archived world. This will be downloaded, and
|
||||||
unpacked in the `/data` directory; if it does not contain a subdirectory
|
unpacked in the `/data` directory; if it does not contain a subdirectory
|
||||||
called `world/` then it will be searched for a file `level.dat` and the
|
called `world/` then it will be searched for a file `level.dat` and the
|
||||||
containing subdirectory renamed to `world`. This means that most of the
|
containing subdirectory renamed to `world`. This means that most of the
|
||||||
archived Minecraft worlds downloadable from the Internet will already be in
|
archived Minecraft worlds downloadable from the Internet will already be in
|
||||||
the correct format.
|
the correct format.
|
||||||
|
|
||||||
@@ -965,7 +929,7 @@ directory, if required.
|
|||||||
**NOTE:** Unless you also mount `/data` as an external volume, this world
|
**NOTE:** Unless you also mount `/data` as an external volume, this world
|
||||||
will be deleted when the container is deleted.
|
will be deleted when the container is deleted.
|
||||||
|
|
||||||
**NOTE:** This URL must be accessible from inside the container. Therefore,
|
**NOTE:** This URL must be accessible from inside the container. Therefore,
|
||||||
you should use an IP address or a globally resolveable FQDN, or else the
|
you should use an IP address or a globally resolveable FQDN, or else the
|
||||||
name of a linked container.
|
name of a linked container.
|
||||||
|
|
||||||
@@ -1041,10 +1005,10 @@ is passed to `docker run`.
|
|||||||
By default, the image declares a Java initial and maximum memory limit of 1 GB. There are several
|
By default, the image declares a Java initial and maximum memory limit of 1 GB. There are several
|
||||||
ways to adjust the memory settings:
|
ways to adjust the memory settings:
|
||||||
|
|
||||||
* `MEMORY`, "1G" by default, can be used to adjust both initial (`Xms`) and max (`Xmx`)
|
- `MEMORY`, "1G" by default, can be used to adjust both initial (`Xms`) and max (`Xmx`)
|
||||||
memory settings of the JVM
|
memory settings of the JVM
|
||||||
* `INIT_MEMORY`, independently sets the initial heap size
|
- `INIT_MEMORY`, independently sets the initial heap size
|
||||||
* `MAX_MEMORY`, independently sets the max heap size
|
- `MAX_MEMORY`, independently sets the max heap size
|
||||||
|
|
||||||
The values of all three are passed directly to the JVM and support format/units as
|
The values of all three are passed directly to the JVM and support format/units as
|
||||||
`<size>[g|G|m|M|k|K]`. For example:
|
`<size>[g|G|m|M|k|K]`. For example:
|
||||||
@@ -1060,6 +1024,24 @@ via a `JVM_XX_OPTS` environment variable.
|
|||||||
For some cases, if e.g. after removing mods, it could be necessary to startup minecraft with an additional `-D` parameter like `-Dfml.queryResult=confirm`. To address this you can use the environment variable `JVM_DD_OPTS`, which builds the params from a given list of values separated by space, but without the `-D` prefix. To make things running under systems (e.g. Plesk), which doesn't allow `=` inside values, a `:` (colon) could be used instead. The upper example would look like this:
|
For some cases, if e.g. after removing mods, it could be necessary to startup minecraft with an additional `-D` parameter like `-Dfml.queryResult=confirm`. To address this you can use the environment variable `JVM_DD_OPTS`, which builds the params from a given list of values separated by space, but without the `-D` prefix. To make things running under systems (e.g. Plesk), which doesn't allow `=` inside values, a `:` (colon) could be used instead. The upper example would look like this:
|
||||||
`JVM_DD_OPTS=fml.queryResult:confirm`, and will be converted to `-Dfml.queryResult=confirm`.
|
`JVM_DD_OPTS=fml.queryResult:confirm`, and will be converted to `-Dfml.queryResult=confirm`.
|
||||||
|
|
||||||
|
### Enable Remote JMX for Profiling
|
||||||
|
|
||||||
|
To enable remote JMX, such as for profiling with VisualVM or JMC, add the environment variable `ENABLE_JMX=true` and add a port forwarding of TCP port 7091, such as:
|
||||||
|
|
||||||
|
-e ENABLE_JMX=true -p 7091:7091
|
||||||
|
|
||||||
|
### Enable Aikar's Flags
|
||||||
|
|
||||||
|
[Aikar has does some research](https://mcflags.emc.gs/) into finding the optimal JVM flags for GC tuning, which becomes more important as more users are connected concurrently. The set of flags documented there can be added using
|
||||||
|
|
||||||
|
-e USE_AIKAR_FLAGS=true
|
||||||
|
|
||||||
|
When `MEMORY` is greater than or equal to 12G, then the Aikar flags will be adjusted according to the article.
|
||||||
|
|
||||||
|
Large page support can also be enabled by adding
|
||||||
|
|
||||||
|
-e USE_LARGE_PAGES=true
|
||||||
|
|
||||||
### HTTP Proxy
|
### HTTP Proxy
|
||||||
|
|
||||||
You may configure the use of an HTTP/HTTPS proxy by passing the proxy's URL via the `PROXY`
|
You may configure the use of an HTTP/HTTPS proxy by passing the proxy's URL via the `PROXY`
|
||||||
@@ -1077,3 +1059,11 @@ pass that at the end of `docker run` after the image name or set `-e CONSOLE=FAL
|
|||||||
|
|
||||||
Some older servers get confused and think that the GUI interface is enabled. You can explicitly
|
Some older servers get confused and think that the GUI interface is enabled. You can explicitly
|
||||||
disable that by passing `-e GUI=FALSE`.
|
disable that by passing `-e GUI=FALSE`.
|
||||||
|
|
||||||
|
## Running on RaspberryPi
|
||||||
|
|
||||||
|
To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag
|
||||||
|
|
||||||
|
itzg/minecraft-server:armv7
|
||||||
|
|
||||||
|
> NOTE: you may need to lower the memory allocation, such as `-e MEMORY=750m`
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#set -x
|
#set -x
|
||||||
# Use this variable to indicate a list of branches that docker hub is watching
|
# Use this variable to indicate a list of branches that docker hub is watching
|
||||||
branches_list=('openj9' 'openj9-nightly' 'adopt11')
|
branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'multiarch' 'armv7')
|
||||||
|
|
||||||
. /start-utils
|
|
||||||
|
|
||||||
function TrapExit {
|
function TrapExit {
|
||||||
log "Checking out back in master"
|
echo "Checking out back in master"
|
||||||
git checkout master
|
git checkout master
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,33 +17,33 @@ do
|
|||||||
batchMode=true
|
batchMode=true
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "Unsupported arg $arg"
|
echo "Unsupported arg $arg"
|
||||||
exit 2
|
exit 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
${batchMode} && log "Using batch mode"
|
${batchMode} && echo "Using batch mode"
|
||||||
|
|
||||||
trap TrapExit EXIT SIGTERM
|
trap TrapExit EXIT SIGTERM
|
||||||
|
|
||||||
test -d ./.git || { log ".git folder was not found. Please start this script from root directory of the project!";
|
test -d ./.git || { echo ".git folder was not found. Please start this script from root directory of the project!";
|
||||||
exit 1; }
|
exit 1; }
|
||||||
|
|
||||||
# Making sure we are in master
|
# Making sure we are in master
|
||||||
git checkout master
|
git checkout master
|
||||||
git pull --all || { log "Can't pull the repo!"; \
|
git pull --all || { echo "Can't pull the repo!"; \
|
||||||
exit 1; }
|
exit 1; }
|
||||||
|
|
||||||
git_branches=$(git branch -a)
|
git_branches=$(git branch -a)
|
||||||
|
|
||||||
for branch in "${branches_list[@]}"; do
|
for branch in "${branches_list[@]}"; do
|
||||||
if [[ "$git_branches" != *"$branch"* ]]; then
|
if [[ "$git_branches" != *"$branch"* ]]; then
|
||||||
log "Can't update $branch because I can't find it in the list of branches."
|
echo "Can't update $branch because I can't find it in the list of branches."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
log "Branch $branch found. Working with it."
|
echo "Branch $branch found. Working with it."
|
||||||
git checkout "$branch" || { log "Can't checkout into the branch. Don't know the cause."; \
|
git checkout "$branch" || { echo "Can't checkout into the branch. Don't know the cause."; \
|
||||||
exit 1; }
|
exit 1; }
|
||||||
proceed='False'
|
proceed='False'
|
||||||
while [[ "$proceed" == "False" ]]; do
|
while [[ "$proceed" == "False" ]]; do
|
||||||
@@ -54,14 +52,14 @@ for branch in "${branches_list[@]}"; do
|
|||||||
|
|
||||||
if git merge -m 'Auto-merging via docker-versions-create' master; then
|
if git merge -m 'Auto-merging via docker-versions-create' master; then
|
||||||
proceed="True"
|
proceed="True"
|
||||||
log "Branch $branch updated to current master successfully"
|
echo "Branch $branch updated to current master successfully"
|
||||||
# pushing changes to remote for this branch
|
# pushing changes to remote for this branch
|
||||||
git commit -m "Auto merge branch with master" -a
|
git commit -m "Auto merge branch with master" -a
|
||||||
# push may fail if remote doesn't have this branch yet. In this case - sending branch
|
# push may fail if remote doesn't have this branch yet. In this case - sending branch
|
||||||
git push || git push -u origin "$branch" || { log "Can't push changes to the origin."; exit 1; }
|
git push || git push -u origin "$branch" || { echo "Can't push changes to the origin."; exit 1; }
|
||||||
elif ${batchMode}; then
|
elif ${batchMode}; then
|
||||||
status=$?
|
status=$?
|
||||||
log "Git merge failed in batch mode"
|
echo "Git merge failed in batch mode"
|
||||||
exit ${status}
|
exit ${status}
|
||||||
# and trap exit gets us back to master
|
# and trap exit gets us back to master
|
||||||
else
|
else
|
||||||
|
|||||||
3
examples/README.md
Normal file
3
examples/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Deployment Examples
|
||||||
|
|
||||||
|
This directory contains various deployment examples of the [itzg/minecraft-server](https://hub.docker.com/r/itzg/minecraft-server/) Docker image.
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
FROM itzg/minecraft-server
|
|
||||||
|
|
||||||
ENV TYPE=SPIGOT
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
plugins:
|
|
||||||
worldedit:
|
|
||||||
file: WorldEdit.jar
|
|
||||||
url: https://dev.bukkit.org/projects/worldedit/files/latest
|
|
||||||
FastAsyncWorldEdit:
|
|
||||||
file: FastAsyncWorldEdit.jar
|
|
||||||
url: https://empcraft.com/fawe/latest.php?bukkit
|
|
||||||
worldguard:
|
|
||||||
file: WorldGuard.jar
|
|
||||||
url: https://dev.bukkit.org/projects/worldguard/files/latest
|
|
||||||
citizens:
|
|
||||||
file: Citizens.jar
|
|
||||||
url: https://dev.bukkit.org/projects/citizens/files/latest
|
|
||||||
20
examples/docker-compose-curseinstance.yml
Normal file
20
examples/docker-compose-curseinstance.yml
Normal file
@@ -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
|
||||||
5
examples/paper-build-plugins/Dockerfile
Normal file
5
examples/paper-build-plugins/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
FROM itzg/minecraft-server
|
||||||
|
|
||||||
|
ENV TYPE=PAPER
|
||||||
|
|
||||||
|
COPY plugins/*.jar /plugins/
|
||||||
11
examples/paper-build-plugins/docker-compose.yml
Normal file
11
examples/paper-build-plugins/docker-compose.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
build: .
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
ports:
|
||||||
|
- 25565:25565
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
1
examples/paper-build-plugins/plugins/.gitignore
vendored
Normal file
1
examples/paper-build-plugins/plugins/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.jar
|
||||||
1
examples/paper-build-plugins/plugins/README.md
Normal file
1
examples/paper-build-plugins/plugins/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Download Bukkit/Spigot plugin jars, such as [WorldEdit](https://dev.bukkit.org/projects/worldedit/files) and place them here. At image build time the `COPY` step will place those jars in `/plugins`. At container startup, the contents of `/plugins` are sync'ed into `/data/plugins` for use with Bukkit/Spigot/Paper server types.
|
||||||
34
log4j2.xml
Normal file
34
log4j2.xml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Configuration status="WARN" packages="com.mojang.util">
|
||||||
|
<Appenders>
|
||||||
|
<Console name="SysOut" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
|
||||||
|
</Console>
|
||||||
|
<Queue name="ServerGuiConsole">
|
||||||
|
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" />
|
||||||
|
</Queue>
|
||||||
|
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
||||||
|
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
|
||||||
|
<Policies>
|
||||||
|
<TimeBasedTriggeringPolicy />
|
||||||
|
<OnStartupTriggeringPolicy />
|
||||||
|
</Policies>
|
||||||
|
<DefaultRolloverStrategy>
|
||||||
|
<Delete basePath="logs">
|
||||||
|
<IfFileName glob="*.log.gz" />
|
||||||
|
<IfLastModified age="7d" />
|
||||||
|
</Delete>
|
||||||
|
</DefaultRolloverStrategy>
|
||||||
|
</RollingRandomAccessFile>
|
||||||
|
</Appenders>
|
||||||
|
<Loggers>
|
||||||
|
<Root level="info">
|
||||||
|
<filters>
|
||||||
|
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
|
||||||
|
</filters>
|
||||||
|
<AppenderRef ref="SysOut"/>
|
||||||
|
<AppenderRef ref="File"/>
|
||||||
|
<AppenderRef ref="ServerGuiConsole"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
||||||
2
mcstatus
2
mcstatus
@@ -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)
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ if [ ! -e /data/eula.txt ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "# Generated via Docker on $(date)" > eula.txt
|
echo "# Generated via Docker on $(date)" > eula.txt
|
||||||
echo "eula=$EULA" >> eula.txt
|
|
||||||
if [ $? != 0 ]; then
|
if ! echo "eula=$EULA" >> 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
|
||||||
@@ -47,58 +47,63 @@ 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
|
||||||
|
|
||||||
log "Checking version information."
|
|
||||||
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}"
|
||||||
|
|
||||||
cd /data
|
cd /data || exit 1
|
||||||
|
|
||||||
export ORIGINAL_TYPE=${TYPE^^}
|
export ORIGINAL_TYPE=${TYPE^^}
|
||||||
|
|
||||||
log "Checking type information."
|
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 "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
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 "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -76,7 +76,9 @@ fi
|
|||||||
|
|
||||||
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
||||||
|
|
||||||
forgeJar=$(find ${FTB_BASE_DIR} -name 'forge*.jar' -a -not -name 'forge*installer')
|
# Allow up to 2 levels since some modpacks have a top-level directory named
|
||||||
|
# for the modpack
|
||||||
|
forgeJar=$(find ${FTB_BASE_DIR} -maxdepth 2 -name 'forge*.jar' -a -not -name 'forge*installer')
|
||||||
if [[ "$forgeJar" ]]; then
|
if [[ "$forgeJar" ]]; then
|
||||||
export FTB_BASE_DIR=$(dirname "${forgeJar}")
|
export FTB_BASE_DIR=$(dirname "${forgeJar}")
|
||||||
log "No entry script found, so building one for ${forgeJar}"
|
log "No entry script found, so building one for ${forgeJar}"
|
||||||
@@ -107,7 +109,8 @@ export FTB_SERVER_START=$(find "${FTB_BASE_DIR}" $entryScriptExpr)
|
|||||||
|
|
||||||
export FTB_DIR=$(dirname "${FTB_SERVER_START}")
|
export FTB_DIR=$(dirname "${FTB_SERVER_START}")
|
||||||
chmod a+x "${FTB_SERVER_START}"
|
chmod a+x "${FTB_SERVER_START}"
|
||||||
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}"
|
grep fml.queryResult=confirm ${FTB_SERVER_START} > /dev/null || \
|
||||||
|
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}"
|
||||||
sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}"
|
sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}"
|
||||||
legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar"
|
legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar"
|
||||||
|
|
||||||
|
|||||||
@@ -35,15 +35,16 @@ case "X$WORLD" in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [[ -d $WORLD ]]; then
|
if [[ -d "$WORLD" ]]; then
|
||||||
if [[ ! -d $worldDest ]]; then
|
if [[ ! -d "$worldDest" ]]; then
|
||||||
log "Cloning world directory from $WORLD ..."
|
log "Cloning world directory from $WORLD ..."
|
||||||
cp -r $WORLD $worldDest
|
cp -r "$WORLD" "$worldDest"
|
||||||
else
|
else
|
||||||
log "Skipping clone from $WORLD since $worldDest exists"
|
log "Skipping clone from $WORLD since $worldDest exists"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log "Invalid URL given for world: Must be HTTP or HTTPS and a ZIP file"
|
log "World cloning source '$WORLD' doesn't seem to exist"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -27,11 +27,23 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ${TYPE} != "SPIGOT" ]; then
|
||||||
|
# Set up log configuration
|
||||||
|
LOGFILE="/data/log4j2.xml"
|
||||||
|
if [ ! -e "$LOGFILE" ]; then
|
||||||
|
log "Creating log4j2.xml in ${LOGFILE}"
|
||||||
|
cp /tmp/log4j2.xml "$LOGFILE"
|
||||||
|
else
|
||||||
|
log "log4j2.xml already created, skipping"
|
||||||
|
fi
|
||||||
|
JVM_OPTS="-Dlog4j.configurationFile=/data/log4j2.xml ${JVM_OPTS}"
|
||||||
|
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 . -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"
|
||||||
echo '[]' > $j
|
echo '[]' > $j
|
||||||
fi
|
fi
|
||||||
@@ -49,24 +61,26 @@ fi
|
|||||||
for c in /config/*
|
for c in /config/*
|
||||||
do
|
do
|
||||||
if [ -f "$c" ]; then
|
if [ -f "$c" ]; then
|
||||||
log Copying configuration `basename "$c"`
|
log Copying configuration $(basename "$c")
|
||||||
cp -rf "$c" /data/config
|
cp -rf "$c" /data/config
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
mkdir -p /data/plugins
|
case ${TYPE} in
|
||||||
if [ "$TYPE" = "SPIGOT" ]; then
|
SPIGOT|BUKKIT|PAPER)
|
||||||
if [ -d /plugins ]; then
|
mkdir -p /data/plugins
|
||||||
log "Copying any Bukkit plugins over..."
|
if [ -d /plugins ]; then
|
||||||
# Copy plugins over using rsync to allow deeply nested updates of plugins
|
log "Copying plugins over..."
|
||||||
# only updates files if the source file is newer and print updated files
|
# Copy plugins over using rsync to allow deeply nested updates of plugins
|
||||||
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /plugins /data
|
# only updates files if the source file is newer and print updated files
|
||||||
fi
|
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /plugins /data
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
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
|
||||||
|
|
||||||
@@ -86,9 +100,81 @@ if [ -n "$JVM_DD_OPTS" ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mcServerRunnerArgs="--stop-duration 60s"
|
if isTrue ${ENABLE_JMX}; then
|
||||||
|
: ${JMX_HOST:=0.0.0.0}
|
||||||
|
: ${JMX_PORT:=7091}
|
||||||
|
JVM_OPTS="${JVM_OPTS}
|
||||||
|
-Dcom.sun.management.jmxremote.local.only=false
|
||||||
|
-Dcom.sun.management.jmxremote.port=${JMX_PORT}
|
||||||
|
-Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT}
|
||||||
|
-Dcom.sun.management.jmxremote.authenticate=false
|
||||||
|
-Dcom.sun.management.jmxremote.ssl=false
|
||||||
|
-Dcom.sun.management.jmxremote.host=${JMX_HOST}
|
||||||
|
-Djava.rmi.server.hostname=${JMX_HOST}"
|
||||||
|
|
||||||
|
log "JMX is enabled. Make sure you have port forwarding for ${JMX_PORT}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if isTrue "${USE_AIKAR_FLAGS}"; then
|
||||||
|
# From https://mcflags.emc.gs/
|
||||||
|
|
||||||
|
if (( $(normalizeMemSize "${MAX_MEMORY}") >= $(normalizeMemSize 12g) )); then
|
||||||
|
log "Using Aikar's >12GB flags"
|
||||||
|
G1NewSizePercent=40
|
||||||
|
G1MaxNewSizePercent=50
|
||||||
|
G1HeapRegionSize=16M
|
||||||
|
G1ReservePercent=15
|
||||||
|
InitiatingHeapOccupancyPercent=20
|
||||||
|
else
|
||||||
|
log "Using Aikar's flags"
|
||||||
|
G1NewSizePercent=30
|
||||||
|
G1MaxNewSizePercent=40
|
||||||
|
G1HeapRegionSize=8M
|
||||||
|
G1ReservePercent=20
|
||||||
|
InitiatingHeapOccupancyPercent=15
|
||||||
|
fi
|
||||||
|
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UseG1GC -XX:+ParallelRefProcEnabled
|
||||||
|
-XX:MaxGCPauseMillis=200
|
||||||
|
-XX:+UnlockExperimentalVMOptions
|
||||||
|
-XX:+DisableExplicitGC
|
||||||
|
-XX:-OmitStackTraceInFastThrow
|
||||||
|
-XX:+AlwaysPreTouch
|
||||||
|
-XX:G1NewSizePercent=${G1NewSizePercent}
|
||||||
|
-XX:G1MaxNewSizePercent=${G1MaxNewSizePercent}
|
||||||
|
-XX:G1HeapRegionSize=${G1HeapRegionSize}
|
||||||
|
-XX:G1ReservePercent=${G1ReservePercent}
|
||||||
|
-XX:G1HeapWastePercent=5
|
||||||
|
-XX:G1MixedGCCountTarget=8
|
||||||
|
-XX:InitiatingHeapOccupancyPercent=${InitiatingHeapOccupancyPercent}
|
||||||
|
-XX:G1MixedGCLiveThresholdPercent=90
|
||||||
|
-XX:G1RSetUpdatingPauseTimePercent=5
|
||||||
|
-XX:SurvivorRatio=32
|
||||||
|
-XX:MaxTenuringThreshold=1
|
||||||
|
-Dusing.aikars.flags=true
|
||||||
|
-Daikars.new.flags=true
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if isTrue "${USE_LARGE_PAGES}"; then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UseLargePagesInMetaspace
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
|
|
||||||
if [ ! -e "${FTB_DIR}/ops.json" -a -e /data/ops.txt ]; then
|
if [ ! -e "${FTB_DIR}/ops.json" -a -e /data/ops.txt ]; then
|
||||||
cp -f /data/ops.txt ${FTB_DIR}/
|
cp -f /data/ops.txt ${FTB_DIR}/
|
||||||
fi
|
fi
|
||||||
|
|||||||
30
start-utils
30
start-utils
@@ -48,3 +48,33 @@ function logn {
|
|||||||
function log {
|
function log {
|
||||||
echo "[init] $*"
|
echo "[init] $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeMemSize {
|
||||||
|
local scale=1
|
||||||
|
case ${1,,} in
|
||||||
|
*k)
|
||||||
|
scale=1024;;
|
||||||
|
*m)
|
||||||
|
scale=1048576;;
|
||||||
|
*g)
|
||||||
|
scale=1073741824;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
val=${1:0: -1}
|
||||||
|
echo $(( val * scale ))
|
||||||
|
}
|
||||||
|
|
||||||
|
function versionLessThan {
|
||||||
|
local activeParts
|
||||||
|
IFS=. read -ra activeParts <<< "${VANILLA_VERSION}"
|
||||||
|
|
||||||
|
local givenParts
|
||||||
|
IFS=. read -ra givenParts <<< "$1"
|
||||||
|
|
||||||
|
if (( activeParts[0] < givenParts[0] )) || \
|
||||||
|
(( activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1] )); then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
18
start-validateCurseInstance
Executable file
18
start-validateCurseInstance
Executable file
@@ -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