From 89e40cfd64ea3138a011c5233373dce9d8f16b21 Mon Sep 17 00:00:00 2001 From: Lida He Date: Wed, 6 Jun 2018 19:56:23 -0400 Subject: [PATCH 01/15] Add Dockerfile Signed-off-by: Lida He --- docker/Dockerfile | 79 +++++++++++++++++ docker/README.md | 85 +++++++++++++++++++ docker/entrypoint.sh | 20 +++++ docker/filters/01-file-input.conf | 17 ++++ .../filters/10-apache-accesslog-filter.conf | 23 +++++ docker/filters/90-pravega-output.conf | 18 ++++ docker/filters/95-stdout-output.conf | 14 +++ docker/hook/build | 17 ++++ docker/logstash.yml | 5 ++ docker/start.sh | 19 +++++ docker/supervisord.conf | 5 ++ docker/supervisord_pravega.conf | 15 ++++ 12 files changed, 317 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/README.md create mode 100755 docker/entrypoint.sh create mode 100644 docker/filters/01-file-input.conf create mode 100644 docker/filters/10-apache-accesslog-filter.conf create mode 100644 docker/filters/90-pravega-output.conf create mode 100644 docker/filters/95-stdout-output.conf create mode 100644 docker/hook/build create mode 100644 docker/logstash.yml create mode 100755 docker/start.sh create mode 100644 docker/supervisord.conf create mode 100644 docker/supervisord_pravega.conf diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..e61db26 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,79 @@ +# Docker container for Pravega +FROM ubuntu:xenial +MAINTAINER Lida He "https://github.com/hldnova" + + +RUN apt update && \ + apt install -y --no-install-recommends \ + wget supervisor curl net-tools \ + apt-transport-https \ + software-properties-common && \ + rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && rm -rf ~/.cache && rm -rf /usr/share/doc + +# Install Java. +RUN \ + echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ + add-apt-repository -y ppa:webupd8team/java && \ + apt update && \ + apt install -y --no-install-recommends oracle-java8-installer && \ + rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && rm -rf ~/.cache && rm -rf /usr/share/doc && \ + rm -rf /var/cache/oracle-jdk8-installer + +# Install logstash +RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add - && \ + echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-5.x.list && \ + apt update && apt install -y --no-install-recommends logstash && \ + rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && rm -rf ~/.cache && rm -rf /usr/share/doc + +# Pravega package and version +#pravega-standalone-0.3.0-1870.f56b52d-20180604.195330-9.tgz +ARG PRAVEGA_VERSION=0.3.0-1870.f56b52d +ARG PRAVEGA_BUILD=20180604.195330-9 +ENV PRAVEGA_PREFIX=pravega-standalone +#pravega-standalone-0.3.0-1870.f56b52d-20180604.195330-9.tgz +ENV PRAVEGA_PACKAGE=${PRAVEGA_PREFIX}-${PRAVEGA_VERSION}-${PRAVEGA_BUILD}.tgz +#pravega-standalone-0.3.0-1870.f56b52d-SNAPSHOT +ENV PRAVEGA_PATH=${PRAVEGA_VERSION}-SNAPSHOT + +# Logstash Pravega output plugin version +ARG PLUGIN_VERSION=0.3.0-SNAPSHOT + +# Install Pravega +RUN cd /opt && \ + wget --no-check-certificate https://oss.jfrog.org/artifactory/jfrog-dependencies/io/pravega/pravega-standalone/${PRAVEGA_PATH}/${PRAVEGA_PACKAGE} && \ + tar zxvf ${PRAVEGA_PACKAGE} && \ + ln -s /opt/${PRAVEGA_PREFIX}-${PRAVEGA_PATH} /opt/pravega && \ + rm -rf /opt/${PRAVEGA_PACKAGE} + +# Install logstash Pravega output plugin +RUN cd /opt && \ + wget --no-check-certificate https://github.com/pravega/logstash-output-pravega/releases/download/v${PLUGIN_VERSION}/logstash-output-pravega-${PLUGIN_VERSION}.gem && \ + /usr/share/logstash/bin/logstash-plugin install logstash-output-pravega-${PLUGIN_VERSION}.gem && \ + rm -rf logstash-output-pravega-${PLUGIN_VERSION}.gem + +ADD supervisord.conf /etc/supervisord.conf + +ADD supervisord_pravega.conf /etc/supervisor/conf.d/pravega-standalone.conf + +RUN mkdir -p /var/log/pravega +RUN mkdir -p /opt/data + +ADD logstash.yml /etc/logstash/ +ADD filters/* /etc/logstash/conf.d/ + +ADD entrypoint.sh /opt/ + +# pravega controller port +EXPOSE 9090 +# pravega rest api port +EXPOSE 9091 +# pravega segment store server port +EXPOSE 6000 +# logstash monitoring api port +EXPOSE 9600 + +ENV TERM linux + +# default command +ENTRYPOINT ["/opt/entrypoint.sh"] +CMD ["supervisord", "-c", "/etc/supervisord.conf"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..98c3d8e --- /dev/null +++ b/docker/README.md @@ -0,0 +1,85 @@ +# Pravega Demo In Docker Container + +This is for running the following pipeline in a Docker container: +``` +Apache access logs -> Logstash with Pravega output plugin -> Pravega stream +``` + +Applications, e.g., Flink jobs, can then read the data from Pravega stream and process them. + +Services running inside the container. +- Pravega standalone. See more details [here](http://pravega.io/docs/latest/getting-started/) +- Logstash with [Pravega output plugin](https://github.com/pravega/logstash-output-pravega). It is configured to read data from a file that contains Apache access logs and push the logs, by default, to Pravega standalone running inside the container. + +The Docker image is prebuilt at https://hub.docker.com/r/emccorp/pravega-demo. + +To start, first create a file at /tmp/access.log +``` +$ touch /tmp/access.log +``` + +Then run script below to start container from prebuilt image. Adjust parameters to your need. +``` +#!/bin/sh +set -u + +PRAVEGA_SCOPE=myscope +PRAVEGA_STREAM=apacheaccess +CONTAINER_NAME=pravega +IMAGE_NAME=emccorp/pravega-demo + +docker run -d --name $CONTAINER_NAME \ + -p 9090:9090 \ + -p 9091:9091 \ + -v /tmp/access.log:/opt/data/access.log \ + -v /tmp/logs/:/var/log/pravega/ \ + -e PRAVEGA_ENDPOINT=${PRAVEGA_ENDPOINT} \ + -e PRAVEGA_SCOPE=${PRAVEGA_SCOPE} \ + -e PRAVEGA_STREAM=${PRAVEGA_STREAM} \ + ${IMAGE_NAME} +``` +The logs files can be found under at /tmp/logs. + +Add access logs to /tmp/access.log, e.g., by runing the command below a few times. +``` +echo '10.1.1.11 - peter [19/Mar/2018:02:24:01 -0400] "PUT /mapping/ HTTP/1.1" 500 182 "http://example.com/myapp" "python-client"' >> /tmp/access.log +``` + +The logs are sent to Pravega stream as json string, for example. +``` +{ + "request" => "/mapping/", + "agent" => "\"python-client\"", + "auth" => "peter", + "ident" => "-", + "verb" => "PUT", + "message" => "10.1.1.11 - peter [19/Mar/2018:02:24:01 -0400] \"PUT /mapping/ HTTP/1.1\" 500 182 \"http://example.com/myapp\" \"python-client\"", + "path" => "/opt/data/access.log", + "referrer" => "\"http://example.com/myapp\"", + "@timestamp" => 2018-03-19T06:24:01.000Z, + "response" => "500", + "bytes" => "182", + "clientip" => "10.1.1.11", + "@version" => "1", + "host" => "5e91529a729f", + "httpversion" => "1.1" +} +``` + +You can then start a Pravega reader to read from it, e.g., [Pravega Samples](https://github.com/pravega/pravega-samples) + + +In case you want to build the images yourself + +Clone this repository +``` +$ git clone https://github.com/hldnova/pravega-docker.git +``` + +Build with tag, e.g., pravega-demo +``` +$ cd pravega-docker +$ docker build --rm=true -t pravega-demo . +``` + +To run with your image, just replace `emccorp/pravega-demo` with your image tag, in this case, `pravega-demo`. diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..8ade623 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +set -ue +PRAVEGA_SCOPE=${PRAVEGA_SCOPE:-myscope} +PRAVEGA_STREAM=${PRAVEGA_STREAM:-apacheaccess} +PRAVEGA_ENDPOINT=${PRAVEGA_ENDPOINT:-tcp://localhost:9090} +sed -i 's|scope =>.*|scope => "'"${PRAVEGA_SCOPE}"'"|' /etc/logstash/conf.d/90-pravega-output.conf +sed -i 's|stream_name =>.*|stream_name => "'"${PRAVEGA_STREAM}"'"|' /etc/logstash/conf.d/90-pravega-output.conf +sed -i 's|pravega_endpoint =>.*|pravega_endpoint => "'"${PRAVEGA_ENDPOINT}"'"|' /etc/logstash/conf.d/90-pravega-output.conf + +exec "$@" diff --git a/docker/filters/01-file-input.conf b/docker/filters/01-file-input.conf new file mode 100644 index 0000000..a8049e1 --- /dev/null +++ b/docker/filters/01-file-input.conf @@ -0,0 +1,17 @@ +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +input { + file { + path => "/opt/data/access.log" + start_position => beginning + } +} + diff --git a/docker/filters/10-apache-accesslog-filter.conf b/docker/filters/10-apache-accesslog-filter.conf new file mode 100644 index 0000000..d33b4b9 --- /dev/null +++ b/docker/filters/10-apache-accesslog-filter.conf @@ -0,0 +1,23 @@ +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +filter { + grok { + match => { "message" => "%{COMBINEDAPACHELOG}" } + } + date { + match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ] + } + mutate { + remove_field => [ "timestamp" ] + } + +} + diff --git a/docker/filters/90-pravega-output.conf b/docker/filters/90-pravega-output.conf new file mode 100644 index 0000000..9da70a6 --- /dev/null +++ b/docker/filters/90-pravega-output.conf @@ -0,0 +1,18 @@ +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +output { + pravega { + pravega_endpoint => "tcp://127.0.0.1:9090" + stream_name => "apacheaccess" + scope => "myscope" + } +} + diff --git a/docker/filters/95-stdout-output.conf b/docker/filters/95-stdout-output.conf new file mode 100644 index 0000000..04986e4 --- /dev/null +++ b/docker/filters/95-stdout-output.conf @@ -0,0 +1,14 @@ +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +output { + stdout { codec => rubydebug } +} + diff --git a/docker/hook/build b/docker/hook/build new file mode 100644 index 0000000..94bd2ee --- /dev/null +++ b/docker/hook/build @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +echo "------ HOOK START - BUILD -------" +printenv + +docker build --build-arg PRAVEGA_VERSION=0.3.0-1870.f56b52dd --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t $IMAGE_NAME . + +echo "------ HOOK END - BUILD -------" diff --git a/docker/logstash.yml b/docker/logstash.yml new file mode 100644 index 0000000..0a37bc7 --- /dev/null +++ b/docker/logstash.yml @@ -0,0 +1,5 @@ + +# bind address for the monitoring api +http.host: "0.0.0.0" + + diff --git a/docker/start.sh b/docker/start.sh new file mode 100755 index 0000000..06b1582 --- /dev/null +++ b/docker/start.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -u + +PRAVEGA_SCOPE=${PRAVEGA_SCOPE:-examples} +PRAVEGA_STREAM=${PRAVEGA_STREAM:-apacheaccess} +CONTAINER_NAME=pravega +IMAGE_NAME=pravega-demo + +docker rm -f ${CONTAINER_NAME} + +docker run -d --name $CONTAINER_NAME \ + -p 9090:9090 \ + -p 9091:9091 \ + -p 9600:9600 \ + -v ${PWD}/access.log:/opt/data/access.log \ + -v ${PWD}/logs:/var/log/pravega \ + -e PRAVEGA_SCOPE=${PRAVEGA_SCOPE} \ + -e PRAVEGA_STREAM=${PRAVEGA_STREAM} \ + ${IMAGE_NAME} diff --git a/docker/supervisord.conf b/docker/supervisord.conf new file mode 100644 index 0000000..a951685 --- /dev/null +++ b/docker/supervisord.conf @@ -0,0 +1,5 @@ +[supervisord] +nodaemon=true + +[include] +files = /etc/supervisor/conf.d/*.conf diff --git a/docker/supervisord_pravega.conf b/docker/supervisord_pravega.conf new file mode 100644 index 0000000..cd701aa --- /dev/null +++ b/docker/supervisord_pravega.conf @@ -0,0 +1,15 @@ +[program:pravega] +command=/opt/pravega/bin/pravega-standalone +stderr_logfile=/var/log/pravega/pravega-error.log +stdout_logfile=/var/log/pravega/pravega-out.log +#redirect_stderr=true + +[program:logstash] +# sleep a while for pravega to start +command=bash -c 'sleep 60 && exec /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d --path.settings /etc/logstash' +stderr_logfile=/var/log/pravega/logstash-error.log +stdout_logfile=/var/log/pravega/logstash-out.log +#redirect_stderr=true + + + From 7c45d9c16bc0865e90a45b6c930f74ddf96e9718 Mon Sep 17 00:00:00 2001 From: Lida He Date: Wed, 6 Jun 2018 20:39:09 -0400 Subject: [PATCH 02/15] add hooks directory for automated build on docker hub Signed-off-by: Lida He --- docker/{hook => hooks}/build | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker/{hook => hooks}/build (100%) diff --git a/docker/hook/build b/docker/hooks/build similarity index 100% rename from docker/hook/build rename to docker/hooks/build From 65f67e348ba122fa5731ede5d023028fe17e6257 Mon Sep 17 00:00:00 2001 From: Lida He Date: Wed, 6 Jun 2018 20:53:26 -0400 Subject: [PATCH 03/15] update README Signed-off-by: Lida He --- docker/README.md | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/docker/README.md b/docker/README.md index 98c3d8e..3901de8 100644 --- a/docker/README.md +++ b/docker/README.md @@ -11,41 +11,42 @@ Services running inside the container. - Pravega standalone. See more details [here](http://pravega.io/docs/latest/getting-started/) - Logstash with [Pravega output plugin](https://github.com/pravega/logstash-output-pravega). It is configured to read data from a file that contains Apache access logs and push the logs, by default, to Pravega standalone running inside the container. -The Docker image is prebuilt at https://hub.docker.com/r/emccorp/pravega-demo. - -To start, first create a file at /tmp/access.log +To build with tag, e.g., pravega-demo +``` +$ docker build --rm=true -t pravega-demo . +``` +To run the pipeline, first create a file at /tmp/access.log ``` $ touch /tmp/access.log ``` -Then run script below to start container from prebuilt image. Adjust parameters to your need. +Then run script below to start container from the image. Adjust parameters to your need. ``` #!/bin/sh set -u -PRAVEGA_SCOPE=myscope +PRAVEGA_SCOPE=examples PRAVEGA_STREAM=apacheaccess CONTAINER_NAME=pravega -IMAGE_NAME=emccorp/pravega-demo +IMAGE_NAME=/pravega-demo docker run -d --name $CONTAINER_NAME \ -p 9090:9090 \ -p 9091:9091 \ -v /tmp/access.log:/opt/data/access.log \ - -v /tmp/logs/:/var/log/pravega/ \ - -e PRAVEGA_ENDPOINT=${PRAVEGA_ENDPOINT} \ + -v $PWD/logs/:/var/log/pravega/ \ -e PRAVEGA_SCOPE=${PRAVEGA_SCOPE} \ -e PRAVEGA_STREAM=${PRAVEGA_STREAM} \ ${IMAGE_NAME} ``` -The logs files can be found under at /tmp/logs. +For debugging, the logs files can be found under at $PWD/logs. Add access logs to /tmp/access.log, e.g., by runing the command below a few times. ``` echo '10.1.1.11 - peter [19/Mar/2018:02:24:01 -0400] "PUT /mapping/ HTTP/1.1" 500 182 "http://example.com/myapp" "python-client"' >> /tmp/access.log ``` -The logs are sent to Pravega stream as json string, for example. +The access logs are sent to Pravega stream as json string, for example. ``` { "request" => "/mapping/", @@ -67,19 +68,3 @@ The logs are sent to Pravega stream as json string, for example. ``` You can then start a Pravega reader to read from it, e.g., [Pravega Samples](https://github.com/pravega/pravega-samples) - - -In case you want to build the images yourself - -Clone this repository -``` -$ git clone https://github.com/hldnova/pravega-docker.git -``` - -Build with tag, e.g., pravega-demo -``` -$ cd pravega-docker -$ docker build --rm=true -t pravega-demo . -``` - -To run with your image, just replace `emccorp/pravega-demo` with your image tag, in this case, `pravega-demo`. From 4ea162714346b48c0810f60db3e08996422b86e6 Mon Sep 17 00:00:00 2001 From: Lida He Date: Wed, 6 Jun 2018 19:56:23 -0400 Subject: [PATCH 04/15] Add docker build to help set up logstash pipeline update version of pravega Signed-off-by: Lida He --- .travis.yml | 7 ++ docker/Dockerfile | 79 +++++++++++++++++++ docker/README.md | 70 ++++++++++++++++ docker/entrypoint.sh | 20 +++++ docker/filters/01-file-input.conf | 17 ++++ .../filters/10-apache-accesslog-filter.conf | 23 ++++++ docker/filters/90-pravega-output.conf | 18 +++++ docker/filters/95-stdout-output.conf | 14 ++++ docker/hooks/pre_build | 21 +++++ docker/logstash.yml | 5 ++ docker/start.sh | 19 +++++ docker/supervisord.conf | 5 ++ docker/supervisord_pravega.conf | 15 ++++ logstash-output-pravega.gemspec | 2 +- pom.xml | 6 +- 15 files changed, 315 insertions(+), 6 deletions(-) create mode 100644 .travis.yml create mode 100644 docker/Dockerfile create mode 100644 docker/README.md create mode 100755 docker/entrypoint.sh create mode 100644 docker/filters/01-file-input.conf create mode 100644 docker/filters/10-apache-accesslog-filter.conf create mode 100644 docker/filters/90-pravega-output.conf create mode 100644 docker/filters/95-stdout-output.conf create mode 100644 docker/hooks/pre_build create mode 100644 docker/logstash.yml create mode 100755 docker/start.sh create mode 100644 docker/supervisord.conf create mode 100644 docker/supervisord_pravega.conf diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..35aa824 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: ruby +rvm: + - jruby +script: + - bundle install + - rake install_jars + - jgem build logstash-output-pravega.gemspec diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..f06fac1 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,79 @@ +# Docker container for Pravega +FROM ubuntu:xenial +MAINTAINER Lida He "https://github.com/hldnova" + + +RUN apt update && \ + apt install -y --no-install-recommends \ + wget supervisor curl net-tools \ + apt-transport-https \ + software-properties-common && \ + rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && rm -rf ~/.cache && rm -rf /usr/share/doc + +# Install Java. +RUN \ + echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ + add-apt-repository -y ppa:webupd8team/java && \ + apt update && \ + apt install -y --no-install-recommends oracle-java8-installer && \ + rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && rm -rf ~/.cache && rm -rf /usr/share/doc && \ + rm -rf /var/cache/oracle-jdk8-installer + +# Install logstash +RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add - && \ + echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-5.x.list && \ + apt update && apt install -y --no-install-recommends logstash && \ + rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && rm -rf ~/.cache && rm -rf /usr/share/doc + +# Pravega package and version +ARG PRAVEGA_VERSION=0.3.0-1870.f56b52d-SNAPSHOT +#ARG PRAVEGA_BUILD=0.3.0-1870.f56b52d-20180604.195330-9 +ENV PRAVEGA_PREFIX=pravega-standalone +#package example: pravega-standalone-0.3.0-1870.f56b52d-20180604.195330-9.tgz +ENV PRAVEGA_PACKAGE=${PRAVEGA_PREFIX}-${PRAVEGA_BUILD}.tgz + +# Install Pravega +RUN cd /opt && \ + wget --no-check-certificate https://oss.jfrog.org/artifactory/jfrog-dependencies/io/pravega/pravega-standalone/${PRAVEGA_VERSION}/maven-metadata.xml && \ + PRAVEGA_BUILD=`grep -A1 tgz maven-metadata.xml | tail -n 1 | awk -F"<|>" '{print $3}'` && \ + PRAVEGA_PACKAGE=${PRAVEGA_PREFIX}-${PRAVEGA_BUILD}.tgz && \ + wget --no-check-certificate https://oss.jfrog.org/artifactory/jfrog-dependencies/io/pravega/pravega-standalone/${PRAVEGA_VERSION}/${PRAVEGA_PACKAGE} && \ + tar zxvf ${PRAVEGA_PACKAGE} && \ + ln -s /opt/${PRAVEGA_PREFIX}-${PRAVEGA_VERSION} /opt/pravega && \ + rm -rf /opt/${PRAVEGA_PACKAGE} + +# Logstash Pravega output plugin version +ARG PLUGIN_VERSION=0.3.0-SNAPSHOT + +# Install logstash Pravega output plugin +RUN cd /opt && \ + wget --no-check-certificate https://github.com/pravega/logstash-output-pravega/releases/download/v${PLUGIN_VERSION}/logstash-output-pravega-${PLUGIN_VERSION}.gem && \ + /usr/share/logstash/bin/logstash-plugin install logstash-output-pravega-${PLUGIN_VERSION}.gem && \ + rm -rf logstash-output-pravega-${PLUGIN_VERSION}.gem + +ADD supervisord.conf /etc/supervisord.conf + +ADD supervisord_pravega.conf /etc/supervisor/conf.d/pravega-standalone.conf + +RUN mkdir -p /var/log/pravega +RUN mkdir -p /opt/data + +ADD logstash.yml /etc/logstash/ +ADD filters/* /etc/logstash/conf.d/ + +ADD entrypoint.sh /opt/ + +# pravega controller port +EXPOSE 9090 +# pravega rest api port +EXPOSE 9091 +# pravega segment store server port +EXPOSE 6000 +# logstash monitoring api port +EXPOSE 9600 + +ENV TERM linux + +# default command +ENTRYPOINT ["/opt/entrypoint.sh"] +CMD ["supervisord", "-c", "/etc/supervisord.conf"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..3901de8 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,70 @@ +# Pravega Demo In Docker Container + +This is for running the following pipeline in a Docker container: +``` +Apache access logs -> Logstash with Pravega output plugin -> Pravega stream +``` + +Applications, e.g., Flink jobs, can then read the data from Pravega stream and process them. + +Services running inside the container. +- Pravega standalone. See more details [here](http://pravega.io/docs/latest/getting-started/) +- Logstash with [Pravega output plugin](https://github.com/pravega/logstash-output-pravega). It is configured to read data from a file that contains Apache access logs and push the logs, by default, to Pravega standalone running inside the container. + +To build with tag, e.g., pravega-demo +``` +$ docker build --rm=true -t pravega-demo . +``` +To run the pipeline, first create a file at /tmp/access.log +``` +$ touch /tmp/access.log +``` + +Then run script below to start container from the image. Adjust parameters to your need. +``` +#!/bin/sh +set -u + +PRAVEGA_SCOPE=examples +PRAVEGA_STREAM=apacheaccess +CONTAINER_NAME=pravega +IMAGE_NAME=/pravega-demo + +docker run -d --name $CONTAINER_NAME \ + -p 9090:9090 \ + -p 9091:9091 \ + -v /tmp/access.log:/opt/data/access.log \ + -v $PWD/logs/:/var/log/pravega/ \ + -e PRAVEGA_SCOPE=${PRAVEGA_SCOPE} \ + -e PRAVEGA_STREAM=${PRAVEGA_STREAM} \ + ${IMAGE_NAME} +``` +For debugging, the logs files can be found under at $PWD/logs. + +Add access logs to /tmp/access.log, e.g., by runing the command below a few times. +``` +echo '10.1.1.11 - peter [19/Mar/2018:02:24:01 -0400] "PUT /mapping/ HTTP/1.1" 500 182 "http://example.com/myapp" "python-client"' >> /tmp/access.log +``` + +The access logs are sent to Pravega stream as json string, for example. +``` +{ + "request" => "/mapping/", + "agent" => "\"python-client\"", + "auth" => "peter", + "ident" => "-", + "verb" => "PUT", + "message" => "10.1.1.11 - peter [19/Mar/2018:02:24:01 -0400] \"PUT /mapping/ HTTP/1.1\" 500 182 \"http://example.com/myapp\" \"python-client\"", + "path" => "/opt/data/access.log", + "referrer" => "\"http://example.com/myapp\"", + "@timestamp" => 2018-03-19T06:24:01.000Z, + "response" => "500", + "bytes" => "182", + "clientip" => "10.1.1.11", + "@version" => "1", + "host" => "5e91529a729f", + "httpversion" => "1.1" +} +``` + +You can then start a Pravega reader to read from it, e.g., [Pravega Samples](https://github.com/pravega/pravega-samples) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..8ade623 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +set -ue +PRAVEGA_SCOPE=${PRAVEGA_SCOPE:-myscope} +PRAVEGA_STREAM=${PRAVEGA_STREAM:-apacheaccess} +PRAVEGA_ENDPOINT=${PRAVEGA_ENDPOINT:-tcp://localhost:9090} +sed -i 's|scope =>.*|scope => "'"${PRAVEGA_SCOPE}"'"|' /etc/logstash/conf.d/90-pravega-output.conf +sed -i 's|stream_name =>.*|stream_name => "'"${PRAVEGA_STREAM}"'"|' /etc/logstash/conf.d/90-pravega-output.conf +sed -i 's|pravega_endpoint =>.*|pravega_endpoint => "'"${PRAVEGA_ENDPOINT}"'"|' /etc/logstash/conf.d/90-pravega-output.conf + +exec "$@" diff --git a/docker/filters/01-file-input.conf b/docker/filters/01-file-input.conf new file mode 100644 index 0000000..a8049e1 --- /dev/null +++ b/docker/filters/01-file-input.conf @@ -0,0 +1,17 @@ +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +input { + file { + path => "/opt/data/access.log" + start_position => beginning + } +} + diff --git a/docker/filters/10-apache-accesslog-filter.conf b/docker/filters/10-apache-accesslog-filter.conf new file mode 100644 index 0000000..d33b4b9 --- /dev/null +++ b/docker/filters/10-apache-accesslog-filter.conf @@ -0,0 +1,23 @@ +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +filter { + grok { + match => { "message" => "%{COMBINEDAPACHELOG}" } + } + date { + match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ] + } + mutate { + remove_field => [ "timestamp" ] + } + +} + diff --git a/docker/filters/90-pravega-output.conf b/docker/filters/90-pravega-output.conf new file mode 100644 index 0000000..9da70a6 --- /dev/null +++ b/docker/filters/90-pravega-output.conf @@ -0,0 +1,18 @@ +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +output { + pravega { + pravega_endpoint => "tcp://127.0.0.1:9090" + stream_name => "apacheaccess" + scope => "myscope" + } +} + diff --git a/docker/filters/95-stdout-output.conf b/docker/filters/95-stdout-output.conf new file mode 100644 index 0000000..04986e4 --- /dev/null +++ b/docker/filters/95-stdout-output.conf @@ -0,0 +1,14 @@ +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +output { + stdout { codec => rubydebug } +} + diff --git a/docker/hooks/pre_build b/docker/hooks/pre_build new file mode 100644 index 0000000..37b5328 --- /dev/null +++ b/docker/hooks/pre_build @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2018 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# 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 +# + +set -vuex +echo "------ HOOK START - BUILD -------" +export PRAVEGA_VERSION=`grep pravega-client ../logstash-output-pravega.gemspec | awk -F"'" '{print $4}'` + +# 0.3.0-SNAPSHOT +export PLUGIN_VERSION=`grep s.version ../logstash-output-pravega.gemspec | awk -F"'" '{print $2}'` + +#docker build --build-arg PRAVEGA_VERSION=${PRAVEGA_VERSION} --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t $IMAGE_NAME . + +echo "------ HOOK END - BUILD -------" diff --git a/docker/logstash.yml b/docker/logstash.yml new file mode 100644 index 0000000..0a37bc7 --- /dev/null +++ b/docker/logstash.yml @@ -0,0 +1,5 @@ + +# bind address for the monitoring api +http.host: "0.0.0.0" + + diff --git a/docker/start.sh b/docker/start.sh new file mode 100755 index 0000000..06b1582 --- /dev/null +++ b/docker/start.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -u + +PRAVEGA_SCOPE=${PRAVEGA_SCOPE:-examples} +PRAVEGA_STREAM=${PRAVEGA_STREAM:-apacheaccess} +CONTAINER_NAME=pravega +IMAGE_NAME=pravega-demo + +docker rm -f ${CONTAINER_NAME} + +docker run -d --name $CONTAINER_NAME \ + -p 9090:9090 \ + -p 9091:9091 \ + -p 9600:9600 \ + -v ${PWD}/access.log:/opt/data/access.log \ + -v ${PWD}/logs:/var/log/pravega \ + -e PRAVEGA_SCOPE=${PRAVEGA_SCOPE} \ + -e PRAVEGA_STREAM=${PRAVEGA_STREAM} \ + ${IMAGE_NAME} diff --git a/docker/supervisord.conf b/docker/supervisord.conf new file mode 100644 index 0000000..a951685 --- /dev/null +++ b/docker/supervisord.conf @@ -0,0 +1,5 @@ +[supervisord] +nodaemon=true + +[include] +files = /etc/supervisor/conf.d/*.conf diff --git a/docker/supervisord_pravega.conf b/docker/supervisord_pravega.conf new file mode 100644 index 0000000..cd701aa --- /dev/null +++ b/docker/supervisord_pravega.conf @@ -0,0 +1,15 @@ +[program:pravega] +command=/opt/pravega/bin/pravega-standalone +stderr_logfile=/var/log/pravega/pravega-error.log +stdout_logfile=/var/log/pravega/pravega-out.log +#redirect_stderr=true + +[program:logstash] +# sleep a while for pravega to start +command=bash -c 'sleep 60 && exec /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d --path.settings /etc/logstash' +stderr_logfile=/var/log/pravega/logstash-error.log +stdout_logfile=/var/log/pravega/logstash-out.log +#redirect_stderr=true + + + diff --git a/logstash-output-pravega.gemspec b/logstash-output-pravega.gemspec index e635888..c36431c 100644 --- a/logstash-output-pravega.gemspec +++ b/logstash-output-pravega.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| # Special flag to let us know this is actually a logstash plugin s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" } - s.requirements << "jar 'io.pravega:pravega-client', '0.3.0-64.d0c8497-SNAPSHOT'" + s.requirements << "jar 'io.pravega:pravega-client', '0.3.0-1870.f56b52d-SNAPSHOT'" # Gem dependencies s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99" diff --git a/pom.xml b/pom.xml index 15e43d2..db84395 100644 --- a/pom.xml +++ b/pom.xml @@ -8,14 +8,10 @@ io.pravega pravega-client - 0.3.0-64.d0c8497-SNAPSHOT + 0.3.0-1870.f56b52d-SNAPSHOT - - sonatype - https://oss.sonatype.org/content/repositories/snapshots - jfrog https://oss.jfrog.org/artifactory/jfrog-dependencies From adb589034180ad184ae9e43f782c44d2d7ea5c9b Mon Sep 17 00:00:00 2001 From: Lida He Date: Thu, 7 Jun 2018 00:12:13 -0400 Subject: [PATCH 05/15] add hook to extract pravega version for automated build on docker hub Signed-off-by: Lida He --- docker/hooks/{pre_build => build} | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) rename docker/hooks/{pre_build => build} (82%) diff --git a/docker/hooks/pre_build b/docker/hooks/build similarity index 82% rename from docker/hooks/pre_build rename to docker/hooks/build index 37b5328..cc2856a 100644 --- a/docker/hooks/pre_build +++ b/docker/hooks/build @@ -13,9 +13,8 @@ set -vuex echo "------ HOOK START - BUILD -------" export PRAVEGA_VERSION=`grep pravega-client ../logstash-output-pravega.gemspec | awk -F"'" '{print $4}'` -# 0.3.0-SNAPSHOT export PLUGIN_VERSION=`grep s.version ../logstash-output-pravega.gemspec | awk -F"'" '{print $2}'` -#docker build --build-arg PRAVEGA_VERSION=${PRAVEGA_VERSION} --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t $IMAGE_NAME . +docker build --build-arg PRAVEGA_VERSION=${PRAVEGA_VERSION} --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t $IMAGE_NAME . echo "------ HOOK END - BUILD -------" From 3d642dd4031177fca6f01bdea713ae13f46fc9a3 Mon Sep 17 00:00:00 2001 From: Lida He Date: Thu, 7 Jun 2018 00:19:39 -0400 Subject: [PATCH 06/15] Update README Signed-off-by: Lida He --- docker/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index 3901de8..80d7b07 100644 --- a/docker/README.md +++ b/docker/README.md @@ -11,10 +11,11 @@ Services running inside the container. - Pravega standalone. See more details [here](http://pravega.io/docs/latest/getting-started/) - Logstash with [Pravega output plugin](https://github.com/pravega/logstash-output-pravega). It is configured to read data from a file that contains Apache access logs and push the logs, by default, to Pravega standalone running inside the container. -To build with tag, e.g., pravega-demo +To build, first pick a [pravega standalone version](https://oss.jfrog.org/artifactory/jfrog-dependencies/io/pravega/pravega-standalone), for example, 0.3.0-1870.f56b52d-SNAPSHOT. Then pick a [plugin release](https://github.com/pravega/logstash-output-pravega/releases), e.g., 0.3.0-SNAPSHOT ``` -$ docker build --rm=true -t pravega-demo . +$ docker build --build-arg PRAVEGA_VERSION=0.3.0-1870.f56b52d-SNAPSHOT --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t pravega-demo . ``` + To run the pipeline, first create a file at /tmp/access.log ``` $ touch /tmp/access.log From a43a01868061906fe95a0d3ef933de510c3e9097 Mon Sep 17 00:00:00 2001 From: Lida He Date: Thu, 21 Jun 2018 22:39:57 -0400 Subject: [PATCH 07/15] update to pravega client 0.3.0 --- logstash-output-pravega.gemspec | 4 ++-- pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/logstash-output-pravega.gemspec b/logstash-output-pravega.gemspec index e635888..66433e2 100644 --- a/logstash-output-pravega.gemspec +++ b/logstash-output-pravega.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'logstash-output-pravega' - s.version = '0.3.0-SNAPSHOT' + s.version = '0.3.0' s.licenses = ['Apache License (2.0)'] s.summary = 'Output events to a Pravega Stream. This uses the Pravega Writer API to write event to a stream on the Pravega' s.description = 'This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program' @@ -17,7 +17,7 @@ Gem::Specification.new do |s| # Special flag to let us know this is actually a logstash plugin s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" } - s.requirements << "jar 'io.pravega:pravega-client', '0.3.0-64.d0c8497-SNAPSHOT'" + s.requirements << "jar 'io.pravega:pravega-client', '0.3.0'" # Gem dependencies s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99" diff --git a/pom.xml b/pom.xml index 15e43d2..d9c4dc5 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ io.pravega pravega-client - 0.3.0-64.d0c8497-SNAPSHOT + 0.3.0 From 701cd0c79ac17596090c30d887725e7f77eca1ac Mon Sep 17 00:00:00 2001 From: Lida He Date: Thu, 21 Jun 2018 22:40:19 -0400 Subject: [PATCH 08/15] get version from gemspec --- docker/hooks/build | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docker/hooks/build b/docker/hooks/build index 94bd2ee..cc2856a 100644 --- a/docker/hooks/build +++ b/docker/hooks/build @@ -9,9 +9,12 @@ # http://www.apache.org/licenses/LICENSE-2.0 # +set -vuex echo "------ HOOK START - BUILD -------" -printenv +export PRAVEGA_VERSION=`grep pravega-client ../logstash-output-pravega.gemspec | awk -F"'" '{print $4}'` -docker build --build-arg PRAVEGA_VERSION=0.3.0-1870.f56b52dd --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t $IMAGE_NAME . +export PLUGIN_VERSION=`grep s.version ../logstash-output-pravega.gemspec | awk -F"'" '{print $2}'` + +docker build --build-arg PRAVEGA_VERSION=${PRAVEGA_VERSION} --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t $IMAGE_NAME . echo "------ HOOK END - BUILD -------" From c670dcf0e85ed6b4eee548130c87c304ade81412 Mon Sep 17 00:00:00 2001 From: Lida He Date: Thu, 21 Jun 2018 23:08:51 -0400 Subject: [PATCH 09/15] update to pravega 0.3.0 Signed-off-by: Lida He --- docker/Dockerfile | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index e61db26..b89485b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -26,24 +26,21 @@ RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && rm -rf ~/.cache && rm -rf /usr/share/doc # Pravega package and version -#pravega-standalone-0.3.0-1870.f56b52d-20180604.195330-9.tgz -ARG PRAVEGA_VERSION=0.3.0-1870.f56b52d -ARG PRAVEGA_BUILD=20180604.195330-9 -ENV PRAVEGA_PREFIX=pravega-standalone -#pravega-standalone-0.3.0-1870.f56b52d-20180604.195330-9.tgz -ENV PRAVEGA_PACKAGE=${PRAVEGA_PREFIX}-${PRAVEGA_VERSION}-${PRAVEGA_BUILD}.tgz -#pravega-standalone-0.3.0-1870.f56b52d-SNAPSHOT -ENV PRAVEGA_PATH=${PRAVEGA_VERSION}-SNAPSHOT +ARG PRAVEGA_VERSION=0.3.0 + +# TODO: update whe Pravega 0.3.0 is released +ARG PRAVEGA_TAG=v0.3.0-rc0 +ENV PRAVEGA_PACKAGE=pravega-${PRAVEGA_VERSION} # Logstash Pravega output plugin version -ARG PLUGIN_VERSION=0.3.0-SNAPSHOT +ARG PLUGIN_VERSION=0.3.0 # Install Pravega RUN cd /opt && \ - wget --no-check-certificate https://oss.jfrog.org/artifactory/jfrog-dependencies/io/pravega/pravega-standalone/${PRAVEGA_PATH}/${PRAVEGA_PACKAGE} && \ - tar zxvf ${PRAVEGA_PACKAGE} && \ - ln -s /opt/${PRAVEGA_PREFIX}-${PRAVEGA_PATH} /opt/pravega && \ - rm -rf /opt/${PRAVEGA_PACKAGE} + wget --no-check-certificate https://github.com/pravega/pravega/releases/download/${PRAVEGA_TAG}/${PRAVEGA_PACKAGE}.tgz && \ + tar zxvf ${PRAVEGA_PACKAGE}.tgz && \ + ln -s /opt/${PRAVEGA_PACKAGE} /opt/pravega && \ + rm -rf /opt/${PRAVEGA_PACKAGE}.tgz # Install logstash Pravega output plugin RUN cd /opt && \ From 73ed59e81122aa3049beace3f3c2a02914518a80 Mon Sep 17 00:00:00 2001 From: Lida He Date: Thu, 21 Jun 2018 23:23:02 -0400 Subject: [PATCH 10/15] set version in pre_build hook --- docker/hooks/{build => pre_build} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename docker/hooks/{build => pre_build} (83%) diff --git a/docker/hooks/build b/docker/hooks/pre_build similarity index 83% rename from docker/hooks/build rename to docker/hooks/pre_build index cc2856a..c5e7405 100644 --- a/docker/hooks/build +++ b/docker/hooks/pre_build @@ -15,6 +15,6 @@ export PRAVEGA_VERSION=`grep pravega-client ../logstash-output-pravega.gemspec export PLUGIN_VERSION=`grep s.version ../logstash-output-pravega.gemspec | awk -F"'" '{print $2}'` -docker build --build-arg PRAVEGA_VERSION=${PRAVEGA_VERSION} --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t $IMAGE_NAME . +#docker build --build-arg PRAVEGA_VERSION=${PRAVEGA_VERSION} --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t $IMAGE_NAME . echo "------ HOOK END - BUILD -------" From 42eea37834d6124222a254cc874b45f32e2780ae Mon Sep 17 00:00:00 2001 From: Lida He Date: Wed, 6 Jun 2018 19:56:23 -0400 Subject: [PATCH 11/15] Add docker build to help set up logstash pipeline update version of pravega Signed-off-by: Lida He --- .travis.yml | 7 +++++++ logstash-output-pravega.gemspec | 4 ++++ pom.xml | 4 ---- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..35aa824 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: ruby +rvm: + - jruby +script: + - bundle install + - rake install_jars + - jgem build logstash-output-pravega.gemspec diff --git a/logstash-output-pravega.gemspec b/logstash-output-pravega.gemspec index 66433e2..ede7d72 100644 --- a/logstash-output-pravega.gemspec +++ b/logstash-output-pravega.gemspec @@ -17,7 +17,11 @@ Gem::Specification.new do |s| # Special flag to let us know this is actually a logstash plugin s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" } +<<<<<<< 73ed59e81122aa3049beace3f3c2a02914518a80 s.requirements << "jar 'io.pravega:pravega-client', '0.3.0'" +======= + s.requirements << "jar 'io.pravega:pravega-client', '0.3.0-1870.f56b52d-SNAPSHOT'" +>>>>>>> Add docker build to help set up logstash pipeline # Gem dependencies s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99" diff --git a/pom.xml b/pom.xml index d9c4dc5..cc777a8 100644 --- a/pom.xml +++ b/pom.xml @@ -12,10 +12,6 @@ - - sonatype - https://oss.sonatype.org/content/repositories/snapshots - jfrog https://oss.jfrog.org/artifactory/jfrog-dependencies From 93bdca8d5430b0c25e21f8fa6a94872b1275e148 Mon Sep 17 00:00:00 2001 From: Lida He Date: Thu, 7 Jun 2018 00:12:13 -0400 Subject: [PATCH 12/15] add hook to extract pravega version for automated build on docker hub Signed-off-by: Lida He --- docker/hooks/{pre_build => build} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename docker/hooks/{pre_build => build} (83%) diff --git a/docker/hooks/pre_build b/docker/hooks/build similarity index 83% rename from docker/hooks/pre_build rename to docker/hooks/build index c5e7405..cc2856a 100644 --- a/docker/hooks/pre_build +++ b/docker/hooks/build @@ -15,6 +15,6 @@ export PRAVEGA_VERSION=`grep pravega-client ../logstash-output-pravega.gemspec export PLUGIN_VERSION=`grep s.version ../logstash-output-pravega.gemspec | awk -F"'" '{print $2}'` -#docker build --build-arg PRAVEGA_VERSION=${PRAVEGA_VERSION} --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t $IMAGE_NAME . +docker build --build-arg PRAVEGA_VERSION=${PRAVEGA_VERSION} --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t $IMAGE_NAME . echo "------ HOOK END - BUILD -------" From aa12ec056d06839217aaa9bc13c20d701ba1702e Mon Sep 17 00:00:00 2001 From: Lida He Date: Thu, 7 Jun 2018 00:19:39 -0400 Subject: [PATCH 13/15] Update README Signed-off-by: Lida He --- docker/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index 3901de8..80d7b07 100644 --- a/docker/README.md +++ b/docker/README.md @@ -11,10 +11,11 @@ Services running inside the container. - Pravega standalone. See more details [here](http://pravega.io/docs/latest/getting-started/) - Logstash with [Pravega output plugin](https://github.com/pravega/logstash-output-pravega). It is configured to read data from a file that contains Apache access logs and push the logs, by default, to Pravega standalone running inside the container. -To build with tag, e.g., pravega-demo +To build, first pick a [pravega standalone version](https://oss.jfrog.org/artifactory/jfrog-dependencies/io/pravega/pravega-standalone), for example, 0.3.0-1870.f56b52d-SNAPSHOT. Then pick a [plugin release](https://github.com/pravega/logstash-output-pravega/releases), e.g., 0.3.0-SNAPSHOT ``` -$ docker build --rm=true -t pravega-demo . +$ docker build --build-arg PRAVEGA_VERSION=0.3.0-1870.f56b52d-SNAPSHOT --build-arg PLUGIN_VERSION=0.3.0-SNAPSHOT -t pravega-demo . ``` + To run the pipeline, first create a file at /tmp/access.log ``` $ touch /tmp/access.log From 5875c033fc9453b3b837e787a358cb5d8dc2c1a9 Mon Sep 17 00:00:00 2001 From: Lida He Date: Fri, 22 Jun 2018 01:55:38 -0400 Subject: [PATCH 14/15] temp workaround for pravega 0.3.0 build --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b89485b..509d167 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -37,7 +37,7 @@ ARG PLUGIN_VERSION=0.3.0 # Install Pravega RUN cd /opt && \ - wget --no-check-certificate https://github.com/pravega/pravega/releases/download/${PRAVEGA_TAG}/${PRAVEGA_PACKAGE}.tgz && \ + wget --no-check-certificate https://github.com/pravega/logstash-output-pravega/releases/download/${PRAVEGA_TAG}/${PRAVEGA_PACKAGE}.tgz && \ tar zxvf ${PRAVEGA_PACKAGE}.tgz && \ ln -s /opt/${PRAVEGA_PACKAGE} /opt/pravega && \ rm -rf /opt/${PRAVEGA_PACKAGE}.tgz From 6b64e0ce12845237674254c8dc85f805b4523cf4 Mon Sep 17 00:00:00 2001 From: Lida He Date: Fri, 22 Jun 2018 01:58:11 -0400 Subject: [PATCH 15/15] temp workaround for pravega 0.3.0 build --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 509d167..dcffa4a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -29,7 +29,7 @@ RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add ARG PRAVEGA_VERSION=0.3.0 # TODO: update whe Pravega 0.3.0 is released -ARG PRAVEGA_TAG=v0.3.0-rc0 +ARG PRAVEGA_TAG=v0.3.0 ENV PRAVEGA_PACKAGE=pravega-${PRAVEGA_VERSION} # Logstash Pravega output plugin version