Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Functionbeat] Docker #15112

Closed
CEikermann opened this issue Dec 14, 2019 · 9 comments
Closed

[Functionbeat] Docker #15112

CEikermann opened this issue Dec 14, 2019 · 9 comments
Labels

Comments

@CEikermann
Copy link

Hello,

we want to deploy functionbeat changes via our CI/CD pipeline. Our idea was to run a small docker container to execute functionbeat commands instead of downloading the functionbeat binary for the right platform.

Can you provide a docker image for functionbeat as well like for all other beats?

Best regards,
Christian

@kvch kvch self-assigned this Dec 17, 2019
@andresrc andresrc added Team:Integrations Label for the Integrations team and removed Team:Beats labels Mar 6, 2020
@pawarrchetan
Copy link

pawarrchetan commented Mar 11, 2020

@andresrc I would also like to have a docker image for Functionbeats.
I am trying to deploy a serverless function for centralized logging. However the normal alpine image gives below error while executing functionbeat.

$ docker run -it --entrypoint sh functionbeat-v9:latest                                                                   [14:41:58]
/ #
/ # which functionbeat
/bin/functionbeat
/ #
/ # functionbeat
sh: functionbeat: not found

My Dockerfile looks like below.

FROM alpine:latest

ARG FUNCTIONBEAT_VERSION=7.6.1

ADD https://artifacts.elastic.co/downloads/beats/functionbeat/functionbeat-${FUNCTIONBEAT_VERSION}-linux-x86_64.tar.gz /tmp

RUN apk add --update --no-cache curl && \
    tar xzvf /tmp/functionbeat-${FUNCTIONBEAT_VERSION}-linux-x86_64.tar.gz && \
    mv functionbeat-${FUNCTIONBEAT_VERSION}-linux-x86_64/functionbeat /bin/ && \
    chmod a+x /bin/functionbeat

ENV PATH /bin/functionbeat:$PATH

ENTRYPOINT ["/bin/functionbeat"]`

@pawarrchetan
Copy link

pawarrchetan commented Mar 11, 2020

@CEikermann @andresrc

The working Dockerfile looks like this -

FROM debian:latest

ARG FUNCTIONBEAT_VERSION=7.6.1

ADD https://artifacts.elastic.co/downloads/beats/functionbeat/functionbeat-${FUNCTIONBEAT_VERSION}-linux-x86_64.tar.gz /tmp

RUN \
    apt-get update \
    && apt-get install -y --no-install-recommends \
    curl \
    && rm -rf /var/lib/apt/lists/* && \
    tar xzvf /tmp/functionbeat-${FUNCTIONBEAT_VERSION}-linux-x86_64.tar.gz && \
    mv functionbeat-${FUNCTIONBEAT_VERSION}-linux-x86_64/functionbeat /bin/functionbeat && \
    chmod a+x /bin/functionbeat

ENV PATH /bin/functionbeat:$PATH

ENTRYPOINT ["functionbeat"]

@kvch
Copy link
Contributor

kvch commented Mar 11, 2020

Thank you for sharing!

@nefelim4ag
Copy link

FROM ubuntu:latest

ARG FUNCTIONBEAT_VERSION=7.7.1

ADD https://artifacts.elastic.co/downloads/beats/functionbeat/functionbeat-${FUNCTIONBEAT_VERSION}-linux-x86_64.tar.gz /tmp

RUN \
    apt-get update \
    && apt-get install -y --no-install-recommends \
    curl \
    && rm -rf /var/lib/apt/lists/* && \
    tar xzvf /tmp/functionbeat-${FUNCTIONBEAT_VERSION}-linux-x86_64.tar.gz && \
    mv -v functionbeat-${FUNCTIONBEAT_VERSION}-linux-x86_64 /opt/functionbeat

WORKDIR /opt/functionbeat
ENV PATH /opt/functionbeat:$PATH

ENTRYPOINT ["functionbeat"]

I got error "Missing pkg/functionbeat-aws" for above dockerfile, so i fix it for current version

@DanielWagner87
Copy link

DanielWagner87 commented Aug 27, 2020

I get the following error each time:

Function: functionbeat, could not deploy, error: bucket 'functionbeat-deployment' already exist and you don't have permission to access it.

I pass the AWS credentials into the container as environment variables. Locally (without Docker Image), the deployment works with my credentials.

This is my docker run command:

docker run -it --rm \
-v $(pwd)/config:/functionbeat/config:ro \
--env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
--env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
--env AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
--env AWS_SECURITY_TOKEN=$AWS_SECURITY_TOKEN \
--env AWS_REGION=eu-central-1 \
--env AWS_DEFAULT_REGION=eu-central-1 \
myorga/functionbeat:latest \
deploy functionbeat -c /functionbeat/config/functionbeat.yml -e -v -d "*"

I have no idea what I am doing wrong. I also have the problem with the above Dockerfile.

@andresrc andresrc added the Team:Services (Deprecated) Label for the former Integrations-Services team label Aug 29, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@andresrc andresrc removed the Team:Integrations Label for the Integrations team label Aug 29, 2020
@DanielWagner87
Copy link

Together with @mmathea-ep we could now solve the problem and build a running Docker Image. Apparently Python is required for the functionbeat executable to work.

This is our Dockerfile:

FROM python:3.7.9-slim-buster as functionbeat-download

ENV FUNCTIONBEAT_VERSION=7.8.1
ENV FUNCTIONBEAT_PACKAGE=functionbeat-${FUNCTIONBEAT_VERSION}-linux-x86_64

ADD https://artifacts.elastic.co/downloads/beats/functionbeat/${FUNCTIONBEAT_PACKAGE}.tar.gz /tmp
RUN mkdir -p /functionbeat && \
    tar -xvf /tmp/${FUNCTIONBEAT_PACKAGE}.tar.gz --strip 1 -C /functionbeat

FROM python:3.7.9-slim-buster

RUN addgroup functionbeat \
 && useradd -g functionbeat --no-create-home functionbeat

USER functionbeat

ENV PATH /bin/functionbeat:$PATH

ENTRYPOINT ["/bin/functionbeat"]
CMD ["help"]

WORKDIR /functionbeat
VOLUME ["/functionbeat/config"]

COPY --from=functionbeat-download /functionbeat/functionbeat /bin/functionbeat
COPY --from=functionbeat-download /functionbeat/pkg/functionbeat-aws /functionbeat/pkg/functionbeat-aws

You can run it via:

docker run -it --rm \
-v $(pwd)/config:/functionbeat/config:ro \
--env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
--env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
--env AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
--env AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION \
{{ DOCKER IMAGE }} \
deploy {{ FUNCTIONBEAT_NAME }} -c /functionbeat/config/functionbeat.yml -e -v -d "*"

Starting from your current directory the folder /config is mounted into the container. In this folder you should place the config file functionbeat.yml.

@kvch kvch removed their assignment Oct 7, 2021
@jlind23 jlind23 added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team and removed Team:Services (Deprecated) Label for the former Integrations-Services team labels Mar 31, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic
Copy link

botelastic bot commented Mar 31, 2023

Hi!
We just realized that we haven't looked into this issue in a while. We're sorry!

We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1.
Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Mar 31, 2023
@botelastic botelastic bot closed this as completed Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants