-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to define custom scripts in independent Elastic Agents (#1822)
Allow to define custom scripts in independent Elastic Agents. This allows developers to customize Elastic Agent bootstrap for instance installing new dependencies or libraries.
- Loading branch information
Showing
44 changed files
with
8,600 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
# Pre-start commands | ||
# Currently, these commands must be a "sh" script | ||
{{ fact "pre_start_script_contents" }} | ||
|
||
# Required to add "-s" since tini is not running as PID 1 | ||
/usr/bin/tini -s -- /usr/local/bin/docker-entrypoint $@ |
41 changes: 25 additions & 16 deletions
41
internal/agentdeployer/_static/docker-agent-base.yml.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ARG ES_AGENT_IMAGE | ||
FROM $ES_AGENT_IMAGE | ||
|
||
{{- $pre_start_script_contents := fact "pre_start_script_contents" }} | ||
{{- $provisioning_script_filename := fact "provisioning_script_filename" }} | ||
{{- $provisioning_script_language := fact "provisioning_script_language" }} | ||
{{- $provisioning_script_contents := fact "provisioning_script_contents" }} | ||
{{- $entrypoint_script_filename := fact "entrypoint_script_filename" }} | ||
{{- $agent_name := fact "agent_name" }} | ||
|
||
{{- $entrypoint_path := (print "/usr/local/bin/" $agent_name "-entrypoint.sh") }} | ||
|
||
USER root | ||
|
||
{{ if ne $provisioning_script_contents "" }} | ||
COPY {{ $provisioning_script_filename }} . | ||
RUN chmod u+x {{ $provisioning_script_filename }} && \ | ||
{{ $provisioning_script_language }} ./{{ $provisioning_script_filename }} && \ | ||
rm {{ $provisioning_script_filename }} | ||
{{ end }} | ||
|
||
{{ if ne $pre_start_script_contents "" }} | ||
COPY {{ $entrypoint_script_filename }} {{ $entrypoint_path }} | ||
RUN chmod a+x {{ $entrypoint_path }} | ||
{{ end }} | ||
|
||
USER elastic-agent | ||
|
||
{{ if ne $pre_start_script_contents "" }} | ||
ENTRYPOINT ["{{ $entrypoint_path }}"] | ||
CMD [""] | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.