From 40559d47089d66c0c81b9d7fd1a2c81b490a5927 Mon Sep 17 00:00:00 2001 From: grakiss Date: Mon, 16 Nov 2015 11:07:54 +0800 Subject: using ELK in web-ui for running log JIRA: COMPASS-142 - make repo for elk Change-Id: I3f0cc25d0485463edeff40f2ded03863c16fe8b5 Signed-off-by: grakiss --- build/arch/RedHat/make_jdk.sh | 3 ++ build/arch/RedHat/make_kibana.sh | 52 +++++++++++++++++++++++++++ build/make_repo.sh | 26 +++++++++++++- build/os/centos/rhel6/compass/Dockerfile.tmpl | 4 +++ build/templates/compass_core.tmpl | 4 +-- 5 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 build/arch/RedHat/make_jdk.sh create mode 100644 build/arch/RedHat/make_kibana.sh (limited to 'build') diff --git a/build/arch/RedHat/make_jdk.sh b/build/arch/RedHat/make_jdk.sh new file mode 100644 index 00000000..6ef45d06 --- /dev/null +++ b/build/arch/RedHat/make_jdk.sh @@ -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 index 00000000..51af5209 --- /dev/null +++ b/build/arch/RedHat/make_kibana.sh @@ -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 diff --git a/build/make_repo.sh b/build/make_repo.sh index c58a032c..7ed4c249 100755 --- a/build/make_repo.sh +++ b/build/make_repo.sh @@ -21,6 +21,24 @@ cat <${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 diff --git a/build/os/centos/rhel6/compass/Dockerfile.tmpl b/build/os/centos/rhel6/compass/Dockerfile.tmpl index 8a8318e1..df2bcb77 100644 --- a/build/os/centos/rhel6/compass/Dockerfile.tmpl +++ b/build/os/centos/rhel6/compass/Dockerfile.tmpl @@ -1,6 +1,10 @@ FROM centos:6.6 MAINTAINER Chigang(Justin) +# 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 diff --git a/build/templates/compass_core.tmpl b/build/templates/compass_core.tmpl index 9c88cc4f..afecba58 100644 --- a/build/templates/compass_core.tmpl +++ b/build/templates/compass_core.tmpl @@ -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 -- cgit 1.2.3-korg