using ELK in web-ui for running log 93/3293/2
authorgrakiss <grakiss.wanglei@huawei.com>
Mon, 16 Nov 2015 03:07:54 +0000 (11:07 +0800)
committergrakiss <grakiss.wanglei@huawei.com>
Mon, 16 Nov 2015 06:45:50 +0000 (14:45 +0800)
JIRA: COMPASS-142
  - make repo for elk

Change-Id: I3f0cc25d0485463edeff40f2ded03863c16fe8b5
Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
build/arch/RedHat/make_jdk.sh [new file with mode: 0644]
build/arch/RedHat/make_kibana.sh [new file with mode: 0644]
build/make_repo.sh
build/os/centos/rhel6/compass/Dockerfile.tmpl
build/templates/compass_core.tmpl

diff --git a/build/arch/RedHat/make_jdk.sh b/build/arch/RedHat/make_jdk.sh
new file mode 100644 (file)
index 0000000..6ef45d0
--- /dev/null
@@ -0,0 +1,3 @@
+wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-x64.rpm
+
+cp -rf jdk-8u65-linux-x64.rpm /var/cache/yum/
diff --git a/build/arch/RedHat/make_kibana.sh b/build/arch/RedHat/make_kibana.sh
new file mode 100644 (file)
index 0000000..51af520
--- /dev/null
@@ -0,0 +1,52 @@
+
+yum -y install wget
+yum -y install tar
+yum -y install rpm-build
+
+cat << EOF > ~/.rpmmacros
+%_topdir /root/rpmbuild
+EOF
+
+mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
+
+pushd .
+
+cd ~/rpmbuild/SOURCES
+wget https://download.elastic.co/kibana/kibana/kibana-4.2.0-linux-x64.tar.gz
+
+cat << EOF > ~/rpmbuild/SPECS/kibana.spec
+Name:       kibana
+Version:    4.2.0
+Release:    1
+Vendor:     elasticsearch
+Summary:    GUN kibana x64
+License:    GPL
+Source:     kibana-4.2.0-linux-x64.tar.gz
+Group:      System Enviroment/Daemons
+URL:        http://www.elasticsearch.co/
+Packager:   test@test.com
+%description
+kibana package
+
+%prep
+tar xvf ../SOURCES/kibana-4.2.0-linux-x64.tar.gz
+
+%install
+cd ../BUILDROOT
+mkdir -p ./kibana-4.2.0-1.x86_64/opt/kibana
+cp -rf ../BUILD/kibana-4.2.0-linux-x64/* ./kibana-4.2.0-1.x86_64/opt/kibana
+
+%clean
+rm -rf ./kibana-4.2.0-linux-x64
+
+%files
+/opt/kibana/
+EOF
+
+cd ~
+rpmbuild -bb rpmbuild/SPECS/kibana.spec
+
+cp -rf rpmbuild/RPMS/* /var/cache/yum/
+
+find /var/cache/yum -name "perl*" | xargs rm -rf
+popd
index c58a032..7ed4c24 100755 (executable)
@@ -21,6 +21,24 @@ cat <<EOF >${WORK_PATH}/work/repo/cp_repo.sh
 #!/bin/bash
 set -ex
 cp /*.tar.gz /result -f
+EOF
+
+cat << EOF >${WORK_PATH}/work/repo/elasticsearch.repo
+[elasticsearch-2.x]
+name=Elasticsearch repository for 2.x packages
+baseurl=http://packages.elastic.co/elasticsearch/2.x/centos
+gpgcheck=1
+gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
+enabled=1
+EOF
+
+cat << EOF > ${WORK_PATH}/work/repo/logstash.repo
+[logstash-2.0]
+name=Logstash repository for 2.0.x packages
+baseurl=http://packages.elastic.co/logstash/2.0/centos
+gpgcheck=1
+gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
+enabled=1
 EOF
 
     sudo apt-get install python-yaml -y
@@ -163,7 +181,8 @@ function make_all_repo()
 
     make_repo --os-ver rhel6 --package-tag compass \
               --tmpl "${WORK_PATH}/build/templates/compass_core.tmpl" \
-              --default-package "epel-release python-yaml python-jinja2 python-paramiko"
+              --default-package "epel-release python-yaml python-jinja2 python-paramiko elasticsearch logstash" \
+              --special-package "kibana jdk"
 
     make_repo --os-ver trusty --package-tag juno \
               --ansible-dir $WORK_PATH/deploy/adapters/ansible \
@@ -191,6 +210,11 @@ function main()
         make_repo --os-ver rhel7 --package-tag juno \
                   --ansible-dir $WORK_PATH/deploy/adapters/ansible \
                   --default-package "rsyslog-7.6.7-1.el7 strace net-tools wget vim openssh-server dracut-config-rescue-033-241.el7_1.3 dracut-network-033-241.el7_1.3"
+    elif [ "$1" = "rhel6" ]; then
+        make_repo --os-ver rhel6 --package-tag compass \
+              --tmpl "${WORK_PATH}/build/templates/compass_core.tmpl" \
+              --default-package "epel-release python-yaml python-jinja2 python-paramiko elasticsearch logstash" \
+              --special-package "kibana jdk"
     else
         make_repo $*
     fi
index 8a8318e..df2bcb7 100644 (file)
@@ -1,6 +1,10 @@
 FROM centos:6.6
 MAINTAINER Chigang(Justin) <chigang@huawei.com>
 
+# add repo files first, then update
+ADD ./elasticsearch.repo /etc/yum.repos.d/elasticsearch.repo
+ADD ./logstash.repo /etc/yum.repos.d/logstash.repo
+
 # TODO: Is there some easy way to get the fastest/closest mirror?
 RUN yum update -y
 
index 9c88cc4..afecba5 100644 (file)
@@ -16,8 +16,8 @@ yum -y install $pkg
 
 mkdir -p /centos6-package
 
-find /var/cache/yum/ -name *.rpm | xargs -i cp {} /centos6-package
+find /var/cache/yum/ -name "*.rpm" | xargs -i cp {} /centos6-package
 
-find /centos6-package  -size 0 -name *.rpm | xargs rm -f
+find /centos6-package  -size 0 -name "*.rpm" | xargs rm -f
 
 tar -zcvf /centos6-package.tar.gz /centos6-package