From 36ced1c6302edf7e8b1c0d546f73922bd13dc98f Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Fri, 9 Dec 2016 10:45:34 -0500 Subject: [PATCH 01/19] small command line fix --- elasticsearch/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 3aad9c06..5c3de57b 100755 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -29,9 +29,9 @@ Where `DOCKERHOST` would be the actual hostname of your host running Docker. To run a multi-node cluster (3-node in this example) on a single Docker machine use: - docker run -d --name es0 -p 9200:9200 es - docker run -d --name es1 --link es0 -e UNICAST_HOSTS=es0 es - docker run -d --name es2 --link es0 -e UNICAST_HOSTS=es0 es + docker run -d --name es0 -p 9200:9200 itzg/elasticsearch + docker run -d --name es1 --link es0 -e UNICAST_HOSTS=es0 itzg/elasticsearch + docker run -d --name es2 --link es0 -e UNICAST_HOSTS=es0 itzg/elasticsearch and then check the cluster health, such as http://192.168.99.100:9200/_cluster/health?pretty From 03a5bb1ab025bfec3a0bb1c5b2208551b5e2079a Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 9 Dec 2016 15:15:38 -0600 Subject: [PATCH 02/19] [es] Upgrade to 5.1.1 --- elasticsearch/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index cc6aafdc..2b4c1d63 100755 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -4,7 +4,7 @@ MAINTAINER itzg RUN apk -U add bash -ENV ES_VERSION=5.0.2 +ENV ES_VERSION=5.1.1 ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz RUN cd /usr/share && \ From 9bb3628792272157a765db477e446ebdd6e44c1c Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 9 Dec 2016 15:23:06 -0600 Subject: [PATCH 03/19] [kibana] Upgrade to 5.1.1 --- kibana/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kibana/Dockerfile b/kibana/Dockerfile index 82e8ebfd..1895029d 100755 --- a/kibana/Dockerfile +++ b/kibana/Dockerfile @@ -2,7 +2,7 @@ FROM openjdk:8u111-jre MAINTAINER itzg -ENV KIBANA_VERSION 5.0.2 +ENV KIBANA_VERSION 5.1.1 ADD https://artifacts.elastic.co/downloads/kibana/kibana-${KIBANA_VERSION}-linux-x86_64.tar.gz /tmp/kibana.tgz From dde4132d2c5fc05b8de7f3f152d146da66752ea2 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 1 Jan 2017 13:29:52 -0600 Subject: [PATCH 04/19] [cass] Switch mirror URL to pair.com --- cassandra/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cassandra/Dockerfile b/cassandra/Dockerfile index c3423b2b..ac73073b 100755 --- a/cassandra/Dockerfile +++ b/cassandra/Dockerfile @@ -4,7 +4,7 @@ MAINTAINER itzg ENV CASSANDRA_VERSION 2.2.8 -ADD http://mirrors.ibiblio.org/apache/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz /tmp/apache-cassandra.tgz +ADD http://apache.mirrors.pair.com/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz /tmp/apache-cassandra.tgz RUN tar -C /opt -zxf /tmp/apache-cassandra.tgz && \ rm /tmp/apache-cassandra.tgz From 5062bc91ab01959fd8757fc00d9f079b8eb85ba7 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 4 Jan 2017 19:56:33 -0600 Subject: [PATCH 05/19] [es] Fixed DISCOVER_HTTP_IP typo in README Fixes #120 --- elasticsearch/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 5c3de57b..8ff08c9c 100755 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -196,7 +196,7 @@ 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 DISCOVERY_HTTP_IP=eth2 + -e DISCOVER_HTTP_IP=eth2 ## Heap size and other JVM options From e44d27c00a81da1ff82aedd693192bbf720a2d47 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 4 Jan 2017 20:37:20 -0600 Subject: [PATCH 06/19] [es] Fine java security grants Fixes #119 * also switch/upgrade base to openjdk 8u111 --- elasticsearch/Dockerfile | 3 ++- elasticsearch/java.policy | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 elasticsearch/java.policy diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index 2b4c1d63..97ee05f0 100755 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -1,4 +1,4 @@ -FROM java:8u92-jre-alpine +FROM openjdk:8u111-jre-alpine MAINTAINER itzg @@ -25,6 +25,7 @@ VOLUME ["/data","/conf"] WORKDIR $ES_HOME +COPY java.policy /usr/lib/jvm/java-1.8-openjdk/jre/lib/security/ COPY start /start COPY log4j2.properties $ES_HOME/config/ diff --git a/elasticsearch/java.policy b/elasticsearch/java.policy new file mode 100644 index 00000000..87b3ede2 --- /dev/null +++ b/elasticsearch/java.policy @@ -0,0 +1,6 @@ +grant { + // JMX Java Management eXtensions + permission javax.management.MBeanTrustPermission "register"; + permission javax.management.MBeanServerPermission "createMBeanServer"; + permission javax.management.MBeanPermission "-#-[-]", "queryNames"; +}; From 262816bd2d799bb9574f7455e7529447d3bbd4be Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 4 Jan 2017 20:43:23 -0600 Subject: [PATCH 07/19] [es] Add note about increasing mmap count --- elasticsearch/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 8ff08c9c..4912ac41 100755 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -1,5 +1,10 @@ This Docker image provides an easily configurable Elasticsearch node. Via port mappings, it is easy to create an arbitrarily sized cluster of nodes. As long as the versions match, you can mix-and-match "real" Elasticsearch nodes with container-ized ones. +# NOTE for use on Linux hosts + +Elasticsearch 5.x requires that the virtual memory mmap count is set sufficiently for stable, +production use. [Refer to this guide for more information](https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html). + # Basic Usage To start an Elasticsearch data node that listens on the standard ports on your host's network interface: From 9fe0021a7aa100ed3adfc9e72a4a7ee343ed1ddc Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 12 Jan 2017 19:40:58 -0600 Subject: [PATCH 08/19] [mc] Upgrade base image to openjdk Fixes #122 --- minecraft-server/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minecraft-server/Dockerfile b/minecraft-server/Dockerfile index fe28bd34..082bf85f 100644 --- a/minecraft-server/Dockerfile +++ b/minecraft-server/Dockerfile @@ -1,4 +1,4 @@ -FROM java:8 +FROM openjdk:8-jre MAINTAINER itzg From 4a7ecffcbbc83c86ae9e6fc121251fd6e91213fb Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 15 Jan 2017 07:04:27 -0600 Subject: [PATCH 09/19] [es][kibana] Upgrade to 5.1.2 --- elasticsearch/Dockerfile | 2 +- kibana/Dockerfile | 2 +- kibana/docker-compose-test.yml | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 kibana/docker-compose-test.yml diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index 97ee05f0..eac63e1a 100755 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -4,7 +4,7 @@ MAINTAINER itzg RUN apk -U add bash -ENV ES_VERSION=5.1.1 +ENV ES_VERSION=5.1.2 ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz RUN cd /usr/share && \ diff --git a/kibana/Dockerfile b/kibana/Dockerfile index 1895029d..7f02dd9c 100755 --- a/kibana/Dockerfile +++ b/kibana/Dockerfile @@ -2,7 +2,7 @@ FROM openjdk:8u111-jre 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 diff --git a/kibana/docker-compose-test.yml b/kibana/docker-compose-test.yml new file mode 100644 index 00000000..7b484fd1 --- /dev/null +++ b/kibana/docker-compose-test.yml @@ -0,0 +1,12 @@ +version: '2' + +services: + es: + build: ../elasticsearch + ports: + - "9200:9200" + + kibana: + build: . + ports: + - "5601:5601" From b8d69278e4f25b449c0705ed2ff46e9ee649b7c2 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Mon, 23 Jan 2017 10:25:50 -0600 Subject: [PATCH 10/19] [es] Fix address binding for Swarm Mode --- elasticsearch/Dockerfile | 2 -- elasticsearch/README.md | 16 ++++++---------- elasticsearch/start | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index eac63e1a..eb99323b 100755 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -15,8 +15,6 @@ EXPOSE 9200 9300 ENV ES_HOME=/usr/share/elasticsearch-$ES_VERSION \ DEFAULT_ES_USER=elasticsearch \ - DISCOVER_TRANSPORT_IP=eth0 \ - DISCOVER_HTTP_IP=eth0 \ ES_JAVA_OPTS="-Xms1g -Xmx1g" RUN adduser -S -s /bin/sh $DEFAULT_ES_USER diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 8ff08c9c..008a0c13 100755 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -182,20 +182,16 @@ Using the Docker Compose file above, a value of `2` is appropriate when scaling 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 -multiple IP addresses. As a result, it creates confusion for the transport publish logic even when using -the special value `_eth0_`. +When using Docker Swarm mode the container is presented with multiple ethernet +devices. By default, all global, routable IP addresses are configured for +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 - -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 ## Heap size and other JVM options diff --git a/elasticsearch/start b/elasticsearch/start index c0252667..61e94ccf 100755 --- a/elasticsearch/start +++ b/elasticsearch/start @@ -19,6 +19,11 @@ discoverIpFromLink() { 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() { if [ -n "$CLUSTER" ]; then @@ -112,8 +117,13 @@ OPTS="$OPTS \ -E transport.tcp.port=9300 \ -E http.port=9200" -discoverIpFromLink $DISCOVER_TRANSPORT_IP transport -discoverIpFromLink $DISCOVER_HTTP_IP http +discoverAllGlobalIps +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_clustering From 788d06c08633a61d5a30476b1756c6516ced62fb Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 2 Feb 2017 20:28:12 -0600 Subject: [PATCH 11/19] [es] Upgrade to 5.2.0 For #124 --- elasticsearch/Dockerfile | 2 +- elasticsearch/docker-compose.yml | 36 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 elasticsearch/docker-compose.yml diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index eb99323b..07f1da1d 100755 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -4,7 +4,7 @@ MAINTAINER itzg RUN apk -U add bash -ENV ES_VERSION=5.1.2 +ENV ES_VERSION=5.2.0 ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz RUN cd /usr/share && \ diff --git a/elasticsearch/docker-compose.yml b/elasticsearch/docker-compose.yml new file mode 100644 index 00000000..aebf36d0 --- /dev/null +++ b/elasticsearch/docker-compose.yml @@ -0,0 +1,36 @@ +version: '3' + +services: + master: + image: es + environment: + TYPE: MASTER + UNICAST_HOSTS: master + MIN_MASTERS: 2 + deploy: + replicas: 3 + update_config: + parallelism: 1 + data: + image: es + environment: + TYPE: DATA + UNICAST_HOSTS: master + deploy: + replicas: 2 + update_config: + parallelism: 1 + gateway: + image: es + ports: + - "9200:9200" + - "9300:9300" + environment: + TYPE: GATEWAY + UNICAST_HOSTS: master + kibana: + image: kibana + ports: + - "5601:5601" + environment: + ELASTICSEARCH_URL: http://gateway:9200 From 5c14c30a789c062d29baa4e72c290761ba643354 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 2 Feb 2017 20:48:17 -0600 Subject: [PATCH 12/19] [es] Include docker stack deploy instructions --- elasticsearch/README.md | 18 ++++++++++++++++++ elasticsearch/docker-compose.yml | 11 ++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 9b005cc7..af349d83 100755 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -54,6 +54,24 @@ and then check the cluster health, such as http://192.168.99.100:9200/_cluster/h "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. + # Configuration Summary ## Ports diff --git a/elasticsearch/docker-compose.yml b/elasticsearch/docker-compose.yml index aebf36d0..e847b7eb 100644 --- a/elasticsearch/docker-compose.yml +++ b/elasticsearch/docker-compose.yml @@ -2,17 +2,17 @@ version: '3' services: master: - image: es + image: itzg/elasticsearch environment: TYPE: MASTER UNICAST_HOSTS: master - MIN_MASTERS: 2 + MIN_MASTERS: 1 deploy: - replicas: 3 + replicas: 1 update_config: parallelism: 1 data: - image: es + image: itzg/elasticsearch environment: TYPE: DATA UNICAST_HOSTS: master @@ -20,8 +20,9 @@ services: replicas: 2 update_config: parallelism: 1 + delay: 60s gateway: - image: es + image: itzg/elasticsearch ports: - "9200:9200" - "9300:9300" From 2125fa0855d922e592236438f7c088b37c584596 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 2 Feb 2017 20:53:47 -0600 Subject: [PATCH 13/19] [es] Tweak spacing on README --- elasticsearch/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index af349d83..47a722dc 100755 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -55,11 +55,11 @@ and then check the cluster health, such as http://192.168.99.100:9200/_cluster/h } 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-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: ``` From 17420ed590b309b2bc49d8ba40d7114f5b455da3 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 4 Feb 2017 14:37:45 -0600 Subject: [PATCH 14/19] [es] Added HEALTHCHECK --- elasticsearch/Dockerfile | 2 ++ elasticsearch/README.md | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index 07f1da1d..936b9fc3 100755 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -13,6 +13,8 @@ RUN cd /usr/share && \ EXPOSE 9200 9300 +HEALTHCHECK --timeout=5s CMD wget -q -O - http://$HOSTNAME:9200/_cat/health + ENV ES_HOME=/usr/share/elasticsearch-$ES_VERSION \ DEFAULT_ES_USER=elasticsearch \ ES_JAVA_OPTS="-Xms1g -Xmx1g" diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 47a722dc..b6aad769 100755 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -72,6 +72,22 @@ 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 ## Ports From 4a89f3c579644f9801dbd82348f4e1b46c8688bd Mon Sep 17 00:00:00 2001 From: Henry Gessau Date: Sun, 12 Feb 2017 18:02:56 -0600 Subject: [PATCH 15/19] 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. --- minecraft-server/README.md | 59 +++++++++++++++++++++++++++++ minecraft-server/start-minecraft.sh | 58 +++++++++++++++++++++++++--- 2 files changed, 112 insertions(+), 5 deletions(-) diff --git a/minecraft-server/README.md b/minecraft-server/README.md index 65d1fff2..6cb9e052 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -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 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 Rather than type the server options below, the port mappings above, etc diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index 02caf3dc..c64372d7 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -157,6 +157,44 @@ function installForge { 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 { SERVER="minecraft_server.$VANILLA_VERSION.jar" @@ -203,6 +241,11 @@ case "$TYPE" in installForge ;; + FTB|ftb) + TYPE=FEED-THE-BEAST + installFTB + ;; + VANILLA|vanilla) installVanilla ;; @@ -447,10 +490,15 @@ else EXTRA_ARGS="" fi -# If we have a bootstrap.txt file... feed that in to the server stdin -if [ -f /data/bootstrap.txt ]; -then - exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt +if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then + echo "Running FTB server modpack start ..." + exec sh ${FTB_SERVER_START} else - exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS + # If we have a bootstrap.txt file... feed that in to the server stdin + if [ -f /data/bootstrap.txt ]; + then + exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt + else + exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS + fi fi From f5dbbcc2c67b8ca1c90977438114ae32d59565b8 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 14 Feb 2017 22:15:36 -0600 Subject: [PATCH 16/19] [mc] Use G1 GC by default and simplify max memory setting For #126 --- minecraft-server/Dockerfile | 2 +- minecraft-server/README.md | 7 ++++--- minecraft-server/start-minecraft.sh | 9 +++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/minecraft-server/Dockerfile b/minecraft-server/Dockerfile index 082bf85f..e89a9061 100644 --- a/minecraft-server/Dockerfile +++ b/minecraft-server/Dockerfile @@ -38,6 +38,6 @@ ENTRYPOINT [ "/start" ] ENV UID=1000 GID=1000 \ 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 \ LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= ONLINE_MODE=TRUE CONSOLE=true diff --git a/minecraft-server/README.md b/minecraft-server/README.md index 6cb9e052..f2495217 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -608,10 +608,11 @@ By default, server checks connecting players against Minecraft's account databas ### Memory Limit -The Java memory limit can be adjusted using the `JVM_OPTS` environment variable, where the default is -the setting shown in the example (max and min at 1024 MB): +By default the image declares a Java memory limit of 1 GB. That can be adjusted +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 diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index c64372d7..c81e2fa8 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -490,6 +490,11 @@ else EXTRA_ARGS="" fi +if [[ ! -z $MAX_MEMORY ]]; then + # put prior JVM_OPTS at the end to give any memory settings there higher precedence + JVM_OPTS="-Xms${MAX_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}" +fi +set -x if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then echo "Running FTB server modpack start ..." exec sh ${FTB_SERVER_START} @@ -497,8 +502,8 @@ else # If we have a bootstrap.txt file... feed that in to the server stdin if [ -f /data/bootstrap.txt ]; then - exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt + exec java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt else - exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS + exec java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS fi fi From e3296c3cc097633615d4240c7569b30fcb66dcce Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 15 Feb 2017 19:30:33 -0600 Subject: [PATCH 17/19] [es] Upgrade to 5.2.1 --- elasticsearch/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index 936b9fc3..c4c1a3cf 100755 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -4,7 +4,7 @@ MAINTAINER itzg RUN apk -U add bash -ENV ES_VERSION=5.2.0 +ENV ES_VERSION=5.2.1 ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz RUN cd /usr/share && \ From 79eb164e904865a0667519ad13ff00209b591d63 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 18 Feb 2017 11:00:55 -0600 Subject: [PATCH 18/19] [mc] Adding example compose file for large minecraft server --- minecraft-server/docker-compose-big.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 minecraft-server/docker-compose-big.yml diff --git a/minecraft-server/docker-compose-big.yml b/minecraft-server/docker-compose-big.yml new file mode 100644 index 00000000..ad190f5b --- /dev/null +++ b/minecraft-server/docker-compose-big.yml @@ -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: From 32b0737e70ce14f4fb2282248c478e61b45b17d6 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 18 Feb 2017 11:53:44 -0600 Subject: [PATCH 19/19] [mc] Add rcon to docker-compose.yml example --- minecraft-server/docker-compose.yml | 37 +++++++++++++++++++---------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/minecraft-server/docker-compose.yml b/minecraft-server/docker-compose.yml index a8b689db..0c1803f6 100644 --- a/minecraft-server/docker-compose.yml +++ b/minecraft-server/docker-compose.yml @@ -1,14 +1,27 @@ -minecraft-server: - ports: - - "25565:25565" +version: '3' - environment: - EULA: "TRUE" +services: + 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 - - container_name: minecraft-server - - tty: true - stdin_open: true - restart: always +volumes: + mc: + rcon: