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

oleewere pushed a commit to branch branch-feature-jenkins-test
in repository https://gitbox.apache.org/repos/asf/ambari-infra.git

commit 611e77bd11fe3e7cb08124e044821272e111f6e1
Author: Oliver Szabo <oleew...@gmail.com>
AuthorDate: Fri Sep 28 12:38:20 2018 +0200

    Add docker push script.
---
 ambari-infra-assembly/pom.xml                      |   2 +-
 jenkins/build.sh                                   |  32 +++++++
 jenkins/containers/infra-solr/Dockerfile           |  45 ++++++++++
 jenkins/containers/infra-solr/bin/entrypoint.sh    | 100 +++++++++++++++++++++
 jenkins/containers/infra-solr/bin/init.sh          |  13 +++
 jenkins/containers/infra-solr/conf/infra-solr.conf |  17 ++++
 jenkins/containers/infra-solr/conf/solr.xml        |  26 ++++++
 7 files changed, 234 insertions(+), 1 deletion(-)

diff --git a/ambari-infra-assembly/pom.xml b/ambari-infra-assembly/pom.xml
index e2175b7..4470cae 100644
--- a/ambari-infra-assembly/pom.xml
+++ b/ambari-infra-assembly/pom.xml
@@ -391,7 +391,7 @@
 
                     <copy 
file="${infra.solr.plugin.dir}/target/ambari-infra-solr-plugin-${project.version}.jar"
                           
toDir="${project.build.directory}/solr/server/solr-webapp/webapp/WEB-INF/lib/"/>
-                    <copy 
file="${infra.solr.plugin.dir}/target/libs/ambari-metrics-common-${project.version}.jar"
+                    <copy 
file="${infra.solr.plugin.dir}/target/libs/ambari-metrics-common-${ambari-metrics.version}.jar"
                           
toDir="${project.build.directory}/solr/server/solr-webapp/webapp/WEB-INF/lib/"/>
                     <copy 
file="${infra.solr.plugin.dir}/target/libs/commons-logging-1.1.1.jar"
                           
toDir="${project.build.directory}/solr/server/solr-webapp/webapp/WEB-INF/lib/"/>
diff --git a/jenkins/build.sh b/jenkins/build.sh
new file mode 100755
index 0000000..669ff7d
--- /dev/null
+++ b/jenkins/build.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+#   Licensed 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.
+
+readlinkf(){
+  # get real path on mac OSX
+  perl -MCwd -e 'print Cwd::abs_path shift' "$1";
+}
+
+if [ "$(uname -s)" = 'Linux' ]; then
+  SCRIPT_DIR="`dirname "$(readlink -f "$0")"`"
+else
+  SCRIPT_DIR="`dirname "$(readlinkf "$0")"`"
+fi
+
+INFRA_PROJECT_DIR="`dirname \"$SCRIPT_DIR\"`"
+
+cd $INFRA_PROJECT_DIR
+
+mvn clean package -DskipTests -Drat.skip=true -Dbuild-deb
+
+docker build -t apache/ambari-infra-solr:latest -f 
jenkins/containers/infra-solr/Dockerfile .
+docker push apache/ambari-infra-solr:latest
diff --git a/jenkins/containers/infra-solr/Dockerfile 
b/jenkins/containers/infra-solr/Dockerfile
new file mode 100644
index 0000000..973be7e
--- /dev/null
+++ b/jenkins/containers/infra-solr/Dockerfile
@@ -0,0 +1,45 @@
+#   Licensed 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:10-jre
+MAINTAINER d...@ambari.apache.org
+
+RUN apt-get update && apt-get install -y python
+ADD jenkins/containers/infra-solr/bin /infra-solr/bin
+ADD jenkins/containers/infra-solr/conf /infra-solr/conf
+ADD ambari-infra-assembly/target/ambari-infra-solr_2.0.0.0-SNAPSHOT.deb 
/infra-solr/ambari-infra-solr.deb
+ADD ambari-infra-assembly/target/ambari-infra-solr-client_2.0.0.0-SNAPSHOT.deb 
/infra-solr/ambari-infra-solr-client.deb
+RUN dpkg -i /infra-solr/ambari-infra-solr.deb
+RUN dpkg -i /infra-solr/ambari-infra-solr-client.deb
+RUN mkdir -p /var/lib/ambari-infra-solr/data
+
+ENV SOLR_USER="infra-solr"
+ENV SOLR_GROUP="infra-solr"
+ENV SOLR_UID="8983"
+ENV SOLR_GID="8983"
+ENV SOLR_HOME /var/lib/ambari-infra-solr/data
+ENV SOLR_INCLUDE /usr/lib/ambari-infra-solr/bin/solr.in.sh
+ENV SOLR_INIT_FILE /infra-solr/bin/init.sh
+ENV SOLR_ZNODE /infra-solr
+ENV SOLR_PORT="8886"
+
+RUN cp /infra-solr/conf/infra-solr.conf /etc/security/limits.d/
+
+RUN groupadd -r --gid $SOLR_GID $SOLR_GROUP && useradd -r --uid $SOLR_UID 
--gid $SOLR_GID $SOLR_USER
+RUN chown -R $SOLR_USER:$SOLR_GROUP /usr/lib/ambari-infra-solr
+RUN chown -R $SOLR_USER:$SOLR_GROUP /var/lib/ambari-infra-solr/data
+RUN chown -R $SOLR_USER:$SOLR_GROUP /usr/lib/ambari-infra-solr-client
+RUN chown -R $SOLR_USER:$SOLR_GROUP /infra-solr && chmod +x 
/infra-solr/bin/entrypoint.sh
+USER $SOLR_USER
+
+WORKDIR /infra-solr/bin/
+ENTRYPOINT ["/infra-solr/bin/entrypoint.sh"]
+CMD ["server"]
\ No newline at end of file
diff --git a/jenkins/containers/infra-solr/bin/entrypoint.sh 
b/jenkins/containers/infra-solr/bin/entrypoint.sh
new file mode 100755
index 0000000..c9fbd43
--- /dev/null
+++ b/jenkins/containers/infra-solr/bin/entrypoint.sh
@@ -0,0 +1,100 @@
+#!/usr/bin/env bash
+#   Licensed 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.
+export SOLR_LOCATION="/usr/lib/ambari-infra-solr"
+export SOLR_CLIENT_LOCATION="/usr/lib/ambari-infra-solr-client"
+command="$1"
+
+if [[ -z "$SOLR_HOST" ]]; then
+  export SOLR_HOST=`hostname -f`
+fi
+
+function client() {
+  echo "Run command: $SOLR_CLIENT_LOCATION/solrCloudCli.sh ${@}"
+  $SOLR_CLIENT_LOCATION/solrCloudCli.sh ${@}
+}
+
+function data_manager() {
+  echo "Run command: python $SOLR_CLIENT_LOCATION/solrDataManager.py ${@}"
+  python $SOLR_CLIENT_LOCATION/solrDataManager.py ${@}
+}
+
+function index_upgrade_tool() {
+  echo "Run command: $SOLR_CLIENT_LOCATION/solrIndexHelper.sh ${@}"
+  $SOLR_CLIENT_LOCATION/solrIndexHelper.sh ${@}
+}
+
+function ambari_migration_helper() {
+  echo "Run command: python $SOLR_CLIENT_LOCATION/migrationHelper.py ${@}"
+  python $SOLR_CLIENT_LOCATION/migrationHelper.py ${@}
+}
+
+function bootstrap_znode() {
+  : ${ZK_CONNECT_STRING:?"Please set the ZK_CONNECT_STRING env variable!"}
+  local retry=${CLIENT_RETRY:-"60"}
+  local interval=${CLIENT_INTERVAL:-"5"}
+  client --create-znode -z $ZK_CONNECT_STRING -zn $SOLR_ZNODE -rt $retry -i 
$interval
+}
+
+function start_standalone() {
+  echo "Run command: $SOLR_LOCATION/bin/solr start -foreground ${@}"
+  $SOLR_LOCATION/bin/solr start -foreground ${@}
+}
+
+function start_cloud() {
+  bootstrap_znode
+  export ZK_HOST="$ZK_CONNECT_STRING$SOLR_ZNODE"
+  echo "Run command: $SOLR_LOCATION/bin/solr start -cloud -noprompt 
-foreground ${@}"
+  $SOLR_LOCATION/bin/solr start -cloud -noprompt -foreground ${@}
+}
+
+function server() {
+  local cloud_mode=${CLOUD_MODE:-"false"}
+  if [[ "$cloud_mode" == "true" ]]; then
+    echo "Solr cloud mode on."
+    start_cloud ${@}
+  else
+    echo "Solr cloud mode off."
+    start_standalone ${@}
+  fi
+}
+
+if [[ -f "$SOLR_INIT_FILE" ]]; then
+  chown $SOLR_USER:$SOLR_GROUP $SOLR_INIT_FILE
+  chmod +x $SOLR_INIT_FILE
+  $SOLR_INIT_FILE
+fi
+
+if [[ ! -f "/var/lib/ambari-infra-solr/data/solr.xml" ]]; then
+  cp /infra-solr/conf/solr.xml /var/lib/ambari-infra-solr/data/
+fi
+
+case $command in
+  "server")
+     server ${@:2}
+     ;;
+  "client")
+     client ${@:2}
+     ;;
+  "data-manager")
+     data_manager ${@:2}
+     ;;
+  "index-upgrade-tool")
+     index_upgrade_tool ${@:2}
+     ;;
+  "ambari-migration-helper")
+     ambari_migration_helper ${@:2}
+     ;;
+  *)
+     echo "Available commands: 
(server|client|data-manager|index-upgrade-tool|ambari-migration-helper|bootstrap-collections)"
+     ;;
+esac
diff --git a/jenkins/containers/infra-solr/bin/init.sh 
b/jenkins/containers/infra-solr/bin/init.sh
new file mode 100755
index 0000000..3dd16ca
--- /dev/null
+++ b/jenkins/containers/infra-solr/bin/init.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+#   Licensed 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.
+echo "No init file specified."
diff --git a/jenkins/containers/infra-solr/conf/infra-solr.conf 
b/jenkins/containers/infra-solr/conf/infra-solr.conf
new file mode 100644
index 0000000..8f413f0
--- /dev/null
+++ b/jenkins/containers/infra-solr/conf/infra-solr.conf
@@ -0,0 +1,17 @@
+# 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.
+
+infra-solr   - nofile 128000
+infra-solr   - nproc  65536
\ No newline at end of file
diff --git a/jenkins/containers/infra-solr/conf/solr.xml 
b/jenkins/containers/infra-solr/conf/solr.xml
new file mode 100644
index 0000000..bff61c2
--- /dev/null
+++ b/jenkins/containers/infra-solr/conf/solr.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  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.
+-->
+<solr>
+  <solrcloud>
+    <str name="host">${host:}</str>
+    <int name="hostPort">${jetty.port:}</int>
+    <str name="hostContext">${hostContext:solr}</str>
+    <int name="zkClientTimeout">${zkClientTimeout:15000}</int>
+    <bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
+  </solrcloud>
+</solr>
\ No newline at end of file

Reply via email to