Skip to content

Commit

Permalink
[GEODE-177] - Moving Dockerfile into Geode codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
William Markito committed Aug 6, 2015
1 parent 1a6a0ef commit fcb42ad
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
56 changes: 56 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM centos:latest
MAINTAINER William Markito <[email protected]>

LABEL Vendor="Apache Geode (incubating)"
LABEL version=unstable

# download JDK 8
ENV JAVA_HOME /jdk1.8.0_51

RUN yum install -y wget which tar git \
&& wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz" \
&& tar xf jdk-8u51-linux-x64.tar.gz \
&& git clone -b develop https://github.com/apache/incubator-geode.git \
&& cd incubator-geode \
&& ./gradlew build -Dskip.tests=true \
&& ls /incubator-geode | grep -v gemfire-assembly | xargs rm -rf \
&& rm -rf /root/.gradle/ \
&& rm -rf /incubator-geode/gemfire-assembly/build/distributions/ \
&& rm -rf /jdk-8u51-linux-x64.tar.gz \
&& rm -rf $JAVA_HOME/*src.zip \
$JAVA_HOME/lib/missioncontrol \
$JAVA_HOME/lib/visualvm \
$JAVA_HOME/lib/*javafx* \
$JAVA_HOME/jre/lib/plugin.jar \
$JAVA_HOME/jre/lib/ext/jfxrt.jar \
$JAVA_HOME/jre/bin/javaws \
$JAVA_HOME/jre/lib/javaws.jar \
$JAVA_HOME/jre/lib/desktop \
$JAVA_HOME/jre/plugin \
$JAVA_HOME/jre/lib/deploy* \
$JAVA_HOME/jre/lib/*javafx* \
$JAVA_HOME/jre/lib/*jfx* \
$JAVA_HOME/jre/lib/amd64/libdecora_sse.so \
$JAVA_HOME/jre/lib/amd64/libprism_*.so \
$JAVA_HOME/jre/lib/amd64/libfxplugins.so \
$JAVA_HOME/jre/lib/amd64/libglass.so \
$JAVA_HOME/jre/lib/amd64/libgstreamer-lite.so \
$JAVA_HOME/jre/lib/amd64/libjavafx*.so \
$JAVA_HOME/jre/lib/amd64/libjfx*.so \
&& rm -rf /usr/share/locale/* \
&& yum remove -y perl \
&& yum clean all

ENV GEODE_HOME /incubator-geode/gemfire-assembly/build/install/apache-geode
ENV PATH $PATH:$GEODE_HOME/bin:$JAVA_HOME/bin

# Default ports:
# RMI/JMX 1099
# REST 8080
# PULE 7070
# LOCATOR 10334
# CACHESERVER 40404
EXPOSE 8080 10334 40404 1099 7070
VOLUME ["/data/"]
CMD ["gfsh"]
#ENTRYPOINT ["gfsh"]
67 changes: 67 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Building the container image

The current Dockerfile is based on a CentOS 6 image, downloads JDK 8, clone the Apache Geode git repository, starts a build and execute the basic tests.

```
docker build -t apachegeode/geode:unstable .
```

This may take a while depending on your internet connection, but it's worth since this is a one time step and you endup with a container that is tested and ready to be used for development. It will download Gradle and as part of the build, project dependencies as well.

# Starting a locator and gfsh

1. Then you can start gfsh as well in order to perform more commands:

```
docker run -it -p 10334:10334 -p 7575:7575 -p 1099:1099 apachegeode/geode:unstable gfsh
```


From this point you can pretty much follow [Apache Geode in 5 minutes](https://cwiki.apache.org/confluence/display/GEODE/Index#Index-Geodein5minutes) for example:

```
start server --name=server1
```

But in order to have real fun with containers you are probably better off using something like docker-compose or kubernetes. Those examples will come next.

# Creating a cluster using multiple containers

Install docker-compose following the instructions on this [link](https://docs.docker.com/compose/install/) and move into the composer directory.

There is a docker-compose.yml example file there with a locator and a server. To start the cluster execute:

```
docker-compose up
```

Or in order to start it in background:

```
docker-compose up -d
```

Do a docker ps and identify the container ID for the locator. Now you can use *gfsh* on this container and connect to the distributed system:

```
docker exec -it <locator_container_id> gfsh
gfsh>connect --locator=locator[10334]
Connecting to Locator at [host=locator, port=10334] ..
Connecting to Manager at [host=192.168.99.100, port=1099] ..
Successfully connected to: [host=192.168.99.100, port=1099]
gfsh>list members
Name | Id
------------ | --------------------------------------
locator | locator(locator:33:locator)<v0>:1351
6e96cc0f6b72 | 172.17.1.92(6e96cc0f6b72:34)<v1>:28140
```

Type exit and now to scale the cluster you can leverage docker-compose scale command. For example:

```
docker-compose scale server=3
```

This will start 2 extra Geode server containers. You can verify this step by repeating the last GFSH step and listing the members.

0 comments on commit fcb42ad

Please sign in to comment.