Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

V6.2.3 filebeat 01 #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.7.0-slim-stretch

WORKDIR /tmp
ADD bin ./bin
ADD build ./build
ADD templates ./templates
ADD tests ./tests
ADD beats.txt Makefile requirements.txt version.json ./

RUN pip3 install -r requirements.txt
RUN pip3 install virtualenv

# Need `make` installed
RUN apt-get update
RUN apt-get install -y build-essential

# actually generate the Dockerfile via a `make` target
RUN make images

CMD ["cat", "/tmp/build/filebeat/Dockerfile-full"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ $(BEATS): venv
-D url=$(DOWNLOAD_URL_ROOT)/$@/$@-$(ELASTIC_VERSION)-linux-x86_64.tar.gz \
-D image_flavor=full \
templates/Dockerfile.j2 > build/$@/Dockerfile-full
docker build $(DOCKER_FLAGS) -f build/$@/Dockerfile-full --tag=$(REGISTRY)/beats/$@:$(VERSION_TAG) build/$@
#docker build $(DOCKER_FLAGS) -f build/$@/Dockerfile-full --tag=$(REGISTRY)/beats/$@:$(VERSION_TAG) build/$@

jinja2 \
-D beat=$@ \
-D elastic_version=$(ELASTIC_VERSION) \
-D url=$(DOWNLOAD_URL_ROOT)/$@/$@-oss-$(ELASTIC_VERSION)-linux-x86_64.tar.gz \
-D image_flavor=oss \
templates/Dockerfile.j2 > build/$@/Dockerfile-oss
docker build $(DOCKER_FLAGS) -f build/$@/Dockerfile-oss --tag=$(REGISTRY)/beats/$@-oss:$(VERSION_TAG) build/$@
#docker build $(DOCKER_FLAGS) -f build/$@/Dockerfile-oss --tag=$(REGISTRY)/beats/$@-oss:$(VERSION_TAG) build/$@

local-httpd:
docker run --rm -d --name=$(HTTPD) --network=host \
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## section-io specifics
We forked a version of filebeats at v6.2.3. In order to build an equivalent docker image
we need to also use the Dockerfile that created the v6.2.3 that Elastic produces.

The file `sectin-io.md` explains how to go about generating the Dockerfile along with the changes to a number of files in this fork.

## Description

This repository contains the official [Beats][beats] Docker images from
Expand Down
4 changes: 0 additions & 4 deletions beats.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
auditbeat
filebeat
heartbeat
metricbeat
packetbeat
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

build() {
docker build -t section-io-filebeats -f Dockerfile.build -v
docker run --rm -it section-io-filebeats > Dockerfile
}

build
23 changes: 23 additions & 0 deletions dev-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

USER=sysadmin
IP=192.168.1.38
ACCT=$USER@$IP

push() {
for f in ./* ; do
if [[ -d $f ]]; then
scp -r $f $ACCT:/home/$USER/
elif [[ -f $f ]]; then
scp $f $ACCT:/home/$USER/$f
else
echo "invalid $f"
fi
done
}

if [ "$1" == "" ]; then
push
else
$1
fi
49 changes: 49 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# change this to the user you created for your VM
DOCKER_USER="sysadmin"

docker_installs() {
apt-get update
apt-get remove docker docker-engine docker.io
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

#apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# sadly this is the command to run because ubuntu doesn't have a docker
# package easy to install via apt-get???
# see: https://askubuntu.com/questions/938700/how-do-i-install-docker-on-ubuntu-16-04-lts
apt install docker.io
}

# post installation setup for user
post_installs() {
if [ ! $(getent group docker) ]; then
echo "add a docker group"
groupadd docker
fi
echo "Adding '$DOCKER_USER' to docker group"
usermod -aG docker "$DOCKER_USER"
}

# Pull the python image before the build -- convenience for development.
docker_pull() {
docker pull python:3.7.0-slim-stretch
}

# 1) setup the shell and dev tools for the user
# 2) add docker to the system
# 3) make docker group and add user
# 4) change user's shell to zsh
installs() {
docker_installs
post_installs
}

$1
29 changes: 29 additions & 0 deletions section.io.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Purpose
These instruction outline the steps used to create the Dockerfile used
to build filebeats for the section.io deployment.

## TL;DR
This is provided as step to create an environment from scratch on a VM
that doesn't initially have docker running.

- Setup a VM (ubuntu/xenial)
- Get User and IP from VM (with bridged network or something that lets
you SSH and SCP to the VM).
- Edit dev-local.sh with the USER and IP
- Run ./dev-local.sh to push local files into VM via SCP
- Ssh into the machine and run $HOME/install.sh which will add docker to the
machine and setup the docker group
- With the ssh session then run $HOME/build.sh which will create the docker
image, then output to console the Dockerfile that was generated.

## Sorter version
Starting with a docker deamon running some environment such that the local
docker can issue commands against.

Simply run `./build.sh` which should `docker build` the image targeting the
configured deamon. The script will then also attempt to run the created
image and simply output the generated Dockerfile.

## Steps in Code
See Dockerfile.build. It hightlights the steps in Dockerfile format using a
Python3 image.
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version": "7.0.0-alpha1"}
{"version": "6.2.3"}