diff --git a/filebeat/tests/system/test_registrar.py b/filebeat/tests/system/test_registrar.py index 813317662fe..6fdfe2181c8 100644 --- a/filebeat/tests/system/test_registrar.py +++ b/filebeat/tests/system/test_registrar.py @@ -1146,7 +1146,7 @@ def test_restart_state_reset_ttl(self): self.render_config_template( path=os.path.abspath(self.working_dir) + "/log/test.log", clean_inactive="20s", - ignore_older="5s" + ignore_older="15s" ) os.mkdir(self.working_dir + "/log/") @@ -1200,7 +1200,7 @@ def test_restart_state_reset_ttl_with_space(self): self.render_config_template( path=os.path.abspath(self.working_dir) + "/log/test file.log", clean_inactive="20s", - ignore_older="5s" + ignore_older="15s" ) os.mkdir(self.working_dir + "/log/") diff --git a/libbeat/docker-compose.yml b/libbeat/docker-compose.yml index 45306a44b8c..e946aa9ce73 100644 --- a/libbeat/docker-compose.yml +++ b/libbeat/docker-compose.yml @@ -60,3 +60,4 @@ services: build: context: ${PWD}/../testing/environments/ dockerfile: Dockerfile + args: [] diff --git a/testing/environments/snapshot-2x.yml b/testing/environments/2x.yml similarity index 59% rename from testing/environments/snapshot-2x.yml rename to testing/environments/2x.yml index 889158efd12..9749e644b64 100644 --- a/testing/environments/snapshot-2x.yml +++ b/testing/environments/2x.yml @@ -6,15 +6,21 @@ services: elasticsearch: build: context: ./docker/elasticsearch - dockerfile: Dockerfile-2.3.3 + dockerfile: Dockerfile-2x + args: + ELASTICSEARCH_VERSION: 2.4.2 command: elasticsearch -Des.network.host=0.0.0.0 logstash: build: context: ./docker/logstash - dockerfile: Dockerfile-2.3.2 + dockerfile: Dockerfile-2x + args: + LOGSTASH_VERSION: 2.4.1 kibana: build: context: ./docker/kibana - dockerfile: Dockerfile-4.5.1 + dockerfile: Dockerfile-4.6 + args: + KIBANA_VERSION: 4.6.3 diff --git a/testing/environments/Dockerfile b/testing/environments/Dockerfile index bf6f60b2d44..79411d5d9ab 100644 --- a/testing/environments/Dockerfile +++ b/testing/environments/Dockerfile @@ -8,3 +8,4 @@ RUN apt-get update && \ apt-get clean +ARG KIBANA_VERSION diff --git a/testing/environments/docker/elasticsearch/Dockerfile-2.2.0 b/testing/environments/docker/elasticsearch/Dockerfile-2.2.0 deleted file mode 100644 index 370c6cfa415..00000000000 --- a/testing/environments/docker/elasticsearch/Dockerfile-2.2.0 +++ /dev/null @@ -1,52 +0,0 @@ -FROM java:8-jre - -# grab gosu for easy step-down from root -RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 -RUN arch="$(dpkg --print-architecture)" \ - && set -x \ - && curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch" \ - && curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch.asc" \ - && gpg --verify /usr/local/bin/gosu.asc \ - && rm /usr/local/bin/gosu.asc \ - && chmod +x /usr/local/bin/gosu - -RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 - -ENV ELASTICSEARCH_MAJOR 2.2 -ENV ELASTICSEARCH_VERSION 2.2.0 -ENV ELASTICSEARCH_REPO_BASE http://download.elasticsearch.org/elasticsearch/staging/2.2.0-8ff36d1/repos/2.x/debian/ - -RUN echo "deb $ELASTICSEARCH_REPO_BASE stable main" > /etc/apt/sources.list.d/elasticsearch.list - -RUN set -x \ - && apt-get update \ - && apt-get install -y --no-install-recommends elasticsearch=$ELASTICSEARCH_VERSION \ - && rm -rf /var/lib/apt/lists/* - -ENV PATH /usr/share/elasticsearch/bin:$PATH - -RUN set -ex \ - && for path in \ - /usr/share/elasticsearch/data \ - /usr/share/elasticsearch/logs \ - /usr/share/elasticsearch/config \ - /usr/share/elasticsearch/config/scripts \ - ; do \ - mkdir -p "$path"; \ - chown -R elasticsearch:elasticsearch "$path"; \ - done - -COPY config /usr/share/elasticsearch/config - -VOLUME /usr/share/elasticsearch/data - -COPY docker-entrypoint.sh / - -ENTRYPOINT ["/docker-entrypoint.sh"] - -EXPOSE 9200 9300 - -CMD ["elasticsearch"] - - -ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/testing/environments/docker/elasticsearch/Dockerfile-2.2.0-shield b/testing/environments/docker/elasticsearch/Dockerfile-2.2.0-shield deleted file mode 100644 index 430d658d572..00000000000 --- a/testing/environments/docker/elasticsearch/Dockerfile-2.2.0-shield +++ /dev/null @@ -1,68 +0,0 @@ -FROM java:8-jre - -# grab gosu for easy step-down from root -RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 -RUN arch="$(dpkg --print-architecture)" \ - && set -x \ - && curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch" \ - && curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch.asc" \ - && gpg --verify /usr/local/bin/gosu.asc \ - && rm /usr/local/bin/gosu.asc \ - && chmod +x /usr/local/bin/gosu - -RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 - -ENV ELASTICSEARCH_MAJOR 2.2 -ENV ELASTICSEARCH_VERSION 2.2.0 -ENV ELASTICSEARCH_REPO_BASE http://packages.elastic.co/elasticsearch/2.x/debian - -RUN echo "deb $ELASTICSEARCH_REPO_BASE stable main" > /etc/apt/sources.list.d/elasticsearch.list - -RUN set -x \ - && apt-get update \ - && apt-get install -y --no-install-recommends elasticsearch=$ELASTICSEARCH_VERSION \ - && rm -rf /var/lib/apt/lists/* - -ENV PATH /usr/share/elasticsearch/bin:$PATH - -RUN set -ex \ - && for path in \ - /usr/share/elasticsearch/data \ - /usr/share/elasticsearch/logs \ - /usr/share/elasticsearch/config \ - /usr/share/elasticsearch/config/scripts \ - ; do \ - mkdir -p "$path"; \ - chown -R elasticsearch:elasticsearch "$path"; \ - done - -COPY config /usr/share/elasticsearch/config - -VOLUME /usr/share/elasticsearch/data - -COPY docker-entrypoint.sh / - -ENTRYPOINT ["/docker-entrypoint.sh"] - -EXPOSE 9200 9300 - -CMD ["elasticsearch"] - - - - - - -ENV ES_USER=beats -ENV ES_PASS=testing - -ENV ES_HOME=/usr/share/elasticsearch -ENV PATH=$ES_HOME/bin/shield:$ES_HOME/bin:$PATH - -RUN rm -fR /etc/elasticsearch && \ - ln -s $ES_HOME/config /etc/elasticsearch - -COPY docker-entrypoint-shield.sh / - - -ENTRYPOINT ["/docker-entrypoint-shield.sh"] diff --git a/testing/environments/docker/elasticsearch/Dockerfile-2.4.0 b/testing/environments/docker/elasticsearch/Dockerfile-2x similarity index 75% rename from testing/environments/docker/elasticsearch/Dockerfile-2.4.0 rename to testing/environments/docker/elasticsearch/Dockerfile-2x index 6ca93007705..0aba41f9426 100644 --- a/testing/environments/docker/elasticsearch/Dockerfile-2.4.0 +++ b/testing/environments/docker/elasticsearch/Dockerfile-2x @@ -12,12 +12,9 @@ RUN arch="$(dpkg --print-architecture)" \ RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 -ENV ELASTICSEARCH_MAJOR 2.4 -ENV ELASTICSEARCH_VERSION 2.4.0 +ARG ELASTICSEARCH_VERSION -RUN wget https://download.elasticsearch.org/elasticsearch/staging/2.4.0-ce9f0c7/org/elasticsearch/distribution/deb/elasticsearch/2.4.0/elasticsearch-2.4.0.deb - -#RUN wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/${ELASTICSEARCH_VERSION}/elasticsearch-${ELASTICSEARCH_VERSION}.deb +RUN wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/${ELASTICSEARCH_VERSION}/elasticsearch-${ELASTICSEARCH_VERSION}.deb RUN dpkg -i elasticsearch-${ELASTICSEARCH_VERSION}.deb diff --git a/testing/environments/docker/elasticsearch/docker-entrypoint-shield.sh b/testing/environments/docker/elasticsearch/docker-entrypoint-shield.sh deleted file mode 100755 index a06035057e8..00000000000 --- a/testing/environments/docker/elasticsearch/docker-entrypoint-shield.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Add the admin user -echo "adding admin user $ES_USER..." -esusers --path.conf=/usr/share/elasticsearch/config useradd $ES_USER -p $ES_PASS -r admin -echo 'done' - -# run original entrypoint -exec /docker-entrypoint.sh $@ diff --git a/testing/environments/docker/elasticsearch/setup.sh b/testing/environments/docker/elasticsearch/setup.sh deleted file mode 100644 index 2be49326cdc..00000000000 --- a/testing/environments/docker/elasticsearch/setup.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - - -# grab gosu for easy step-down from root -gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 -arch="$(dpkg --print-architecture)" \ - && set -x \ - && curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch" \ - && curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch.asc" \ - && gpg --verify /usr/local/bin/gosu.asc \ - && rm /usr/local/bin/gosu.asc \ - && chmod +x /usr/local/bin/gosu - -apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 - -wget $1 -O elasticsearch.deb - -dpkg -i elasticsearch.deb - -# this is more convenient when running without the init script -cp -r /etc/elasticsearch/ /usr/share/elasticsearch/config - -set -ex \ - && for path in \ - /usr/share/elasticsearch/data \ - /usr/share/elasticsearch/logs \ - /usr/share/elasticsearch/config \ - /usr/share/elasticsearch/config/scripts \ - ; do \ - mkdir -p "$path"; \ - chown -R elasticsearch:elasticsearch "$path"; \ - done diff --git a/testing/environments/docker/kibana/Dockerfile-4.6.0 b/testing/environments/docker/kibana/Dockerfile-4.6 similarity index 95% rename from testing/environments/docker/kibana/Dockerfile-4.6.0 rename to testing/environments/docker/kibana/Dockerfile-4.6 index c1f9daf7444..69519206926 100644 --- a/testing/environments/docker/kibana/Dockerfile-4.6.0 +++ b/testing/environments/docker/kibana/Dockerfile-4.6 @@ -15,10 +15,10 @@ RUN arch="$(dpkg --print-architecture)" \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu -ENV KIBANA_VERSION 4.6.0 +ARG KIBANA_VERSION RUN set -x \ - && curl -fSL "https://download.elastic.co/kibana/kibana/kibana-4.6.1-linux-x86_64.tar.gz" -o kibana.tar.gz \ + && curl -fSL "https://download.elastic.co/kibana/kibana/kibana-${KIBANA_VERSION}-linux-x86_64.tar.gz" -o kibana.tar.gz \ && mkdir -p /opt/kibana \ && tar -xz --strip-components=1 -C /opt/kibana -f kibana.tar.gz \ && chown -R kibana:kibana /opt/kibana \ diff --git a/testing/environments/docker/logstash/Dockerfile-1.5.5 b/testing/environments/docker/logstash/Dockerfile-1.5.5 deleted file mode 100644 index 0f58f180a6e..00000000000 --- a/testing/environments/docker/logstash/Dockerfile-1.5.5 +++ /dev/null @@ -1,28 +0,0 @@ -FROM java:8-jre - -ENV LS_VERSION 1.5 - -ENV DEB_URL https://download.elastic.co/logstash/logstash/packages/debian/logstash_1.5.5-1_all.deb - -ENV PATH $PATH:/opt/logstash/bin:/opt/logstash/vendor/jruby/bin - -# install logstash -RUN set -x && \ - mkdir -p /var/tmp && \ - wget -qO /var/tmp/logstash.deb $DEB_URL && \ - apt-get update -y && \ - apt-get install -y logrotate git && \ - dpkg -i /var/tmp/logstash.deb && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -RUN plugin install logstash-input-beats - -COPY logstash.conf.1.5.tmpl /logstash.conf.1.5.tmpl -COPY docker-entrypoint.sh /entrypoint.sh - -COPY pki /etc/pki - -ENTRYPOINT ["/entrypoint.sh"] - -CMD logstash agent -f /logstash.conf diff --git a/testing/environments/docker/logstash/Dockerfile-2.4.0 b/testing/environments/docker/logstash/Dockerfile-2x similarity index 84% rename from testing/environments/docker/logstash/Dockerfile-2.4.0 rename to testing/environments/docker/logstash/Dockerfile-2x index 434b614a812..ea8b1682902 100644 --- a/testing/environments/docker/logstash/Dockerfile-2.4.0 +++ b/testing/environments/docker/logstash/Dockerfile-2x @@ -1,8 +1,8 @@ FROM java:8-jre -ENV LS_VERSION 2 +ARG LOGSTASH_VERSION -ENV DEB_URL https://download.elastic.co/logstash/logstash/packages/debian/logstash-2.4.0.snapshot4_all.deb +ENV DEB_URL https://download.elastic.co/logstash/logstash/packages/debian/logstash-${LOGSTASH_VERSION}_all.deb ENV PATH $PATH:/opt/logstash/bin:/opt/logstash/vendor/jruby/bin @@ -18,7 +18,7 @@ RUN set -x && \ RUN plugin install logstash-input-beats -COPY logstash.conf.2.tmpl /logstash.conf.2.tmpl +COPY logstash.conf.tmpl /logstash.conf.tmpl COPY docker-entrypoint.sh /entrypoint.sh COPY pki /etc/pki diff --git a/testing/environments/docker/logstash/Dockerfile-5.0.0 b/testing/environments/docker/logstash/Dockerfile-5.0.0 index 6c18a8f3aff..1a4aedcdf31 100644 --- a/testing/environments/docker/logstash/Dockerfile-5.0.0 +++ b/testing/environments/docker/logstash/Dockerfile-5.0.0 @@ -1,6 +1,5 @@ FROM java:8-jre -ENV LS_VERSION 5 ENV VERSION 5.0.0 ENV URL https://artifacts.elastic.co/downloads/logstash/logstash-${VERSION}.tar.gz ENV PATH $PATH:/opt/logstash-$VERSION/bin @@ -11,7 +10,7 @@ RUN set -x && \ wget -qO logstash.tar.gz $URL && \ tar xzf logstash.tar.gz -COPY logstash.conf.2.tmpl /logstash.conf.2.tmpl +COPY logstash.conf.tmpl /logstash.conf.tmpl COPY docker-entrypoint.sh /entrypoint.sh COPY pki /etc/pki diff --git a/testing/environments/docker/logstash/Dockerfile-snapshot b/testing/environments/docker/logstash/Dockerfile-snapshot index 11e030c3592..4def0562947 100644 --- a/testing/environments/docker/logstash/Dockerfile-snapshot +++ b/testing/environments/docker/logstash/Dockerfile-snapshot @@ -16,7 +16,7 @@ RUN set -x && \ tar xzf logstash.tar.gz -COPY logstash.conf.2.tmpl /logstash.conf.2.tmpl +COPY logstash.conf.tmpl /logstash.conf.tmpl COPY docker-entrypoint.sh /entrypoint.sh COPY pki /etc/pki diff --git a/testing/environments/docker/logstash/docker-entrypoint.sh b/testing/environments/docker/logstash/docker-entrypoint.sh index 70db1bb5d10..f9147a5e88b 100755 --- a/testing/environments/docker/logstash/docker-entrypoint.sh +++ b/testing/environments/docker/logstash/docker-entrypoint.sh @@ -58,21 +58,12 @@ waitForElasticsearch() { exit 1 } -updateConfigFile_1_5() { - sed -e "s/host .*/host => \"$ES_HOST\"/" /logstash.conf.1.5.tmpl > /logstash.conf -} - -updateConfigFile_2() { - sed -e "s/hosts.*/hosts => [\"$ES_HOST:$ES_PORT\"]/" /logstash.conf.2.tmpl > /logstash.conf +updateConfigFile() { + sed -e "s/hosts.*/hosts => [\"$ES_HOST:$ES_PORT\"]/" /logstash.conf.tmpl > /logstash.conf } # Main -readParams -if [ "$LS_VERSION" == "1.5" ]; then - updateConfigFile_1_5 -else - updateConfigFile_2 -fi +updateConfigFile waitForElasticsearch exec "$@" diff --git a/testing/environments/docker/logstash/logstash.conf.1.5.tmpl b/testing/environments/docker/logstash/logstash.conf.1.5.tmpl deleted file mode 100644 index 0baa6de7229..00000000000 --- a/testing/environments/docker/logstash/logstash.conf.1.5.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -input { - beats { - port => 5044 - ssl => false - } - - beats { - port => 5055 - ssl => true - ssl_certificate => "/etc/pki/tls/certs/logstash.crt" - ssl_key => "/etc/pki/tls/private/logstash.key" - } -} - -output { - elasticsearch { - protocol => "http" - user => "beats" - password => "testing" - host => "" - port => "9200" - index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}" - document_type => "%{[@metadata][type]}" - } - - # stdout{} -} diff --git a/testing/environments/docker/logstash/logstash.conf.2.tmpl b/testing/environments/docker/logstash/logstash.conf.tmpl similarity index 100% rename from testing/environments/docker/logstash/logstash.conf.2.tmpl rename to testing/environments/docker/logstash/logstash.conf.tmpl diff --git a/testing/environments/es17-ls15-kb41.yml b/testing/environments/es17-ls15-kb41.yml deleted file mode 100644 index 097755e120c..00000000000 --- a/testing/environments/es17-ls15-kb41.yml +++ /dev/null @@ -1,15 +0,0 @@ -# This is the environment with the last major releases -# It extends the base.yml environment - -version: '2' -services: - elasticsearch: - image: elasticsearch:1.7 - - logstash: - build: - context: ./docker/logstash - dockerfile: Dockerfile-1.5.5 - - kibana: - image: kibana:4.1 diff --git a/testing/environments/ports.yml b/testing/environments/ports.yml index bcb50296d32..5ada00093d8 100644 --- a/testing/environments/ports.yml +++ b/testing/environments/ports.yml @@ -1,4 +1,7 @@ -# Defines if ports should be exported +# Defines if ports should be exported. +# This is useful for testing locally with a full elastic stack setup. +# All services can be reached through localhost like localhost:5601 for Kibana +# This is not used for CI as otherwise ports conflicts could happen. version: '2' services: elasticsearch: