54 lines
2.0 KiB
YAML
54 lines
2.0 KiB
YAML
language: minimal
|
|
services: docker
|
|
|
|
env:
|
|
- DOCKER_COMPOSE_VERSION=1.14.0
|
|
|
|
install:
|
|
# Install Docker Compose
|
|
- curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o "$HOME/bin/docker-compose"
|
|
- chmod +x "$HOME/bin/docker-compose"
|
|
- docker-compose --version
|
|
|
|
before_script:
|
|
# Build images
|
|
- docker-compose build
|
|
|
|
# Pull buildpack image (curl 7.52.0+)
|
|
- docker pull buildpack-deps:artful-curl
|
|
- shopt -s expand_aliases
|
|
- alias curl='docker run --rm --net=host buildpack-deps:artful-curl curl'
|
|
|
|
script:
|
|
# Compose
|
|
- docker-compose up -d
|
|
- sleep 60
|
|
- curl -s --retry 10 --retry-delay 5 --retry-connrefused -D- 'http://localhost:9200/'
|
|
- curl -s --retry 10 --retry-delay 5 --retry-connrefused -D- 'http://localhost:5601/api/status'
|
|
- curl -s --retry 10 --retry-delay 5 --retry-connrefused -D- 'http://localhost:9600/_node/pipelines/main?pretty'
|
|
- echo 'dockerelk' | nc localhost 5000
|
|
- sleep 2
|
|
- curl -s -XPOST 'http://localhost:9200/_refresh'
|
|
- curl -s 'http://localhost:9200/_count?q=message:dockerelk' | egrep '^{"count":1,'
|
|
- curl -s 'http://localhost:9200/_search?q=message:dockerelk&pretty'
|
|
- docker-compose ps
|
|
- docker-compose logs
|
|
- docker-compose down -v
|
|
|
|
# Swarm
|
|
- docker swarm init
|
|
- docker stack deploy -c ./docker-stack.yml elk
|
|
- sleep 60
|
|
- curl -s --retry 10 --retry-delay 5 --retry-connrefused -D- 'http://localhost:9200/'
|
|
- curl -s --retry 10 --retry-delay 5 --retry-connrefused -D- 'http://localhost:5601/api/status'
|
|
- curl -s --retry 10 --retry-delay 5 --retry-connrefused -D- 'http://localhost:9600/_node/pipelines/main?pretty'
|
|
- echo 'dockerelk' | nc localhost 5000
|
|
- sleep 2
|
|
- curl -s -XPOST 'http://localhost:9200/_refresh'
|
|
- curl -s 'http://localhost:9200/_count?q=message:dockerelk' | egrep '^{"count":1,'
|
|
- curl -s 'http://localhost:9200/_search?q=message:dockerelk&pretty'
|
|
- docker stack services elk
|
|
- docker service logs elk_elasticsearch
|
|
- docker service logs elk_kibana
|
|
- docker service logs elk_logstash
|