Skip to content

Commit

Permalink
feat: add Oracle support on Metricbeat Docker images (#12890)
Browse files Browse the repository at this point in the history
* feat: add Oracle support on Metricbeat Docker images

* Delete packer_cache.sh

* test: use the other Docker image name

* fix: typo

* test: use TAG

* tset: check image installed

* test: use another name

* test: remove --pull setting

* test: overwrite build-image target

* fix: install only lib needed

* fix: overwrite build-image target xpack

* test: add flag to disable pull on docker-compose build

* fix: change approach use the latest oracle instant basic bionaries
  • Loading branch information
kuisathaverat committed Mar 16, 2020
1 parent 8d267b7 commit 46a5b8b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
6 changes: 5 additions & 1 deletion dev-tools/mage/integtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,15 @@ func dockerComposeBuildImages() error {
return err
}

args := []string{"-p", dockerComposeProjectName(), "build", "--pull", "--force-rm"}
args := []string{"-p", dockerComposeProjectName(), "build", "--force-rm"}
if _, noCache := os.LookupEnv("DOCKER_NOCACHE"); noCache {
args = append(args, "--no-cache")
}

if _, forcePull := os.LookupEnv("DOCKER_PULL"); forcePull {
args = append(args, "--pull")
}

out := ioutil.Discard
if mg.Verbose() {
out = os.Stderr
Expand Down
7 changes: 6 additions & 1 deletion libbeat/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ COMMIT_ID=$(shell git rev-parse HEAD)
DOCKER_COMPOSE_PROJECT_NAME?=${BEAT_NAME}${TESTING_ENVIRONMENT//-}${BEAT_VERSION//-}${COMMIT_ID} ## @testing The name of the docker-compose project used by the integration and system tests
DOCKER_COMPOSE?=TESTING_ENVIRONMENT=${TESTING_ENVIRONMENT} ES_BEATS=${ES_BEATS} docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} -f docker-compose.yml
DOCKER_CACHE?=1 ## @miscellaneous If set to 0, all docker images are created without cache
DOCKER_PULL?=1 ## @miscellaneous If set to 0, disable the force pull on docker-compose build
GOPACKAGES_COMMA_SEP=$(subst $(space),$(comma),$(strip ${GOPACKAGES}))
PYTHON_EXE?=python3
PYTHON_ENV?=${BUILD_DIR}/python-env
Expand All @@ -115,6 +116,10 @@ ifeq ($(DOCKER_CACHE),0)
DOCKER_NOCACHE=--no-cache
endif

ifeq ($(DOCKER_PULL),1)
DOCKER_FORCE_PULL=--pull
endif

# Conditionally enable the race detector when RACE_DETECTOR=1.
ifeq ($(RACE_DETECTOR),1)
RACE=-race
Expand Down Expand Up @@ -403,7 +408,7 @@ $(.OVER)import-dashboards: update ${BEAT_NAME}
# Builds the environment to test beat
.PHONY: build-image
build-image: write-environment
${DOCKER_COMPOSE} build ${DOCKER_NOCACHE} --pull --force-rm
${DOCKER_COMPOSE} build ${DOCKER_NOCACHE} ${DOCKER_FORCE_PULL} --force-rm

# Runs the environment so the redis and elasticsearch can also be used for local development
# To use it for running the test, set ES_HOST and REDIS_HOST environment variable to the ip of your docker-machine.
Expand Down
15 changes: 13 additions & 2 deletions metricbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM golang:1.13.8

RUN \
apt-get update \
&& apt-get install -y --no-install-recommends \
apt update \
&& apt install -qq -y --no-install-recommends \
netcat \
python3 \
python3-pip \
python3-venv \
libaio-dev \
unzip \
&& rm -rf /var/lib/apt/lists/*

ENV PYTHON_ENV=/tmp/python-env
Expand All @@ -15,5 +17,14 @@ RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools
RUN pip3 install --upgrade docker-compose==1.23.2

# Oracle instant client
RUN cd /usr/lib \
&& curl -sLo instantclient-basic-linux.zip https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip \
&& unzip instantclient-basic-linux.zip \
&& rm instantclient-basic-linux.zip
ENV LD_LIBRARY_PATH=/usr/lib/instantclient_19_6

ENV PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/oracle/12.2/client64/bin

# Add healthcheck for the docker/healthcheck metricset to check during testing.
HEALTHCHECK CMD exit 0

0 comments on commit 46a5b8b

Please sign in to comment.