This is an automated email from the ASF dual-hosted git repository. shuber pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/unomi.git
commit ea788caaf6a6f626a5d51fd10265ee36ddb271ef Author: Mike Ghen <[email protected]> AuthorDate: Fri May 3 21:19:48 2019 -0400 Added docker from mikeghen/unomi-dokcer --- docker/Dockerfile | 37 +++++++++++++++++++++++++++++++++++++ docker/README.md | 16 ++++++++++++++++ docker/docker-compose.yml | 35 +++++++++++++++++++++++++++++++++++ docker/entrypoint.sh | 16 ++++++++++++++++ 4 files changed, 104 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..2ac0004 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,37 @@ +################################################################################ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +FROM openjdk:8-jre + +# Unomi environment variables +ENV KARAF_INSTALL_PATH /opt +ENV KARAF_HOME $KARAF_INSTALL_PATH/apache-unomi +ENV PATH $PATH:$KARAF_HOME/bin +ENV KARAF_OPTS "-Dunomi.autoStart=true" +WORKDIR $KARAF_HOME + +RUN wget http://apache.mirrors.pair.com/incubator/unomi/1.3.0-incubating/unomi-1.3.0-incubating-bin.tar.gz +RUN tar -xzf unomi-1.3.0-incubating-bin.tar.gz +RUN mv unomi-1.3.0-incubating/* . +RUN rm unomi-1.3.0-incubating-bin.tar.gz +RUN rm -r unomi-1.3.0-incubating +COPY ./entrypoint.sh ./entrypoint.sh + +EXPOSE 9443 +EXPOSE 8181 + +CMD ["/bin/bash", "./entrypoint.sh"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..343ddb7 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,16 @@ +# Unomi Docker Image + + + [](https://microbadger.com/images/mikeghen/unomi:1.3 "Get your own version badge on microbadger.com") +# Running Unomi +Unomi requires ElasticSearch so it is recommended to run Unomi and ElasticSearch using docker-compose: +``` +docker-compose up +``` + +# Environment variables + +When you start the `unomi` image, you can adjust the configuration of the Unomi instance by passing one or more environment variables on the `docker run` command line. + +- **`ELASTICSEARCH_HOST`** - The IP address of hostname for ElasticSearch +- **`ELASTICSEARCH_PORT`** - The port for ElasticSearch diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..61ee644 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,35 @@ +version: '2.2' +services: + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:5.6.3 + volumes: # Persist ES data in seperate "esdata" volume + - esdata1:/usr/share/elasticsearch/data + environment: + - bootstrap.memory_lock=true + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + - discovery.type=single-node + - xpack.security.enabled=false + - cluster.name=contextElasticSearch + ports: # Expose Elasticsearch ports + - "9300:9300" + - "9200:9200" + + unomi: + # TODO: Replace with official image + image: mikeghen/unomi:1.3 + container_name: unomi + environment: + - ELASTICSEARCH_HOST=elasticsearch + - ELASTICSEARCH_PORT=9300 + ports: + - 8181:8181 + - 9443:9443 + links: + - elasticsearch + depends_on: + - elasticsearch + + +volumes: # Define seperate volume for Elasticsearch data + esdata1: + driver: local diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..b20fd80 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Wait for heathy ElasticSearch +# next wait for ES status to turn to Green +health_check="$(curl -fsSL "$ELASTICSEARCH_HOST:9200/_cat/health?h=status")" + +until ([ "$health_check" = 'yellow' ] || [ "$health_check" = 'green' ]); do + health_check="$(curl -fsSL "$ELASTICSEARCH_HOST:9200/_cat/health?h=status")" + >&2 echo "Elastic Search is unavailable - waiting" + sleep 1 +done + +sed -i "s/elasticSearchAddresses=localhost:9300/elasticSearchAddresses=${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/g" /opt/apache-unomi/etc/org.apache.unomi.persistence.elasticsearch.cfg +$KARAF_HOME/bin/start +$KARAF_HOME/bin/status # Call to status delays while Karaf creates karaf.log +tail -f $KARAF_HOME/data/log/karaf.log
