This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/master by this push:
     new a27a15f  ATLAS-4218: Docker support to run Apache Hive and Apache 
HBase with Atlas hook
a27a15f is described below

commit a27a15f902face47839aef7f5a65ecb1ad4cbc4f
Author: Madhan Neethiraj <[email protected]>
AuthorDate: Wed Mar 17 19:54:22 2021 -0700

    ATLAS-4218: Docker support to run Apache Hive and Apache HBase with Atlas 
hook
---
 dev-support/atlas-docker/.dockerignore             |  4 +-
 dev-support/atlas-docker/.env                      |  2 +
 dev-support/atlas-docker/Dockerfile.atlas          |  8 +--
 .../atlas-hbase-setup.sh => Dockerfile.atlas-db}   | 18 +++----
 dev-support/atlas-docker/Dockerfile.atlas-hbase    | 20 +++++--
 dev-support/atlas-docker/Dockerfile.atlas-hive     | 52 ++++++++++++++++++
 dev-support/atlas-docker/README.md                 |  2 +-
 .../init_postgres.sh}                              | 14 +++--
 .../atlas-docker/docker-compose.atlas-hbase.yml    |  4 ++
 .../atlas-docker/docker-compose.atlas-hive.yml     | 45 ++++++++++++++++
 dev-support/atlas-docker/download-archives.sh      |  2 +
 dev-support/atlas-docker/scripts/atlas-build.sh    |  4 +-
 ...setup.sh => atlas-hbase-application.properties} | 15 ++----
 .../atlas-docker/scripts/atlas-hbase-setup.sh      |  1 -
 ...-setup.sh => atlas-hive-application.properties} | 15 ++----
 .../{atlas-hbase-setup.sh => atlas-hive-setup.sh}  | 23 ++++++--
 .../{atlas-hbase-setup.sh => atlas-hive.sh}        | 31 ++++++++---
 dev-support/atlas-docker/scripts/hbase-site.xml    |  4 ++
 dev-support/atlas-docker/scripts/hive-site.xml     | 63 ++++++++++++++++++++++
 19 files changed, 264 insertions(+), 63 deletions(-)

diff --git a/dev-support/atlas-docker/.dockerignore 
b/dev-support/atlas-docker/.dockerignore
index fa4ce32..d4a3db2 100644
--- a/dev-support/atlas-docker/.dockerignore
+++ b/dev-support/atlas-docker/.dockerignore
@@ -1,5 +1,7 @@
 *
 !config
-!dist/apache-atlas-*-bin.tar.gz
+!dist/apache-atlas-*-hbase-hook.tar.gz
+!dist/apache-atlas-*-hive-hook.tar.gz
+!dist/apache-atlas-*-server.tar.gz
 !downloads/*
 !scripts/*
diff --git a/dev-support/atlas-docker/.env b/dev-support/atlas-docker/.env
index 79d2b97..eb49061 100644
--- a/dev-support/atlas-docker/.env
+++ b/dev-support/atlas-docker/.env
@@ -8,3 +8,5 @@ ATLAS_VERSION=3.0.0-SNAPSHOT
 HADOOP_VERSION=3.3.0
 HBASE_VERSION=2.3.3
 KAFKA_VERSION=2.5.0
+HIVE_VERSION=3.1.2
+HIVE_HADOOP_VERSION=3.1.0
diff --git a/dev-support/atlas-docker/Dockerfile.atlas 
b/dev-support/atlas-docker/Dockerfile.atlas
index 4bafe80..8887791 100644
--- a/dev-support/atlas-docker/Dockerfile.atlas
+++ b/dev-support/atlas-docker/Dockerfile.atlas
@@ -18,12 +18,12 @@ FROM atlas-base:latest
 
 ARG ATLAS_VERSION
 
-COPY ./scripts/atlas.sh                              ${ATLAS_SCRIPTS}/
-COPY ./dist/apache-atlas-${ATLAS_VERSION}-bin.tar.gz /home/atlas/dist/
+COPY ./scripts/atlas.sh                                 ${ATLAS_SCRIPTS}/
+COPY ./dist/apache-atlas-${ATLAS_VERSION}-server.tar.gz /home/atlas/dist/
 
-RUN tar xfz /home/atlas/dist/apache-atlas-${ATLAS_VERSION}-bin.tar.gz 
--directory=/opt/ && \
+RUN tar xfz /home/atlas/dist/apache-atlas-${ATLAS_VERSION}-server.tar.gz 
--directory=/opt/ && \
     ln -s /opt/apache-atlas-${ATLAS_VERSION} ${ATLAS_HOME} && \
-    rm -f /home/atlas/dist/apache-atlas-${ATLAS_VERSION}-bin.tar.gz && \
+    rm -f /home/atlas/dist/apache-atlas-${ATLAS_VERSION}-server.tar.gz && \
     mkdir -p /var/run/atlas /var/log/atlas /home/atlas/data 
${ATLAS_HOME}/hbase/conf && \
     rm -rf ${ATLAS_HOME}/logs && \
     ln -s /var/log/atlas ${ATLAS_HOME}/logs && \
diff --git a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh 
b/dev-support/atlas-docker/Dockerfile.atlas-db
old mode 100755
new mode 100644
similarity index 73%
copy from dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
copy to dev-support/atlas-docker/Dockerfile.atlas-db
index c576989..b596809
--- a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
+++ b/dev-support/atlas-docker/Dockerfile.atlas-db
@@ -1,5 +1,3 @@
-#!/bin/bash
-
 # 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
@@ -16,13 +14,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-echo "export JAVA_HOME=${JAVA_HOME}" >> ${HBASE_HOME}/conf/hbase-env.sh
-
-cat <<EOF > /etc/ssh/ssh_config
-Host *
-   StrictHostKeyChecking no
-   UserKnownHostsFile=/dev/null
-EOF
+FROM postgres:12
 
-cp ${ATLAS_SCRIPTS}/hbase-site.xml /opt/hbase/conf/hbase-site.xml
-chown -R hbase:hadoop /opt/hbase/
+# Copy DB init script
+USER 0
+RUN  mkdir -p /docker-entrypoint-initdb.d
+COPY config/init_postgres.sh /docker-entrypoint-initdb.d/
+RUN chown -R postgres:postgres /docker-entrypoint-initdb.d/
+ENV POSTGRES_PASSWORD atlasR0cks!
diff --git a/dev-support/atlas-docker/Dockerfile.atlas-hbase 
b/dev-support/atlas-docker/Dockerfile.atlas-hbase
index 1c5fa28..6b4b6ed 100644
--- a/dev-support/atlas-docker/Dockerfile.atlas-hbase
+++ b/dev-support/atlas-docker/Dockerfile.atlas-hbase
@@ -20,15 +20,25 @@ ARG ATLAS_VERSION
 ARG HBASE_VERSION
 
 
-COPY ./downloads/hbase-${HBASE_VERSION}-bin.tar.gz     /home/atlas/dist/
+COPY ./dist/apache-atlas-${ATLAS_VERSION}-hbase-hook.tar.gz /home/atlas/dist/
+COPY ./downloads/hbase-${HBASE_VERSION}-bin.tar.gz          /home/atlas/dist/
 
-COPY ./scripts/atlas-hbase-setup.sh                    /home/atlas/scripts/
-COPY ./scripts/atlas-hbase.sh                          /home/atlas/scripts/
-COPY ./scripts/hbase-site.xml                          /home/atlas/scripts/
+COPY ./scripts/atlas-hbase-setup.sh               /home/atlas/scripts/
+COPY ./scripts/atlas-hbase.sh                     /home/atlas/scripts/
+COPY ./scripts/hbase-site.xml                     /home/atlas/scripts/
+COPY ./scripts/atlas-hbase-application.properties /home/atlas/scripts/
 
 RUN tar xvfz /home/atlas/dist/hbase-${HBASE_VERSION}-bin.tar.gz 
--directory=/opt/ && \
     ln -s /opt/hbase-${HBASE_VERSION} /opt/hbase && \
-    rm -f /home/atlas/dist/hbase-${HBASE_VERSION}-bin.tar.gz
+    rm -f /home/atlas/dist/hbase-${HBASE_VERSION}-bin.tar.gz && \
+    tar xvfz /home/atlas/dist/apache-atlas-${ATLAS_VERSION}-hbase-hook.tar.gz 
--directory=/opt/ && \
+    ln -s /opt/apache-atlas-hbase-hook-${ATLAS_VERSION} 
/opt/apache-atlas-hbase-hook && \
+    rm -f /home/atlas/dist/apache-atlas-${ATLAS_VERSION}-hbase-hook.tar.gz && \
+    ln -s 
/opt/apache-atlas-hbase-hook/hook/hbase/atlas-plugin-classloader-${ATLAS_VERSION}.jar
 /opt/hbase/lib/ && \
+    ln -s 
/opt/apache-atlas-hbase-hook/hook/hbase/hbase-bridge-shim-${ATLAS_VERSION}.jar 
/opt/hbase/lib/ && \
+    ln -s /opt/apache-atlas-hbase-hook/hook/hbase/atlas-hbase-plugin-impl 
/opt/hbase/lib/atlas-hbase-plugin-impl && \
+    cp /home/atlas/scripts/hbase-site.xml /opt/hbase/conf/hbase-site.xml && \
+    cp -f /home/atlas/scripts/atlas-hbase-application.properties 
/opt/hbase/conf/atlas-application.properties
 
 ENV HBASE_HOME /opt/hbase
 ENV PATH       
/usr/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/hbase/bin
diff --git a/dev-support/atlas-docker/Dockerfile.atlas-hive 
b/dev-support/atlas-docker/Dockerfile.atlas-hive
new file mode 100644
index 0000000..23b637f
--- /dev/null
+++ b/dev-support/atlas-docker/Dockerfile.atlas-hive
@@ -0,0 +1,52 @@
+# 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 atlas-base:latest
+
+ARG HIVE_VERSION
+ARG HIVE_HADOOP_VERSION
+ARG ATLAS_VERSION
+
+
+COPY ./dist/apache-atlas-${ATLAS_VERSION}-hive-hook.tar.gz /home/atlas/dist/
+COPY ./downloads/apache-hive-${HIVE_VERSION}-bin.tar.gz    /home/atlas/dist/
+COPY ./downloads/hadoop-${HIVE_HADOOP_VERSION}.tar.gz      /home/atlas/dist/
+
+COPY ./scripts/atlas-hive-setup.sh               /home/atlas/scripts/
+COPY ./scripts/atlas-hive.sh                     /home/atlas/scripts/
+COPY ./scripts/atlas-hive-application.properties /home/atlas/scripts/
+COPY ./scripts/hive-site.xml                     /home/atlas/scripts/
+
+RUN tar xvfz /home/atlas/dist/apache-hive-${HIVE_VERSION}-bin.tar.gz 
--directory=/opt/ && \
+    ln -s /opt/apache-hive-${HIVE_VERSION}-bin /opt/hive && \
+    rm -f /home/atlas/dist/apache-hive-${HIVE_VERSION}-bin.tar.gz && \
+    tar xvfz /home/atlas/dist/hadoop-${HIVE_HADOOP_VERSION}.tar.gz 
--directory=/opt/ && \
+    ln -s /opt/hadoop-${HIVE_HADOOP_VERSION} /opt/hadoop && \
+    rm -f /home/atlas/dist/hadoop-${HIVE_HADOOP_VERSION}.tar.gz && \
+    tar xvfz /home/atlas/dist/apache-atlas-${ATLAS_VERSION}-hive-hook.tar.gz 
--directory=/opt/ && \
+    ln -s /opt/apache-atlas-hive-hook-${ATLAS_VERSION} 
/opt/apache-atlas-hive-hook && \
+    rm -f /home/atlas/dist/apache-atlas-${ATLAS_VERSION}-hive-hook.tar.gz && \
+    ln -s 
/opt/apache-atlas-hive-hook/hook/hive/atlas-plugin-classloader-${ATLAS_VERSION}.jar
 /opt/hive/lib/ && \
+    ln -s 
/opt/apache-atlas-hive-hook/hook/hive/hive-bridge-shim-${ATLAS_VERSION}.jar 
/opt/hive/lib/ && \
+    ln -s /opt/apache-atlas-hive-hook/hook/hive/atlas-hive-plugin-impl 
/opt/hive/lib/atlas-hive-plugin-impl && \
+    cp -f /home/atlas/scripts/hive-site.xml /opt/hive/conf/hive-site.xml && \
+    cp -f /home/atlas/scripts/atlas-hive-application.properties 
/opt/hive/conf/atlas-application.properties
+
+ENV HIVE_HOME   /opt/hive
+ENV HADOOP_HOME /opt/hadoop
+ENV PATH        
/usr/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/hive/bin:/opt/hadoop/bin
+
+ENTRYPOINT [ "/home/atlas/scripts/atlas-hive.sh" ]
diff --git a/dev-support/atlas-docker/README.md 
b/dev-support/atlas-docker/README.md
index 6ba4058..694d8db 100644
--- a/dev-support/atlas-docker/README.md
+++ b/dev-support/atlas-docker/README.md
@@ -43,7 +43,7 @@ Docker files in this folder create docker images and run them 
to build Apache At
 
    5.2. Execute following command to install and start Atlas and dependent 
services (Solr, HBase, Kafka) in containers:
 
-        docker-compose -f docker-compose.atlas-base.yml -f 
docker-compose.atlas.yml -f docker-compose.atlas-hadoop.yml -f 
docker-compose.atlas-hbase.yml -f docker-compose.atlas-kafka.yml up -d
+        docker-compose -f docker-compose.atlas-base.yml -f 
docker-compose.atlas.yml -f docker-compose.atlas-hadoop.yml -f 
docker-compose.atlas-hbase.yml -f docker-compose.atlas-kafka.yml -f 
docker-compose.atlas-hive.yml up -d
 
    Apache Atlas will be installed at /opt/atlas/, and logs are at 
/var/logs/atlas directory.
 
diff --git a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh 
b/dev-support/atlas-docker/config/init_postgres.sh
old mode 100755
new mode 100644
similarity index 74%
copy from dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
copy to dev-support/atlas-docker/config/init_postgres.sh
index c576989..0602878
--- a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
+++ b/dev-support/atlas-docker/config/init_postgres.sh
@@ -16,13 +16,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-echo "export JAVA_HOME=${JAVA_HOME}" >> ${HBASE_HOME}/conf/hbase-env.sh
 
-cat <<EOF > /etc/ssh/ssh_config
-Host *
-   StrictHostKeyChecking no
-   UserKnownHostsFile=/dev/null
-EOF
+set -e
 
-cp ${ATLAS_SCRIPTS}/hbase-site.xml /opt/hbase/conf/hbase-site.xml
-chown -R hbase:hadoop /opt/hbase/
+psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" 
<<-EOSQL
+    CREATE USER hive WITH PASSWORD 'atlasR0cks!';
+    CREATE DATABASE hive;
+    GRANT ALL PRIVILEGES ON DATABASE hive TO hive;
+EOSQL
diff --git a/dev-support/atlas-docker/docker-compose.atlas-hbase.yml 
b/dev-support/atlas-docker/docker-compose.atlas-hbase.yml
index 7157889..6105aa7 100644
--- a/dev-support/atlas-docker/docker-compose.atlas-hbase.yml
+++ b/dev-support/atlas-docker/docker-compose.atlas-hbase.yml
@@ -6,6 +6,7 @@ services:
       dockerfile: Dockerfile.atlas-hbase
       args:
         - HBASE_VERSION=${HBASE_VERSION}
+        - ATLAS_VERSION=${ATLAS_VERSION}
     image: atlas-hbase
     container_name: atlas-hbase
     hostname: atlas-hbase.example.com
@@ -23,8 +24,11 @@ services:
         condition: service_healthy
       atlas-zk:
         condition: service_started
+      atlas-kafka:
+        condition: service_started
     environment:
       - HBASE_VERSION
+      - ATLAS_VERSION
 
 networks:
   atlas:
diff --git a/dev-support/atlas-docker/docker-compose.atlas-hive.yml 
b/dev-support/atlas-docker/docker-compose.atlas-hive.yml
new file mode 100644
index 0000000..bb410cd
--- /dev/null
+++ b/dev-support/atlas-docker/docker-compose.atlas-hive.yml
@@ -0,0 +1,45 @@
+version: '3'
+services:
+  atlas-hive:
+    build:
+      context: .
+      dockerfile: Dockerfile.atlas-hive
+      args:
+        - HIVE_HADOOP_VERSION=${HIVE_HADOOP_VERSION}
+        - HIVE_VERSION=${HIVE_VERSION}
+        - ATLAS_VERSION=${ATLAS_VERSION}
+    image: atlas-hive
+    container_name: atlas-hive
+    hostname: atlas-hive.example.com
+    stdin_open: true
+    tty: true
+    networks:
+      - atlas
+    ports:
+      - "10000:10000"
+    depends_on:
+      atlas-db:
+        condition: service_started
+      atlas-hadoop:
+        condition: service_healthy
+      atlas-zk:
+        condition: service_started
+      atlas-kafka:
+        condition: service_started
+    environment:
+      - HIVE_HADOOP_VERSION
+      - HIVE_VERSION
+      - ATLAS_VERSION
+
+  atlas-db:
+    build:
+      context: .
+      dockerfile: Dockerfile.atlas-db
+    image: atlas-db
+    container_name: atlas-db
+    hostname: atlas-db.example.com
+    networks:
+      - atlas
+
+networks:
+  atlas:
diff --git a/dev-support/atlas-docker/download-archives.sh 
b/dev-support/atlas-docker/download-archives.sh
index dc6d22c..b5ede35 100755
--- a/dev-support/atlas-docker/download-archives.sh
+++ b/dev-support/atlas-docker/download-archives.sh
@@ -46,4 +46,6 @@ downloadIfNotPresent() {
 downloadIfNotPresent hadoop-${HADOOP_VERSION}.tar.gz        
https://archive.apache.org/dist/hadoop/common/hadoop-${HADOOP_VERSION}
 downloadIfNotPresent hbase-${HBASE_VERSION}-bin.tar.gz      
https://archive.apache.org/dist/hbase/${HBASE_VERSION}
 downloadIfNotPresent kafka_2.12-${KAFKA_VERSION}.tgz        
https://archive.apache.org/dist/kafka/${KAFKA_VERSION}
+downloadIfNotPresent apache-hive-${HIVE_VERSION}-bin.tar.gz 
https://archive.apache.org/dist/hive/hive-${HIVE_VERSION}
+downloadIfNotPresent hadoop-${HIVE_HADOOP_VERSION}.tar.gz   
https://archive.apache.org/dist/hadoop/common/hadoop-${HIVE_HADOOP_VERSION}
 
diff --git a/dev-support/atlas-docker/scripts/atlas-build.sh 
b/dev-support/atlas-docker/scripts/atlas-build.sh
index 316ef41..e53ebbb 100755
--- a/dev-support/atlas-docker/scripts/atlas-build.sh
+++ b/dev-support/atlas-docker/scripts/atlas-build.sh
@@ -86,4 +86,6 @@ fi
 
 mvn ${ARG_PROFILES} ${ARG_SKIPTESTS} -DskipDocs clean package
 
-mv -f distro/target/apache-atlas-${ATLAS_VERSION}-bin.tar.gz /home/atlas/dist/
+mv -f distro/target/apache-atlas-${ATLAS_VERSION}-server.tar.gz     
/home/atlas/dist/
+mv -f distro/target/apache-atlas-${ATLAS_VERSION}-hive-hook.tar.gz  
/home/atlas/dist/
+mv -f distro/target/apache-atlas-${ATLAS_VERSION}-hbase-hook.tar.gz 
/home/atlas/dist/
diff --git a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh 
b/dev-support/atlas-docker/scripts/atlas-hbase-application.properties
old mode 100755
new mode 100644
similarity index 73%
copy from dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
copy to dev-support/atlas-docker/scripts/atlas-hbase-application.properties
index c576989..8c5b9e0
--- a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
+++ b/dev-support/atlas-docker/scripts/atlas-hbase-application.properties
@@ -1,5 +1,4 @@
-#!/bin/bash
-
+#
 # 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
@@ -15,14 +14,10 @@
 # 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.
+#
 
-echo "export JAVA_HOME=${JAVA_HOME}" >> ${HBASE_HOME}/conf/hbase-env.sh
 
-cat <<EOF > /etc/ssh/ssh_config
-Host *
-   StrictHostKeyChecking no
-   UserKnownHostsFile=/dev/null
-EOF
+atlas.rest.address=http://atlas-example.com:21000
 
-cp ${ATLAS_SCRIPTS}/hbase-site.xml /opt/hbase/conf/hbase-site.xml
-chown -R hbase:hadoop /opt/hbase/
+atlas.kafka.zookeeper.connect=atlas-zk.example.com:2181
+atlas.kafka.bootstrap.servers=atlas-kafka.example.com:9092
diff --git a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh 
b/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
index c576989..9387b55 100755
--- a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
+++ b/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
@@ -24,5 +24,4 @@ Host *
    UserKnownHostsFile=/dev/null
 EOF
 
-cp ${ATLAS_SCRIPTS}/hbase-site.xml /opt/hbase/conf/hbase-site.xml
 chown -R hbase:hadoop /opt/hbase/
diff --git a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh 
b/dev-support/atlas-docker/scripts/atlas-hive-application.properties
old mode 100755
new mode 100644
similarity index 73%
copy from dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
copy to dev-support/atlas-docker/scripts/atlas-hive-application.properties
index c576989..8c5b9e0
--- a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
+++ b/dev-support/atlas-docker/scripts/atlas-hive-application.properties
@@ -1,5 +1,4 @@
-#!/bin/bash
-
+#
 # 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
@@ -15,14 +14,10 @@
 # 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.
+#
 
-echo "export JAVA_HOME=${JAVA_HOME}" >> ${HBASE_HOME}/conf/hbase-env.sh
 
-cat <<EOF > /etc/ssh/ssh_config
-Host *
-   StrictHostKeyChecking no
-   UserKnownHostsFile=/dev/null
-EOF
+atlas.rest.address=http://atlas-example.com:21000
 
-cp ${ATLAS_SCRIPTS}/hbase-site.xml /opt/hbase/conf/hbase-site.xml
-chown -R hbase:hadoop /opt/hbase/
+atlas.kafka.zookeeper.connect=atlas-zk.example.com:2181
+atlas.kafka.bootstrap.servers=atlas-kafka.example.com:9092
diff --git a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh 
b/dev-support/atlas-docker/scripts/atlas-hive-setup.sh
similarity index 59%
copy from dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
copy to dev-support/atlas-docker/scripts/atlas-hive-setup.sh
index c576989..f92b8c5 100755
--- a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
+++ b/dev-support/atlas-docker/scripts/atlas-hive-setup.sh
@@ -16,7 +16,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-echo "export JAVA_HOME=${JAVA_HOME}" >> ${HBASE_HOME}/conf/hbase-env.sh
+echo "export JAVA_HOME=${JAVA_HOME}" >> ${HADOOP_HOME}/etc/hadoop/hadoop-env.sh
 
 cat <<EOF > /etc/ssh/ssh_config
 Host *
@@ -24,5 +24,22 @@ Host *
    UserKnownHostsFile=/dev/null
 EOF
 
-cp ${ATLAS_SCRIPTS}/hbase-site.xml /opt/hbase/conf/hbase-site.xml
-chown -R hbase:hadoop /opt/hbase/
+cat <<EOF > ${HADOOP_HOME}/etc/hadoop/core-site.xml
+<configuration>
+  <property>
+    <name>fs.defaultFS</name>
+    <value>hdfs://atlas-hadoop:9000</value>
+  </property>
+</configuration>
+EOF
+
+cp ${ATLAS_SCRIPTS}/hive-site.xml ${HIVE_HOME}/conf/hive-site.xml
+cp ${ATLAS_SCRIPTS}/hive-site.xml ${HIVE_HOME}/conf/hiveserver2-site.xml
+su -c "${HIVE_HOME}/bin/schematool -dbType postgres -initSchema" hive
+
+mkdir -p /opt/hive/logs
+chown -R hive:hadoop /opt/hive/
+chmod g+w /opt/hive/logs
+
+cd ${ATLAS_HOME}/atlas-hive-plugin
+./enable-hive-plugin.sh
diff --git a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh 
b/dev-support/atlas-docker/scripts/atlas-hive.sh
similarity index 51%
copy from dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
copy to dev-support/atlas-docker/scripts/atlas-hive.sh
index c576989..57bd890 100755
--- a/dev-support/atlas-docker/scripts/atlas-hbase-setup.sh
+++ b/dev-support/atlas-docker/scripts/atlas-hive.sh
@@ -16,13 +16,28 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-echo "export JAVA_HOME=${JAVA_HOME}" >> ${HBASE_HOME}/conf/hbase-env.sh
+service ssh start
 
-cat <<EOF > /etc/ssh/ssh_config
-Host *
-   StrictHostKeyChecking no
-   UserKnownHostsFile=/dev/null
-EOF
+if [ ! -e ${HIVE_HOME}/.setupDone ]
+then
+  su -c "ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa" hdfs
+  su -c "cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys" hdfs
+  su -c "chmod 0600 ~/.ssh/authorized_keys" hdfs
 
-cp ${ATLAS_SCRIPTS}/hbase-site.xml /opt/hbase/conf/hbase-site.xml
-chown -R hbase:hadoop /opt/hbase/
+  su -c "ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa" yarn
+  su -c "cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys" yarn
+  su -c "chmod 0600 ~/.ssh/authorized_keys" yarn
+
+  echo "ssh" > /etc/pdsh/rcmd_default
+
+  ${ATLAS_SCRIPTS}/atlas-hive-setup.sh
+
+  touch ${HIVE_HOME}/.setupDone
+fi
+
+su -c "${HIVE_HOME}/bin/hiveserver2" hive
+
+HIVESERVER2_PID=`ps -ef  | grep -v grep | grep -i 
"org.apache.hive.service.server.HiveServer2" | awk '{print $2}'`
+
+# prevent the container from exiting
+tail --pid=$HIVESERVER2_PID -f /dev/null
diff --git a/dev-support/atlas-docker/scripts/hbase-site.xml 
b/dev-support/atlas-docker/scripts/hbase-site.xml
index dd8828f..934321d 100644
--- a/dev-support/atlas-docker/scripts/hbase-site.xml
+++ b/dev-support/atlas-docker/scripts/hbase-site.xml
@@ -49,4 +49,8 @@
     <name>hbase.zookeeper.quorum</name>
     <value>atlas-zk.example.com</value>
   </property>
+  <property>
+    <name>hbase.coprocessor.master.classes</name>
+    <value>org.apache.atlas.hbase.hook.HBaseAtlasCoprocessor</value>
+  </property>
 </configuration>
diff --git a/dev-support/atlas-docker/scripts/hive-site.xml 
b/dev-support/atlas-docker/scripts/hive-site.xml
new file mode 100644
index 0000000..9ad54e7
--- /dev/null
+++ b/dev-support/atlas-docker/scripts/hive-site.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
+/*
+ * 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.
+ */
+-->
+<configuration>
+    <property>
+        <name>javax.jdo.option.ConnectionURL</name>
+        <value>jdbc:postgresql://atlas-db/hive</value>
+    </property>
+    <property>
+        <name>javax.jdo.option.ConnectionDriverName</name>
+        <value>org.postgresql.Driver</value>
+    </property>
+    <property>
+        <name>javax.jdo.option.ConnectionUserName</name>
+        <value>hive</value>
+    </property>
+    <property>
+        <name>javax.jdo.option.ConnectionPassword</name>
+        <value>atlasR0cks!</value>
+    </property>
+
+    <property>
+        <name>hive.server2.enable.doAs</name>
+        <value>false</value>
+    </property>
+
+    <property>
+        <name>hive.zookeeper.quorum</name>
+        <value>atlas-zk.example.com</value>
+    </property>
+
+    <property>
+        <name>hive.zookeeper.client.port</name>
+        <value>2181</value>
+    </property>
+
+    <property>
+        <name>hive.exec.post.hooks</name>
+        <value>org.apache.atlas.hive.hook.HiveHook</value>
+    </property>
+
+    <property>
+        <name>hive.metastore.event.listeners</name>
+        <value>org.apache.atlas.hive.hook.HiveMetastoreHook</value>
+    </property>
+</configuration>

Reply via email to