Compare commits

...

24 Commits

Author SHA1 Message Date
Geoff Bourne
9ee907783d [mc] Added issues link 2017-09-02 12:29:50 -05:00
Geoff Bourne
463cc62b75 [mc] Check writability of /data
Document JVM_OPTS
For #176 and #177
2017-09-02 12:24:09 -05:00
Geoff Bourne
5afd98edd8 [es] Upgrade to 5.5.1 2017-08-12 13:58:39 -05:00
Geoff Bourne
8b9051d72e Merge pull request #174 from Rob5Underscores/master
Add support for a zip file of mod configs to be supplied!
2017-07-17 06:56:44 -05:00
Rob Weddell
d6392f3aa9 Add support for a zip file of mod configs to be supplied!
This was added such that Sponge servers are supported.
(For Sponge: TYPE=FORGE, MODPACK=[zip including sponge plugins and jar], MODCONFIG=[sponge configuration])
2017-07-17 11:48:23 +01:00
Geoff Bourne
fe808be91b Merge pull request #173 from opHASnoNAME/master
Set UID for ES_DEFAULT_USER to 1100, avoid conflicts with debian host…
2017-07-16 14:16:24 -05:00
Arne Riemann
2cab10e906 Forgot -u for UID 2017-07-16 16:09:28 +02:00
Geoff Bourne
7f39d1f22e [mc] Properly check empty json files to fix
For #162
2017-07-15 20:02:40 -05:00
Arne Riemann
a9184368c1 Set UID for ES_DEFAULT_USER to 1100, avoid conflicts with debian host systems 2017-07-15 06:38:36 +02:00
Geoff Bourne
caf2fc2ab6 [es] Correcting old-ADD tar file path 2017-07-13 09:09:10 -05:00
Geoff Bourne
5dd8141e5e Merge pull request #169 from manojsb/patch-1
Upgrade to ES 5.5.0
2017-07-13 08:53:42 -05:00
Geoff Bourne
2ff28675d4 [es] Adapt to new Dockerfile ADD behavior 2017-07-13 08:52:02 -05:00
Manoj Kumar
519bd986b5 Update Dockerfile
Updated to v5.5.0
2017-07-12 11:41:13 +05:30
Geoff Bourne
e41efba176 [es] Using NON_DATA in 3x1GB stack
For #165
2017-07-04 18:08:10 -05:00
Geoff Bourne
0502813496 [es] Add NON_DATA type
For #165
2017-07-04 18:06:08 -05:00
Geoff Bourne
932a6828f9 [mc] Auto fix pre 1.12 empty json
For #162
2017-07-03 14:20:12 -05:00
Geoff Bourne
d176ef3f6a Merge pull request #167 from lukascernydis/master
Added option REMOVE_OLD_MODS
2017-07-01 20:09:12 -05:00
Lukáš Černý
deb98268f6 Added option REMOVE_OLD_MODS 2017-07-02 01:32:24 +02:00
Geoff Bourne
e1531c3237 [mc] Switch to openjdk alpine base image 2017-06-29 19:45:51 -05:00
Geoff Bourne
47af45a430 Merge pull request #166 from macman31/patch-1
Fix typos in config file generation
2017-06-29 19:19:11 -05:00
ATMD
0195b42eea Fix regex to change gamemode value
The sed command `sed -i "/gamemode\s*=/ c gamemode=$MODE" $SERVER_PROPERTIES` matches all lines containing `gamemode=`.
This includes the line `force-gamemode` that is set it with `setServerProp "force-gamemode" "$FORCE_GAMEMODE"`
So basically the `force-gamemode` line is erased and the `gamemode=value` line is duplicated, and then the server cleans it up at start and deduplicates the `gamemode` line and create a new `force-gamemode` line with a default value.
This fix ensures that only the `gamemode=` line is modified when changing the gamemode value.
2017-06-29 21:53:26 +02:00
ATMD
f875af5cdb Delete repetition of spawn-npcs 2017-06-29 20:25:24 +02:00
ATMD
32a918b902 Fix typo SPAWN_ANIMIALS 2017-06-29 19:56:14 +02:00
Geoff Bourne
d09a56075f [es] Add an example minimal composition 2017-06-28 23:17:39 -05:00
9 changed files with 151 additions and 24 deletions

View File

@@ -4,12 +4,18 @@ LABEL maintainer "itzg"
RUN apk -U add bash RUN apk -U add bash
ENV ES_VERSION=5.4.2 ARG ES_VERSION=5.5.1
# avoid conflicts with debian host systems when mounting to host volume
ARG DEFAULT_ES_USER_UID=1100
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
# need to adapt to both Docker's new remote-unpack-ADD behavior and the old behavior
RUN cd /usr/share && \ RUN cd /usr/share && \
tar xf /tmp/es.tgz && \ if [ -f /tmp/elasticsearch-$ES_VERSION.tar.gz ]; then \
rm /tmp/es.tgz tar xf /tmp/elasticsearch-$ES_VERSION.tar.gz; \
else mv /tmp/elasticsearch-${ES_VERSION} /usr/share; \
fi && \
rm -f /tmp/elasticsearch-$ES_VERSION.tar.gz
EXPOSE 9200 9300 EXPOSE 9200 9300
@@ -17,9 +23,10 @@ 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 \
DEFAULT_ES_USER_UID=$DEFAULT_ES_USER_UID \
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 -u $DEFAULT_ES_USER_UID $DEFAULT_ES_USER
VOLUME ["/data","/conf"] VOLUME ["/data","/conf"]

View File

@@ -181,8 +181,9 @@ To simplify all that, this image provides a `TYPE` variable to let you amongst t
* `MASTER` : master-eligible, but holds no data. It is good to have three or more of these in a * `MASTER` : master-eligible, but holds no data. It is good to have three or more of these in a
large cluster large cluster
* `DATA` (or `NON_MASTER`) : holds data and serves search/index requests. Scale these out for elastic-y goodness. * `DATA` (or `NON_MASTER`) : holds data and serves search/index requests. Scale these out for elastic-y goodness.
* `NON_DATA` : performs all duties except holding data
* `GATEWAY` (or `COORDINATING`) : only operates as a client node or a "smart router". These are the ones whose HTTP port 9200 will need to be exposed * `GATEWAY` (or `COORDINATING`) : only operates as a client node or a "smart router". These are the ones whose HTTP port 9200 will need to be exposed
* `INGEST` : operates only as an ingest node and is not master or data eligble * `INGEST` : operates only as an ingest node and is not master or data eligible
A [Docker Compose](https://docs.docker.com/compose/overview/) file will serve as a good example of these three node types: A [Docker Compose](https://docs.docker.com/compose/overview/) file will serve as a good example of these three node types:

View File

@@ -0,0 +1,35 @@
# This composition is known to work on a Swarm cluster consisting of
# 3 VM nodes with 1GB allocated to each.
version: '3'
services:
master:
image: itzg/elasticsearch
environment:
UNICAST_HOSTS: master
MIN_MASTERS: 1
ES_JAVA_OPTS: -Xms756m -Xmx756m
TYPE: NON_DATA
ports:
- "9200:9200"
- "9300:9300"
deploy:
replicas: 1
update_config:
parallelism: 1
data:
image: itzg/elasticsearch
deploy:
mode: global
update_config:
parallelism: 1
environment:
TYPE: DATA
UNICAST_HOSTS: master
ES_JAVA_OPTS: -Xms512m -Xmx512m
kibana:
image: kibana
ports:
- "5601:5601"
environment:
ELASTICSEARCH_URL: http://master:9200

View File

@@ -28,7 +28,7 @@ services:
TYPE: INGEST TYPE: INGEST
UNICAST_HOSTS: master UNICAST_HOSTS: master
kibana: kibana:
image: kibana image: kibana:5.5.1
ports: ports:
- "5601:5601" - "5601:5601"
environment: environment:

View File

@@ -0,0 +1,21 @@
version: '3'
services:
master:
image: itzg/elasticsearch
environment:
UNICAST_HOSTS: master
MIN_MASTERS: 1
ports:
- "9200:9200"
- "9300:9300"
deploy:
replicas: 1
update_config:
parallelism: 1
kibana:
image: kibana
ports:
- "5601:5601"
environment:
ELASTICSEARCH_URL: http://master:9200

View File

@@ -99,10 +99,18 @@ setup_personality() {
OPTS="$OPTS -E node.master=false -E node.data=false -E node.ingest=true" OPTS="$OPTS -E node.master=false -E node.data=false -E node.ingest=true"
;; ;;
DATA|NON_MASTER) DATA)
OPTS="$OPTS -E node.master=false -E node.data=true -E node.ingest=false" OPTS="$OPTS -E node.master=false -E node.data=true -E node.ingest=false"
;; ;;
NON_MASTER)
OPTS="$OPTS -E node.master=false -E node.data=true -E node.ingest=true"
;;
NON_DATA)
OPTS="$OPTS -E node.master=true -E node.data=false -E node.ingest=true"
;;
*) *)
echo "Unknown node type. Please use MASTER|GATEWAY|DATA|NON_MASTER" echo "Unknown node type. Please use MASTER|GATEWAY|DATA|NON_MASTER"
exit 1 exit 1

View File

@@ -1,12 +1,8 @@
FROM alpine FROM openjdk:8u131-jre-alpine
LABEL maintainer "itzg" LABEL maintainer "itzg"
RUN echo "http://dl-3.alpinelinux.org/alpine/v3.5/community/" >> /etc/apk/repositories &&\ RUN apk add -U \
apk update && \
apk add \
openjdk8-jre-base \
openssl \ openssl \
imagemagick \ imagemagick \
lsof \ lsof \

View File

@@ -1,6 +1,7 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/itzg/minecraft-server.svg)](https://hub.docker.com/r/itzg/minecraft-server/) [![Docker Pulls](https://img.shields.io/docker/pulls/itzg/minecraft-server.svg)](https://hub.docker.com/r/itzg/minecraft-server/)
[![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/) [![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/)
[![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/dockerfiles.svg)](https://github.com/itzg/dockerfiles/issues)
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
@@ -672,6 +673,20 @@ To use this option pass the environment variable `MODPACK`, such as
top level of the zip archive. Make sure the jars are compatible with the top level of the zip archive. Make sure the jars are compatible with the
particular `TYPE` of server you are running. particular `TYPE` of server you are running.
### Remove old mods/plugins
When the option above is specified (`MODPACK`) you can also instruct script to
delete old mods/plugins prior to installing new ones. This behaviour is desirable
in case you want to upgrade mods/plugins from downloaded zip file.
To use this option pass the environment variable `REMOVE_OLD_MODS="TRUE"`, such as
docker run -d -e REMOVE_OLD_MODS="TRUE" -e MODPACK=http://www.example.com/mods/modpack.zip ...
**NOTE:** This option will be taken into account only when option `MODPACK` is also used.
**WARNING:** All content of the `mods` or `plugins` directory will be deleted
before unpacking new content from the zip file.
### Online mode ### Online mode
By default, server checks connecting players against Minecraft's account database. If you want to create an offline server or your server is not connected to the internet, you can disable the server to try connecting to minecraft.net to authenticate players with environment variable `ONLINE_MODE`, like this By default, server checks connecting players against Minecraft's account database. If you want to create an offline server or your server is not connected to the internet, you can disable the server to try connecting to minecraft.net to authenticate players with environment variable `ONLINE_MODE`, like this
@@ -696,3 +711,9 @@ The values of all three are passed directly to the JVM and support format/units
### /data ownership ### /data ownership
In order to adapt to differences in `UID` and `GID` settings the entry script will attempt to correct ownership and writability of the `/data` directory. This logic can be disabled by setting `-e SKIP_OWNERSHIP_FIX=TRUE`. In order to adapt to differences in `UID` and `GID` settings the entry script will attempt to correct ownership and writability of the `/data` directory. This logic can be disabled by setting `-e SKIP_OWNERSHIP_FIX=TRUE`.
### JVM Options
General JVM options can be passed to the Minecraft Server invocation by passing a `JVM_OPTS`
environment variable. Options like `-X` that need to proceed general JVM options can be passed
via a `JVM_XX_OPTS` environment variable.

View File

@@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
shopt -s nullglob
#umask 002 #umask 002
export HOME=/data export HOME=/data
@@ -7,6 +9,10 @@ if [ ! -e /data/eula.txt ]; then
if [ "$EULA" != "" ]; then if [ "$EULA" != "" ]; then
echo "# Generated via Docker on $(date)" > eula.txt echo "# Generated via Docker on $(date)" > eula.txt
echo "eula=$EULA" >> eula.txt echo "eula=$EULA" >> eula.txt
if [ $? != 0 ]; then
echo "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
exit 2
fi
else else
echo "" echo ""
echo "Please accept the Minecraft EULA at" echo "Please accept the Minecraft EULA at"
@@ -18,6 +24,11 @@ if [ ! -e /data/eula.txt ]; then
fi fi
fi fi
if ! touch /data/.verify_access; then
echo "ERROR: /data doesn't seem to be writable. Please make sure attached directory is writable by uid=${UID} "
exit 2
fi
SERVER_PROPERTIES=/data/server.properties SERVER_PROPERTIES=/data/server.properties
FTB_DIR=/data/FeedTheBeast FTB_DIR=/data/FeedTheBeast
VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
@@ -403,9 +414,15 @@ case "X$MODPACK" in
echo " from $MODPACK ..." echo " from $MODPACK ..."
curl -sSL -o /tmp/modpack.zip "$MODPACK" curl -sSL -o /tmp/modpack.zip "$MODPACK"
if [ "$TYPE" = "SPIGOT" ]; then if [ "$TYPE" = "SPIGOT" ]; then
if [ "$REMOVE_OLD_MODS" = "TRUE" ]; then
rm -rf /data/plugins/*
fi
mkdir -p /data/plugins mkdir -p /data/plugins
unzip -o -d /data/plugins /tmp/modpack.zip unzip -o -d /data/plugins /tmp/modpack.zip
else else
if [ "$REMOVE_OLD_MODS" = "TRUE" ]; then
rm -rf /data/mods/*
fi
mkdir -p /data/mods mkdir -p /data/mods
unzip -o -d /data/mods /tmp/modpack.zip unzip -o -d /data/mods /tmp/modpack.zip
fi fi
@@ -417,6 +434,28 @@ case "X$MODPACK" in
esac esac
fi fi
# If supplied with a URL for a config (simple zip of configurations), download it and unpack
if [[ "$MODCONFIG" ]]; then
case "X$MODCONFIG" in
X[Hh][Tt][Tt][Pp]*[Zz][iI][pP])
echo "Downloading mod/plugin configs via HTTP"
echo " from $MODCONFIG ..."
curl -sSL -o /tmp/modconfig.zip "$MODCONFIG"
if [ "$TYPE" = "SPIGOT" ]; then
mkdir -p /data/plugins
unzip -o -d /data/plugins /tmp/modconfig.zip
else
mkdir -p /data/config
unzip -o -d /data/config /tmp/modconfig.zip
fi
rm -f /tmp/modconfig.zip
;;
*)
echo "Invalid URL given for modconfig: Must be HTTP or HTTPS and a ZIP file"
;;
esac
fi
function setServerProp { function setServerProp {
local prop=$1 local prop=$1
local var=$2 local var=$2
@@ -441,11 +480,10 @@ if [ ! -e server.properties ]; then
setServerProp "allow-nether" "$ALLOW_NETHER" setServerProp "allow-nether" "$ALLOW_NETHER"
setServerProp "announce-player-achievements" "$ANNOUNCE_PLAYER_ACHIEVEMENTS" setServerProp "announce-player-achievements" "$ANNOUNCE_PLAYER_ACHIEVEMENTS"
setServerProp "enable-command-block" "$ENABLE_COMMAND_BLOCK" setServerProp "enable-command-block" "$ENABLE_COMMAND_BLOCK"
setServerProp "spawn-animals" "$SPAWN_ANIMAILS" setServerProp "spawn-animals" "$SPAWN_ANIMALS"
setServerProp "spawn-monsters" "$SPAWN_MONSTERS" setServerProp "spawn-monsters" "$SPAWN_MONSTERS"
setServerProp "spawn-npcs" "$SPAWN_NPCS" setServerProp "spawn-npcs" "$SPAWN_NPCS"
setServerProp "generate-structures" "$GENERATE_STRUCTURES" setServerProp "generate-structures" "$GENERATE_STRUCTURES"
setServerProp "spawn-npcs" "$SPAWN_NPCS"
setServerProp "view-distance" "$VIEW_DISTANCE" setServerProp "view-distance" "$VIEW_DISTANCE"
setServerProp "hardcore" "$HARDCORE" setServerProp "hardcore" "$HARDCORE"
setServerProp "max-build-height" "$MAX_BUILD_HEIGHT" setServerProp "max-build-height" "$MAX_BUILD_HEIGHT"
@@ -527,7 +565,7 @@ if [ ! -e server.properties ]; then
;; ;;
esac esac
sed -i "/gamemode\s*=/ c gamemode=$MODE" $SERVER_PROPERTIES sed -i "/^gamemode\s*=/ c gamemode=$MODE" $SERVER_PROPERTIES
fi fi
fi fi
@@ -555,13 +593,13 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then
fi fi
fi fi
# Make sure files exist to avoid errors # Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
if [ ! -e banned-players.json ]; then for j in *.json; do
echo '[]' > banned-players.json if [[ $(python -c "print open('$j').read().strip()==''") = True ]]; then
fi echo "Fixing JSON $j"
if [ ! -e banned-ips.json ]; then echo '[]' > $j
echo '[]' > banned-ips.json fi
fi done
# If any modules have been provided, copy them over # If any modules have been provided, copy them over
mkdir -p /data/mods mkdir -p /data/mods