Compare commits

...

14 Commits

Author SHA1 Message Date
Geoff Bourne
e261fae348 [es] Upgrade to 5.4.2 2017-06-21 19:06:13 -05:00
Geoff Bourne
5b8668d73f [mc] Add dinnerbone's mcstatus and use it for HEALTHCHECK
Part of #159
2017-06-11 11:03:00 -05:00
Geoff Bourne
123292b56b Merge pull request #156 from dirkcjelli/mc_fixes
minecraft-server: Fixed FORGEVERSION case, add support for BIOMESOP
Fixes #139
2017-06-07 21:00:39 -05:00
Sascha Askani
0e0828f47f Revert "Fix FORGEVERSION -> FORGE_VERSION, remove unneeded statement in default"
This reverts commit cb6643a345.
2017-06-07 20:55:39 -05:00
Geoff Bourne
532c9fa69a Merge branch 'master' into mc_fixes 2017-06-07 20:54:35 -05:00
Geoff Bourne
e509563b10 [mc] Correctly pre-populate json config files
For #158
2017-06-07 20:43:35 -05:00
Geoff Bourne
899f31917c [mc] Add some FORGE_INSTALLER lookup messages 2017-06-07 08:07:44 -05:00
Geoff Bourne
e6ca9a1c6d [mc] glob for forge jar, but exclude installer 2017-06-06 23:09:45 -05:00
Geoff Bourne
24c68b9c2c [mc] Avoid trying to run forge installer as server 2017-06-06 22:36:39 -05:00
Geoff Bourne
2891e1ac3e [mc] Check for valid $FORGE_INSTALLER 2017-06-05 21:34:15 -05:00
Sascha Askani
da9618c08b add support for BIOMESOP level type 2017-06-05 16:09:26 +02:00
Sascha Askani
cb6643a345 Fix FORGEVERSION -> FORGE_VERSION, remove unneeded statement in default
case
2017-06-05 16:08:26 +02:00
Geoff Bourne
71527b87c1 [mc] Add support for custom Forge installer sources
For #154
2017-06-03 20:51:54 -05:00
Geoff Bourne
df25a22634 [es] Upgrade to 5.4.1 2017-06-02 12:02:11 -05:00
5 changed files with 145 additions and 76 deletions

View File

@@ -4,7 +4,7 @@ LABEL maintainer "itzg"
RUN apk -U add bash RUN apk -U add bash
ENV ES_VERSION=5.4.0 ENV ES_VERSION=5.4.2
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 && \

View File

@@ -7,20 +7,11 @@ services:
TYPE: MASTER TYPE: MASTER
UNICAST_HOSTS: master UNICAST_HOSTS: master
MIN_MASTERS: 1 MIN_MASTERS: 1
deploy:
replicas: 1
update_config:
parallelism: 1
data: data:
build: . build: .
environment: environment:
TYPE: DATA TYPE: DATA
UNICAST_HOSTS: master UNICAST_HOSTS: master
deploy:
replicas: 2
update_config:
parallelism: 1
delay: 60s
gateway: gateway:
build: . build: .
ports: ports:

View File

@@ -16,9 +16,13 @@ RUN echo "http://dl-3.alpinelinux.org/alpine/v3.5/community/" >> /etc/apk/reposi
git \ git \
jq \ jq \
mysql-client \ mysql-client \
python python-dev && \ python python-dev py2-pip && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
RUN pip install mcstatus
HEALTHCHECK CMD mcstatus localhost ping
RUN addgroup -g 1000 minecraft \ RUN addgroup -g 1000 minecraft \
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \ && adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
&& mkdir /data \ && mkdir /data \

View File

@@ -117,6 +117,34 @@ or a specific version:
docker run -d -e VERSION=1.7.9 ... docker run -d -e VERSION=1.7.9 ...
## Healthcheck
This image contains [Dinnerbone's mcstatus](https://github.com/Dinnerbone/mcstatus) and uses
its `ping` command to continually check on the container's. That can be observed
from the `STATUS` column of `docker ps`
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b418af073764 mc "/start" 43 seconds ago Up 41 seconds (healthy) 0.0.0.0:25565->25565/tcp, 25575/tcp mc
```
You can also query the container's health in a script friendly way:
```
> docker container inspect -f "{{.State.Health.Status}}" mc
healthy
```
Finally, since `mcstatus` is on the `PATH` you can exec into the container
and use mcstatus directly and invoke any of its other commands:
```
> docker exec mc mcstatus localhost status
version: v1.12 (protocol 335)
description: "{u'text': u'A Minecraft Server Powered by Docker'}"
players: 0/20 No players online
```
## Running a Forge Server ## Running a Forge Server
Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line. Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line.
@@ -127,6 +155,20 @@ but you can also choose to run a specific version with `-e FORGEVERSION=10.13.4.
-e TYPE=FORGE -e FORGEVERSION=10.13.4.1448 \ -e TYPE=FORGE -e FORGEVERSION=10.13.4.1448 \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
To use a pre-downloaded Forge installer, place it in the attached `/data` directory and
specify the name of the installer file with `FORGE_INSTALLER`, such as:
$ docker run -d -v /path/on/host:/data ... \
-e FORGE_INSTALLER=forge-1.11.2-13.20.0.2228-installer.jar ...
To download a Forge installer from a custom location, such as your own file repository, specify
the URL with `FORGE_INSTALLER_URL`, such as:
$ docker run -d -v /path/on/host:/data ... \
-e FORGE_INSTALLER_URL=http://HOST/forge-1.11.2-13.20.0.2228-installer.jar ...
In both of the cases above, there is no need for the `VERSION` or `FORGEVERSION` variables.
In order to add mods, you have two options. In order to add mods, you have two options.
### Using the /data volume ### Using the /data volume

View File

@@ -121,84 +121,116 @@ function downloadPaper {
function installForge { function installForge {
TYPE=FORGE TYPE=FORGE
norm=$VANILLA_VERSION
case $VANILLA_VERSION in if [[ -z $FORGE_INSTALLER && -z $FORGE_INSTALLER_URL ]]; then
*.*.*) norm=$VANILLA_VERSION
norm=$VANILLA_VERSION ;;
*.*)
norm=${VANILLA_VERSION}.0 ;;
esac
echo "Checking Forge version information." case $VANILLA_VERSION in
case $FORGEVERSION in *.*.*)
RECOMMENDED) norm=$VANILLA_VERSION ;;
curl -fsSL -o /tmp/forge.json http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json *.*)
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$VANILLA_VERSION-recommended\"]") norm=${VANILLA_VERSION}.0 ;;
if [ $FORGE_VERSION = null ]; then esac
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$VANILLA_VERSION-latest\"]")
echo "Checking Forge version information."
case $FORGEVERSION in
RECOMMENDED)
curl -fsSL -o /tmp/forge.json http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$VANILLA_VERSION-recommended\"]")
if [ $FORGE_VERSION = null ]; then if [ $FORGE_VERSION = null ]; then
echo "ERROR: Version $VANILLA_VERSION is not supported by Forge" FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$VANILLA_VERSION-latest\"]")
echo " Refer to http://files.minecraftforge.net/ for supported versions" if [ $FORGE_VERSION = null ]; then
exit 2 echo "ERROR: Version $VANILLA_VERSION is not supported by Forge"
echo " Refer to http://files.minecraftforge.net/ for supported versions"
exit 2
fi
fi fi
fi ;;
;;
*) *)
FORGE_VERSION=$FORGEVERSION FORGE_VERSION=$FORGEVERSION
;; ;;
esac esac
normForgeVersion=$VANILLA_VERSION-$FORGE_VERSION-$norm normForgeVersion=$VANILLA_VERSION-$FORGE_VERSION-$norm
shortForgeVersion=$VANILLA_VERSION-$FORGE_VERSION shortForgeVersion=$VANILLA_VERSION-$FORGE_VERSION
forgeFileNames=" FORGE_INSTALLER="/tmp/forge-$shortForgeVersion-installer.jar"
$normForgeVersion/forge-$normForgeVersion-installer.jar elif [[ -z $FORGE_INSTALLER ]]; then
$shortForgeVersion/forge-$shortForgeVersion-installer.jar FORGE_INSTALLER="/tmp/forge-installer.jar"
END elif [[ ! -e $FORGE_INSTALLER ]]; then
" echo "ERROR: the given Forge installer doesn't exist : $FORGE_INSTALLER"
exit 2
fi
FORGE_INSTALLER="/tmp/forge-$shortForgeVersion-installer.jar"
installMarker=".forge-installed-$shortForgeVersion" installMarker=".forge-installed-$shortForgeVersion"
if [ ! -e $installMarker ]; then if [ ! -e $installMarker ]; then
if [ ! -e $FORGE_INSTALLER ]; then if [ ! -e $FORGE_INSTALLER ]; then
echo "Downloading $normForgeVersion"
for fn in $forgeFileNames; do if [[ -z $FORGE_INSTALLER_URL ]]; then
if [ $fn == END ]; then echo "Downloading $normForgeVersion"
echo "Unable to compute URL for $normForgeVersion"
forgeFileNames="
$normForgeVersion/forge-$normForgeVersion-installer.jar
$shortForgeVersion/forge-$shortForgeVersion-installer.jar
END
"
for fn in $forgeFileNames; do
if [ $fn == END ]; then
echo "Unable to compute URL for $normForgeVersion"
exit 2
fi
downloadUrl=http://files.minecraftforge.net/maven/net/minecraftforge/forge/$fn
echo "...trying $downloadUrl"
if curl -o $FORGE_INSTALLER -fsSL $downloadUrl; then
break
fi
done
else
echo "Downloading $FORGE_INSTALLER_URL ..."
if ! curl -o $FORGE_INSTALLER -fsSL $FORGE_INSTALLER_URL; then
echo "Failed to download from given location $FORGE_INSTALLER_URL"
exit 2 exit 2
fi fi
downloadUrl=http://files.minecraftforge.net/maven/net/minecraftforge/forge/$fn
echo "...trying $downloadUrl"
if curl -o $FORGE_INSTALLER -fsSL $downloadUrl; then
break
fi
done
echo "Installing Forge $shortForgeVersion"
mkdir -p mods
tries=3
while ((--tries >= 0)); do
java -jar $FORGE_INSTALLER --installServer
if [ $? == 0 ]; then
break
fi
done
if (($tries < 0)); then
echo "Forge failed to install after several tries." >&2
exit 10
fi fi
SERVER=$(ls *forge*$shortForgeVersion*.jar)
if [ -z $SERVER ]; then
echo "Unable to derive server jar for Forge $shortForgeVersion"
exit 2
fi
echo "Using server $SERVER"
echo $SERVER > $installMarker
fi fi
echo "Installing Forge $shortForgeVersion using $FORGE_INSTALLER"
mkdir -p mods
tries=3
while ((--tries >= 0)); do
java -jar $FORGE_INSTALLER --installServer
if [ $? == 0 ]; then
break
fi
done
if (($tries < 0)); then
echo "Forge failed to install after several tries." >&2
exit 10
fi
# NOTE $shortForgeVersion will be empty if installer location was given to us
echo "Finding installed server jar..."
for j in *forge*.jar; do
echo "...$j"
case $j in
*installer*)
;;
*)
SERVER=$j
break
;;
esac
done
if [[ -z $SERVER ]]; then
echo "Unable to derive server jar for Forge"
exit 2
fi
echo "Using server $SERVER"
echo $SERVER > $installMarker
else else
SERVER=$(cat $installMarker) SERVER=$(cat $installMarker)
fi fi
@@ -438,7 +470,7 @@ if [ ! -e server.properties ]; then
echo "Setting level type to $LEVEL_TYPE" echo "Setting level type to $LEVEL_TYPE"
# check for valid values and only then set # check for valid values and only then set
case $LEVEL_TYPE in case $LEVEL_TYPE in
DEFAULT|FLAT|LARGEBIOMES|AMPLIFIED|CUSTOMIZED) DEFAULT|FLAT|LARGEBIOMES|AMPLIFIED|CUSTOMIZED|BIOMESOP)
sed -i "/level-type\s*=/ c level-type=$LEVEL_TYPE" /data/server.properties sed -i "/level-type\s*=/ c level-type=$LEVEL_TYPE" /data/server.properties
;; ;;
*) *)
@@ -525,10 +557,10 @@ fi
# Make sure files exist to avoid errors # Make sure files exist to avoid errors
if [ ! -e banned-players.json ]; then if [ ! -e banned-players.json ]; then
echo '' > banned-players.json echo '[]' > banned-players.json
fi fi
if [ ! -e banned-ips.json ]; then if [ ! -e banned-ips.json ]; then
echo '' > banned-ips.json echo '[]' > banned-ips.json
fi fi
# If any modules have been provided, copy them over # If any modules have been provided, copy them over