Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
docker-elk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段孔乐
docker-elk
Commits
b000267d
Unverified
Commit
b000267d
authored
Mar 04, 2020
by
Antoine Cotten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
travis: Move reusable functions to bash lib
parent
c680149e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
56 deletions
+61
-56
.travis.yml
.travis.yml
+3
-3
testing.sh
.travis/lib/testing.sh
+0
-51
run-tests-core.sh
.travis/run-tests-core.sh
+56
-0
README.md
README.md
+2
-2
No files found.
.travis.yml
View file @
b000267d
...
...
@@ -24,12 +24,12 @@ before_script:
-
sed -i 's/\(password =>\) "changeme"/\1 "testpasswd"/g' logstash/pipeline/logstash.conf
script
:
# Co
mpose
# Co
re Elastic Stack
-
docker-compose up -d elasticsearch
-
sleep 30
-
.travis/elasticsearch-setup-passwords.exp
-
docker-compose up -d
-
.travis/run-tests.sh
-
.travis/run-tests
-core
.sh
-
docker-compose ps
-
docker-compose logs elasticsearch
-
docker-compose logs kibana
...
...
@@ -45,7 +45,7 @@ script:
-
.travis/elasticsearch-setup-passwords.exp swarm
-
docker service scale elk_kibana=1 --detach=false
-
docker service scale elk_logstash=1 --detach=false
-
.travis/run-tests.sh swarm
-
.travis/run-tests
-core
.sh swarm
-
docker stack services elk
-
docker service logs elk_elasticsearch
-
docker service logs elk_kibana
...
...
.travis/
run-tests
.sh
→
.travis/
lib/testing
.sh
View file @
b000267d
#!/usr/bin/env bash
set
-eu
set
-o
pipefail
function
log
{
echo
-e
"
\n
[+]
$1
\n
"
}
...
...
@@ -51,51 +48,3 @@ function poll_ready {
return
$result
}
declare
MODE
=
""
if
[
"$#"
-ge
1
]
;
then
MODE
=
$1
fi
log
'Waiting for Elasticsearch readiness'
poll_ready elasticsearch
'http://localhost:9200/'
'elastic:testpasswd'
log
'Waiting for Kibana readiness'
poll_ready kibana
'http://localhost:5601/api/status'
'kibana:testpasswd'
log
'Waiting for Logstash readiness'
poll_ready logstash
'http://localhost:9600/_node/pipelines/main?pretty'
log
'Creating Logstash index pattern in Kibana'
source
.env
curl
-X
POST
-D-
'http://localhost:5601/api/saved_objects/index-pattern'
\
-s
-w
'\n'
\
-H
'Content-Type: application/json'
\
-H
"kbn-version:
${
ELK_VERSION
}
"
\
-u
elastic:testpasswd
\
-d
'{"attributes":{"title":"logstash-*","timeFieldName":"@timestamp"}}'
log
'Searching index pattern via Kibana API'
response
=
"
$(
curl
'http://localhost:5601/api/saved_objects/_find?type=index-pattern'
-s
-u
elastic:testpasswd
)
"
echo
"
$response
"
count
=
"
$(
jq
-rn
--argjson
data
"
${
response
}
"
'$data.total'
)
"
if
[[
$count
-ne
1
]]
;
then
echo
"Expected 1 index pattern, got
${
count
}
"
exit
1
fi
log
'Sending message to Logstash TCP input'
echo
'dockerelk'
| nc
-q0
localhost 5000
sleep
1
curl
-X
POST
'http://localhost:9200/_refresh'
-u
elastic:testpasswd
\
-s
-w
'\n'
log
'Searching message in Elasticsearch'
response
=
"
$(
curl
'http://localhost:9200/_count?q=message:dockerelk&pretty'
-s
-u
elastic:testpasswd
)
"
echo
"
$response
"
count
=
"
$(
jq
-rn
--argjson
data
"
${
response
}
"
'$data.count'
)
"
if
[[
$count
-ne
1
]]
;
then
echo
"Expected 1 document, got
${
count
}
"
exit
1
fi
.travis/run-tests-core.sh
0 → 100755
View file @
b000267d
#!/usr/bin/env bash
set
-eu
set
-o
pipefail
source
"
$(
dirname
${
BASH_SOURCE
[0]
})
/lib/testing.sh"
declare
MODE
=
""
if
[
"$#"
-ge
1
]
;
then
MODE
=
$1
fi
log
'Waiting for readiness of Elasticsearch'
poll_ready elasticsearch
'http://localhost:9200/'
'elastic:testpasswd'
log
'Waiting for readiness of Kibana'
poll_ready kibana
'http://localhost:5601/api/status'
'kibana:testpasswd'
log
'Waiting for readiness of Logstash'
poll_ready logstash
'http://localhost:9600/_node/pipelines/main?pretty'
log
'Creating Logstash index pattern in Kibana'
source
.env
curl
-X
POST
-D-
'http://localhost:5601/api/saved_objects/index-pattern'
\
-s
-w
'\n'
\
-H
'Content-Type: application/json'
\
-H
"kbn-version:
${
ELK_VERSION
}
"
\
-u
elastic:testpasswd
\
-d
'{"attributes":{"title":"logstash-*","timeFieldName":"@timestamp"}}'
log
'Searching index pattern via Kibana API'
response
=
"
$(
curl
'http://localhost:5601/api/saved_objects/_find?type=index-pattern'
-s
-u
elastic:testpasswd
)
"
echo
"
$response
"
count
=
"
$(
jq
-rn
--argjson
data
"
${
response
}
"
'$data.total'
)
"
if
[[
$count
-ne
1
]]
;
then
echo
"Expected 1 index pattern, got
${
count
}
"
exit
1
fi
log
'Sending message to Logstash TCP input'
echo
'dockerelk'
| nc
-q0
localhost 5000
sleep
1
curl
-X
POST
'http://localhost:9200/_refresh'
-u
elastic:testpasswd
\
-s
-w
'\n'
log
'Searching message in Elasticsearch'
response
=
"
$(
curl
'http://localhost:9200/_count?q=message:dockerelk&pretty'
-s
-u
elastic:testpasswd
)
"
echo
"
$response
"
count
=
"
$(
jq
-rn
--argjson
data
"
${
response
}
"
'$data.count'
)
"
if
[[
$count
-ne
1
]]
;
then
echo
"Expected 1 document, got
${
count
}
"
exit
1
fi
README.md
View file @
b000267d
...
...
@@ -59,8 +59,8 @@ Other available stack variants:
### Host setup
*
[
Docker Engine
](
https://docs.docker.com/install/
)
version
**17.05
+
**
or newer
*
[
Docker Compose
](
https://docs.docker.com/compose/install/
)
version
**1.20.0
+
**
or newer
*
[
Docker Engine
](
https://docs.docker.com/install/
)
version
**17.05**
or newer
*
[
Docker Compose
](
https://docs.docker.com/compose/install/
)
version
**1.20.0**
or newer
*
1.5 GB of RAM
> :information_source: Especially on Linux, make sure your user has the [required permissions][linux-postinstall] to
...
...
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