Compare commits

...

14 Commits

Author SHA1 Message Date
Geoff Bourne
32b0737e70 [mc] Add rcon to docker-compose.yml example 2017-02-18 11:53:44 -06:00
Geoff Bourne
79eb164e90 [mc] Adding example compose file for large minecraft server 2017-02-18 11:00:55 -06:00
Geoff Bourne
e3296c3cc0 [es] Upgrade to 5.2.1 2017-02-15 19:30:33 -06:00
Geoff Bourne
f5dbbcc2c6 [mc] Use G1 GC by default and simplify max memory setting
For #126
2017-02-14 22:15:36 -06:00
Geoff Bourne
134eaedf23 Merge pull request #125 from HenryGessau/FTB
Add Feed-The-Beast (FTB) server modpack support
2017-02-13 22:23:33 -06:00
Henry Gessau
4a89f3c579 Add Feed-The-Beast (FTB) server modpack support
The popular mod site https://www.feed-the-beast.com provides server
modpacks to go with their client modpacks. These server modpacks
include a custom start script that must be used to launch the server.
2017-02-13 22:13:53 -05:00
Geoff Bourne
17420ed590 [es] Added HEALTHCHECK 2017-02-04 14:37:45 -06:00
Geoff Bourne
2125fa0855 [es] Tweak spacing on README 2017-02-02 20:53:47 -06:00
Geoff Bourne
5c14c30a78 [es] Include docker stack deploy instructions 2017-02-02 20:48:17 -06:00
Geoff Bourne
788d06c086 [es] Upgrade to 5.2.0
For #124
2017-02-02 20:28:12 -06:00
Geoff Bourne
1a88c96beb Merged branch master into master 2017-02-02 19:31:11 -06:00
Geoff Bourne
b8d69278e4 [es] Fix address binding for Swarm Mode 2017-01-23 10:25:50 -06:00
Geoff Bourne
4a7ecffcbb [es][kibana] Upgrade to 5.1.2 2017-01-15 07:04:27 -06:00
Geoff Bourne
9fe0021a7a [mc] Upgrade base image to openjdk
Fixes #122
2017-01-12 19:40:58 -06:00
11 changed files with 275 additions and 39 deletions

View File

@@ -4,7 +4,7 @@ MAINTAINER itzg
RUN apk -U add bash RUN apk -U add bash
ENV ES_VERSION=5.1.1 ENV ES_VERSION=5.2.1
ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz
RUN cd /usr/share && \ RUN cd /usr/share && \
@@ -13,10 +13,10 @@ RUN cd /usr/share && \
EXPOSE 9200 9300 EXPOSE 9200 9300
HEALTHCHECK --timeout=5s CMD wget -q -O - http://$HOSTNAME:9200/_cat/health
ENV ES_HOME=/usr/share/elasticsearch-$ES_VERSION \ ENV ES_HOME=/usr/share/elasticsearch-$ES_VERSION \
DEFAULT_ES_USER=elasticsearch \ DEFAULT_ES_USER=elasticsearch \
DISCOVER_TRANSPORT_IP=eth0 \
DISCOVER_HTTP_IP=eth0 \
ES_JAVA_OPTS="-Xms1g -Xmx1g" ES_JAVA_OPTS="-Xms1g -Xmx1g"
RUN adduser -S -s /bin/sh $DEFAULT_ES_USER RUN adduser -S -s /bin/sh $DEFAULT_ES_USER

View File

@@ -54,6 +54,40 @@ and then check the cluster health, such as http://192.168.99.100:9200/_cluster/h
"unassigned_shards" : 0 "unassigned_shards" : 0
} }
If you have a Docker Swarm cluster already initialized you can download this
[docker-compose.yml](https://raw.githubusercontent.com/itzg/dockerfiles/master/elasticsearch/docker-compose.yml) and deploy a cluster using:
docker stack deploy -c docker-compose.yml es
With a `docker service ls` you can confirm 1 master, 2 data, and 1 gateway nodes are running:
```
ID NAME MODE REPLICAS IMAGE
9nwnno8hbqgk es_kibana replicated 1/1 kibana:latest
f5x7nipwmvkr es_gateway replicated 1/1 es
om8rly2yxylw es_data replicated 2/2 es
tdvfilj370yn es_master replicated 1/1 es
```
As you can see, there is also a Kibana instance included and available at port 5601.
# Health Checks
This container declares a [HEALTHCHECK](https://docs.docker.com/engine/reference/builder/#/healthcheck) that queries the `_cat/health`
endpoint for a quick, one-line gauge of health every 30 seconds.
The current health of the container is shown in the `STATUS` column of `docker ps`, such as
Up 14 minutes (healthy)
You can also check the history of health checks from `inspect`, such as:
```
> docker inspect -f "{{json .State.Health}}" es
{"Status":"healthy","FailingStreak":0,"Log":[...
```
# Configuration Summary # Configuration Summary
## Ports ## Ports
@@ -187,20 +221,16 @@ Using the Docker Compose file above, a value of `2` is appropriate when scaling
docker-compose scale master=3 docker-compose scale master=3
## Auto transport/http discovery with Swarm Mode ## Multiple Network Binding, such as Swarm Mode
When using Docker Swarm mode (starting with 1.12), the overlay and ingress network interfaces are assigned When using Docker Swarm mode the container is presented with multiple ethernet
multiple IP addresses. As a result, it creates confusion for the transport publish logic even when using devices. By default, all global, routable IP addresses are configured for
the special value `_eth0_`. Elasticsearch to use as `network.host`.
To resolve this, add That discovery can be overridden by providing a specific ethernet device name
to `DISCOVER_TRANSPORT_IP` and/or `DISCOVER_HTTP_IP`, such as
-e DISCOVER_TRANSPORT_IP=eth0 -e DISCOVER_TRANSPORT_IP=eth0
replacing `eth0` with another interface within the container, if needed.
The same can be done for publish/binding of the http module by adding:
-e DISCOVER_HTTP_IP=eth2 -e DISCOVER_HTTP_IP=eth2
## Heap size and other JVM options ## Heap size and other JVM options

View File

@@ -0,0 +1,37 @@
version: '3'
services:
master:
image: itzg/elasticsearch
environment:
TYPE: MASTER
UNICAST_HOSTS: master
MIN_MASTERS: 1
deploy:
replicas: 1
update_config:
parallelism: 1
data:
image: itzg/elasticsearch
environment:
TYPE: DATA
UNICAST_HOSTS: master
deploy:
replicas: 2
update_config:
parallelism: 1
delay: 60s
gateway:
image: itzg/elasticsearch
ports:
- "9200:9200"
- "9300:9300"
environment:
TYPE: GATEWAY
UNICAST_HOSTS: master
kibana:
image: kibana
ports:
- "5601:5601"
environment:
ELASTICSEARCH_URL: http://gateway:9200

View File

@@ -19,6 +19,11 @@ discoverIpFromLink() {
OPTS="$OPTS -E $mode.host=$ip" OPTS="$OPTS -E $mode.host=$ip"
} }
discoverAllGlobalIps() {
ips=`ipaddr show scope global|awk '$1 == "inet" { if (!match($2,"/32")) { gsub("/.*","",$2) ; addrs[length(addrs)] = $2 } } END { for (i in addrs) { if (i>0) printf "," ; printf addrs[i] } }'`
OPTS="$OPTS -E network.host=$ips"
}
setup_clustering() { setup_clustering() {
if [ -n "$CLUSTER" ]; then if [ -n "$CLUSTER" ]; then
@@ -112,8 +117,13 @@ OPTS="$OPTS \
-E transport.tcp.port=9300 \ -E transport.tcp.port=9300 \
-E http.port=9200" -E http.port=9200"
discoverIpFromLink $DISCOVER_TRANSPORT_IP transport discoverAllGlobalIps
discoverIpFromLink $DISCOVER_HTTP_IP http if [ "${DISCOVER_TRANSPORT_IP}" != "" ]; then
discoverIpFromLink $DISCOVER_TRANSPORT_IP transport
fi
if [ "${DISCOVER_HTTP_IP}" != "" ]; then
discoverIpFromLink $DISCOVER_HTTP_IP http
fi
setup_personality setup_personality
setup_clustering setup_clustering

View File

@@ -2,7 +2,7 @@ FROM openjdk:8u111-jre
MAINTAINER itzg MAINTAINER itzg
ENV KIBANA_VERSION 5.1.1 ENV KIBANA_VERSION 5.1.2
ADD https://artifacts.elastic.co/downloads/kibana/kibana-${KIBANA_VERSION}-linux-x86_64.tar.gz /tmp/kibana.tgz ADD https://artifacts.elastic.co/downloads/kibana/kibana-${KIBANA_VERSION}-linux-x86_64.tar.gz /tmp/kibana.tgz

View File

@@ -0,0 +1,12 @@
version: '2'
services:
es:
build: ../elasticsearch
ports:
- "9200:9200"
kibana:
build: .
ports:
- "5601:5601"

View File

@@ -1,4 +1,4 @@
FROM java:8 FROM openjdk:8-jre
MAINTAINER itzg MAINTAINER itzg
@@ -38,6 +38,6 @@ ENTRYPOINT [ "/start" ]
ENV UID=1000 GID=1000 \ ENV UID=1000 GID=1000 \
MOTD="A Minecraft Server Powered by Docker" \ MOTD="A Minecraft Server Powered by Docker" \
JVM_OPTS="-Xmx1024M -Xms1024M" \ JVM_XX_OPTS="-XX:+UseG1GC" MAX_MEMORY="1G" \
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \ TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= ONLINE_MODE=TRUE CONSOLE=true LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= ONLINE_MODE=TRUE CONSOLE=true

View File

@@ -264,6 +264,65 @@ 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 Server with a Feed-The-Beast (FTB) modpack
Enable this server mode by adding a `-e TYPE=FTB` to your command-line,
but note the following additional steps needed...
You need to specify a modpack to run, using the `FTB_SERVER_MOD` environment
variable. An FTB server modpack is available together with its respective
client modpack on https://www.feed-the-beast.com under "Additional Files."
Because of the interactive delayed download mechanism on that web site, you
must manually download the server modpack. 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.
$ docker run -d -v /path/on/host:/data -e TYPE=FTB \
-e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
### 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
### FTB server JVM options
An FTB server modpack contains its own startup script that launches the
JVM and it does not use the `JVM_OPTS` environment variable. Instead
you can use `MIN_RAM` and `MAX_RAM` variables. These are appended to
the JVM `-Xms` and `-Xmx` options. For example, `-e MIN_RAM=2G` results
in `-Xms2G` passed to the JVM.
Additionally, `PERMGEN_SIZE` is passed on to `-XX:PermSize`. Here is an
example:
$ docker run -d -v /path/on/host:/data -e TYPE=FTB \
-e MIN_RAM=1G -e MAX_RAM=2G -e PERMGEN_SIZE=512M \
-e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
Note: The FTB server start script will also override other options,
like `MOTD`.
## Using Docker Compose ## Using Docker Compose
Rather than type the server options below, the port mappings above, etc Rather than type the server options below, the port mappings above, etc
@@ -549,10 +608,11 @@ By default, server checks connecting players against Minecraft's account databas
### Memory Limit ### Memory Limit
The Java memory limit can be adjusted using the `JVM_OPTS` environment variable, where the default is By default the image declares a Java memory limit of 1 GB. That can be adjusted
the setting shown in the example (max and min at 1024 MB): higher (or lower) by setting the `MAX_MEMORY` environment variable. For example,
the following increases the memory limit to 8 GB:
docker run -e 'JVM_OPTS=-Xmx1024M -Xms1024M' ... docker run -e MAX_MEMORY=8G ...
### /data ownership ### /data ownership

View File

@@ -0,0 +1,21 @@
version: '3'
services:
minecraft-server:
ports:
- "25570:25565"
volumes:
- "mcbig:/data"
environment:
EULA: "TRUE"
MAX_MEMORY: 32G
MAX_BUILD_HEIGHT: 256
VIEW_DISTANCE: 15
LEVEL_TYPE: LARGEBIOMES
MAX_PLAYERS: 100
CONSOLE: "false"
image: itzg/minecraft-server
restart: always
volumes:
mcbig:

View File

@@ -1,14 +1,27 @@
minecraft-server: version: '3'
ports:
- "25565:25565"
environment: services:
EULA: "TRUE" minecraft:
image: itzg/minecraft-server
ports:
- "25565:25565"
volumes:
- "mc:/data"
environment:
EULA: "TRUE"
CONSOLE: "false"
ENABLE_RCON: "true"
RCON_PASSWORD: "testing"
RCON_PORT: 28016
restart: always
rcon:
image: itzg/rcon
ports:
- "4326:4326"
- "4327:4327"
volumes:
- "rcon:/opt/rcon-web-admin/db"
image: itzg/minecraft-server volumes:
mc:
container_name: minecraft-server rcon:
tty: true
stdin_open: true
restart: always

View File

@@ -157,6 +157,44 @@ function installForge {
fi fi
} }
function installFTB {
TYPE=FEED-THE-BEAST
echo "Looking for Feed-The-Beast server modpack."
if [[ -z $FTB_SERVER_MOD ]]; then
echo "Environment variable FTB_SERVER_MOD not set."
echo "Set FTB_SERVER_MOD to the file name of the FTB server modpack."
echo "(And place the modpack in the /data directory.)"
exit 2
fi
local srv_modpack=${FTB_SERVER_MOD}
if [[ ${srv_modpack:0:5} == "data/" ]]; then
# Prepend with "/"
srv_modpack=/${srv_modpack}
fi
if [[ ! ${srv_modpack:0:1} == "/" ]]; then
# If not an absolute path, assume file is in "/data"
srv_modpack=/data/${srv_modpack}
fi
if [[ ! -f ${srv_modpack} ]]; then
echo "FTB server modpack ${srv_modpack} not found."
exit 2
fi
if [[ ! ${srv_modpack: -4} == ".zip" ]]; then
echo "FTB server modpack ${srv_modpack} is not a zip archive."
echo "Please set FTB_SERVER_MOD to a file with a .zip extension."
exit 2
fi
echo "Unpacking FTB server modpack ${srv_modpack} ..."
local ftb_dir=/data/FeedTheBeast
mkdir -p ${ftb_dir}
unzip -u -o ${srv_modpack} -d ${ftb_dir}
cp -f /data/eula.txt ${ftb_dir}/eula.txt
FTB_SERVER_START=${ftb_dir}/ServerStart.sh
chmod a+x ${FTB_SERVER_START}
}
function installVanilla { function installVanilla {
SERVER="minecraft_server.$VANILLA_VERSION.jar" SERVER="minecraft_server.$VANILLA_VERSION.jar"
@@ -203,6 +241,11 @@ case "$TYPE" in
installForge installForge
;; ;;
FTB|ftb)
TYPE=FEED-THE-BEAST
installFTB
;;
VANILLA|vanilla) VANILLA|vanilla)
installVanilla installVanilla
;; ;;
@@ -447,10 +490,20 @@ else
EXTRA_ARGS="" EXTRA_ARGS=""
fi fi
# If we have a bootstrap.txt file... feed that in to the server stdin if [[ ! -z $MAX_MEMORY ]]; then
if [ -f /data/bootstrap.txt ]; # put prior JVM_OPTS at the end to give any memory settings there higher precedence
then JVM_OPTS="-Xms${MAX_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt fi
else set -x
exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
echo "Running FTB server modpack start ..."
exec sh ${FTB_SERVER_START}
else
# If we have a bootstrap.txt file... feed that in to the server stdin
if [ -f /data/bootstrap.txt ];
then
exec java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt
else
exec java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS
fi
fi fi