This is an automated email from the ASF dual-hosted git repository.
oleewere pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ambari-infra.git
The following commit(s) were added to refs/heads/master by this push:
new 12bc539 AMBARI-24721. Use maven docker plugin to build infra solr
images (#1)
12bc539 is described below
commit 12bc5391d8cea0ceb02cde07f3b396d6ad29b59d
Author: Olivér Szabó <[email protected]>
AuthorDate: Tue Oct 2 11:18:30 2018 +0200
AMBARI-24721. Use maven docker plugin to build infra solr images (#1)
* Add docker push script.
* Test commit for use fabric docker plugin to push image
* Try out jdk instead of jre
* add Makefile + docker build changes for infra-solr
* Remove ls from Dockerfile
* Add .repository to .gitignore
* Exclude .repository from rat check
---
.gitignore | 1 +
Makefile | 32 +++++++
ambari-infra-assembly/pom.xml | 28 +++++-
ambari-infra-manager-it/pom.xml | 4 +-
jenkins/containers/docker-infra-solr/Dockerfile | 51 +++++++++++
.../containers/docker-infra-solr/bin/entrypoint.sh | 100 +++++++++++++++++++++
jenkins/containers/docker-infra-solr/bin/init.sh | 13 +++
.../docker-infra-solr/conf/infra-solr.conf | 17 ++++
jenkins/containers/docker-infra-solr/conf/solr.xml | 26 ++++++
pom.xml | 11 +--
10 files changed, 275 insertions(+), 8 deletions(-)
diff --git a/.gitignore b/.gitignore
index b48f609..9c77d11 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
.classpath
.project
.settings
+.repository
.idea/
.iml/
.DS_Store
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8620dbe
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,32 @@
+# 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.
+
+GIT_REV_SHORT = $(shell git rev-parse --short HEAD)
+MAVEN_BINARY ?= mvn
+
+package:
+ $(MAVEN_BINARY) clean package
+
+test:
+ $(MAVEN_BINARY) clean test
+
+rpm:
+ $(MAVEN_BINARY) clean package -Dbuild-rpm -DskipTests
+
+deb:
+ $(MAVEN_BINARY) clean package -Dbuild-deb -DskipTests
+
+docker-build:
+ $(MAVEN_BINARY) clean package docker:build -DskipTests -Dbuild-deb
+
+docker-push:
+ $(MAVEN_BINARY) clean package docker:build docker:push -DskipTests
-Dbuild-deb
diff --git a/ambari-infra-assembly/pom.xml b/ambari-infra-assembly/pom.xml
index e2175b7..fe9d72e 100644
--- a/ambari-infra-assembly/pom.xml
+++ b/ambari-infra-assembly/pom.xml
@@ -45,6 +45,7 @@
<common-fileupload.location.url>http://central.maven.org/maven2/commons-fileupload/commons-fileupload/1.3.3/commons-fileupload-1.3.3.jar</common-fileupload.location.url>
<common-fileupload.jar.name>commons-fileupload-1.3.3.jar</common-fileupload.jar.name>
<common-fileupload.old.jar.name>commons-fileupload-1.3.2.jar</common-fileupload.old.jar.name>
+ <jenkins.docker.folder>../jenkins/containers</jenkins.docker.folder>
</properties>
<profiles>
@@ -391,17 +392,42 @@
<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/"/>
<chmod file="${project.build.directory}/solr/bin/**"
perm="755"/>
<chmod
file="${project.build.directory}/solr/server/scripts/**" perm="755"/>
+
+ <copy todir="${project.build.directory}" >
+ <fileset dir="${jenkins.docker.folder}" includes="**"/>
+ </copy>
+ <copy
todir="${project.build.directory}/docker-infra-solr/solr" >
+ <fileset dir="${project.build.directory}/solr"
includes="**"/>
+ </copy>
+ <copy
todir="${project.build.directory}/docker-infra-solr/solr-client" >
+ <fileset dir="${solr.client.dir}/target/package"
includes="**"/>
+ </copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <configuration>
+ <verbose>true</verbose>
+ <images>
+ <image>
+ <name>apache/ambari-infra-solr:latest</name>
+ <build>
+
<dockerFileDir>${project.build.directory}/docker-infra-solr</dockerFileDir>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ </plugin>
</plugins>
</build>
</profile>
diff --git a/ambari-infra-manager-it/pom.xml b/ambari-infra-manager-it/pom.xml
index c9b8bad..2fac6a9 100644
--- a/ambari-infra-manager-it/pom.xml
+++ b/ambari-infra-manager-it/pom.xml
@@ -34,7 +34,7 @@
<properties>
<jbehave.version>4.0.5</jbehave.version>
<failsafe-plugin.version>2.20</failsafe-plugin.version>
- <docker.host>localhost</docker.host>
+ <infra-manager.docker.host>localhost</infra-manager.docker.host>
<stories.location>NONE</stories.location>
</properties>
@@ -202,7 +202,7 @@
</includes>
<systemPropertyVariables>
<log4j.configuration>file:${project.build.testOutputDirectory}/log4j.properties</log4j.configuration>
- <docker.host>${docker.host}</docker.host>
+ <docker.host>${infra-manager.docker.host}</docker.host>
<backend.stories.location>${stories.location}</backend.stories.location>
</systemPropertyVariables>
</configuration>
diff --git a/jenkins/containers/docker-infra-solr/Dockerfile
b/jenkins/containers/docker-infra-solr/Dockerfile
new file mode 100644
index 0000000..cdab2cc
--- /dev/null
+++ b/jenkins/containers/docker-infra-solr/Dockerfile
@@ -0,0 +1,51 @@
+# 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 [email protected]
+
+RUN apt-get update && apt-get install -y python
+
+ADD bin /infra-solr/bin
+ADD conf /infra-solr/conf
+ADD solr /usr/lib/ambari-infra-solr
+ADD solr-client /usr/lib/ambari-infra-solr-client
+
+RUN mkdir -p /var/lib/ambari-infra-solr/data && mkdir -p
/etc/ambari-infra-solr/conf
+
+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 /etc/ambari-infra-solr/conf
+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
+RUN find /usr/lib/ambari-infra-solr -type d -exec chmod 755 {} +
+RUN find /usr/lib/ambari-infra-solr -type f -exec chmod 644 {} +
+RUN find /usr/lib/ambari-infra-solr-client -type d -exec chmod 755 {} +
+RUN find /usr/lib/ambari-infra-solr-client -type f -exec chmod 644 {} +
+
+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/docker-infra-solr/bin/entrypoint.sh
b/jenkins/containers/docker-infra-solr/bin/entrypoint.sh
new file mode 100755
index 0000000..c9fbd43
--- /dev/null
+++ b/jenkins/containers/docker-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/docker-infra-solr/bin/init.sh
b/jenkins/containers/docker-infra-solr/bin/init.sh
new file mode 100755
index 0000000..3dd16ca
--- /dev/null
+++ b/jenkins/containers/docker-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/docker-infra-solr/conf/infra-solr.conf
b/jenkins/containers/docker-infra-solr/conf/infra-solr.conf
new file mode 100644
index 0000000..8f413f0
--- /dev/null
+++ b/jenkins/containers/docker-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/docker-infra-solr/conf/solr.xml
b/jenkins/containers/docker-infra-solr/conf/solr.xml
new file mode 100644
index 0000000..bff61c2
--- /dev/null
+++ b/jenkins/containers/docker-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
diff --git a/pom.xml b/pom.xml
index f4365d6..cf43d51 100644
--- a/pom.xml
+++ b/pom.xml
@@ -163,17 +163,17 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20</version>
</plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.27.1</version>
+ </plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<inherited>false</inherited>
<artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
-
<descriptor>../ambari-project/src/main/assemblies/empty.xml</descriptor>
- </descriptors>
- </configuration>
<executions>
<execution>
<id>build-tarball</id>
@@ -285,6 +285,7 @@
<exclude>**/docker/Profile</exclude>
<exclude>**/docker/.env</exclude>
<exclude>**/*.story</exclude>
+ <exclude>.repository/**</exclude>
</excludes>
</configuration>
<executions>