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

[Heartbeat][Agent] Synthetics deps and Elastic Agent #22932

Closed
andrewvc opened this issue Dec 4, 2020 · 25 comments · Fixed by #27052
Closed

[Heartbeat][Agent] Synthetics deps and Elastic Agent #22932

andrewvc opened this issue Dec 4, 2020 · 25 comments · Fixed by #27052
Assignees
Labels
Agent Heartbeat Team:obs-ds-hosted-services Label for the Observability Hosted Services team test-plan-ok This PR passed manual testing v7.15.0

Comments

@andrewvc
Copy link
Contributor

andrewvc commented Dec 4, 2020

This picks up part of the discussion from #22837 where we agreed to include an extra gigabyte of deps for synthetics in the main heartbeat image. The remaining question is what to do about agent? There are essentially two paths forward:

  1. Make the agent docker image include the extra ~1GiB of deps for synthetics (RPM deps, node, and chromium)
  2. Make a separate agent docker image that is larger for use in situations where synthetics is needed.

I propose that we make a new 'centralized' agent docker distribution with the extra deps. It won't be intended for use as a side car, and will only be put in place on the few machines where running agent is the main purpose, rather than say, every server or k8s pod etc.

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Dec 4, 2020
@ruflin
Copy link
Member

ruflin commented Dec 7, 2020

As the Elastic Agent has also the option to download the dependencies if needed, it would be good to know how long it would take to download this additional dependency?

@mostlyjason
Copy link

Thanks I assume this isn't just concerning docker and also concerns adding synthetics to the agent installer?

If we add 1GB to the main agent image, that would eat a lot of bandwidth & storage across 1000s of hosts. So option 2 sounds better for the majority of users.

More generally, we talked about having a minimal docker image for hosts that are internet connected so they can download dependencies on demand, and a full docker image for offline hosts. @ph do you remember where this conversation ended up? I can't seem the find the issue.

@jsoriano jsoriano added Team:Ingest Management Team:obs-ds-hosted-services Label for the Observability Hosted Services team labels Dec 8, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/uptime (Team:Uptime)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 8, 2020
@ph
Copy link
Contributor

ph commented Dec 8, 2020

@mostlyjason I can't find that issue, we mentioned it in the heartbeat issue some time ago but this use case is different, and I am not sure it fit well with docker.


I might ask question that have been already decided, but I don't have enough details about the architecture

Now, I think there is multiple question to asks, as @mostlyjason pointed out what is the usecase when there is no docker involved for synthetics. Is Docker a hard requirement on that new feature? Do people that run heartbeat from the tar.gz will be able to use that new behavior?

How the execution look like, is heartbeat starting a new container from hearbeat how this work inside the docker images?

Maybe @ruflin or @andrewvc could

@andrewvc
Copy link
Contributor Author

@ph docker is not a hard requirement, but it is one initially, mostly because we don't want to support multiple platforms. There's a lot that can go wrong with all the GUI deps, node deps, etc., and it makes more sense to focus on features right now.

I expect that will change in the future. However, it sort of ruins the whole "click to add an integration, it just works" aspect, since you can't just do that. You need a box with all the stuff. So, for agent, maybe it should be docker only.

That said, I think we practically need to go with the second approach, of two docker images. A regular fleet version and a jumbo version. That also hurts the vision of a single agent, but it's the better compromise IMHO.

@andrewvc
Copy link
Contributor Author

It looks like heartbeat with synthetics is actually only ~500MiB. Given that the size isn't so bad, is there any objection to simply merging synthetics into the agent docker image?

@ruflin
Copy link
Member

ruflin commented Apr 23, 2021

Our current image is ~569MB. So adding synthetics would double it. My biggest concern is that if Elastic Agent is deployed across many machines, this will consume now double the bandwidth, 500 is already quite a bit.

@andrewvc
Copy link
Contributor Author

@ruflin we're at the point where we need a firm decision relatively soon. The two options I see are either include it in the mainline image or make an alternate agent-synthetics image. Which way should we go?

@ruflin
Copy link
Member

ruflin commented Apr 23, 2021

It is a tricky decision here. If we include it and later realise the size is too large, we can't remove it anymore as it is a breaking change. If we go the separate container, my understanding is that a user could not just add synthetics but would need a separate container for it. @alvarolobato @tbragin Would be nice if you could chime in here.

@ph
Copy link
Contributor

ph commented Apr 23, 2021

@ruflin @andrewvc That size increase would only affect our container's release or all of our artifacts?

@andrewvc
Copy link
Contributor Author

Just the container, and it wouldn't increase by 500 Mib, probably only a few hundred if I had to guess. Metricbeat's docker image is 190MiB today by comparison, so we could call that the base size.

@mostlyjason
Copy link

mostlyjason commented Apr 27, 2021

It helps that its just the container. Containers are usually run on servers, not as often on endpoints. Usually there are a smaller number of servers and 500MB of disk isn't a concern. In that case increasing the size shouldn't be as much of an issue. We could always release a minimal image later.

Also, does that mean users cannot run synthetics on a regular agent install? If so, we should consider adding that to the blocklist to prevent users from adding it.

@andrewvc
Copy link
Contributor Author

andrewvc commented Apr 27, 2021 via email

@andrewvc
Copy link
Contributor Author

andrewvc commented May 3, 2021

@ruflin @ph @mostlyjason do we have enough info to come to a decision here? I vote we bundle with docker agent.

@mostlyjason
Copy link

+1 to bundle it then. You can add it to the blocklist here #21000

@ph
Copy link
Contributor

ph commented May 10, 2021

+1 to bundle it for docker-agent.

@paulb-elastic
Copy link
Contributor

@mostlyjason / @ph, irrespective of this being bundled or not, what is the behaviour from a Fleet perspective, if the non-Docker version of the Elastic Agent is used (reason for asking is I wonder if this is a similar flow to if we didn’t bundle Synthetics with the image)?

For example, if I install the binary version of the Elastic Agent (non-Docker), and associate this to an Agent Policy which has a Synthetic Integration policy, what happens in that case? Is there some kind of you are running the wrong version of the Agent error?

@ruflin
Copy link
Member

ruflin commented May 11, 2021

@paulb-elastic Not much happens today except that you will get an error from the Elastic Agent when rolling out the policy. We should fix this by bringing knowledge about the capabilities of an Elastic Agent to Fleet. There are other features which require this too.

@paulb-elastic
Copy link
Contributor

This has been discussed and although simpler for onboarding, we can’t ignore the additional space overhead of bundling Synthetics+dependencies with the Docker build of Elastic Agent.

As such, to proceed with this, we will be opting for a separate Docker build of the Elastic Agent+Synthetics+Dependencies and clarify in the documentation and readme that this must be used to try Real Browser Synthetic Integrations.

@mostlyjason
Copy link

@paul-tavares I jsut want to answer your question:

what is the behaviour from a Fleet perspective, if the non-Docker version of the Elastic Agent is used (reason for asking is I wonder if this is a similar flow to if we didn’t bundle Synthetics with the image)?

If you add synthetics to the blocklist that gets bundled by default in distributions of the agent without synthetics, then the user will see the agent show up as unhealthy on the agents page and they will be able to see an error that synthetics is blocked. Without adding it to the blocklist, the agent will show as healthy when it is not.

@andrewvc
Copy link
Contributor Author

andrewvc commented May 24, 2021

Thanks @mostlyjason we've opened an issue around that here #25775

andrewvc added a commit to andrewvc/beats that referenced this issue May 24, 2021
We do not yet have a synthetics fleet image available, so, for now,
users should not be allowed to create synthetics inputs in fleet.

See elastic#22932 (comment)
@andrewvc andrewvc reopened this Aug 9, 2021
@andrewvc
Copy link
Contributor Author

andrewvc commented Aug 9, 2021

Reopening because we now have an implementation in #27052

andrewvc added a commit that referenced this issue Aug 11, 2021
#27052)

Creates a new offline tagged docker image that includes the dependencies required for synthetics. Building elastic-agent docker images will now create additional -offline tagged images with these extras. We may need to do additional work to ensure that these additional images are incorporated into the release process and onto the public website.

These changes also set the ELASTIC_SYNTHETICS_CAPABLE env flag, as done in heartbeat, to enable synthetics features in the docker environment. This dovetails with the work @dominiqueclarke is doing in elastic/integrations#1064 and elsewhere

Fixes #22932
mergify bot pushed a commit that referenced this issue Aug 11, 2021
#27052)

Creates a new offline tagged docker image that includes the dependencies required for synthetics. Building elastic-agent docker images will now create additional -offline tagged images with these extras. We may need to do additional work to ensure that these additional images are incorporated into the release process and onto the public website.

These changes also set the ELASTIC_SYNTHETICS_CAPABLE env flag, as done in heartbeat, to enable synthetics features in the docker environment. This dovetails with the work @dominiqueclarke is doing in elastic/integrations#1064 and elsewhere

Fixes #22932

(cherry picked from commit 4727470)
andrewvc added a commit that referenced this issue Aug 16, 2021
#27052) (#27324)

Creates a new offline tagged docker image that includes the dependencies required for synthetics. Building elastic-agent docker images will now create additional -offline tagged images with these extras. We may need to do additional work to ensure that these additional images are incorporated into the release process and onto the public website.

These changes also set the ELASTIC_SYNTHETICS_CAPABLE env flag, as done in heartbeat, to enable synthetics features in the docker environment. This dovetails with the work @dominiqueclarke is doing in elastic/integrations#1064 and elsewhere

Fixes #22932

(cherry picked from commit 4727470)

Co-authored-by: Andrew Cholakian <andrew@andrewvc.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
mergify bot pushed a commit that referenced this issue Aug 18, 2021
#27052)

Creates a new offline tagged docker image that includes the dependencies required for synthetics. Building elastic-agent docker images will now create additional -offline tagged images with these extras. We may need to do additional work to ensure that these additional images are incorporated into the release process and onto the public website.

These changes also set the ELASTIC_SYNTHETICS_CAPABLE env flag, as done in heartbeat, to enable synthetics features in the docker environment. This dovetails with the work @dominiqueclarke is doing in elastic/integrations#1064 and elsewhere

Fixes #22932

(cherry picked from commit 4727470)

# Conflicts:
#	dev-tools/mage/dockerbuilder.go
mergify bot added a commit that referenced this issue Aug 18, 2021
#27052) (#27324)

Creates a new offline tagged docker image that includes the dependencies required for synthetics. Building elastic-agent docker images will now create additional -offline tagged images with these extras. We may need to do additional work to ensure that these additional images are incorporated into the release process and onto the public website.

These changes also set the ELASTIC_SYNTHETICS_CAPABLE env flag, as done in heartbeat, to enable synthetics features in the docker environment. This dovetails with the work @dominiqueclarke is doing in elastic/integrations#1064 and elsewhere

Fixes #22932

(cherry picked from commit 4727470)

Co-authored-by: Andrew Cholakian <andrew@andrewvc.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit f9b2610)

# Conflicts:
#	dev-tools/mage/dockerbuilder.go
@vigneshshanmugam vigneshshanmugam added test-plan Add this PR to be manual test plan v7.15.0 labels Aug 18, 2021
@dominiqueclarke dominiqueclarke self-assigned this Aug 31, 2021
@dominiqueclarke dominiqueclarke added the test-plan-ok This PR passed manual testing label Aug 31, 2021
@dominiqueclarke
Copy link

Tested with beats/elastic-agent-complete:7.15.0-caca3588-SNAPSHOT: https://container-library.elastic.co/r/beats/elastic-agent-complete:7.15.0-caca3588-SNAPSHOT

Working as expected for both inline and zip url tests.
Screen Shot 2021-08-31 at 10 33 56 AM

@dominiqueclarke dominiqueclarke removed the test-plan Add this PR to be manual test plan label Aug 31, 2021
@paulb-elastic paulb-elastic reopened this Sep 3, 2021
@paulb-elastic
Copy link
Contributor

Re closing as opened by Zube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agent Heartbeat Team:obs-ds-hosted-services Label for the Observability Hosted Services team test-plan-ok This PR passed manual testing v7.15.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants