Compare commits

...

95 Commits

Author SHA1 Message Date
Geoff Bourne
32b0737e70 [mc] Add rcon to docker-compose.yml example 2017-02-18 11:53:44 -06:00
Geoff Bourne
79eb164e90 [mc] Adding example compose file for large minecraft server 2017-02-18 11:00:55 -06:00
Geoff Bourne
e3296c3cc0 [es] Upgrade to 5.2.1 2017-02-15 19:30:33 -06:00
Geoff Bourne
f5dbbcc2c6 [mc] Use G1 GC by default and simplify max memory setting
For #126
2017-02-14 22:15:36 -06:00
Geoff Bourne
134eaedf23 Merge pull request #125 from HenryGessau/FTB
Add Feed-The-Beast (FTB) server modpack support
2017-02-13 22:23:33 -06:00
Henry Gessau
4a89f3c579 Add Feed-The-Beast (FTB) server modpack support
The popular mod site https://www.feed-the-beast.com provides server
modpacks to go with their client modpacks. These server modpacks
include a custom start script that must be used to launch the server.
2017-02-13 22:13:53 -05:00
Geoff Bourne
17420ed590 [es] Added HEALTHCHECK 2017-02-04 14:37:45 -06:00
Geoff Bourne
2125fa0855 [es] Tweak spacing on README 2017-02-02 20:53:47 -06:00
Geoff Bourne
5c14c30a78 [es] Include docker stack deploy instructions 2017-02-02 20:48:17 -06:00
Geoff Bourne
788d06c086 [es] Upgrade to 5.2.0
For #124
2017-02-02 20:28:12 -06:00
Geoff Bourne
1a88c96beb Merged branch master into master 2017-02-02 19:31:11 -06:00
Geoff Bourne
b8d69278e4 [es] Fix address binding for Swarm Mode 2017-01-23 10:25:50 -06:00
Geoff Bourne
4a7ecffcbb [es][kibana] Upgrade to 5.1.2 2017-01-15 07:04:27 -06:00
Geoff Bourne
9fe0021a7a [mc] Upgrade base image to openjdk
Fixes #122
2017-01-12 19:40:58 -06:00
Geoff Bourne
262816bd2d [es] Add note about increasing mmap count 2017-01-04 20:43:23 -06:00
Geoff Bourne
e44d27c00a [es] Fine java security grants
Fixes #119
* also switch/upgrade base to openjdk 8u111
2017-01-04 20:37:20 -06:00
Geoff Bourne
5062bc91ab [es] Fixed DISCOVER_HTTP_IP typo in README
Fixes #120
2017-01-04 19:56:33 -06:00
Geoff Bourne
dde4132d2c [cass] Switch mirror URL to pair.com 2017-01-01 13:29:52 -06:00
Geoff Bourne
9bb3628792 [kibana] Upgrade to 5.1.1 2016-12-09 15:23:06 -06:00
Geoff Bourne
03a5bb1ab0 [es] Upgrade to 5.1.1 2016-12-09 15:15:38 -06:00
Geoff Bourne
3a9a1dc043 [es] small command line fix (#117)
small command line fix
2016-12-09 10:55:08 -06:00
Eric Pugh
36ced1c630 small command line fix 2016-12-09 10:45:34 -05:00
Geoff Bourne
0cb0755739 [kibana] Upgrade to 5.0.2 2016-11-30 19:21:16 -06:00
Geoff Bourne
3e8eca6e28 [es] Upgrade to 5.0.2
Fixes #113
2016-11-29 22:05:13 -06:00
Geoff Bourne
a179f5f7ba [cass] Upgrade to 2.2.8 2016-11-29 19:14:05 -06:00
Geoff Bourne
f2955bcc2f [es] Bump to 5.0.1
* explicitly configure default JVM heap size
* /conf needed ownership fixed
For #112
2016-11-28 20:37:44 -07:00
Geoff Bourne
a0c1ed88d1 [kibana] Adjust binding hosting from old default 2016-11-13 15:18:37 -06:00
Geoff Bourne
de6d7a64ac Merge branch 'master' of github.com:itzg/dockerfiles 2016-11-13 14:59:47 -06:00
Geoff Bourne
3bf560bfbe [kibana] Upgrade to 5.0.0
* also switched to openjdk 8 base image
2016-11-13 14:59:22 -06:00
Geoff Bourne
f1b58323d3 [es] Fixed TYPE usage
Removed last of the --'s parameters
2016-11-05 10:46:32 -05:00
Geoff Bourne
d4a888073b [es] Upgrade to 5.0.0 2016-11-04 20:18:43 -05:00
Geoff Bourne
54844930bb [jenkins] Working around hub build issue 2016-10-23 09:52:25 -05:00
Geoff Bourne
b26714c9c1 [jenkins] Move COPY later in build 2016-10-23 09:36:16 -05:00
Geoff Bourne
f03a8f0edc [jenkins] Switch local ADD to COPY 2016-10-23 09:29:46 -05:00
Geoff Bourne
048beefadc [jenkins] Pre-installing graphviz (for dependency graphs, etc) 2016-10-23 00:35:02 -05:00
Geoff Bourne
de3545e8d9 Merge pull request #109 from manuelgu/patch-1
Fix formatting in minecraft README
2016-10-18 13:54:57 -05:00
manuelgu
e766301d1e Fix formatting 2016-10-18 13:59:43 +02:00
Geoff Bourne
3348083424 [mc] Fix game mode shorthand handling of s*
For #107
2016-10-02 07:50:19 -05:00
Geoff Bourne
1e0183a3b1 [es] Added ports and volumes summary 2016-10-01 09:52:40 -05:00
Geoff Bourne
fd0500feb2 [es] COPY start script 2016-09-30 22:02:11 -05:00
Geoff Bourne
e86138cdf2 [es] Upgrade to 2.4.1 2016-09-30 22:07:48 -04:00
Geoff Bourne
ddb69ced3b Merge pull request #106 from kstrauser/feature/noconsole-envvar
Added CONSOLE envvar to control console output
2016-09-22 22:07:46 -05:00
Kirk Strauser
c48f85cc4f Oops! --noconsole for non-bootstrap, too 2016-09-22 19:51:44 -07:00
Kirk Strauser
aa13deecdb Added CONSOLE envvar to control console output
By default, CONSOLE is true. When set to false, start-minecraft.sh
adds "--noconsole" to java. Use this to keep Spigot from burning CPU.
2016-09-22 19:51:44 -07:00
Geoff Bourne
4c0f24613c [cass] Upgrade to 2.2.7 2016-09-22 18:55:40 -04:00
Geoff Bourne
b5bcea7d61 [mc] Add SKIP_OWNERSHIP_FIX option
For #104
2016-09-10 08:22:30 -05:00
Geoff Bourne
76d4fd1bbc [mc] Check writability of /data before chown'ing it
For #104
2016-09-06 21:36:54 -05:00
Geoff Bourne
f7523eef4e [es] Upgrade to 2.4.0 2016-09-04 19:34:49 -05:00
Geoff Bourne
c38bfb22cc [es] Also adding host IP discovery for http 2016-09-04 16:10:08 -05:00
Geoff Bourne
8cea619c13 [es] Add support for Swarm Mode with proper transport publish computation 2016-09-04 15:25:04 -05:00
Geoff Bourne
e570ac8715 Merged mc/non-writable-home into master 2016-09-01 21:16:49 -05:00
Geoff Bourne
d14d666e24 [mc] Ensure home directory is writable
For #102
2016-08-30 17:11:10 -05:00
Geoff Bourne
8956d43c47 [jenkins] Declare VOLUME for home directory 2016-08-28 14:40:22 -05:00
Geoff Bourne
911fcf8b42 [mc] Correcting EULA usage in compose example in README
Part of #101
2016-08-15 22:04:36 -05:00
Geoff Bourne
3e61c8084f Merge pull request #101 from parthipanramesh/master
minecraft-server: EULA var needs to be a string (docker-compose.yml)
2016-08-15 21:59:24 -05:00
Parthipan Ramesh
fe6e8c04ff minecraft-server: EULA var needs to be a string (docker-compose.yml)
docker-compose refuses to build a container without the quotation marks.
2016-08-15 20:06:12 +02:00
Geoff Bourne
f1293ff979 Merge pull request #99 from jimtremblay/master
Add ability to change online-mode from environment variable when contained created
2016-08-03 21:16:47 -05:00
Jim Tremblay
5c5b8cd999 Add default value of ONLINE_MODE 2016-08-03 21:59:48 -04:00
Jim Tremblay
074424a5bd Add section about new option ONLINE_MODE 2016-08-03 21:58:07 -04:00
Jim Tremblay
99b1de0bbd Update start-minecraft.sh 2016-08-01 22:09:30 -04:00
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
27 changed files with 1257 additions and 311 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.8
RUN wget -qO /tmp/apache-cassandra.tgz http://mirrors.ibiblio.org/apache/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz ADD http://apache.mirrors.pair.com/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz /tmp/apache-cassandra.tgz
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,32 @@
FROM java:openjdk-8u72-jdk FROM openjdk:8u111-jre-alpine
MAINTAINER itzg MAINTAINER itzg
ENV ES_VERSION 2.3.0 RUN apk -U add bash
RUN wget -qO /tmp/es.tgz https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ES_VERSION/elasticsearch-$ES_VERSION.tar.gz && \ ENV ES_VERSION=5.2.1
cd /usr/share && \
ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz
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
WORKDIR $ES_HOME
USER elasticsearch
EXPOSE 9200 9300 EXPOSE 9200 9300
ENV OPTS=-Dnetwork.host=_non_loopback_ 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"
RUN adduser -S -s /bin/sh $DEFAULT_ES_USER
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/
CMD ["/start"] CMD ["/start"]

View File

@@ -1,17 +1,17 @@
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" # NOTE for use on Linux hosts
Elasticsearch nodes with container-ized ones.
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 # 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,16 +28,15 @@ 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
To run a multi-node cluster (3-node in this example) on a single Docker machine use: 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 es0 -p 9200:9200 itzg/elasticsearch
docker run -d --name es1 --link es0 -e UNICAST_HOSTS=es0 es docker run -d --name es1 --link es0 -e UNICAST_HOSTS=es0 itzg/elasticsearch
docker run -d --name es2 --link es0 -e UNICAST_HOSTS=es0 es 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 and then check the cluster health, such as http://192.168.99.100:9200/_cluster/health?pretty
@@ -55,17 +54,59 @@ and then check the cluster health, such as http://192.168.99.100:9200/_cluster/h
"unassigned_shards" : 0 "unassigned_shards" : 0
} }
# Configuration 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:
The following configuration options are specified using `docker run` docker stack deploy -c docker-compose.yml es
environment variables (`-e`) like
With a `docker service ls` you can confirm 1 master, 2 data, and 1 gateway nodes are running:
```
ID NAME MODE REPLICAS IMAGE
9nwnno8hbqgk es_kibana replicated 1/1 kibana:latest
f5x7nipwmvkr es_gateway replicated 1/1 es
om8rly2yxylw es_data replicated 2/2 es
tdvfilj370yn es_master replicated 1/1 es
```
As you can see, there is also a Kibana instance included and available at port 5601.
# Health Checks
This container declares a [HEALTHCHECK](https://docs.docker.com/engine/reference/builder/#/healthcheck) that queries the `_cat/health`
endpoint for a quick, one-line gauge of health every 30 seconds.
The current health of the container is shown in the `STATUS` column of `docker ps`, such as
Up 14 minutes (healthy)
You can also check the history of health checks from `inspect`, such as:
```
> docker inspect -f "{{json .State.Health}}" es
{"Status":"healthy","FailingStreak":0,"Log":[...
```
# Configuration Summary
## Ports
* `9200` - HTTP REST
* `9300` - Native transport
## Volumes
* `/data` - location of `path.data`
* `/conf` - location of `path.conf`
# Configuration Details
The following configuration options are specified using `docker run` 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 +118,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 +127,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 +143,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 +155,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 +164,85 @@ 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
## Multiple Network Binding, such as Swarm Mode
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`.
That discovery can be overridden by providing a specific ethernet device name
to `DISCOVER_TRANSPORT_IP` and/or `DISCOVER_HTTP_IP`, such as
-e DISCOVER_TRANSPORT_IP=eth0
-e DISCOVER_HTTP_IP=eth2
## Heap size and other JVM options
By default this image will run Elasticsearch with a Java heap size of 1 GB. If that value
or any other JVM options need to be adjusted, then replace the `ES_JAVA_OPTS`
environment variable.
For example, this would allow for the use of 16 GB of heap:
-e ES_JAVA_OPTS="-Xms16g -Xmx16g"
Refer to [this page](https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html)
for more information about why both the minimum and maximum sizes were set to
the same value.

View File

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

View File

@@ -0,0 +1,6 @@
grant {
// JMX Java Management eXtensions
permission javax.management.MBeanTrustPermission "register";
permission javax.management.MBeanServerPermission "createMBeanServer";
permission javax.management.MBeanPermission "-#-[-]", "queryNames";
};

View File

@@ -0,0 +1,74 @@
status = error
# log action execution errors for easier debugging
logger.action.name = org.elasticsearch.action
logger.action.level = debug
appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
appender.rolling.type = RollingFile
appender.rolling.name = rolling
appender.rolling.fileName = ${sys:es.logs}.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.10000m%n
appender.rolling.filePattern = ${sys:es.logs}-%d{yyyy-MM-dd}.log
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true
rootLogger.level = info
rootLogger.appenderRef.console.ref = console
#rootLogger.appenderRef.rolling.ref = rolling
appender.deprecation_rolling.type = RollingFile
appender.deprecation_rolling.name = deprecation_rolling
appender.deprecation_rolling.fileName = ${sys:es.logs}_deprecation.log
appender.deprecation_rolling.layout.type = PatternLayout
appender.deprecation_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.10000m%n
appender.deprecation_rolling.filePattern = ${sys:es.logs}_deprecation-%i.log.gz
appender.deprecation_rolling.policies.type = Policies
appender.deprecation_rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.deprecation_rolling.policies.size.size = 1GB
appender.deprecation_rolling.strategy.type = DefaultRolloverStrategy
appender.deprecation_rolling.strategy.max = 4
logger.deprecation.name = org.elasticsearch.deprecation
logger.deprecation.level = warn
#logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling
logger.deprecation.additivity = false
appender.index_search_slowlog_rolling.type = RollingFile
appender.index_search_slowlog_rolling.name = index_search_slowlog_rolling
appender.index_search_slowlog_rolling.fileName = ${sys:es.logs}_index_search_slowlog.log
appender.index_search_slowlog_rolling.layout.type = PatternLayout
appender.index_search_slowlog_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%.10000m%n
appender.index_search_slowlog_rolling.filePattern = ${sys:es.logs}_index_search_slowlog-%d{yyyy-MM-dd}.log
appender.index_search_slowlog_rolling.policies.type = Policies
appender.index_search_slowlog_rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.index_search_slowlog_rolling.policies.time.interval = 1
appender.index_search_slowlog_rolling.policies.time.modulate = true
logger.index_search_slowlog_rolling.name = index.search.slowlog
logger.index_search_slowlog_rolling.level = trace
logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling.ref = console
logger.index_search_slowlog_rolling.additivity = false
appender.index_indexing_slowlog_rolling.type = RollingFile
appender.index_indexing_slowlog_rolling.name = index_indexing_slowlog_rolling
appender.index_indexing_slowlog_rolling.fileName = ${sys:es.logs}_index_indexing_slowlog.log
appender.index_indexing_slowlog_rolling.layout.type = PatternLayout
appender.index_indexing_slowlog_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%.10000m%n
appender.index_indexing_slowlog_rolling.filePattern = ${sys:es.logs}_index_indexing_slowlog-%d{yyyy-MM-dd}.log
appender.index_indexing_slowlog_rolling.policies.type = Policies
appender.index_indexing_slowlog_rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.index_indexing_slowlog_rolling.policies.time.interval = 1
appender.index_indexing_slowlog_rolling.policies.time.modulate = true
logger.index_indexing_slowlog.name = index.indexing.slowlog.index
logger.index_indexing_slowlog.level = trace
logger.index_indexing_slowlog.appenderRef.index_indexing_slowlog_rolling.ref = console
logger.index_indexing_slowlog.additivity = false

View File

@@ -1,5 +1,103 @@
#!/bin/sh #!/bin/sh
pre_checks() {
mmc=$(sysctl vm.max_map_count|sed 's/.*= //')
if [[ $mmc -lt 262144 ]]; then
echo "
ERROR: As of 5.0.0 Elasticsearch requires increasing mmap counts.
Refer to https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
"
exit 1
fi
}
discoverIpFromLink() {
dev=$1
mode=$2
ip=`ipaddr show dev $dev scope global|awk '$1 == "inet" { if (!match($2,"/32")) { gsub("/.*","",$2) ; print $2 } }'`
echo "Discovered $mode address $ip for $dev"
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
OPTS="$OPTS -E cluster.name=$CLUSTER"
if [ -n "$CLUSTER_FROM" ]; then
if [ -d /data/$CLUSTER_FROM -a ! -d /data/$CLUSTER ]; then
echo "Performing cluster data migration from $CLUSTER_FROM to $CLUSTER"
mv /data/$CLUSTER_FROM /data/$CLUSTER
fi
fi
fi
if [ -n "$NODE_NAME" ]; then
OPTS="$OPTS -E node.name=$NODE_NAME"
fi
if [ -n "$MULTICAST" ]; then
OPTS="$OPTS -E discovery.zen.ping.multicast.enabled=$MULTICAST"
fi
if [ -n "$UNICAST_HOSTS" ]; then
OPTS="$OPTS -E discovery.zen.ping.unicast.hosts=$UNICAST_HOSTS"
fi
if [ -n "$PUBLISH_AS" ]; then
OPTS="$OPTS -E transport.publish_host=$(echo $PUBLISH_AS | awk -F: '{print $1}')"
OPTS="$OPTS -E transport.publish_port=$(echo $PUBLISH_AS | awk -F: '{if ($2) print $2; else print 9300}')"
fi
if [ -n "$MIN_MASTERS" ]; then
OPTS="$OPTS -E discovery.zen.minimum_master_nodes=$MIN_MASTERS"
fi
}
install_plugins() {
if [ -n "$PLUGINS" ]; then
for p in $(echo $PLUGINS | awk -v RS=, '{print}')
do
echo "Installing the plugin $p"
$ES_HOME/bin/elasticsearch-plugin install $p
done
else
mkdir -p $ES_HOME/plugins
fi
}
setup_personality() {
if [ -n "$TYPE" ]; then
case $TYPE in
MASTER)
OPTS="$OPTS -E node.master=true -E node.data=false"
;;
GATEWAY)
OPTS="$OPTS -E node.master=false -E node.data=false"
;;
DATA|NON_MASTER)
OPTS="$OPTS -E node.master=false -E node.data=true"
;;
*)
echo "Unknown node type. Please use MASTER|GATEWAY|DATA|NON_MASTER"
exit 1
esac
fi
}
pre_checks
if [ -f /conf/env ]; then if [ -f /conf/env ]; then
. /conf/env . /conf/env
fi fi
@@ -8,50 +106,37 @@ if [ ! -e /conf/elasticsearch.* ]; then
cp $ES_HOME/config/elasticsearch.yml /conf cp $ES_HOME/config/elasticsearch.yml /conf
fi fi
if [ ! -e /conf/logging.* ]; then if [ ! -e /conf/log4j2.properties ]; then
cp $ES_HOME/config/logging.yml /conf cp $ES_HOME/config/log4j2.properties /conf
fi fi
OPTS="$OPTS -Des.path.conf=/conf \ OPTS="$OPTS \
-Des.path.data=/data \ -E path.conf=/conf \
-Des.path.logs=/data \ -E path.data=/data \
-Des.transport.tcp.port=9300 \ -E path.logs=/data \
-Des.http.port=9200" -E transport.tcp.port=9300 \
-E http.port=9200"
if [ -n "$CLUSTER" ]; then discoverAllGlobalIps
OPTS="$OPTS -Des.cluster.name=$CLUSTER" if [ "${DISCOVER_TRANSPORT_IP}" != "" ]; then
if [ -n "$CLUSTER_FROM" ]; then discoverIpFromLink $DISCOVER_TRANSPORT_IP transport
if [ -d /data/$CLUSTER_FROM -a ! -d /data/$CLUSTER ]; then fi
echo "Performing cluster data migration from $CLUSTER_FROM to $CLUSTER" if [ "${DISCOVER_HTTP_IP}" != "" ]; then
mv /data/$CLUSTER_FROM /data/$CLUSTER discoverIpFromLink $DISCOVER_HTTP_IP http
fi
fi
fi fi
if [ -n "$NODE_NAME" ]; then setup_personality
OPTS="$OPTS -Des.node.name=$NODE_NAME" setup_clustering
fi install_plugins
if [ -n "$MULTICAST" ]; then mkdir -p /conf/scripts
OPTS="$OPTS -Des.discovery.zen.ping.multicast.enabled=$MULTICAST"
fi
if [ -n "$UNICAST_HOSTS" ]; then
OPTS="$OPTS -Des.discovery.zen.ping.unicast.hosts=$UNICAST_HOSTS"
fi
if [ -n "$PUBLISH_AS" ]; then
OPTS="$OPTS -Des.transport.publish_host=$(echo $PUBLISH_AS | awk -F: '{print $1}')"
OPTS="$OPTS -Des.transport.publish_port=$(echo $PUBLISH_AS | awk -F: '{if ($2) print $2; else print 9300}')"
fi
if [ -n "$PLUGINS" ]; then
for p in $(echo $PLUGINS | awk -v RS=, '{print}')
do
echo "Installing the plugin $p"
$ES_HOME/bin/plugin install $p
done
fi
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 /conf
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

@@ -1,11 +1,17 @@
FROM java:openjdk-8u72-jdk FROM java:openjdk-8u102-jdk
MAINTAINER itzg MAINTAINER itzg
ADD download-and-start.sh /download-and-start RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
graphviz \
&& apt-get clean
ENV JENKINS_HOME /data ENV JENKINS_HOME=/data
VOLUME ["/data"]
VOLUME ["/data", "/root", "/opt/jenkins"]
EXPOSE 8080 38252 EXPOSE 8080 38252
CMD ["/download-and-start"] COPY download-and-start.sh /opt/download-and-start
CMD ["/opt/download-and-start"]

View File

@@ -18,21 +18,6 @@ would be:
ID=$(docker run -d -p 8080:8080 -v /SOME_HOST_DIR:/data itzg/jenkins ID=$(docker run -d -p 8080:8080 -v /SOME_HOST_DIR:/data itzg/jenkins
# Entering the container to perform manual config
As with any Docker container, you can run a shell within the running container:
docker exec -it $ID bash
A more realistic example is installing git, openjdk-7-jdk, etc:
docker exec $ID apt-get update
docker exec $ID apt-get install -y git openjdk-7-jdk
and then Configure the JDK in Jenkins:
![](http://i.imgur.com/HVetwKc.png)
# Enabling Jenkins slave agents # Enabling Jenkins slave agents
By default, Jenkins will pick a random port to allow slave nodes launched By default, Jenkins will pick a random port to allow slave nodes launched
@@ -47,3 +32,20 @@ Launch your Jenkins container using
and configure the port in the Global Security settings: and configure the port in the Global Security settings:
![](http://i.imgur.com/PhQiEHy.png) ![](http://i.imgur.com/PhQiEHy.png)
# Image Parameters
## Volumes
* `/data` - a majority of the Jenkins content is maintained here, such as workspaces
* `/root` - some tools, such as Maven, utilize the home directory for default repository storage
* `/opt/jenkins` - the installed distribution is expanded here
## Ports
* `8080` - for the web UI
* `38252` - for slave incoming JMX access
## Environment Variables
* `JENKINS_OPTS` - passed to the initial Java invocation of Jenkins

View File

@@ -26,4 +26,4 @@ fi
cd /opt/jenkins cd /opt/jenkins
exec java -jar jenkins.war exec java $JENKINS_OPTS -jar jenkins.war

View File

@@ -1,13 +1,14 @@
FROM itzg/ubuntu-openjdk-7 FROM openjdk:8u111-jre
MAINTAINER itzg MAINTAINER itzg
ENV KIBANA_VERSION 4.1.1 ENV KIBANA_VERSION 5.1.2
RUN wget -q -O /tmp/kibana.tgz https://download.elasticsearch.org/kibana/kibana/kibana-${KIBANA_VERSION}-linux-x64.tar.gz ADD https://artifacts.elastic.co/downloads/kibana/kibana-${KIBANA_VERSION}-linux-x86_64.tar.gz /tmp/kibana.tgz
RUN tar -C /opt -xzf /tmp/kibana.tgz && rm /tmp/kibana.tgz RUN tar -C /opt -xzf /tmp/kibana.tgz && rm /tmp/kibana.tgz
ENV KIBANA_HOME /opt/kibana-$KIBANA_VERSION-linux-x64
ENV KIBANA_HOME /opt/kibana-$KIBANA_VERSION-linux-x86_64
# Simplify for cross-container # Simplify for cross-container
ENV ES_URL http://es:9200 ENV ES_URL http://es:9200

View File

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

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/sh
OPTS="-e $ES_URL" OPTS="-e $ES_URL -H $HOSTNAME"
exec bin/kibana $OPTS exec bin/kibana $OPTS

View File

@@ -1,48 +1,43 @@
FROM java:8 FROM openjdk:8-jre
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 useradd -s /bin/false --uid 1000 minecraft \
RUN chmod +x /usr/bin/jsawk
RUN useradd -M -s /bin/false --uid 1000 minecraft \
&& mkdir /data \ && mkdir /data \
&& mkdir /config \ && mkdir /config \
&& mkdir /mods \ && mkdir /mods \
&& mkdir /plugins \ && mkdir /plugins \
&& chown minecraft:minecraft /data /config /mods /plugins && mkdir /home/minecraft \
&& chown minecraft:minecraft /data /config /mods /plugins /home/minecraft
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","/home/minecraft"]
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_XX_OPTS="-XX:+UseG1GC" MAX_MEMORY="1G" \
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= ONLINE_MODE=TRUE CONSOLE=true
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,21 @@ 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 ### Using the /data volume
@@ -202,6 +209,120 @@ This works well if you want to have a common set of plugins in a separate
location, but still have multiple worlds with different server requirements location, but still have multiple worlds with different server requirements
in either persistent volumes or a downloadable archive. in either persistent volumes or a downloadable archive.
## Running a 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
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 Server with a Feed-The-Beast (FTB) modpack
Enable this server mode by adding a `-e TYPE=FTB` to your command-line,
but note the following additional steps needed...
You need to specify a modpack to run, using the `FTB_SERVER_MOD` environment
variable. An FTB server modpack is available together with its respective
client modpack on https://www.feed-the-beast.com under "Additional Files."
Because of the interactive delayed download mechanism on that web site, you
must manually download the server modpack. Copy the modpack to the `/data`
directory (see "Attaching data directory to host filesystem”).
Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line.
$ docker run -d -v /path/on/host:/data -e TYPE=FTB \
-e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
### Using the /data volume
You must use a persistent `/data` mount for this type of server.
To do this, you will need to attach the container's `/data` directory
(see "Attaching data directory to host filesystem”).
If the modpack is updated and you want to run the new version on your
server, you stop and remove the container:
docker stop mc
docker rm mc
Do not erase anything from your /data directory (unless you know of
specific mods that have been removed from the modpack). Download the
updated FTB server modpack and copy it to `/data`. Start a new container
with `FTB_SERVER_MOD` specifying the updated modpack file.
$ docker run -d -v /path/on/host:/data -e TYPE=FTB \
-e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.7.zip \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
### FTB server JVM options
An FTB server modpack contains its own startup script that launches the
JVM and it does not use the `JVM_OPTS` environment variable. Instead
you can use `MIN_RAM` and `MAX_RAM` variables. These are appended to
the JVM `-Xms` and `-Xmx` options. For example, `-e MIN_RAM=2G` results
in `-Xms2G` passed to the JVM.
Additionally, `PERMGEN_SIZE` is passed on to `-XX:PermSize`. Here is an
example:
$ docker run -d -v /path/on/host:/data -e TYPE=FTB \
-e MIN_RAM=1G -e MAX_RAM=2G -e PERMGEN_SIZE=512M \
-e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
Note: The FTB server start script will also override other options,
like `MOTD`.
## Using Docker Compose ## Using Docker Compose
Rather than type the server options below, the port mappings above, etc Rather than type the server options below, the port mappings above, etc
@@ -215,7 +336,7 @@ minecraft-server:
- "25565:25565" - "25565:25565"
environment: environment:
EULA: TRUE EULA: "TRUE"
image: itzg/minecraft-server image: itzg/minecraft-server
@@ -266,6 +387,114 @@ 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
@@ -369,11 +598,22 @@ 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.
## JVM Configuration ### 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
docker run -d -e ONLINE_MODE=FALSE ...
## Miscellaneous Options
### Memory Limit ### Memory Limit
The Java memory limit can be adjusted using the `JVM_OPTS` environment variable, where the default is By default the image declares a Java memory limit of 1 GB. That can be adjusted
the setting shown in the example (max and min at 1024 MB): higher (or lower) by setting the `MAX_MEMORY` environment variable. For example,
the following increases the memory limit to 8 GB:
docker run -e 'JVM_OPTS=-Xmx1024M -Xms1024M' ... docker run -e MAX_MEMORY=8G ...
### /data ownership
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`.

View File

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

View File

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

View File

@@ -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,236 @@ 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 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"
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." FTB|ftb)
case $FORGEVERSION in TYPE=FEED-THE-BEAST
RECOMMENDED) installFTB
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 +258,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 +301,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 +314,57 @@ 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"
setServerProp "online-mode" "$ONLINE_MODE"
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 +377,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,14 +396,16 @@ 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)
;; ;;
s*) su*)
MODE=0 MODE=0
;; ;;
c*) c*)
@@ -255,7 +414,7 @@ if [ ! -e server.properties ]; then
a*) a*)
MODE=2 MODE=2
;; ;;
s*) sp*)
MODE=3 MODE=3
;; ;;
*) *)
@@ -270,10 +429,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,18 +478,32 @@ 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
# If we have a bootstrap.txt file... feed that in to the server stdin if [[ $CONSOLE = false ]]; then
if [ -f /data/bootstrap.txt ]; EXTRA_ARGS=--noconsole
then
exec java $JVM_OPTS -jar $SERVER < /data/bootstrap.txt
else else
exec java $JVM_OPTS -jar $SERVER EXTRA_ARGS=""
fi fi
exec java $JVM_OPTS -jar $SERVER 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}
else
# If we have a bootstrap.txt file... feed that in to the server stdin
if [ -f /data/bootstrap.txt ];
then
exec java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt
else
exec java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS
fi
fi

View File

@@ -4,12 +4,19 @@ set -e
usermod --uid $UID minecraft usermod --uid $UID minecraft
groupmod --gid $GID minecraft groupmod --gid $GID minecraft
chown -R minecraft:minecraft /data /start-minecraft if [ "$SKIP_OWNERSHIP_FIX" != "TRUE" ]; then
chmod -R g+wX /data /start-minecraft fix_ownership() {
dir=$1
if ! sudo -u minecraft test -w $dir; then
echo "Correcting writability of $dir ..."
chown -R minecraft:minecraft $dir
chmod -R u+w $dir
fi
}
while lsof -- /start-minecraft; do fix_ownership /data
echo -n "." fix_ownership /home/minecraft
sleep 1 fi
done
echo "...switching to user 'minecraft'" echo "Switching to user 'minecraft'"
exec sudo -E -u minecraft /start-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