Browse code

Docker file for wavefront-proxy

Change-Id: I9ca5671399fadf52044ebce77bb269c3a8ade0ca
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/3989
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Vinay Kulkarni <kulkarniv@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

DheerajSShetty authored on 2017/10/07 07:50:02
Showing 4 changed files
... ...
@@ -434,7 +434,8 @@ k8s-docker-images: start-docker photon-docker-image
434 434
 	./build-flannel-docker-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \
435 435
 	./build-calico-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \
436 436
 	./build-k8s-heapster-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \
437
-	./build-k8s-nginx-ingress.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE)
437
+	./build-k8s-nginx-ingress.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE)  && \
438
+	./build-wavefront-proxy-docker-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE)
438 439
 
439 440
 install-photon-docker-image: photon-docker-image
440 441
 	sudo docker build -t photon:tdnf .
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        lightweight java application to send metrics to.
2 2
 Name:           wavefront-proxy
3 3
 Version:        4.16
4
-Release:        3%{?dist}
4
+Release:        4%{?dist}
5 5
 License:        Apache 2.0
6 6
 URL:            https://github.com/wavefrontHQ/java
7 7
 Source0:        https://github.com/wavefrontHQ/java/archive/wavefront-%{version}.tar.gz 
... ...
@@ -44,6 +44,7 @@ Restart=on-failure
44 44
 WantedBy=multi-user.target
45 45
 EOF
46 46
 sed -i 's/\/etc\/init.d\/$APP_BASE-proxy restart/ systemctl restart $APP_BASE-proxy/' pkg/opt/wavefront/wavefront-proxy/bin/autoconf-wavefront-proxy.sh
47
+sed -i 's/-jar \/opt\/wavefront\/wavefront-proxy\/bin\/wavefront-push-agent.jar/-jar \/opt\/wavefront-push-agent.jar/' proxy/docker/run.sh
47 48
 
48 49
 %build
49 50
 mvn install
... ...
@@ -57,6 +58,7 @@ install -m 755 -D pkg/etc/wavefront/wavefront-proxy/wavefront.conf.default %{bui
57 57
 install -m 755 -D pkg/usr/share/doc/wavefront-proxy/copyright %{buildroot}/%{_docdir}/%name/copyright
58 58
 install -m 755 -D proxy/target/proxy-%{version}-uber.jar %{buildroot}/opt/wavefront-push-agent.jar
59 59
 install -m 755 -D wavefront-proxy.service %{buildroot}/%{_unitdir}/wavefront-proxy.service
60
+install -m 755 -D proxy/docker/run.sh %{buildroot}/opt/wavefront/%{name}/bin/run.sh
60 61
 
61 62
 %pre
62 63
 user="wavefront"
... ...
@@ -104,6 +106,8 @@ rm -rf %{buildroot}/*
104 104
 %{_unitdir}/wavefront-proxy.service
105 105
 
106 106
 %changelog
107
+* Mon Oct 08 2017 Dheeraj Shetty <dheerajs@vmware.com> 4.16-4
108
+- Add Docker related files to the package
107 109
 * Tue Oct 03 2017 Dheeraj Shetty <dheerajs@vmware.com> 4.16-3
108 110
 - Fix for CVE-2017-9735
109 111
 * Mon Sep 18 2017 Alexey Makhalov <amakhalov@vmware.com> 4.16-2
110 112
new file mode 100644
... ...
@@ -0,0 +1,36 @@
0
+FROM vmware/photon
1
+
2
+# This script may automatically configure wavefront without prompting, based on
3
+# these variables:
4
+#  WAVEFRONT_URL           (required)
5
+#  WAVEFRONT_TOKEN         (required)
6
+#  JAVA_HEAP_USAGE         (default is 4G)
7
+#  WAVEFRONT_HOSTNAME      (default is the docker containers hostname)
8
+#  WAVEFRONT_USE_GRAPHITE  (default is false)
9
+
10
+
11
+RUN tdnf install -y net-tools sed openjre shadow
12
+# Copy files
13
+COPY [ "./tmp/wavefront-proxy/etc/wavefront/wavefront-proxy/log4j2-stdout.xml", \
14
+       "./tmp/wavefront-proxy/etc/wavefront/wavefront-proxy/log4j2.xml", \
15
+       "./tmp/wavefront-proxy/etc/wavefront/wavefront-proxy/preprocessor_rules.yaml",\
16
+       "./tmp/wavefront-proxy/etc/wavefront/wavefront-proxy/wavefront.conf", \
17
+       "/etc/wavefront/wavefront-proxy/" ]
18
+
19
+COPY ./tmp/wavefront-proxy/lib/systemd/system/wavefront-proxy.service /lib/systemd/system/ 
20
+COPY ./tmp/wavefront-proxy/opt/wavefront-push-agent.jar /opt/
21
+COPY ./tmp/wavefront-proxy/opt/wavefront/wavefront-proxy/bin/autoconf-wavefront-proxy.sh /opt/wavefront/wavefront-proxy/bin/
22
+COPY ./tmp/wavefront-proxy/opt/wavefront/wavefront-proxy/bin/run.sh /
23
+
24
+# Configure agent
25
+ENV DO_SERVICE_RESTART=false
26
+RUN echo '\nephemeral=true' >> /etc/wavefront/wavefront-proxy/wavefront.conf
27
+RUN echo '\nflushThreads=6' >> /etc/wavefront/wavefront-proxy/wavefront.conf
28
+
29
+# Run the agent
30
+EXPOSE 3878
31
+EXPOSE 2878
32
+EXPOSE 4242
33
+ENV PATH=/opt/wavefront/wavefront-proxy/jre/bin:$PATH
34
+ENV WAVEFRONT_USE_GRAPHITE=false
35
+ENTRYPOINT ["/bin/bash", "/run.sh"]
0 36
new file mode 100755
... ...
@@ -0,0 +1,42 @@
0
+#!/bin/bash -e
1
+
2
+DIST_TAG=$1
3
+DIST_VER=$2
4
+SPEC_DIR=$3
5
+STAGE_DIR=$4
6
+ARCH=noarch
7
+
8
+#
9
+# Docker image for wavefront-proxy
10
+#
11
+WAVEFRONT_PROXY_VER=`cat ${SPEC_DIR}/wavefront-proxy/wavefront-proxy.spec | grep Version | cut -d: -f2 | tr -d ' '`
12
+WAVEFRONT_PROXY_VER_REL=${WAVEFRONT_PROXY_VER}-`cat ${SPEC_DIR}/wavefront-proxy/wavefront-proxy.spec | grep Release | cut -d: -f2 | tr -d ' ' | cut -d% -f1`
13
+WAVEFRONT_PROXY_RPM=wavefront-proxy-${WAVEFRONT_PROXY_VER_REL}${DIST_TAG}.${ARCH}.rpm
14
+WAVEFRONT_PROXY_RPM_FILE=${STAGE_DIR}/RPMS/${ARCH}/${WAVEFRONT_PROXY_RPM}
15
+WAVEFRONT_PROXY_TAR=wavefront-proxy.tar
16
+
17
+if [ ! -f ${WAVEFRONT_PROXY_RPM_FILE} ]
18
+then
19
+    echo "wavefront-proxy RPM ${WAVEFRONT_PROXY_RPM_FILE} not found. Exiting.."
20
+    exit 1
21
+fi
22
+
23
+IMG_NAME=vmware_photon_${DIST_VER}/wavefront-proxy:v${WAVEFRONT_PROXY_VER}
24
+
25
+IMG_ID=`docker images -q ${IMG_NAME} 2> /dev/null`
26
+if [[ ! -z "${IMG_ID}" ]]; then
27
+    echo "Removing image ${IMG_NAME}"
28
+    docker rmi -f ${IMG_NAME}
29
+fi
30
+
31
+mkdir -p tmp/wavefront-proxy
32
+cp ${WAVEFRONT_PROXY_RPM_FILE} tmp/wavefront-proxy/
33
+pushd ./tmp/wavefront-proxy
34
+rpm2cpio ${WAVEFRONT_PROXY_RPM} | cpio -vid
35
+popd
36
+docker build --rm -t ${IMG_NAME} -f Dockerfile.wavefront-proxy .
37
+docker save -o ${WAVEFRONT_PROXY_TAR} ${IMG_NAME}
38
+gzip ${WAVEFRONT_PROXY_TAR}
39
+mv -f ${WAVEFRONT_PROXY_TAR}.gz ${STAGE_DIR}/
40
+
41
+rm -rf ./tmp