From f7bc8c09e485bce8ea29ae87ad5174858630f7b6 Mon Sep 17 00:00:00 2001 From: Alexander Sitnik Date: Tue, 23 May 2017 12:56:01 +0300 Subject: [PATCH 01/10] Use FE and BE images from Docker Hub --- rdbms-image/docker-compose.yml | 8 ++++---- riak-image/docker-compose.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rdbms-image/docker-compose.yml b/rdbms-image/docker-compose.yml index 0fa2a22..83631bd 100644 --- a/rdbms-image/docker-compose.yml +++ b/rdbms-image/docker-compose.yml @@ -1,4 +1,4 @@ -version: "2" +version: "3" services: zookeeper: image: wurstmeister/zookeeper @@ -33,7 +33,7 @@ services: DH_PORT: 8080 dh_frontend: - build: ./devicehive-frontend + image: devicehive/devicehive-frontend-rdbms:${DEVICEHIVE_BRANCH:-latest} ports: - "8080:8080" depends_on: @@ -52,9 +52,9 @@ services: DH_POSTGRES_DB: "postgres" DH_BACKEND_ADDRESS: dh_backend DH_BACKEND_HAZELCAST_PORT: 5701 - + dh_backend: - build: ./devicehive-backend + image: devicehive/devicehive-backend-rdbms:${DEVICEHIVE_BRANCH:-latest} depends_on: - "postgres" - "kafka" diff --git a/riak-image/docker-compose.yml b/riak-image/docker-compose.yml index d4dfd79..9850dd6 100644 --- a/riak-image/docker-compose.yml +++ b/riak-image/docker-compose.yml @@ -1,4 +1,4 @@ -version: "2" +version: "3" services: zookeeper: image: wurstmeister/zookeeper @@ -57,7 +57,7 @@ services: DH_PORT: 8080 dh_frontend: - build: ./devicehive-frontend + image: devicehive/devicehive-frontend-riak:${DEVICEHIVE_TAG:-latest} ports: - "8080:8080" depends_on: @@ -77,7 +77,7 @@ services: DH_BACKEND_HAZELCAST_PORT: 5701 dh_backend: - build: ./devicehive-backend + image: devicehive/devicehive-backend-riak:${DEVICEHIVE_TAG:-latest} depends_on: - "zookeeper" - "kafka" From 9a85d48843e99e541320e66b6e243d1de560ccc1 Mon Sep 17 00:00:00 2001 From: Alexander Sitnik Date: Tue, 23 May 2017 12:57:07 +0300 Subject: [PATCH 02/10] Remove FE and BE images source They are move to devicehive/devicehive-java-server repository for use in autobuild. --- rdbms-image/devicehive-backend/Dockerfile | 38 ----- .../devicehive-backend/devicehive-start.sh | 33 ---- rdbms-image/devicehive-frontend/Dockerfile | 40 ----- .../devicehive-frontend/devicehive-start.sh | 28 ---- riak-image/devicehive-backend/Dockerfile | 38 ----- .../devicehive-backend/devicehive-start.sh | 148 ------------------ riak-image/devicehive-frontend/Dockerfile | 40 ----- .../devicehive-frontend/devicehive-start.sh | 28 ---- 8 files changed, 393 deletions(-) delete mode 100644 rdbms-image/devicehive-backend/Dockerfile delete mode 100644 rdbms-image/devicehive-backend/devicehive-start.sh delete mode 100644 rdbms-image/devicehive-frontend/Dockerfile delete mode 100644 rdbms-image/devicehive-frontend/devicehive-start.sh delete mode 100644 riak-image/devicehive-backend/Dockerfile delete mode 100644 riak-image/devicehive-backend/devicehive-start.sh delete mode 100644 riak-image/devicehive-frontend/Dockerfile delete mode 100644 riak-image/devicehive-frontend/devicehive-start.sh diff --git a/rdbms-image/devicehive-backend/Dockerfile b/rdbms-image/devicehive-backend/Dockerfile deleted file mode 100644 index f514216..0000000 --- a/rdbms-image/devicehive-backend/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -FROM openjdk:8-jdk-alpine - -MAINTAINER devicehive - -ENV DH_VERSION="3.0.0-SNAPSHOT" -ENV MAVEN_VERSION="3.3.3" -ENV M2_HOME /usr/share/maven/ - -RUN apk update \ - && apk add --no-cache netcat-openbsd - -# Builds .jar from source code and removes unnecessary dependencies. -RUN apk add --virtual .build-dependencies ca-certificates git openssh openssl curl \ - && mkdir $M2_HOME \ - && cd $M2_HOME \ - && curl -O http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ - && tar -xf apache-maven-$MAVEN_VERSION-bin.tar.gz \ - && mv apache-maven-$MAVEN_VERSION/* $M2_HOME \ - && mkdir -p /opt/devicehive \ - && git clone -b master https://github.com/devicehive/devicehive-java-server.git /opt/devicehive/source \ - && cd /opt/devicehive/source \ - && $M2_HOME/bin/mvn clean package -Pbooted-rdbms,shim-kafka,!booted-riak -DskipTests \ - && mv /opt/devicehive/source/devicehive-backend/target/devicehive-backend-${DH_VERSION}-boot.jar /opt/devicehive/ \ - && rm -rf /opt/devicehive/source \ - && rm -rf $M2_HOME \ - && rm -rf ~/.m2 \ - && apk del .build-dependencies - -#start script -ADD devicehive-start.sh /opt/devicehive/ - -VOLUME ["/var/log/devicehive"] - -WORKDIR /opt/devicehive/ - -ENTRYPOINT ["/bin/sh"] - -CMD ["./devicehive-start.sh"] diff --git a/rdbms-image/devicehive-backend/devicehive-start.sh b/rdbms-image/devicehive-backend/devicehive-start.sh deleted file mode 100644 index 7fd2bc3..0000000 --- a/rdbms-image/devicehive-backend/devicehive-start.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -e - -set -x - -# Check if Zookeper, Kafka and Postgres are ready -while true; do - `nc $DH_ZK_ADDRESS $DH_ZK_PORT` - result_zk=$? - `nc $DH_POSTGRES_ADDRESS $DH_POSTGRES_PORT` - result_postgres=$? - `nc $DH_KAFKA_ADDRESS $DH_KAFKA_PORT` - result_kafka=$? - - if [ "$result_kafka" -eq 0 ] && [ "$result_postgres" -eq 0 ] && [ "$result_zk" -eq 0 ]; then - break - fi - sleep 3 -done - -echo "Starting DeviceHive" -java -server -Xmx512m -XX:MaxRAMFraction=1 -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -XX:+ScavengeBeforeFullGC -XX:+CMSScavengeBeforeRemark -jar \ --Dspring.datasource.url=jdbc:postgresql://${DH_POSTGRES_ADDRESS}:${DH_POSTGRES_PORT}/${DH_POSTGRES_DB} \ --Dspring.datasource.username="${DH_POSTGRES_USERNAME}" \ --Dspring.datasource.password="${DH_POSTGRES_PASSWORD}" \ --Dbootstrap.servers=${DH_KAFKA_ADDRESS}:${DH_KAFKA_PORT} \ --Dzookeeper.connect=${DH_ZK_ADDRESS}:${DH_ZK_PORT} \ --Dhazelcast.port=${DH_HAZELCAST_PORT:-5701} \ --Drpc.server.request-consumer.threads=${DH_RPC_SERVER_REQ_CONS_THREADS:-1} \ --Drpc.server.worker.threads=${DH_RPC_SERVER_WORKER_THREADS:-1} \ --Drpc.server.disruptor.wait-strategy=${DH_RPC_SERVER_DISR_WAIT_STRATEGY:-blocking} \ -./devicehive-backend-${DH_VERSION}-boot.jar - -set +x \ No newline at end of file diff --git a/rdbms-image/devicehive-frontend/Dockerfile b/rdbms-image/devicehive-frontend/Dockerfile deleted file mode 100644 index 8f35820..0000000 --- a/rdbms-image/devicehive-frontend/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -FROM openjdk:8-jdk-alpine - -MAINTAINER devicehive - -ENV DH_VERSION="3.0.0-SNAPSHOT" -ENV MAVEN_VERSION="3.3.3" -ENV M2_HOME /usr/share/maven/ - -RUN apk update \ - && apk add --no-cache netcat-openbsd - -# Builds .jar from source code and removes unnecessary dependencies. -RUN apk add --virtual .build-dependencies ca-certificates git openssh openssl curl \ - && mkdir $M2_HOME \ - && cd $M2_HOME \ - && curl -O http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ - && tar -xf apache-maven-$MAVEN_VERSION-bin.tar.gz \ - && mv apache-maven-$MAVEN_VERSION/* $M2_HOME \ - && mkdir -p /opt/devicehive \ - && git clone -b master https://github.com/devicehive/devicehive-java-server.git /opt/devicehive/source \ - && cd /opt/devicehive/source \ - && $M2_HOME/bin/mvn clean package -Pbooted-rdbms,shim-kafka,!booted-riak -DskipTests \ - && mv /opt/devicehive/source/devicehive-frontend/target/devicehive-frontend-${DH_VERSION}-boot.jar /opt/devicehive/ \ - && rm -rf /opt/devicehive/source \ - && rm -rf $M2_HOME \ - && rm -rf ~/.m2 \ - && apk del .build-dependencies - -#start script -ADD devicehive-start.sh /opt/devicehive/ - -VOLUME ["/var/log/devicehive"] - -WORKDIR /opt/devicehive/ - -ENTRYPOINT ["/bin/sh"] - -CMD ["./devicehive-start.sh"] - -EXPOSE 8080 diff --git a/rdbms-image/devicehive-frontend/devicehive-start.sh b/rdbms-image/devicehive-frontend/devicehive-start.sh deleted file mode 100644 index 5a1a75e..0000000 --- a/rdbms-image/devicehive-frontend/devicehive-start.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -e - -set -x - -# Check if backend is ready -while true; do - `nc $DH_BACKEND_ADDRESS $DH_BACKEND_HAZELCAST_PORT` - result=$? - - if [ "$result" -eq 0 ]; then - break - fi - sleep 3 -done - -echo "Starting DeviceHive" -java -server -Xmx512m -XX:MaxRAMFraction=1 -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -XX:+ScavengeBeforeFullGC -XX:+CMSScavengeBeforeRemark -jar \ --Dspring.datasource.url=jdbc:postgresql://${DH_POSTGRES_ADDRESS}:${DH_POSTGRES_PORT}/${DH_POSTGRES_DB} \ --Dspring.datasource.username="${DH_POSTGRES_USERNAME}" \ --Dspring.datasource.password="${DH_POSTGRES_PASSWORD}" \ --Dbootstrap.servers=${DH_KAFKA_ADDRESS}:${DH_KAFKA_PORT} \ --Dzookeeper.servers=${DH_ZK_ADDRESS}:${DH_ZK_PORT} \ --Drpc.client.response-consumer.threads=${DH_RPC_CLIENT_RES_CONS_THREADS:-1} \ --Dserver.context-path=/api \ --Dserver.port=8080 \ -./devicehive-frontend-${DH_VERSION}-boot.jar - -set +x diff --git a/riak-image/devicehive-backend/Dockerfile b/riak-image/devicehive-backend/Dockerfile deleted file mode 100644 index 3971908..0000000 --- a/riak-image/devicehive-backend/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -FROM frolvlad/alpine-oraclejdk8 - -MAINTAINER devicehive - -ENV DH_VERSION="3.0.0-SNAPSHOT" -ENV MAVEN_VERSION="3.3.3" -ENV M2_HOME /usr/share/maven/ - -RUN apk update \ - && apk add --no-cache netcat-openbsd curl - -# Builds .jar from source code and removes unnecessary dependencies. -RUN apk add --virtual .build-dependencies ca-certificates git openssh openssl \ - && mkdir $M2_HOME \ - && cd $M2_HOME \ - && curl -O http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ - && tar -xf apache-maven-$MAVEN_VERSION-bin.tar.gz \ - && mv apache-maven-$MAVEN_VERSION/* $M2_HOME \ - && mkdir -p /opt/devicehive \ - && git clone -b master https://github.com/devicehive/devicehive-java-server.git /opt/devicehive/source \ - && cd /opt/devicehive/source \ - && $M2_HOME/bin/mvn clean package -Pbooted-riak,shim-kafka,!booted-rdbms -DskipTests \ - && mv /opt/devicehive/source/devicehive-backend/target/devicehive-backend-${DH_VERSION}-boot.jar /opt/devicehive/ \ - && rm -rf /opt/devicehive/source \ - && rm -rf $M2_HOME \ - && rm -rf ~/.m2 \ - && apk del .build-dependencies - -#start script -ADD devicehive-start.sh /opt/devicehive/ - -VOLUME ["/var/log/devicehive"] - -WORKDIR /opt/devicehive/ - -ENTRYPOINT ["/bin/sh"] - -CMD ["./devicehive-start.sh"] diff --git a/riak-image/devicehive-backend/devicehive-start.sh b/riak-image/devicehive-backend/devicehive-start.sh deleted file mode 100644 index de55e58..0000000 --- a/riak-image/devicehive-backend/devicehive-start.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/bash -e - -set -x - -# Check if Zookeper, Kafka and riak are ready -while true; do - `nc $DH_ZK_ADDRESS $DH_ZK_PORT` - result_zk=$? - `nc $DH_KAFKA_ADDRESS $DH_KAFKA_PORT` - result_kafka=$? - `curl --output /dev/null --silent --head --fail "http://${DH_RIAK_HOST_MEMBER}:${DH_RIAK_HTTP_PORT}/ping"` - result_riak=$? - - if [ "$result_kafka" -eq 0 ] && [ "$result_zk" -eq 0 ] && [ "$result_riak" -eq 0 ]; then - break - fi - sleep 5 -done - -echo "Setting Riak" -curl -XPUT \ - -H "Content-Type: application/json" \ - -H 'x-riak-index-login_bin: dhadmin' \ - -d "{\"id\": 1, \"login\":\"dhadmin\", \"passwordHash\":\"DFXFrZ8VQIkOYECScBbBwsYinj+o8IlaLsRQ81wO+l8=\", \"passwordSalt\":\"sjQbZgcCmFxqTV4CCmGwpIHO\", \"role\":\"ADMIN\", \"status\":\"ACTIVE\", \"loginAttempts\":0, \"lastLogin\":null,\"googleLogin\":null,\"facebookLogin\":null,\"githubLogin\":null,\"entityVersion\":0,\"data\":null}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/user/keys/1 - -curl -XPOST \ - -H "Content-Type: application/json" \ - -d '{"increment": 100}' \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/counters/buckets/dh_counters/datatypes/userCounter - - -curl -XPUT \ - -H "Content-Type: application/json" \ - -H 'x-riak-index-label_bin: Access Key for dhadmin' \ - -H 'x-riak-index-userId_int: 1' \ - -H 'x-riak-index-key_bin: 1jwKgLYi/CdfBTI9KByfYxwyQ6HUIEfnGSgakdpFjgk=' \ - -H 'x-riak-index-expirationDate_int: -1' \ - -d "{\"id\": 1, \"label\":\"Access Key for dhadmin\", \"key\": \"1jwKgLYi/CdfBTI9KByfYxwyQ6HUIEfnGSgakdpFjgk=\", \"expirationDate\": null, \"type\":\"DEFAULT\", \"user\":{\"id\":1,\"login\":\"dhadmin\",\"passwordHash\":\"DFXFrZ8VQIkOYECScBbBwsYinj+o8IlaLsRQ81wO+l8=\",\"passwordSalt\":\"sjQbZgcCmFxqTV4CCmGwpIHO\",\"loginAttempts\":0,\"role\":\"ADMIN\",\"status\":\"ACTIVE\",\"lastLogin\":null,\"googleLogin\":null,\"facebookLogin\":null,\"githubLogin\":null,\"entityVersion\":0,\"data\":null}, \"permissions\": [{\"id\":null,\"domains\":null,\"subnets\":null,\"actions\":null,\"networkIds\":null,\"deviceGuids\":null}]}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/access_key/keys/1 - -curl -XPOST \ - -H "Content-Type: application/json" \ - -d '{"increment": 100}' \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/counters/buckets/dh_counters/datatypes/accessKeyCounter - -curl -XPUT \ - -H "Content-Type: application/json" \ - -H 'x-riak-index-name_bin: Sample VirtualLed Device' \ - -d "{\"id\":1, \"name\":\"Sample VirtualLed Device\", \"permanent\": false, \"offlineTimeout\": 600, \"data\":null,\"equipment\":[]}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/device_class/keys/1 - -curl -XPOST \ - -H "Content-Type: application/json" \ - -d '{"increment": 100}' \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/counters/buckets/dh_counters/datatypes/deviceClassCounter - -curl -XPUT \ - -H "Content-Type: application/json" \ - -H 'x-riak-index-name_bin: VirtualLed Sample Network' \ - -d "{\"id\":1,\"key\":null,\"name\":\"VirtualLed Sample Network\", \"description\":\"A DeviceHive network for VirtualLed sample\",\"entityVersion\":null}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/network/keys/1 - -curl -XPOST \ - -H "Content-Type: application/json" \ - -d '{"increment": 100}' \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/counters/buckets/dh_counters/datatypes/networkCounter - -curl -XPUT \ - -H "Content-Type: application/json" \ - -H 'x-riak-index-guid_bin: e50d6085-2aba-48e9-b1c3-73c673e414be' \ - -d "{\"id\":1, \"guid\":\"e50d6085-2aba-48e9-b1c3-73c673e414be\", \"name\":\"Sample VirtualLed Device\", \"status\":\"Offline\", \"network\": {\"id\":1,\"key\":null,\"name\":\"VirtualLed Sample Network\", \"description\":\"A DeviceHive network for VirtualLed sample\",\"entityVersion\":null}, \"deviceClass\":{\"id\":1, \"name\":\"Sample VirtualLed Device\", \"permanent\": false, \"offlineTimeout\": 600, \"data\":null,\"equipment\":null}, \"blocked\":null}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/device/keys/1 - -curl -XPOST \ - -H "Content-Type: application/json" \ - -d '{"increment": 100}' \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/counters/buckets/dh_counters/datatypes/deviceCounter - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":\"false\"}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/google.identity.allowed - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":\"google_id\"}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/google.identity.client.id - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":\"false\"}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/facebook.identity.allowed - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":\"facebook_id\"}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/facebook.identity.client.id - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":\"false\"}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/github.identity.allowed - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":\"github_id\"}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/github.identity.client.id - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":\"true\"}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/allowNetworkAutoCreate - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":\"http://${DH_RIAK_HOST}:8080/cassandra\"}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/cassandra.rest.endpoint - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":120000}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/websocket.ping.timeout - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":1200000}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/session.timeout - -curl -XPUT \ - -H "Content-Type: application/json" \ - -d "{\"value\":1000}" \ - http://${DH_RIAK_HOST}:${DH_RIAK_HTTP_PORT}/types/default/buckets/configuration/keys/user.login.lastTimeout - -echo "Starting DeviceHive" -java -server -Xmx512m -XX:MaxRAMFraction=1 -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -XX:+ScavengeBeforeFullGC -XX:+CMSScavengeBeforeRemark -jar \ --Dflyway.enabled=false \ --Driak.host=${DH_RIAK_HOST} \ --Driak.port=${DH_RIAK_PORT} \ --Dbootstrap.servers=${DH_KAFKA_ADDRESS}:${DH_KAFKA_PORT} \ --Dzookeeper.connect=${DH_ZK_ADDRESS}:${DH_ZK_PORT} \ --Dhazelcast.port=${DH_HAZELCAST_PORT:-5701} \ --Drpc.server.request-consumer.threads=${DH_RPC_SERVER_REQ_CONS_THREADS:-1} \ --Drpc.server.worker.threads=${DH_RPC_SERVER_WORKER_THREADS:-1} \ --Drpc.server.disruptor.wait-strategy=${DH_RPC_SERVER_DISR_WAIT_STRATEGY:-blocking} \ -./devicehive-backend-${DH_VERSION}-boot.jar - -set +x diff --git a/riak-image/devicehive-frontend/Dockerfile b/riak-image/devicehive-frontend/Dockerfile deleted file mode 100644 index 0f2cef9..0000000 --- a/riak-image/devicehive-frontend/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -FROM frolvlad/alpine-oraclejdk8 - -MAINTAINER devicehive - -ENV DH_VERSION="3.0.0-SNAPSHOT" -ENV MAVEN_VERSION="3.3.3" -ENV M2_HOME /usr/share/maven/ - -RUN apk update \ - && apk add --no-cache netcat-openbsd - -# Builds .jar from source code and removes unnecessary dependencies. -RUN apk add --virtual .build-dependencies ca-certificates curl git openssh openssl \ - && mkdir $M2_HOME \ - && cd $M2_HOME \ - && curl -O http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ - && tar -xf apache-maven-$MAVEN_VERSION-bin.tar.gz \ - && mv apache-maven-$MAVEN_VERSION/* $M2_HOME \ - && mkdir -p /opt/devicehive \ - && git clone -b master https://github.com/devicehive/devicehive-java-server.git /opt/devicehive/source \ - && cd /opt/devicehive/source \ - && $M2_HOME/bin/mvn clean package -Pbooted-riak,shim-kafka,!booted-rdbms -DskipTests \ - && mv /opt/devicehive/source/devicehive-frontend/target/devicehive-frontend-${DH_VERSION}-boot.jar /opt/devicehive/ \ - && rm -rf /opt/devicehive/source \ - && rm -rf $M2_HOME \ - && rm -rf ~/.m2 \ - && apk del .build-dependencies - -#start script -ADD devicehive-start.sh /opt/devicehive/ - -VOLUME ["/var/log/devicehive"] - -WORKDIR /opt/devicehive/ - -ENTRYPOINT ["/bin/sh"] - -CMD ["./devicehive-start.sh"] - -EXPOSE 8080 diff --git a/riak-image/devicehive-frontend/devicehive-start.sh b/riak-image/devicehive-frontend/devicehive-start.sh deleted file mode 100644 index fdf1318..0000000 --- a/riak-image/devicehive-frontend/devicehive-start.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -e - -set -x - -# Check if backend is ready -while true; do - `nc $DH_BACKEND_ADDRESS $DH_BACKEND_HAZELCAST_PORT` - result=$? - - if [ "$result" -eq 0 ]; then - break - fi - sleep 3 -done - -echo "Starting DeviceHive" -java -server -Xmx512m -XX:MaxRAMFraction=1 -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -XX:+ScavengeBeforeFullGC -XX:+CMSScavengeBeforeRemark -jar \ --Dflyway.enabled=false \ --Driak.host=${DH_RIAK_HOST} \ --Driak.port=${DH_RIAK_PORT} \ --Dbootstrap.servers=${DH_KAFKA_ADDRESS}:${DH_KAFKA_PORT} \ --Dzookeeper.servers=${DH_ZK_ADDRESS}:${DH_ZK_PORT} \ --Drpc.client.response-consumer.threads=${DH_RPC_CLIENT_RES_CONS_THREADS:-1} \ --Dserver.context-path=/api \ --Dserver.port=8080 \ -./devicehive-frontend-${DH_VERSION}-boot.jar - -set +x From ec1fd966efbab0cbd9191d9792fe397d73cbca42 Mon Sep 17 00:00:00 2001 From: Alexander Sitnik Date: Tue, 23 May 2017 16:10:22 +0300 Subject: [PATCH 03/10] Change tag variable name --- rdbms-image/docker-compose.yml | 4 ++-- riak-image/docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rdbms-image/docker-compose.yml b/rdbms-image/docker-compose.yml index 83631bd..205fca2 100644 --- a/rdbms-image/docker-compose.yml +++ b/rdbms-image/docker-compose.yml @@ -33,7 +33,7 @@ services: DH_PORT: 8080 dh_frontend: - image: devicehive/devicehive-frontend-rdbms:${DEVICEHIVE_BRANCH:-latest} + image: devicehive/devicehive-frontend-rdbms:${DH_TAG:-latest} ports: - "8080:8080" depends_on: @@ -54,7 +54,7 @@ services: DH_BACKEND_HAZELCAST_PORT: 5701 dh_backend: - image: devicehive/devicehive-backend-rdbms:${DEVICEHIVE_BRANCH:-latest} + image: devicehive/devicehive-backend-rdbms:${DH_TAG:-latest} depends_on: - "postgres" - "kafka" diff --git a/riak-image/docker-compose.yml b/riak-image/docker-compose.yml index 9850dd6..5a68b2a 100644 --- a/riak-image/docker-compose.yml +++ b/riak-image/docker-compose.yml @@ -57,7 +57,7 @@ services: DH_PORT: 8080 dh_frontend: - image: devicehive/devicehive-frontend-riak:${DEVICEHIVE_TAG:-latest} + image: devicehive/devicehive-frontend-riak:${DH_TAG:-latest} ports: - "8080:8080" depends_on: @@ -77,7 +77,7 @@ services: DH_BACKEND_HAZELCAST_PORT: 5701 dh_backend: - image: devicehive/devicehive-backend-riak:${DEVICEHIVE_TAG:-latest} + image: devicehive/devicehive-backend-riak:${DH_TAG:-latest} depends_on: - "zookeeper" - "kafka" From 54d5c11e7559368cb60fc74646752569195a28df Mon Sep 17 00:00:00 2001 From: Alexander Sitnik Date: Wed, 24 May 2017 12:45:22 +0300 Subject: [PATCH 04/10] Use Kafka image from Docker Hub --- rdbms-image/docker-compose.yml | 2 +- riak-image/docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rdbms-image/docker-compose.yml b/rdbms-image/docker-compose.yml index 205fca2..c2eab84 100644 --- a/rdbms-image/docker-compose.yml +++ b/rdbms-image/docker-compose.yml @@ -5,7 +5,7 @@ services: ports: - "2181:2181" kafka: - build: ../kafka + image: devicehive/devicehive-kafka ports: - "9092:9092" links: diff --git a/riak-image/docker-compose.yml b/riak-image/docker-compose.yml index 5a68b2a..56cd087 100644 --- a/riak-image/docker-compose.yml +++ b/riak-image/docker-compose.yml @@ -5,7 +5,7 @@ services: ports: - "2181:2181" kafka: - build: ../kafka + image: devicehive/devicehive-kafka ports: - "9092:9092" links: From d7a0a1903be0cfc2cfd90d2a2f72cb88885b1f10 Mon Sep 17 00:00:00 2001 From: Alexander Sitnik Date: Wed, 24 May 2017 12:45:53 +0300 Subject: [PATCH 05/10] Delete Kafka image source It was moved to separate repository 'devicehive-kafka-docker': https://github.com/devicehive/devicehive-kafka-docker --- kafka/Dockerfile | 5 --- kafka/start-kafka-zookeper.sh | 76 ----------------------------------- 2 files changed, 81 deletions(-) delete mode 100644 kafka/Dockerfile delete mode 100644 kafka/start-kafka-zookeper.sh diff --git a/kafka/Dockerfile b/kafka/Dockerfile deleted file mode 100644 index ae4f4d8..0000000 --- a/kafka/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM wurstmeister/kafka:0.10.0.1 - -ADD start-kafka-zookeper.sh /usr/bin/start-kafka-zookeper.sh -RUN chmod a+x /usr/bin/start-kafka-zookeper.sh -CMD ["start-kafka-zookeper.sh"] \ No newline at end of file diff --git a/kafka/start-kafka-zookeper.sh b/kafka/start-kafka-zookeper.sh deleted file mode 100644 index 64cab2a..0000000 --- a/kafka/start-kafka-zookeper.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -# Check if zookeper is ready -while true; do - if [ `echo stat | nc $DH_ZK_ADDRESS $DH_ZK_PORT | grep -q Mode` ]; then - sleep 1 - else - break - fi -done - -if [[ -z "$KAFKA_PORT" ]]; then - export KAFKA_PORT=9092 -fi -if [[ -z "$KAFKA_ADVERTISED_PORT" ]]; then - export KAFKA_ADVERTISED_PORT=$(docker port `hostname` $KAFKA_PORT | sed -r "s/.*:(.*)/\1/g") -fi -if [[ -z "$KAFKA_BROKER_ID" ]]; then - # By default auto allocate broker ID - export KAFKA_BROKER_ID=-1 -fi -if [[ -z "$KAFKA_LOG_DIRS" ]]; then - export KAFKA_LOG_DIRS="/kafka/kafka-logs-$HOSTNAME" -fi -if [[ -z "$KAFKA_ZOOKEEPER_CONNECT" ]]; then - export KAFKA_ZOOKEEPER_CONNECT=$(env | grep ZK.*PORT_2181_TCP= | sed -e 's|.*tcp://||' | paste -sd ,) -fi - -if [[ -n "$KAFKA_HEAP_OPTS" ]]; then - sed -r -i "s/(export KAFKA_HEAP_OPTS)=\"(.*)\"/\1=\"$KAFKA_HEAP_OPTS\"/g" $KAFKA_HOME/bin/kafka-server-start.sh - unset KAFKA_HEAP_OPTS -fi - -if [[ -z "$KAFKA_ADVERTISED_HOST_NAME" && -n "$HOSTNAME_COMMAND" ]]; then - export KAFKA_ADVERTISED_HOST_NAME=$(eval $HOSTNAME_COMMAND) -fi - -for VAR in `env` -do - if [[ $VAR =~ ^KAFKA_ && ! $VAR =~ ^KAFKA_HOME ]]; then - kafka_name=`echo "$VAR" | sed -r "s/KAFKA_(.*)=.*/\1/g" | tr '[:upper:]' '[:lower:]' | tr _ .` - env_var=`echo "$VAR" | sed -r "s/(.*)=.*/\1/g"` - if egrep -q "(^|^#)$kafka_name=" $KAFKA_HOME/config/server.properties; then - sed -r -i "s@(^|^#)($kafka_name)=(.*)@\2=${!env_var}@g" $KAFKA_HOME/config/server.properties #note that no config values may contain an '@' char - else - echo "$kafka_name=${!env_var}" >> $KAFKA_HOME/config/server.properties - fi - fi -done - -if [[ -n "$CUSTOM_INIT_SCRIPT" ]] ; then - eval $CUSTOM_INIT_SCRIPT -fi - - -KAFKA_PID=0 - -# see https://medium.com/@gchudnov/trapping-signals-in-docker-containers-7a57fdda7d86#.bh35ir4u5 -term_handler() { - echo 'Stopping Kafka....' - if [ $KAFKA_PID -ne 0 ]; then - kill -s TERM "$KAFKA_PID" - wait "$KAFKA_PID" - fi - echo 'Kafka stopped.' - exit -} - - -# Capture kill requests to stop properly -trap "term_handler" SIGHUP SIGINT SIGTERM -create-topics.sh & -$KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties & -KAFKA_PID=$! - -wait \ No newline at end of file From 5121d390c9019be5e9a023eac807909275c537ae Mon Sep 17 00:00:00 2001 From: Alexander Sitnik Date: Wed, 24 May 2017 17:48:16 +0300 Subject: [PATCH 06/10] Use Riak image from Docker Hub --- riak-image/docker-compose.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/riak-image/docker-compose.yml b/riak-image/docker-compose.yml index 56cd087..2ff959b 100644 --- a/riak-image/docker-compose.yml +++ b/riak-image/docker-compose.yml @@ -18,8 +18,7 @@ services: - /var/run/docker.sock:/var/run/docker.sock coordinator: - build: riak - image: devicehive/riak-ts + image: devicehive/devicehive-riakts ports: - "8087:8087" - "8098:8098" @@ -30,8 +29,7 @@ services: volumes: - ./schemas:/etc/riak/schemas member: - build: riak - image: devicehive/riak-ts + image: devicehive/devicehive-riakts ports: - "8087" - "8098" From 52519472ee7382c0270fb2c67f8c37d99422da43 Mon Sep 17 00:00:00 2001 From: Alexander Sitnik Date: Wed, 24 May 2017 17:48:36 +0300 Subject: [PATCH 07/10] Dockerfile for Raik TS moved to it's own repo --- riak-image/docker-compose.yml | 2 -- riak-image/riak/Dockerfile | 10 ---------- riak-image/schemas/counters.dt | 1 - 3 files changed, 13 deletions(-) delete mode 100644 riak-image/riak/Dockerfile delete mode 100644 riak-image/schemas/counters.dt diff --git a/riak-image/docker-compose.yml b/riak-image/docker-compose.yml index 2ff959b..c0e8bd4 100644 --- a/riak-image/docker-compose.yml +++ b/riak-image/docker-compose.yml @@ -26,8 +26,6 @@ services: - CLUSTER_NAME=riakts labels: - "com.basho.riak.cluster.name=riakts" - volumes: - - ./schemas:/etc/riak/schemas member: image: devicehive/devicehive-riakts ports: diff --git a/riak-image/riak/Dockerfile b/riak-image/riak/Dockerfile deleted file mode 100644 index 75ba183..0000000 --- a/riak-image/riak/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM basho/riak-ts:1.4.0 -MAINTAINER devicehive - -RUN apt-get update \ - && apt-get -y install subversion \ - && svn export https://github.com/devicehive/devicehive-java-server.git/branches/master/devicehive-riak-dao/src/main/resources/map-reduce /etc/riak/dh-mr/src/ \ - && mkdir /etc/riak/dh-mr/ebin/ \ - && /usr/lib/riak/$(ls /usr/lib/riak/ | grep erts)/bin/erlc -o /etc/riak/dh-mr/ebin /etc/riak/dh-mr/src/*.erl \ - && echo '[{riak_kv, [{add_paths, ["/etc/riak/dh-mr/ebin"]}]}].' > /etc/riak/advanced.config \ - && apt-get -y remove --purge subversion diff --git a/riak-image/schemas/counters.dt b/riak-image/schemas/counters.dt deleted file mode 100644 index e64bdbf..0000000 --- a/riak-image/schemas/counters.dt +++ /dev/null @@ -1 +0,0 @@ -counter From a2d3e577ece40ca0cac8e2868e252a983375c78f Mon Sep 17 00:00:00 2001 From: Alexander Sitnik Date: Thu, 25 May 2017 11:23:58 +0300 Subject: [PATCH 08/10] Use prebuild Admin Console images --- rdbms-image/docker-compose.yml | 4 ++-- riak-image/docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rdbms-image/docker-compose.yml b/rdbms-image/docker-compose.yml index c2eab84..5a1697e 100644 --- a/rdbms-image/docker-compose.yml +++ b/rdbms-image/docker-compose.yml @@ -23,9 +23,9 @@ services: - "5432:5432" dh_admin: - build: ../devicehive-admin + image: devicehive/admin-console:${DH_ADMIN_TAG:-latest} ports: - - "80:80" + - "80:8080" depends_on: - "dh_frontend" environment: diff --git a/riak-image/docker-compose.yml b/riak-image/docker-compose.yml index c0e8bd4..00defdf 100644 --- a/riak-image/docker-compose.yml +++ b/riak-image/docker-compose.yml @@ -43,9 +43,9 @@ services: - COORDINATOR_NODE=coordinator dh_admin: - build: ../devicehive-admin + image: devicehive/admin-console:${DH_ADMIN_TAG:-latest} ports: - - "80:80" + - "80:8080" depends_on: - "dh_frontend" environment: From 78f8be757ec4b29bf5c76d3c1c19e3d62a73d280 Mon Sep 17 00:00:00 2001 From: Alexander Sitnik Date: Thu, 25 May 2017 11:24:49 +0300 Subject: [PATCH 09/10] Remove Admin Console files --- devicehive-admin/Dockerfile | 23 ---------------- devicehive-admin/admin-start.sh | 10 ------- devicehive-admin/nginx.conf | 48 --------------------------------- 3 files changed, 81 deletions(-) delete mode 100644 devicehive-admin/Dockerfile delete mode 100644 devicehive-admin/admin-start.sh delete mode 100644 devicehive-admin/nginx.conf diff --git a/devicehive-admin/Dockerfile b/devicehive-admin/Dockerfile deleted file mode 100644 index 62f1e39..0000000 --- a/devicehive-admin/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM nginx:alpine - -MAINTAINER devicehive - -RUN mkdir -p /opt/devicehive/admin - -#add start script -ADD admin-start.sh /opt/devicehive/ - -#installing devicehive admin console -ADD https://github.com/devicehive/devicehive-admin-console/archive/stable.tar.gz /tmp -RUN tar -C /tmp -xzf /tmp/stable.tar.gz \ - && mv -v /tmp/devicehive-admin-console-stable/* /opt/devicehive/admin/ \ - && sed -i -e 's/restEndpoint.*/restEndpoint: location.origin + \"\/api\/rest\"\,/' /opt/devicehive/admin/scripts/config.js \ - && rm -f /tmp/stable.tar.gz - -COPY nginx.conf /etc/nginx/nginx.conf - -WORKDIR /opt/devicehive/ - -ENTRYPOINT ["/bin/sh"] - -CMD ["./admin-start.sh"] diff --git a/devicehive-admin/admin-start.sh b/devicehive-admin/admin-start.sh deleted file mode 100644 index 7d44c52..0000000 --- a/devicehive-admin/admin-start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -e - -set -x - -sed -i -e 's/DH_HOST/'"${DH_HOST}"'/' /etc/nginx/nginx.conf -sed -i -e 's/DH_PORT/'"${DH_PORT}"'/' /etc/nginx/nginx.conf - -nginx -g 'daemon off;' - -set +x diff --git a/devicehive-admin/nginx.conf b/devicehive-admin/nginx.conf deleted file mode 100644 index 21b5cf4..0000000 --- a/devicehive-admin/nginx.conf +++ /dev/null @@ -1,48 +0,0 @@ -error_log /dev/stdout info; - -events { worker_connections 60000; } - -http { - - access_log /dev/stdout; - - tcp_nodelay on; - tcp_nopush on; - - include /etc/nginx/mime.types; - default_type application/octet-stream; - gzip on; - gzip_http_version 1.0; - gzip_proxied any; - gzip_min_length 500; - gzip_disable "MSIE [1-6]\."; - gzip_types text/plain text/xml text/css - text/comma-separated-values - text/javascript - application/x-javascript - application/atom+xml; - - server { - listen 80; - - location /admin { - sendfile on; - root /opt/devicehive; - index index.html; - } - - - location /api/ { - proxy_redirect off; - proxy_pass http://DH_HOST:DH_PORT/api/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - } - - - } - -} From ede3eaf378520cb5232327f50092202e5fe773cb Mon Sep 17 00:00:00 2001 From: Alexander Sitnik Date: Tue, 23 May 2017 16:39:49 +0300 Subject: [PATCH 10/10] Update README files --- rdbms-image/README.md | 47 ++++++++++++++++++++++++++++++------------- riak-image/README.md | 35 ++++++++++++++++---------------- 2 files changed, 50 insertions(+), 32 deletions(-) diff --git a/rdbms-image/README.md b/rdbms-image/README.md index 0de5743..4406c7d 100644 --- a/rdbms-image/README.md +++ b/rdbms-image/README.md @@ -1,5 +1,5 @@ # Installation -[DeviceHive](https://github.com/devicehive/devicehive-java-server) docker container accepts the following environment variables which enable persistent storage in PostgreSQL, message bus support through Apache Kafka and scalable storage of device messages using Apache Cassandra. +[DeviceHive](https://github.com/devicehive/devicehive-java-server) Docker containers accept the following environment variables which enable persistent storage in PostgreSQL, message bus support through Apache Kafka and scalable storage of device messages using Apache Cassandra. ## Configure ### PostgreSQL @@ -22,7 +22,7 @@ To enable DeviceHive to communicate over Apache Kafka message bus to scale out a More configurable parameters at [devicehive-start.sh](devicehive-frontend/devicehive-start.sh) and [devicehive-start.sh](devicehive-backend/devicehive-start.sh). ## Run -In order to run DeviceHive from docker container, define environment variables as per your requirements and run: +In order to run DeviceHive stack in Docker containers, define environment variables as per your requirements and run: ``` docker-compose up ``` @@ -38,35 +38,37 @@ docker run -p 80:80 -v ./config.xml:/opt/devicehive/config.xml -e _JAVA_OPTIONS= ## Docker-Compose -Below is an example of linking containers with services using [docker-compose](https://docs.docker.com/compose/compose-file/#/version-2). +Below is an example of linking containers with services using [docker-compose](https://docs.docker.com/compose/compose-file/#/version-3). + ``` -version: "2" +version: "3" services: zookeeper: image: wurstmeister/zookeeper ports: - "2181:2181" kafka: - image: wurstmeister/kafka:0.10.0.1 + image: devicehive/devicehive-kafka ports: - "9092:9092" - depends_on: + links: - "zookeeper" environment: - KAFKA_ADVERTISED_HOST_NAME: 192.168.99.100 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + DH_ZK_ADDRESS: zookeeper + DH_ZK_PORT: 2181 volumes: - /var/run/docker.sock:/var/run/docker.sock postgres: - image: postgres:9.4.4 + image: postgres:9.4 ports: - "5432:5432" dh_admin: - build: ../devicehive-admin + image: devicehive/admin-console ports: - - "80:80" + - "80:8080" depends_on: - "dh_frontend" environment: @@ -74,7 +76,7 @@ services: DH_PORT: 8080 dh_frontend: - build: ./devicehive-frontend + image: devicehive/devicehive-frontend-rdbms ports: - "8080:8080" depends_on: @@ -90,10 +92,27 @@ services: DH_POSTGRES_PORT: 5432 DH_POSTGRES_USERNAME: "postgres" DH_POSTGRES_PASSWORD: "mysecretpassword" + DH_POSTGRES_DB: "postgres" + DH_BACKEND_ADDRESS: dh_backend + DH_BACKEND_HAZELCAST_PORT: 5701 + + dh_backend: + image: devicehive/devicehive-backend-rdbms + depends_on: + - "postgres" + - "kafka" + - "zookeeper" + environment: + DH_ZK_ADDRESS: zookeeper + DH_ZK_PORT: 2181 + DH_KAFKA_ADDRESS: kafka + DH_KAFKA_PORT: 9092 + DH_POSTGRES_ADDRESS: postgres + DH_POSTGRES_PORT: 5432 + DH_POSTGRES_USERNAME: "postgres" + DH_POSTGRES_PASSWORD: "mysecretpassword" + DH_POSTGRES_DB: "postgres" ``` Enjoy! - - - diff --git a/riak-image/README.md b/riak-image/README.md index 9fe1b46..9e1c2d8 100644 --- a/riak-image/README.md +++ b/riak-image/README.md @@ -1,5 +1,5 @@ # Installation -[DeviceHive](https://github.com/devicehive/devicehive-java-server) docker container accepts the following environment variables which enable persistent storage in Riak TS, message bus support through Apache Kafka and scalable storage of device messages using Apache Cassandra. +[DeviceHive](https://github.com/devicehive/devicehive-java-server) Docker containers accept the following environment variables which enable persistent storage in Riak TS, message bus support through Apache Kafka and scalable storage of device messages using Apache Cassandra. ## Configure ### Riak TS @@ -20,7 +20,7 @@ To enable DeviceHive to communicate over Apache Kafka message bus to scale out a More configurable parameters at [devicehive-start.sh](devicehive-frontend/devicehive-start.sh) and [devicehive-start.sh](devicehive-backend/devicehive-start.sh). ## Run -In order to run DeviceHive from docker container, define environment variables as per your requirements and run: +In order to run DeviceHive stack in Docker containers, define environment variables as per your requirements and run: ``` docker-compose up ``` @@ -36,28 +36,29 @@ docker run -p 80:80 -v ./config.xml:/opt/devicehive/config.xml -e _JAVA_OPTIONS= ## Docker-Compose -Below is an example of linking containers with services using [docker-compose](https://docs.docker.com/compose/compose-file/#version-2). +Below is an example of linking containers with services using [docker-compose](https://docs.docker.com/compose/compose-file/#version-3). ``` -version: "2" +version: "3" services: zookeeper: image: wurstmeister/zookeeper ports: - "2181:2181" kafka: - image: wurstmeister/kafka:0.10.0.1 + image: devicehive/devicehive-kafka ports: - "9092:9092" - depends_on: + links: - "zookeeper" environment: - KAFKA_ADVERTISED_HOST_NAME: 192.168.99.100 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + DH_ZK_ADDRESS: zookeeper + DH_ZK_PORT: 2181 volumes: - /var/run/docker.sock:/var/run/docker.sock coordinator: - image: basho/riak-ts:1.4.0 + image: devicehive/devicehive-riakts ports: - "8087:8087" - "8098:8098" @@ -65,10 +66,8 @@ services: - CLUSTER_NAME=riakts labels: - "com.basho.riak.cluster.name=riakts" - volumes: - - ./schemas:/etc/riak/schemas member: - image: basho/riak-ts:1.4.0 + image: devicehive/devicehive-riakts ports: - "8087" - "8098" @@ -84,9 +83,9 @@ services: - COORDINATOR_NODE=coordinator dh_admin: - build: ../devicehive-admin + image: devicehive/admin-console ports: - - "80:80" + - "80:8080" depends_on: - "dh_frontend" environment: @@ -94,7 +93,7 @@ services: DH_PORT: 8080 dh_frontend: - build: ./devicehive-frontend + image: devicehive/devicehive-frontend-riak ports: - "8080:8080" depends_on: @@ -110,9 +109,11 @@ services: DH_RIAK_HOST: coordinator DH_RIAK_PORT: 8087 DH_RIAK_HTTP_PORT: 8098 + DH_BACKEND_ADDRESS: dh_backend + DH_BACKEND_HAZELCAST_PORT: 5701 dh_backend: - build: ./devicehive-backend + image: devicehive/devicehive-backend-riak depends_on: - "zookeeper" - "kafka" @@ -126,6 +127,7 @@ services: DH_RIAK_HOST: coordinator DH_RIAK_PORT: 8087 DH_RIAK_HTTP_PORT: 8098 + DH_RIAK_HOST_MEMBER: member volumes: schemas: @@ -134,6 +136,3 @@ volumes: Enjoy! - - -