UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Ironbank Containers
E
Elastic
Beats
elastic-agent
Commits
2267cda5
Commit
2267cda5
authored
Nov 19, 2020
by
kuisathaverat
Browse files
Update Elastic Agent for 7.10.0
parent
cb47f9eb
Pipeline
#80198
passed with stages
in 12 minutes and 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
11 deletions
+27
-11
Dockerfile
Dockerfile
+4
-3
scripts/docker-entrypoint
scripts/docker-entrypoint
+23
-8
No files found.
Dockerfile
View file @
2267cda5
...
@@ -74,7 +74,8 @@ RUN groupadd --gid 1000 ${ELASTIC_PRODUCT} && useradd --uid 1000 --gid 1000 --gr
...
@@ -74,7 +74,8 @@ RUN groupadd --gid 1000 ${ELASTIC_PRODUCT} && useradd --uid 1000 --gid 1000 --gr
# Elastic Agent permissions
# Elastic Agent permissions
RUN
find /usr/share//elastic-agent/data
-type
d
-exec
chmod
0770
{}
\;
&&
\
RUN
find /usr/share//elastic-agent/data
-type
d
-exec
chmod
0770
{}
\;
&&
\
find /usr/share//elastic-agent/data
-type
f
-exec
chmod
0660
{}
\;
find /usr/share//elastic-agent/data
-type
f
-exec
chmod
0660
{}
\;
&&
\
chmod
+x /usr/share//elastic-agent/data/elastic-agent-
*
/elastic-agent
COPY
jq /usr/local/bin
COPY
jq /usr/local/bin
RUN
chown
root:root /usr/local/bin/jq
&&
chmod
0755 /usr/local/bin/jq
RUN
chown
root:root /usr/local/bin/jq
&&
chmod
0755 /usr/local/bin/jq
...
@@ -93,8 +94,8 @@ LABEL org.label-schema.schema-version="1.0" \
...
@@ -93,8 +94,8 @@ LABEL org.label-schema.schema-version="1.0" \
org.label-schema.vcs-url="https://github.com/elastic/${ELASTIC_PRODUCT}" \
org.label-schema.vcs-url="https://github.com/elastic/${ELASTIC_PRODUCT}" \
org.label-schema.license="Elastic License" license="Elastic License"
org.label-schema.license="Elastic License" license="Elastic License"
ENTRYPOINT
["/usr/local/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint"
, "-E", "http.enabled=true", "-E", "http.host=unix:///usr/share/elastic-agent/data/elastic-agent.sock"
]
ENTRYPOINT
["/usr/local/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint"]
CMD
["--environment", "container"]
CMD
["--environment", "container"]
# see https://www.elastic.co/guide/en/beats/elastic-agent/current/http-endpoint.html
# see https://www.elastic.co/guide/en/beats/elastic-agent/current/http-endpoint.html
HEALTHCHECK
--interval=10s --timeout=5s --start-period=1m --retries=5 CMD
curl -I -f --max-time 5 --unix-socket '/usr/share/elastic-agent/data/elastic-agent.sock' 'http:/stats/?pretty
'
HEALTHCHECK
--interval=10s --timeout=5s --start-period=1m --retries=5 CMD
test -w '/tmp/elastic-agent/default/metricbeat/metricbeat.sock
'
scripts/docker-entrypoint
View file @
2267cda5
...
@@ -12,12 +12,23 @@ set -eo pipefail
...
@@ -12,12 +12,23 @@ set -eo pipefail
# KIBANA_PASSWORD - password for accessing kibana API [changeme]
# KIBANA_PASSWORD - password for accessing kibana API [changeme]
# KIBANA_USERNAME - username for accessing kibana API [elastic]
# KIBANA_USERNAME - username for accessing kibana API [elastic]
function
log
(){
local
msg
=
$1
if
[
"
${
DEBUG
}
"
==
"1"
]
;
then
echo
$msg
fi
}
function
setup
(){
function
setup
(){
curl
-X
POST
${
KIBANA_HOST
:-
http
://localhost:5601
}
/api/fleet/setup
-H
'kbn-xsrf: true'
-u
${
KIBANA_USERNAME
:-
elastic
}
:
${
KIBANA_PASSWORD
:-
changeme
}
echo
"Fleet setup"
curl
-X
POST
${
KIBANA_HOST
:-
http
://localhost:5601
}
/api/fleet/agents/setup
\
curl
-X
POST
-sS
${
KIBANA_HOST
:-
http
://localhost:5601
}
/api/fleet/setup
-H
'kbn-xsrf: true'
-u
${
KIBANA_USERNAME
:-
elastic
}
:
${
KIBANA_PASSWORD
:-
changeme
}
echo
""
echo
"Agent setup"
curl
-X
POST
-sS
${
KIBANA_HOST
:-
http
://localhost:5601
}
/api/fleet/agents/setup
\
-H
'Content-Type: application/json'
\
-H
'Content-Type: application/json'
\
-H
'kbn-xsrf: true'
\
-H
'kbn-xsrf: true'
\
-u
${
KIBANA_USERNAME
:-
elastic
}
:
${
KIBANA_PASSWORD
:-
changeme
}
-u
${
KIBANA_USERNAME
:-
elastic
}
:
${
KIBANA_PASSWORD
:-
changeme
}
echo
""
}
}
function
enroll
(){
function
enroll
(){
...
@@ -27,23 +38,27 @@ function enroll(){
...
@@ -27,23 +38,27 @@ function enroll(){
if
[[
-n
"
${
FLEET_ENROLLMENT_TOKEN
}
"
]]
;
then
if
[[
-n
"
${
FLEET_ENROLLMENT_TOKEN
}
"
]]
;
then
apikey
=
"
${
FLEET_ENROLLMENT_TOKEN
}
"
apikey
=
"
${
FLEET_ENROLLMENT_TOKEN
}
"
else
else
enrollResp
=
$(
curl
${
KIBANA_HOST
:-
http
://localhost:5601
}
/api/fleet/enrollment-api-keys
\
echo
"Enroll Agent API key"
enrollResp
=
$(
curl
-sS
${
KIBANA_HOST
:-
http
://localhost:5601
}
/api/fleet/enrollment-api-keys
\
-H
'Content-Type: application/json'
\
-H
'Content-Type: application/json'
\
-H
'kbn-xsrf: true'
\
-H
'kbn-xsrf: true'
\
-u
${
KIBANA_USERNAME
:-
elastic
}
:
${
KIBANA_PASSWORD
:-
changeme
}
)
-u
${
KIBANA_USERNAME
:-
elastic
}
:
${
KIBANA_PASSWORD
:-
changeme
}
)
echo
""
local
exitCode
=
$?
local
exitCode
=
$?
if
[
$exitCode
-ne
0
]
;
then
if
[
$exitCode
-ne
0
]
;
then
exit
$exitCode
exit
$exitCode
fi
fi
echo
$enrollResp
log
$enrollResp
local
apikeyId
=
$(
echo
$enrollResp
| jq
-r
'.list[0].id'
)
local
apikeyId
=
$(
echo
$enrollResp
| jq
-r
'.list[0].id'
)
echo
$apikeyId
log
$apikeyId
enrollResp
=
$(
curl
${
KIBANA_HOST
:-
http
://localhost:5601
}
/api/fleet/enrollment-api-keys/
$apikeyId
\
echo
"Enroll Agent"
enrollResp
=
$(
curl
-sS
${
KIBANA_HOST
:-
http
://localhost:5601
}
/api/fleet/enrollment-api-keys/
$apikeyId
\
-H
'Content-Type: application/json'
\
-H
'Content-Type: application/json'
\
-H
'kbn-xsrf: true'
\
-H
'kbn-xsrf: true'
\
-u
${
KIBANA_USERNAME
:-
elastic
}
:
${
KIBANA_PASSWORD
:-
changeme
}
)
-u
${
KIBANA_USERNAME
:-
elastic
}
:
${
KIBANA_PASSWORD
:-
changeme
}
)
echo
""
exitCode
=
$?
exitCode
=
$?
if
[
$exitCode
-ne
0
]
;
then
if
[
$exitCode
-ne
0
]
;
then
...
@@ -52,13 +67,13 @@ function enroll(){
...
@@ -52,13 +67,13 @@ function enroll(){
apikey
=
$(
echo
$enrollResp
| jq
-r
'.item.api_key'
)
apikey
=
$(
echo
$enrollResp
| jq
-r
'.item.api_key'
)
fi
fi
echo
$apikey
log
$apikey
if
[[
-n
"
${
FLEET_ENROLL_INSECURE
}
"
]]
&&
[[
${
FLEET_ENROLL_INSECURE
}
==
1
]]
;
then
if
[[
-n
"
${
FLEET_ENROLL_INSECURE
}
"
]]
&&
[[
${
FLEET_ENROLL_INSECURE
}
==
1
]]
;
then
insecure_flag
=
"--insecure"
insecure_flag
=
"--insecure"
fi
fi
./
elastic-agent enroll
${
insecure_flag
}
${
KIBANA_HOST
:-
http
://localhost:5601
}
$apikey
-f
elastic-agent enroll
${
insecure_flag
}
${
KIBANA_HOST
:-
http
://localhost:5601
}
$apikey
-f
}
}
if
[[
-n
"
${
FLEET_SETUP
}
"
]]
&&
[[
${
FLEET_SETUP
}
==
1
]]
;
then
setup
;
fi
if
[[
-n
"
${
FLEET_SETUP
}
"
]]
&&
[[
${
FLEET_SETUP
}
==
1
]]
;
then
setup
;
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment