Compare commits

...

35 Commits

Author SHA1 Message Date
Geoff Bourne
47c3350c10 [es] Fixed plugin installation after Alpine switch
For #98
2016-07-31 10:03:43 -05:00
Geoff Bourne
84bb96ef38 Merge pull request #97 from rakkhin/master
Add support for PAPER as possible Minecraft server
2016-07-22 06:53:34 -05:00
Tomasz Majer
ada4a1fab5 Mention PaperSpigot in README.md 2016-07-22 13:48:50 +02:00
Tomasz Majer
ea78bdd559 Add support for PAPER as possible Minecraft server 2016-07-21 18:32:45 +02:00
Geoff Bourne
fa790ab787 [es] Fixed whitespace in README 2016-07-10 16:51:44 -05:00
Geoff Bourne
281c044999 [es] Adding node type and min master variables
For #24
2016-07-10 16:32:55 -05:00
Geoff Bourne
b9dcdee34b Merge pull request #94 from jaychris/elasticsearch-fix-start
fixed env inheritance issue, re-ordered OPTS
2016-07-10 09:50:52 -05:00
Jay Christopherson
87b2ce1c24 fixed env inheritance issue with su command; re-ordered OPTS a bit so that --path.plugins will always be the last in order 2016-07-10 07:00:10 -07:00
Geoff Bourne
55e38181bd [es] Upgraded to 2.3.4 and based on alpine 2016-07-09 12:52:02 -05:00
Geoff Bourne
ac3cbe75a9 Merge pull request #90 from larrywright/larrywright-patch-1
Update start-minecraft.sh
2016-07-07 18:02:20 -05:00
Larry Wright
d89de80db8 Update start-minecraft.sh
Each time this script is run it downloads the modpack if one is specified. When it tries to unzip the file, if the files already exist in the plugins directory, the script will hang indefinitely because unzip asks for confirmation that you want to overwrite the existing files. Adding -o to the unzip command will tell it to overwrite the files. I suspect the world download has the same issue, but I don't use that and so can't really test it.
2016-07-07 09:17:13 -05:00
Geoff Bourne
1e1a572227 Merged branch master into master 2016-07-01 22:17:35 -05:00
Geoff Bourne
379905c6ff [mc] Use restify to lookup Spigot/Bukkit URLs at startup
For #87
2016-07-01 22:17:10 -05:00
Geoff Bourne
ec1dd96a7c [gb] Apply all files in /config to /data at startup 2016-06-27 11:16:09 -05:00
Geoff Bourne
413de37568 [gb] Allow dir or file of .git 2016-06-27 08:30:54 -05:00
Geoff Bourne
3147c5638f [gb] Option to auto-create and push existing content
For #85
2016-06-26 22:40:11 -05:00
Geoff Bourne
0832bb0c43 [mc] Update Spigot info in README
For #80 and #79
2016-06-11 18:49:18 -05:00
Geoff Bourne
b97348d703 [mc] Remove extraneous exec java call
Fixed #76
2016-06-11 18:44:23 -05:00
Geoff Bourne
4cff161deb [mc] Use new versions metadata json URL
For #83
2016-06-11 18:42:33 -05:00
Geoff Bourne
b1c0e598ad [gitblit] Fix -p usage in README 2016-06-11 18:32:09 -05:00
Geoff Bourne
63035c347b [gitblit] Upgrade to latest version and add repo init feature 2016-06-11 18:18:17 -05:00
Geoff Bourne
c806c425fd [mc] Properly quote parameters passed into entry point 2016-05-30 11:41:03 -05:00
Geoff Bourne
0defd266a6 [mc] Use ENTRYPOINT and pass through extra args
Enables experimenting for #80
2016-05-28 20:58:36 -05:00
Geoff Bourne
dd5a21067b [es] Upgrade to 2.3.2 2016-05-09 19:45:40 -05:00
Geoff Bourne
2d48bcb1a0 [cass] Upgrade to 2.2.6 2016-05-09 19:43:44 -05:00
Geoff Bourne
5617936f10 Pre-compute the Bukkit/Spigot download URLs
For #77
2016-05-09 19:28:25 -05:00
Geoff Bourne
b5e459ab0a ...try wget for Spigot download
#74
2016-04-24 12:40:59 -05:00
Geoff Bourne
ae9109e2bf ...remove debugging code from Spigot download
#74
2016-04-24 11:59:44 -05:00
Geoff Bourne
b9f247728f [mc] Detect and display curl error during Spigot/Bukkit download
#74
2016-04-24 10:50:48 -05:00
Geoff Bourne
3052cd1155 [mc] Normalize on SPIGOT for plugin/world setup
#75
2016-04-24 10:32:59 -05:00
Geoff Bourne
46c865a123 Only create /home/minecraft if absent
* only download/build Spigot/Bukkit when absent
* refactored download ops into functions
#72
2016-04-24 07:26:26 -05:00
Geoff Bourne
cf5d194b14 [mc] Robust handling of Forge, Bukkit, and Spigot version selection
* refactor server.properties sed ops into a utility function
* also switch to jq instead of jsawk
* simplify to BUILD_FROM_SOURCE from BUILD_SPIGOT_FROM_SOURCE
Fixes #70
2016-04-23 22:23:55 -05:00
Geoff Bourne
0ea4ea7d0c [cass] Make sure to enable start_rpc
* also note in titan-gremlin that 1.x of ES is needed
* provide docker compose snippet
Part of #68
2016-04-17 12:21:53 -05:00
Geoff Bourne
a6580b3fe3 [mc] Adding Docker stars to README 2016-04-16 16:45:50 -05:00
Sander
a4835ec331 Build spigot using buildtools (#67)
* Download buildtools

* Download buildtools

* Not a good idea to chmod /root

* Remove bukkit code

* fix jar not found

* Run start-minecraft as root (temp)

* Working buildtools

* Remove echo line

* Added more server properties, not working yet

* Show what server properties are being added

* Show what server properties are being added

* Add rcon.password

* Add max-world-size

* Added alot of server settings

* Expose rcon port

* Export home per itzg suggestion

* Update readme and server properties

* Env for building spigot from source

* Update readme
2016-04-16 11:26:13 -05:00
16 changed files with 722 additions and 211 deletions

View File

@@ -1,11 +1,11 @@
FROM itzg/ubuntu-openjdk-7 FROM java:openjdk-8u72-jdk
MAINTAINER itzg MAINTAINER itzg
ENV CASSANDRA_VERSION 2.2.5 ENV CASSANDRA_VERSION 2.2.6
RUN wget -qO /tmp/apache-cassandra.tgz http://mirrors.ibiblio.org/apache/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz RUN wget -qO /tmp/apache-cassandra.tgz http://mirrors.ibiblio.org/apache/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz
RUN tar -C /opt -zxvf /tmp/apache-cassandra.tgz && \ RUN tar -C /opt -zxf /tmp/apache-cassandra.tgz && \
rm /tmp/apache-cassandra.tgz rm /tmp/apache-cassandra.tgz

View File

@@ -1,19 +1,17 @@
#!/bin/bash #!/bin/bash
sed -i -e 's/log4j.rootLogger=.*/log4j.rootLogger=INFO,stdout/' $CASSANDRA_HOME/conf/log4j-server.properties
cassYml=$CASSANDRA_HOME/conf/cassandra.yaml cassYml=$CASSANDRA_HOME/conf/cassandra.yaml
privateAddr=$(hostname -i) privateAddr=$(hostname -i)
seeds=${SEEDS:-${PUBLISH_AS:-$privateAddr}} seeds=${SEEDS:-${PUBLISH_AS:-$privateAddr}}
sed -i -e "s/- seeds:.*/- seeds: \"$seeds\"/" $cassYml sed -i -e "s/- seeds:.*/- seeds: \"$seeds\"/" \
-e "s/listen_address:.*/listen_address: $privateAddr/" \
sed -i -e "s/listen_address:.*/listen_address: $privateAddr/" $cassYml -e "s/rpc_address:.*/rpc_address: $privateAddr/" \
sed -i -e "s/rpc_address:.*/rpc_address: $privateAddr/" $cassYml -e "s/start_rpc:.*/start_rpc: true/" \
-e "s#- /var/lib/cassandra/data#- $CASSANDRA_DATA#" \
sed -i -e "s#- /var/lib/cassandra/data#- $CASSANDRA_DATA#" $cassYml $cassYml
if [ -n "$PUBLISH_AS" ]; then if [ -n "$PUBLISH_AS" ]; then
sed -i -e "s/\(\s*#\)\?\s*broadcast_address:.*/broadcast_address: $PUBLISH_AS/" $cassYml sed -i -e "s/\(\s*#\)\?\s*broadcast_address:.*/broadcast_address: $PUBLISH_AS/" $cassYml
@@ -24,4 +22,3 @@ cp -rn $CASSANDRA_HOME/conf/* $CASSANDRA_CONF
# source the original # source the original
. $CASSANDRA_HOME/bin/orig.cassandra.in.sh . $CASSANDRA_HOME/bin/orig.cassandra.in.sh

View File

@@ -1,28 +1,26 @@
FROM java:openjdk-8u72-jdk FROM java:8u92-jre-alpine
MAINTAINER itzg MAINTAINER itzg
ENV ES_VERSION 2.3.0 ENV ES_VERSION=2.3.4
RUN wget -qO /tmp/es.tgz https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ES_VERSION/elasticsearch-$ES_VERSION.tar.gz && \ ADD https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ES_VERSION/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz
cd /usr/share && \ RUN cd /usr/share && \
tar xf /tmp/es.tgz && \ tar xf /tmp/es.tgz && \
rm /tmp/es.tgz rm /tmp/es.tgz
ENV ES_HOME /usr/share/elasticsearch-$ES_VERSION
RUN useradd -d $ES_HOME -M -r elasticsearch && \
chown -R elasticsearch: $ES_HOME
RUN mkdir /data /conf && touch /data/.CREATED /conf/.CREATED && chown -R elasticsearch: /data /conf
VOLUME ["/data","/conf"]
ADD start /start ADD start /start
WORKDIR $ES_HOME
USER elasticsearch
EXPOSE 9200 9300 EXPOSE 9200 9300
ENV OPTS=-Dnetwork.host=_non_loopback_ ENV ES_HOME=/usr/share/elasticsearch-$ES_VERSION \
OPTS=-Dnetwork.host=_non_loopback_ \
DEFAULT_ES_USER=elasticsearch
RUN adduser -S -s /bin/sh $DEFAULT_ES_USER
VOLUME ["/data","/conf"]
WORKDIR $ES_HOME
CMD ["/start"] CMD ["/start"]

View File

@@ -1,17 +1,12 @@
This Docker image provides an easily configurable Elasticsearch node. Via 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.
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.
# Basic Usage # Basic Usage
To start an Elasticsearch data node that listens on the standard ports on To start an Elasticsearch data node that listens on the standard ports on your host's network interface:
your host's network interface:
docker run -d -p 9200:9200 -p 9300:9300 itzg/elasticsearch docker run -d -p 9200:9200 -p 9300:9300 itzg/elasticsearch
You'll then be able to connect to the Elasticsearch HTTP interface to confirm You'll then be able to connect to the Elasticsearch HTTP interface to confirm it's alive:
it's alive:
http://DOCKERHOST:9200/ http://DOCKERHOST:9200/
@@ -28,8 +23,7 @@ http://DOCKERHOST:9200/
"tagline" : "You Know, for Search" "tagline" : "You Know, for Search"
} }
Where `DOCKERHOST` would be the actual hostname of your host running Where `DOCKERHOST` would be the actual hostname of your host running Docker.
Docker.
# Simple, multi-node cluster # Simple, multi-node cluster
@@ -57,15 +51,11 @@ and then check the cluster health, such as http://192.168.99.100:9200/_cluster/h
# Configuration # Configuration
The following configuration options are specified using `docker run` The following configuration options are specified using `docker run` environment variables (`-e`) like
environment variables (`-e`) like
docker run ... -e NAME=VALUE ... itzg/elasticsearch docker run ... -e NAME=VALUE ... itzg/elasticsearch
Since Docker's `-e` settings are baked into the container definition, this image provides an Since Docker's `-e` settings are baked into the container definition, this image provides an extra feature to change any of the settings below for an existing container. Either create/edit the file `env` in the `/conf` volume mapping or edit within the running container's context using:
extra feature to change any of the settings below for an existing container. Either
create/edit the file `env` in the `/conf` volume mapping or edit within the running container's
context using:
docker exec -it CONTAINER_ID vi /conf/env docker exec -it CONTAINER_ID vi /conf/env
@@ -77,8 +67,7 @@ The contents of the `/conf/env` file are standard shell
entries where `NAME` is one of the variables described below. entries where `NAME` is one of the variables described below.
Configuration options not explicitly supported below can be specified via the `OPTS` environment variable. For Configuration options not explicitly supported below can be specified via the `OPTS` environment variable. For example, by default `OPTS` is set with
example, by default `OPTS` is set with
OPTS=-Dnetwork.bind_host=_non_loopback_ OPTS=-Dnetwork.bind_host=_non_loopback_
@@ -87,17 +76,13 @@ port mapping out from the container_.
## Cluster Name ## Cluster Name
If joining a pre-existing cluster, then you may need to specify a cluster name If joining a pre-existing cluster, then you may need to specify a cluster name different than the default "elasticsearch":
different than the default "elasticsearch":
-e CLUSTER=dockers -e CLUSTER=dockers
## Zen Unicast Hosts ## Zen Unicast Hosts
When joining a multi-physical-host cluster, multicast may not be supported When joining a multi-physical-host cluster, multicast may not be supported on the physical network. In that case, your node can reference specific one or more hosts in the cluster via the [Zen Unicast Hosts](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#unicast) capability as a comma-separated list of `HOST:PORT` pairs:
on the physical network. In that case, your node can reference specific one or more hosts in
the cluster via the
[Zen Unicast Hosts](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#unicast) capability as a comma-separated list of `HOST:PORT` pairs:
-e UNICAST_HOSTS=HOST:PORT[,HOST:PORT] -e UNICAST_HOSTS=HOST:PORT[,HOST:PORT]
@@ -107,8 +92,7 @@ such as
## Plugins ## Plugins
You can install one or more plugins before startup by passing a comma-separated You can install one or more plugins before startup by passing a comma-separated list of plugins.
list of plugins.
-e PLUGINS=ID[,ID] -e PLUGINS=ID[,ID]
@@ -120,10 +104,7 @@ Many more plugins [are available here](http://www.elasticsearch.org/guide/en/ela
## Publish As ## Publish As
Since the container gives the Elasticsearch software an isolated perspective Since the container gives the Elasticsearch software an isolated perspective of its networking, it will most likely advertise its published address with a container-internal IP address. This can be overridden with a physical networking name and port using:
of its networking, it will most likely advertise its published address with
a container-internal IP address. This can be overridden with a physical networking
name and port using:
-e PUBLISH_AS=DOCKERHOST:9301 -e PUBLISH_AS=DOCKERHOST:9301
@@ -132,7 +113,59 @@ than the cosmetic weirdness in the logs, Elasticsearch seems to be quite toleran
## Node Name ## Node Name
Rather than use the randomly assigned node name, you can indicate a specific Rather than use the randomly assigned node name, you can indicate a specific one using:
one using:
-e NODE_NAME=Docker -e NODE_NAME=Docker
## Node Type
If you refer to [the Node section](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-node.html)
of the Elasticsearch reference guide, you'll find that there's three main types of nodes: master-eligible, data, and client.
In larger clusters it is important to dedicate a small number (>= 3) of master nodes. There are also cases where a large cluster may need dedicated gateway nodes that are neither master nor data nodes and purely operate as "smart routers" and have large amounts of CPU and memory to handle client requests and search-reduce.
To simplify all that, this image provides a `TYPE` variable to let you amongst these combinations. The choices are:
* (not set, the default) : the default node type which is both master-eligible and a data node
* `MASTER` : master-eligible, but holds no data. It is good to have three or more of these in a
large cluster
* `DATA` (or `NON_MASTER`) : holds data and serves search/index requests. Scale these out for elastic-y goodness.
* `GATEWAY` : only operates as a client node or a "smart router". These are the ones whose HTTP port 9200 will need to be exposed
A [Docker Compose](https://docs.docker.com/compose/overview/) file will serve as a good example of these three node types:
```
version: '2'
services:
gateway:
image: itzg/elasticsearch
environment:
UNICAST_HOSTS: master
TYPE: GATEWAY
ports:
- "9200:9200"
master:
image: itzg/elasticsearch
environment:
UNICAST_HOSTS: gateway
TYPE: MASTER
MIN_MASTERS: 2
data:
image: itzg/elasticsearch
environment:
UNICAST_HOSTS: master,gateway
TYPE: DATA
```
## Minimum Master Nodes
In combination with the `TYPE` variable above, you will also want to configure the minimum master nodes to [avoid split-brain](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-node.html#split-brain) during network outages.
The minimum, which can be calculated as `(master_eligible_nodes / 2) + 1`, can be set with the `MIN_MASTERS` variable.
Using the Docker Compose file above, a value of `2` is appropriate when scaling the cluster to 3 master nodes:
docker-compose scale master=3

View File

@@ -45,13 +45,53 @@ if [ -n "$PUBLISH_AS" ]; then
OPTS="$OPTS -Des.transport.publish_port=$(echo $PUBLISH_AS | awk -F: '{if ($2) print $2; else print 9300}')" OPTS="$OPTS -Des.transport.publish_port=$(echo $PUBLISH_AS | awk -F: '{if ($2) print $2; else print 9300}')"
fi fi
if [ -n "$TYPE" ]; then
case $TYPE in
MASTER)
OPTS="$OPTS --node.master=true --node.data=false"
;;
GATEWAY)
OPTS="$OPTS --node.master=false --node.data=false"
;;
DATA|NON_MASTER)
OPTS="$OPTS --node.master=false --node.data=true"
;;
*)
echo "Unknown node type. Please use MASTER|GATEWAY|DATA|NON_MASTER"
exit 1
esac
fi
if [ -n "$MIN_MASTERS" ]; then
OPTS="$OPTS --discovery.zen.minimum_master_nodes=$MIN_MASTERS"
fi
mkdir -p /conf/plugins
OPTS="$OPTS --path.plugins=/conf/plugins"
if [ -n "$PLUGINS" ]; then if [ -n "$PLUGINS" ]; then
PLUGIN_OPTS="-Des.path.conf=/conf -Des.path.plugins=/conf/plugins"
for p in $(echo $PLUGINS | awk -v RS=, '{print}') for p in $(echo $PLUGINS | awk -v RS=, '{print}')
do do
echo "Installing the plugin $p" echo "Installing the plugin $p"
$ES_HOME/bin/plugin install $p $ES_HOME/bin/plugin $PLUGIN_OPTS install $p -t 1m -b
done done
else
mkdir -p /conf/plugins
fi fi
mkdir -p /conf/scripts
echo "Starting Elasticsearch with the options $OPTS" echo "Starting Elasticsearch with the options $OPTS"
$ES_HOME/bin/elasticsearch $OPTS CMD="$ES_HOME/bin/elasticsearch $OPTS"
if [ `id -u` = 0 ]; then
echo "Running as non-root..."
chown -R $DEFAULT_ES_USER /data
set -x
su -c "$CMD" $DEFAULT_ES_USER
else
$CMD
fi

View File

@@ -1,30 +1,26 @@
FROM itzg/ubuntu-openjdk-7 FROM java:8
MAINTAINER itzg MAINTAINER itzg
ENV APT_GET_UPDATE 2014-07-19 ENV GITBLIT_VERSION 1.7.1
RUN apt-get update RUN wget -qO /tmp/gitblit.tgz http://dl.bintray.com/gitblit/releases/gitblit-$GITBLIT_VERSION.tar.gz
RUN apt-get -y install wget tar
ENV GITBLIT_VERSION 1.6.0 RUN tar -C /opt -xvf /tmp/gitblit.tgz && \
rm /tmp/gitblit.tgz
RUN wget -O /tmp/gitblit.tgz http://dl.bintray.com/gitblit/releases/gitblit-$GITBLIT_VERSION.tar.gz
RUN mkdir /opt/gitblit
RUN tar -C /opt/gitblit -xvf /tmp/gitblit.tgz
RUN rm /tmp/gitblit.tgz
VOLUME ["/data"] VOLUME ["/data"]
ADD start.sh /start ADD start.sh /start
WORKDIR /opt/gitblit ENV GITBLIT_PATH=/opt/gitblit-${GITBLIT_VERSION} \
ENV GITBLIT_PATH /opt/gitblit GITBLIT_HTTPS_PORT=443 \
ENV GITBLIT_HTTPS_PORT 443 GITBLIT_HTTP_PORT=80 \
ENV GITBLIT_HTTP_PORT 80 GITBLIT_BASE_FOLDER=/data \
ENV GITBLIT_BASE_FOLDER /data GITBLIT_ADMIN_USER=admin \
GITBLIT_INITIAL_REPO=
WORKDIR $GITBLIT_PATH
EXPOSE 80 443 EXPOSE 80 443
CMD ["/start"] ENTRYPOINT ["/start"]

View File

@@ -1,5 +1,46 @@
Provides a ready-to-use instance of [GitBlit](http://gitblit.com/). In order to allow for Provides a ready-to-use instance of [GitBlit](http://gitblit.com/).
future upgrades run the container with a volume mount of `/data`, such as:
docker run -d -p 80:80 p 443:443 -v /tmp/gitblit-data:/data --name gitblit itzg/gitblit ## Basic usage
Start the GitBlit container using
docker run -d -p 80:80 -p 443:443 --name gitblit itzg/gitblit
Access its web interface at the mapped HTTP (80) or HTTPS (443) port of the
Docker host. Login with the default credentials __admin__ / __admin__ .
## Data volume
In order to allow for future upgrades, run the container with a volume mount of `/data`, such as:
-v /tmp/gitblit-data:/data
## Initial repository creation
As a convenience for cluster configuration management with git
(such as with [Spring Cloud Config](https://cloud.spring.io/spring-cloud-config/)),
you may specify the name of an initial repository to be owned by the 'admin' user.
This can be enabled by passing the name of that repository via the environment
variable `GITBLIT_INITIAL_REPO`, such as
-e GITBLIT_INITIAL_REPO=default
## Create repositories with content
In addition to the approach above, you can push repostories with existing
content by attaching them to sub-directories of `/repos`, such as
docker run -v $HOME/git/example:/repos/example ...
## Custom configuration
You can add or override any of the `*.properties` files for configuring GitBlit,
typically `gitblit.properties`, by placing those files in a volume attached at
`/config`, such as
-v $(pwd)/extra-config:/config
The property files in that configuration directory will be renamed with the
suffix `.applied` to avoid overwriting manually modified configuration on
the next container startup.

View File

@@ -1,10 +1,103 @@
#!/bin/sh #!/bin/bash
contents=`ls $GITBLIT_BASE_FOLDER|wc -l` apply_base_data() {
contents=`ls $GITBLIT_BASE_FOLDER|wc -l`
if [ $contents = "0" ]; then if [ $contents = "0" ]; then
cp -r $GITBLIT_PATH/data/* $GITBLIT_BASE_FOLDER cp -r $GITBLIT_PATH/data/* $GITBLIT_BASE_FOLDER
fi
}
apply_config() {
cp -rf /config/* $GITBLIT_BASE_FOLDER
}
create_repo() {
local repo_dir=$GITBLIT_BASE_FOLDER/git/$1.git
mkdir -p $repo_dir
cd $repo_dir
git init --bare
echo "
[gitblit]
description =
originRepository =
owner = $GITBLIT_ADMIN_USER
acceptNewPatchsets = true
acceptNewTickets = true
mergeTo = master
useIncrementalPushTags = false
allowForks = true
accessRestriction = PUSH
authorizationControl = AUTHENTICATED
verifyCommitter = false
showRemoteBranches = false
isFrozen = false
skipSizeCalculation = false
skipSummaryMetrics = false
federationStrategy = FEDERATE_THIS
isFederated = false
gcThreshold =
gcPeriod = 0
" >> config
git config --replace-all core.logallrefupdates false
echo "
CREATING repository '$1' with:
* read/clone access for all
* push access for authenticated users"
RET="file://$repo_dir"
}
apply_repos() {
for rdir in /repos/*; do
if [ -e $rdir/.git ]; then
r=$(basename $rdir)
create_repo $r
local url=$RET
cd $rdir
echo "* pushed existing content"
git push --all $url
fi
done
}
create_initial_repo() {
if [ -d $GITBLIT_INITIAL_REPO ]; then
return
fi
create_repo $GITBLIT_INITIAL_REPO
}
shopt -s nullglob
if [ ! -f /var/local/gitblit_firststart ]; then
FIRSTSTART=1
else
FIRSTSTART=0
fi fi
$JAVA_HOME/bin/java -jar $GITBLIT_PATH/gitblit.jar --httpsPort $GITBLIT_HTTPS_PORT --httpPort $GITBLIT_HTTP_PORT --baseFolder $GITBLIT_BASE_FOLDER if [ $FIRSTSTART = 1 ]; then
apply_base_data
echo "
Applying configuration from /config
"
apply_config
touch /var/local/gitblit_firststart
fi
if [[ -n $GITBLIT_INITIAL_REPO ]]; then
create_initial_repo
fi
apply_repos
cd $GITBLIT_PATH
$JAVA_HOME/bin/java -jar $GITBLIT_PATH/gitblit.jar \
--httpsPort $GITBLIT_HTTPS_PORT --httpPort $GITBLIT_HTTP_PORT \
--baseFolder $GITBLIT_BASE_FOLDER

View File

@@ -2,21 +2,18 @@ FROM java:8
MAINTAINER itzg MAINTAINER itzg
ENV APT_GET_UPDATE 2015-10-03 ENV APT_GET_UPDATE 2016-04-23
RUN apt-get update RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
libmozjs-24-bin \
imagemagick \ imagemagick \
lsof \ lsof \
nano \ nano \
sudo \ sudo \
vim \ vim \
jq \
&& apt-get clean && apt-get clean
RUN update-alternatives --install /usr/bin/js js /usr/bin/js24 100
RUN wget -O /usr/bin/jsawk https://github.com/micha/jsawk/raw/master/jsawk
RUN chmod +x /usr/bin/jsawk
RUN useradd -M -s /bin/false --uid 1000 minecraft \ RUN useradd -M -s /bin/false --uid 1000 minecraft \
&& mkdir /data \ && mkdir /data \
&& mkdir /config \ && mkdir /config \
@@ -24,25 +21,22 @@ RUN useradd -M -s /bin/false --uid 1000 minecraft \
&& mkdir /plugins \ && mkdir /plugins \
&& chown minecraft:minecraft /data /config /mods /plugins && chown minecraft:minecraft /data /config /mods /plugins
EXPOSE 25565 EXPOSE 25565 25575
ADD https://github.com/itzg/restify/releases/download/1.0.3/restify_linux_amd64 /usr/local/bin/restify
COPY start.sh /start COPY start.sh /start
COPY start-minecraft.sh /start-minecraft COPY start-minecraft.sh /start-minecraft
COPY mcadmin.jq /usr/share
RUN chmod +x /usr/local/bin/*
VOLUME ["/data"] VOLUME ["/data","/mods","/config","/plugins"]
VOLUME ["/mods"]
VOLUME ["/config"]
VOLUME ["/plugins"]
COPY server.properties /tmp/server.properties COPY server.properties /tmp/server.properties
WORKDIR /data WORKDIR /data
CMD [ "/start" ] ENTRYPOINT [ "/start" ]
# Special marker ENV used by MCCY management tool ENV UID=1000 GID=1000 \
ENV MC_IMAGE=YES MOTD="A Minecraft Server Powered by Docker" \
JVM_OPTS="-Xmx1024M -Xms1024M" \
ENV UID=1000 GID=1000 TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
ENV MOTD A Minecraft Server Powered by Docker LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK=
ENV JVM_OPTS -Xmx1024M -Xms1024M
ENV TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK=

View File

@@ -1,6 +1,6 @@
[![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/)
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
@@ -155,14 +155,76 @@ in either persistent volumes or a downloadable archive.
Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT -e VERSION=1.8` or `-e TYPE=SPIGOT -e VERSION=1.8` to your command-line. Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT -e VERSION=1.8` or `-e TYPE=SPIGOT -e VERSION=1.8` to your command-line.
The VERSION option should be set to 1.8, as this is the only version of CraftBukkit and Spigot currently docker run -d -v /path/on/host:/data \
available. The latest build in this branch will be used.
$ 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 -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
You can install Bukkit plugins in two ways. 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
pass `--noconsole` at the very end of the command line and not use `-it`. For example,
docker run -d -v /path/on/host:/data \
-e TYPE=SPIGOT -e VERSION=1.8 \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server --noconsole
You can install Bukkit plugins in two ways...
### Using the /data volume
This is the easiest way if you are using a persistent `/data` mount.
To do this, you will need to attach the container's `/data` directory
(see "Attaching data directory to host filesystem”).
Then, you can add plugins to the `/path/on/host/plugins` folder you chose. From the example above,
the `/path/on/host` folder contents look like:
```
/path/on/host
├── plugins
│   └── ... INSTALL PLUGINS HERE ...
├── ops.json
├── server.properties
├── whitelist.json
└── ...
```
If you add plugins while the container is running, you'll need to restart it to pick those
up:
docker stop mc
docker start mc
### Using separate mounts
This is the easiest way if you are using an ephemeral `/data` filesystem,
or downloading a world with the `WORLD` option.
There is one additional volume that can be mounted; `/plugins`.
Any files in this filesystem will be copied over to the main
`/data/plugins` filesystem before starting Minecraft.
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 PaperSpigot server
Enable PaperSpigot server mode by adding a `-e TYPE=PAPER -e VERSION=1.9.4` to your command-line.
docker run -d -v /path/on/host:/data \
-e TYPE=PAPER -e VERSION=1.9.4 \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
__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,
docker run -d -v /path/on/host:/data \
-e TYPE=PAPER -e VERSION=1.9.4 \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server --noconsole
You can install Bukkit plugins in two ways...
### Using the /data volume ### Using the /data volume
@@ -266,6 +328,112 @@ downloaded, scaled, and converted from any other image format:
docker run -d -e ICON=http://..../some/image.png ... docker run -d -e ICON=http://..../some/image.png ...
### Rcon
To use rcon use the `ENABLE_RCON` and `RCON_PASSORD` variables.
By default rcon port will be `25575` but can easily be changed with the `RCON_PORT` variable.
docker run -d -e ENABLE_RCON=true -e RCON_PASSWORD=testing
### Query
Enabling this will enable the gamespy query protocol.
By default the query port will be `25565` (UDP) but can easily be changed with the `QUERY_PORT` variable.
docker run -d -e ENABLE_QUERY=true
### Max players
By default max players is 20, you can increase this with the `MAX_PLAYERS` variable.
docker run -d -e MAX_PLAYERS=50
### Max world size
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
### Allow Nether
Allows players to travel to the Nether.
docker run -d -e ALLOW_NETHER=true
### Announce Player Achievements
Allows server to announce when a player gets an achievement.
docker run -d -e ANNOUNCE_PLAYER_ACHIEVEMENTS=true
### Enable Command Block
Enables command blocks
docker run -d -e ENABLE_COMMAND_BLOCK=true
### Force Gamemode
Force players to join in the default game mode.
- false - Players will join in the gamemode they left in.
- true - Players will always join in the default gamemode.
docker run -d -e FORCE_GAMEMODE=false
### Generate Structures
Defines whether structures (such as villages) will be generated.
- false - Structures will not be generated in new chunks.
- true - Structures will be generated in new chunks.
docker run -d -e GENERATE_STRUCTURES=true
### Hardcore
If set to true, players will be set to spectator mode if they die.
docker run -d -e HARDCORE=false
### Max Build Height
The maximum height in which building is allowed.
Terrain may still naturally generate above a low height limit.
docker run -d -e MAX_BUILD_HEIGHT=256
### Max Tick Time
The maximum number of milliseconds a single tick may take before the server watchdog stops the server with the message, A single server tick took 60.00 seconds (should be max 0.05); Considering it to be crashed, server will forcibly shutdown. Once this criteria is met, it calls System.exit(1).
Setting this to -1 will disable watchdog entirely
docker run -d -e MAX_TICK_TIME=60000
### Spawn Animals
Determines if animals will be able to spawn.
docker run -d -e SPAWN_ANIMALS=true
### Spawn Monsters
Determines if monsters will be spawned.
docker run -d -e SPAWN_MONSTERS=true
### Spawn NPCs
Determines if villagers will be spawned.
docker run -d -e SPAWN_NPCS=true
### 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).
It determines the server-side viewing distance.
docker run -d -e VIEW_DISTANCE=10
### Level Seed ### Level Seed
If you want to create the Minecraft level with a specific seed, use `SEED`, such as If you want to create the Minecraft level with a specific seed, use `SEED`, such as

View File

@@ -0,0 +1,7 @@
.[] |
select(.elements | length > 1) |
select(.elements[].elements[] | select(.class == "version" and .text == $version)) |
.elements[].elements[] |
select(.class|contains("server-jar")) |
.elements[] | select(.name="a") |
.href

View File

@@ -5,11 +5,14 @@ enable-query=false
allow-flight=false allow-flight=false
announce-player-achievements=true announce-player-achievements=true
server-port=25565 server-port=25565
rcon.port=25575
query.port=25565
level-type=DEFAULT level-type=DEFAULT
enable-rcon=false enable-rcon=false
force-gamemode=false force-gamemode=false
level-seed= level-seed=
server-ip= server-ip=
max-tick-time=60000
max-build-height=256 max-build-height=256
spawn-npcs=true spawn-npcs=true
white-list=false white-list=false
@@ -31,3 +34,5 @@ view-distance=10
spawn-protection=16 spawn-protection=16
motd=A Minecraft Server powered by Docker motd=A Minecraft Server powered by Docker
generator-settings= generator-settings=
rcon.password=
max-world-size=29999984

View File

@@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
umask 002 #umask 002
export HOME=/data
if [ ! -e /data/eula.txt ]; then if [ ! -e /data/eula.txt ]; then
if [ "$EULA" != "" ]; then if [ "$EULA" != "" ]; then
@@ -17,101 +18,193 @@ if [ ! -e /data/eula.txt ]; then
fi fi
fi fi
VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
echo "Checking version information." echo "Checking version information."
case "X$VERSION" in case "X$VERSION" in
X|XLATEST|Xlatest) X|XLATEST|Xlatest)
VANILLA_VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.release)'` VANILLA_VERSION=`curl -sSL $VERSIONS_JSON | jq -r '.latest.release'`
;; ;;
XSNAPSHOT|Xsnapshot) XSNAPSHOT|Xsnapshot)
VANILLA_VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.snapshot)'` VANILLA_VERSION=`curl -sSL $VERSIONS_JSON | jq -r '.latest.snapshot'`
;; ;;
X[1-9]*) X[1-9]*)
VANILLA_VERSION=$VERSION VANILLA_VERSION=$VERSION
;; ;;
*) *)
VANILLA_VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.release)'` VANILLA_VERSION=`curl -sSL $VERSIONS_JSON | jq -r '.latest.release'`
;; ;;
esac esac
cd /data cd /data
function buildSpigotFromSource {
echo "Building Spigot $VANILLA_VERSION from source, might take a while, get some coffee"
mkdir /data/temp
cd /data/temp
wget -q -P /data/temp https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
java -jar /data/temp/BuildTools.jar --rev $VANILLA_VERSION 2>&1 |tee /data/spigot_build.log| while read l; do echo -n .; done; echo "done"
mv spigot-*.jar /data/spigot_server.jar
mv craftbukkit-*.jar /data/craftbukkit_server.jar
echo "Cleaning up"
rm -rf /data/temp
cd /data
}
function downloadSpigot {
local match
case "$TYPE" in
*BUKKIT|*bukkit)
match="Craftbukkit"
;;
*)
match="Spigot"
;;
esac
downloadUrl=$(restify --class=jar-div https://mcadmin.net/ | \
jq --arg version "$match $VANILLA_VERSION" -r -f /usr/share/mcadmin.jq)
if [[ -n $downloadUrl ]]; then
echo "Downloading $match"
wget -q -O $SERVER "$downloadUrl"
status=$?
if [ $status != 0 ]; then
echo "ERROR: failed to download from $downloadUrl due to (error code was $status)"
exit 3
fi
else
echo "ERROR: Version $VANILLA_VERSION is not supported for $TYPE"
echo " Refer to https://mcadmin.net/ for supported versions"
exit 2
fi
}
function downloadPaper {
local build
case "$VERSION" in
latest|LATEST|1.10)
build="lastSuccessfulBuild";;
1.9.4)
build="773";;
1.9.2)
build="727";;
1.9)
build="612";;
1.8.8)
build="443";;
*)
build="nosupp";;
esac
if [ $build != "nosupp" ]; then
downloadUrl="https://ci.destroystokyo.com/job/PaperSpigot/$build/artifact/paperclip.jar"
wget -q -O $SERVER "$downloadUrl"
status=$?
if [ $status != 0 ]; then
echo "ERROR: failed to download from $downloadUrl due to (error code was $status)"
exit 3
fi
else
echo "ERROR: Version $VERSION is not supported for $TYPE"
echo " Refer to https://ci.destroystokyo.com/job/PaperSpigot/"
echo " for supported versions"
exit 2
fi
}
function installForge {
TYPE=FORGE
norm=$VANILLA_VERSION
echo "Checking Forge version information."
case $FORGEVERSION in
RECOMMENDED)
curl -o /tmp/forge.json -sSL http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$norm-recommended\"]")
if [ $FORGE_VERSION = null ]; then
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$norm-latest\"]")
if [ $FORGE_VERSION = null ]; then
echo "ERROR: Version $FORGE_VERSION is not supported by Forge"
echo " Refer to http://files.minecraftforge.net/ for supported versions"
exit 2
fi
fi
;;
*)
FORGE_VERSION=$FORGEVERSION
;;
esac
# URL format changed for 1.7.10 from 10.13.2.1300
sorted=$((echo $FORGE_VERSION; echo 10.13.2.1300) | sort -V | head -1)
if [[ $norm == '1.7.10' && $sorted == '10.13.2.1300' ]]; then
# if $FORGEVERSION >= 10.13.2.1300
normForgeVersion="$norm-$FORGE_VERSION-$norm"
else
normForgeVersion="$norm-$FORGE_VERSION"
fi
FORGE_INSTALLER="forge-$normForgeVersion-installer.jar"
SERVER="forge-$normForgeVersion-universal.jar"
if [ ! -e "$SERVER" ]; then
echo "Downloading $FORGE_INSTALLER ..."
wget -q http://files.minecraftforge.net/maven/net/minecraftforge/forge/$normForgeVersion/$FORGE_INSTALLER
echo "Installing $SERVER"
java -jar $FORGE_INSTALLER --installServer
fi
}
function installVanilla {
SERVER="minecraft_server.$VANILLA_VERSION.jar"
if [ ! -e $SERVER ]; then
echo "Downloading $SERVER ..."
wget -q https://s3.amazonaws.com/Minecraft.Download/versions/$VANILLA_VERSION/$SERVER
fi
}
echo "Checking type information." echo "Checking type information."
case "$TYPE" in case "$TYPE" in
*BUKKIT|*bukkit|SPIGOT|spigot) *BUKKIT|*bukkit|SPIGOT|spigot)
TYPE=SPIGOT
case "$TYPE" in case "$TYPE" in
*BUKKIT|*bukkit) *BUKKIT|*bukkit)
echo "Downloading latest CraftBukkit $VANILLA_VERSION server ..."
SERVER=craftbukkit_server.jar SERVER=craftbukkit_server.jar
;; ;;
*) *)
echo "Downloading latest Spigot $VANILLA_VERSION server ..."
SERVER=spigot_server.jar SERVER=spigot_server.jar
;; ;;
esac esac
case $VANILLA_VERSION in
1.8*)
URL=/spigot18/$SERVER
;;
1.9*)
URL=/spigot19/$SERVER
;;
*)
echo "That version of $SERVER is not available."
exit 1
;;
esac
#attempt https, and if it fails, fallback to http and download that way. Display error if neither works. if [ ! -f $SERVER ]; then
wget -q -N $SERVER https://getspigot.org$URL || \ if [[ "$BUILD_SPIGOT_FROM_SOURCE" = TRUE || "$BUILD_SPIGOT_FROM_SOURCE" = true || "$BUILD_FROM_SOURCE" = TRUE || "$BUILD_FROM_SOURCE" = true ]]; then
(echo "Falling back to http, unable to contact server using https..." && \ buildSpigotFromSource
wget -q -N $SERVER http://getspigot.org$URL) || \ else
echo "Unable to download new copy of spigot server" downloadSpigot
fi
fi
# normalize on Spigot for operations below
TYPE=SPIGOT
;;
;; PAPER|paper)
SERVER=paper_server.jar
if [ ! -f $SERVER ]; then
downloadPaper
fi
# normalize on Spigot for operations below
TYPE=SPIGOT
;;
FORGE|forge) FORGE|forge)
TYPE=FORGE TYPE=FORGE
norm=$VANILLA_VERSION installForge
echo "Checking Forge version information."
case $FORGEVERSION in
RECOMMENDED)
FORGE_VERSION=`wget -O - http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json | jsawk -n "out(this.promos['$norm-recommended'])"`
;;
*)
FORGE_VERSION=$FORGEVERSION
;;
esac
# URL format changed for 1.7.10 from 10.13.2.1300
sorted=$((echo $FORGE_VERSION; echo 10.13.2.1300) | sort -V | head -1)
if [[ $norm == '1.7.10' && $sorted == '10.13.2.1300' ]]; then
# if $FORGEVERSION >= 10.13.2.1300
normForgeVersion="$norm-$FORGE_VERSION-$norm"
else
normForgeVersion="$norm-$FORGE_VERSION"
fi
FORGE_INSTALLER="forge-$normForgeVersion-installer.jar"
SERVER="forge-$normForgeVersion-universal.jar"
if [ ! -e "$SERVER" ]; then
echo "Downloading $FORGE_INSTALLER ..."
wget -q http://files.minecraftforge.net/maven/net/minecraftforge/forge/$normForgeVersion/$FORGE_INSTALLER
echo "Installing $SERVER"
java -jar $FORGE_INSTALLER --installServer
fi
;; ;;
VANILLA|vanilla) VANILLA|vanilla)
SERVER="minecraft_server.$VANILLA_VERSION.jar" installVanilla
if [ ! -e $SERVER ]; then
echo "Downloading $SERVER ..."
wget -q https://s3.amazonaws.com/Minecraft.Download/versions/$VANILLA_VERSION/$SERVER
fi
;; ;;
*) *)
@@ -122,6 +215,7 @@ case "$TYPE" in
esac esac
# If supplied with a URL for a world, download it and unpack # If supplied with a URL for a world, download it and unpack
if [[ "$WORLD" ]]; then if [[ "$WORLD" ]]; then
case "X$WORLD" in case "X$WORLD" in
@@ -164,10 +258,10 @@ case "X$MODPACK" in
wget -q -O /tmp/modpack.zip "$MODPACK" wget -q -O /tmp/modpack.zip "$MODPACK"
if [ "$TYPE" = "SPIGOT" ]; then if [ "$TYPE" = "SPIGOT" ]; then
mkdir -p /data/plugins mkdir -p /data/plugins
unzip -d /data/plugins /tmp/modpack.zip unzip -o -d /data/plugins /tmp/modpack.zip
else else
mkdir -p /data/mods mkdir -p /data/mods
unzip -d /data/mods /tmp/modpack.zip unzip -o -d /data/mods /tmp/modpack.zip
fi fi
rm -f /tmp/modpack.zip rm -f /tmp/modpack.zip
;; ;;
@@ -177,33 +271,56 @@ case "X$MODPACK" in
esac esac
fi fi
function setServerProp {
local prop=$1
local var=$2
if [ -n "$var" ]; then
echo "Setting $prop to $var"
sed -i "/$prop\s*=/ c $prop=$var" /data/server.properties
fi
}
if [ ! -e server.properties ]; then if [ ! -e server.properties ]; then
echo "Creating server.properties"
cp /tmp/server.properties . cp /tmp/server.properties .
if [ -n "$WHITELIST" ]; then if [ -n "$WHITELIST" ]; then
echo "Creating whitelist"
sed -i "/whitelist\s*=/ c whitelist=true" /data/server.properties sed -i "/whitelist\s*=/ c whitelist=true" /data/server.properties
sed -i "/white-list\s*=/ c white-list=true" /data/server.properties sed -i "/white-list\s*=/ c white-list=true" /data/server.properties
fi fi
if [ -n "$MOTD" ]; then setServerProp "motd" "$MOTD"
sed -i "/motd\s*=/ c motd=$MOTD" /data/server.properties setServerProp "allow-nether" "$ALLOW_NETHER"
fi setServerProp "announce-player-achievements" "$ANNOUNCE_PLAYER_ACHIEVEMENTS"
setServerProp "enable-command-block" "$ENABLE_COMMAND_BLOCK"
if [ -n "$LEVEL" ]; then setServerProp "spawn-animals" "$SPAWN_ANIMAILS"
sed -i "/level-name\s*=/ c level-name=$LEVEL" /data/server.properties setServerProp "spawn-monsters" "$SPAWN_MONSTERS"
fi setServerProp "spawn-npcs" "$SPAWN_NPCS"
setServerProp "generate-structures" "$GENERATE_STRUCTURES"
if [ -n "$SEED" ]; then setServerProp "spawn-npcs" "$SPAWN_NPCS"
sed -i "/level-seed\s*=/ c level-seed=$SEED" /data/server.properties setServerProp "view-distance" "$VIEW_DISTANCE"
fi setServerProp "hardcore" "$HARDCORE"
setServerProp "max-build-height" "$MAX_BUILD_HEIGHT"
if [ -n "$PVP" ]; then setServerProp "force-gamemode" "$FORCE_GAMEMODE"
sed -i "/pvp\s*=/ c pvp=$PVP" /data/server.properties setServerProp "hardmax-tick-timecore" "$MAX_TICK_TIME"
fi setServerProp "enable-query" "$ENABLE_QUERY"
setServerProp "query.port" "$QUERY_PORT"
setServerProp "enable-rcon" "$ENABLE_RCON"
setServerProp "rcon.password" "$RCON_PASSWORD"
setServerProp "rcon.port" "$RCON_PORT"
setServerProp "max-players" "$MAX_PLAYERS"
setServerProp "max-world-size" "$MAX_WORLD_SIZE"
setServerProp "level-name" "$LEVEL"
setServerProp "level-seed" "$SEED"
setServerProp "pvp" "$PVP"
setServerProp "generator-settings" "$GENERATOR_SETTINGS"
if [ -n "$LEVEL_TYPE" ]; then if [ -n "$LEVEL_TYPE" ]; then
# normalize to uppercase # normalize to uppercase
LEVEL_TYPE=${LEVEL_TYPE^^} LEVEL_TYPE=${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)
@@ -216,10 +333,6 @@ if [ ! -e server.properties ]; then
esac esac
fi fi
if [ -n "$GENERATOR_SETTINGS" ]; then
sed -i "/generator-settings\s*=/ c generator-settings=$GENERATOR_SETTINGS" /data/server.properties
fi
if [ -n "$DIFFICULTY" ]; then if [ -n "$DIFFICULTY" ]; then
case $DIFFICULTY in case $DIFFICULTY in
peaceful|0) peaceful|0)
@@ -239,10 +352,12 @@ if [ ! -e server.properties ]; then
exit 1 exit 1
;; ;;
esac esac
echo "Setting difficulty to $DIFFICULTY"
sed -i "/difficulty\s*=/ c difficulty=$DIFFICULTY" /data/server.properties sed -i "/difficulty\s*=/ c difficulty=$DIFFICULTY" /data/server.properties
fi fi
if [ -n "$MODE" ]; then if [ -n "$MODE" ]; then
echo "Setting mode"
case ${MODE,,?} in case ${MODE,,?} in
0|1|2|3) 0|1|2|3)
;; ;;
@@ -270,10 +385,12 @@ fi
if [ -n "$OPS" -a ! -e ops.txt.converted ]; then if [ -n "$OPS" -a ! -e ops.txt.converted ]; then
echo "Setting ops"
echo $OPS | awk -v RS=, '{print}' >> ops.txt echo $OPS | awk -v RS=, '{print}' >> ops.txt
fi fi
if [ -n "$WHITELIST" -a ! -e white-list.txt.converted ]; then if [ -n "$WHITELIST" -a ! -e white-list.txt.converted ]; then
echo "Setting whitelist"
echo $WHITELIST | awk -v RS=, '{print}' >> white-list.txt echo $WHITELIST | awk -v RS=, '{print}' >> white-list.txt
fi fi
@@ -317,8 +434,8 @@ do
done done
if [ "$TYPE" = "SPIGOT" ]; then if [ "$TYPE" = "SPIGOT" ]; then
echo Copying any Bukkit plugins over
if [ -d /plugins ]; then if [ -d /plugins ]; then
echo Copying any Bukkit plugins over
cp -r /plugins /data cp -r /plugins /data
fi fi
fi fi
@@ -326,9 +443,7 @@ fi
# If we have a bootstrap.txt file... feed that in to the server stdin # If we have a bootstrap.txt file... feed that in to the server stdin
if [ -f /data/bootstrap.txt ]; if [ -f /data/bootstrap.txt ];
then then
exec java $JVM_OPTS -jar $SERVER < /data/bootstrap.txt exec java $JVM_OPTS -jar $SERVER "$@" < /data/bootstrap.txt
else else
exec java $JVM_OPTS -jar $SERVER exec java $JVM_OPTS -jar $SERVER "$@"
fi fi
exec java $JVM_OPTS -jar $SERVER

View File

@@ -11,5 +11,9 @@ while lsof -- /start-minecraft; do
echo -n "." echo -n "."
sleep 1 sleep 1
done done
echo "...switching to user 'minecraft'"
exec sudo -E -u minecraft /start-minecraft mkdir -p /home/minecraft
chown minecraft: /home/minecraft
echo "Switching to user 'minecraft'"
exec sudo -E -u minecraft /start-minecraft "$@"

View File

@@ -17,11 +17,11 @@ the next time you (re)start your container.
# Connecting to Cassandra and Elasticsearch Containers # Connecting to Cassandra and Elasticsearch Containers
First start containers for Cassandra and Elasticsearch, where the `--name` you choose First start containers for Cassandra and Elasticsearch (pre-2.x),
can be arbitrary or left off to use a generated name. where the `--name` you choose can be arbitrary or left off to use a generated name.
docker run -d --name gremlin-cass itzg/cassandra docker run -d --name gremlin-cass itzg/cassandra
docker run -d --name gremlin-es itzg/elasticsearch docker run -d --name gremlin-es itzg/elasticsearch:1.x
Now start Gremlin with networking links to those containers with the aliases Now start Gremlin with networking links to those containers with the aliases
@@ -43,3 +43,21 @@ and with that you can follow the
==>age=10000 ==>age=10000
gremlin> saturn.in('father').in('father').name gremlin> saturn.in('father').in('father').name
==>hercules ==>hercules
# Running and Connecting with Docker Compose
Create the following Compose content as the file `docker-compose.yml` and in
that directory invoke `docker-compose run titan` to run the Gremlin shell
with the supporting Elasticsearch and Cassandra containers.
```
titan:
image: itzg/titan-gremlin
links:
- cass
- es
cass:
image: itzg/cassandra
es:
image: itzg/elasticsearch:1.x
```

View File

@@ -59,4 +59,6 @@ END
args="$args /tmp/init.groovy" args="$args /tmp/init.groovy"
fi fi
# Allow a little extra time for Cassandra to be ready
sleep 1
exec $TITAN_HOME/bin/gremlin.sh $args exec $TITAN_HOME/bin/gremlin.sh $args