Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script for deploying elk via docker compose (#8459)
- Loading branch information
ading007
committed
Feb 13, 2019
1 parent
4d2ac6d
commit 719983a
Showing
5 changed files
with
429 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
version: '2' | ||
services: | ||
vic-elasticsearch-1: | ||
image: elasticsearch:6.4.2 | ||
container_name: elastic1 | ||
command: | | ||
sh -c 'sysctl -w vm.max_map_count=262144 && /usr/local/bin/docker-entrypoint.sh eswrapper' | ||
environment: | ||
- cluster.name=vic-cluster | ||
- node.name=vic-elasticsearch-1 | ||
- discovery.type=zen | ||
- "discovery.zen.ping.unicast.hosts=vic-elasticsearch-2,vic-elasticsearch-3" | ||
- discovery.zen.minimum_master_nodes=2 | ||
- "ES_JAVA_OPTS=-Xms1g -Xmx1g" | ||
- ELASTIC_PASSWORD=changeme | ||
- ALLOW_INSECURE_DEFAULT_TLS_CERT="true" | ||
volumes: | ||
- esdata1:/usr/share/elasticsearch/data | ||
ports: | ||
- 9200:9200 | ||
- 9300:9300 | ||
networks: | ||
- es--net | ||
|
||
vic-elasticsearch-2: | ||
image: elasticsearch:6.4.2 | ||
container_name: elastic2 | ||
command: | | ||
sh -c 'sysctl -w vm.max_map_count=262144 && /usr/local/bin/docker-entrypoint.sh eswrapper' | ||
environment: | ||
- cluster.name=vic-cluster | ||
- node.name=vic-elasticsearch-2 | ||
- discovery.type=zen | ||
- "discovery.zen.ping.unicast.hosts=vic-elasticsearch-1,vic-elasticsearch-3" | ||
- discovery.zen.minimum_master_nodes=2 | ||
- "ES_JAVA_OPTS=-Xms1g -Xmx1g" | ||
- ELASTIC_PASSWORD=changeme | ||
- ALLOW_INSECURE_DEFAULT_TLS_CERT="true" | ||
volumes: | ||
- esdata2:/usr/share/elasticsearch/data | ||
ports: | ||
- 9201:9200 | ||
- 9301:9300 | ||
networks: | ||
- es--net | ||
|
||
vic-elasticsearch-3: | ||
image: elasticsearch:6.4.2 | ||
container_name: elastic3 | ||
command: | | ||
sh -c 'sysctl -w vm.max_map_count=262144 && /usr/local/bin/docker-entrypoint.sh eswrapper' | ||
environment: | ||
- cluster.name=vic-cluster | ||
- node.name=vic-elasticsearch-3 | ||
- discovery.type=zen | ||
- "discovery.zen.ping.unicast.hosts=vic-elasticsearch-1,vic-elasticsearch-2" | ||
- discovery.zen.minimum_master_nodes=2 | ||
- "ES_JAVA_OPTS=-Xms1g -Xmx1g" | ||
- ELASTIC_PASSWORD=changeme | ||
- ALLOW_INSECURE_DEFAULT_TLS_CERT="true" | ||
volumes: | ||
- esdata3:/usr/share/elasticsearch/data | ||
ports: | ||
- 9202:9200 | ||
- 9302:9300 | ||
networks: | ||
- es--net | ||
|
||
logstash-1: | ||
image: logstash:6.4.2 | ||
container_name: logstash1 | ||
ports: | ||
- 5000:5000 | ||
- 5044:5044 | ||
- 9600:9600 | ||
environment: | ||
- "LS_JAVA_OPTS=-Xms1g -Xmx1g" | ||
- "NODE_NAME=logstash-1" | ||
- XPACK_MONITORING_ELASTICSEARCH_URL=[ "vic-elasticsearch-1", "vic-elasticsearch-2","vic-elasticsearch-3"] | ||
# - "LOG_LEVEL=debug" | ||
# - "XPACK_MONITORING_ENABLED" | ||
# https://www.elastic.co/guide/en/logstash/current/logstash-settings-file.html | ||
# All environement variables can be found in the link above | ||
# Replace . with _ in the options and convert alphabets to all caps for environment variable name | ||
# These environment variables are written in all capitals, with underscores as word separators | ||
networks: | ||
- es--net | ||
depends_on: | ||
- vic-elasticsearch-1 | ||
- vic-elasticsearch-2 | ||
- vic-elasticsearch-3 | ||
|
||
logstash-2: | ||
image: logstash:6.4.2 | ||
container_name: logstash2 | ||
ports: | ||
- 5001:5000 | ||
- 5045:5044 | ||
- 9601:9600 | ||
environment: | ||
- "LS_JAVA_OPTS=-Xms1g -Xmx1g" | ||
- "NODE_NAME=logstash-2" | ||
- XPACK_MONITORING_ELASTICSEARCH_URL=[ "vic-elasticsearch-1", "vic-elasticsearch-2","vic-elasticsearch-3"] | ||
networks: | ||
- es--net | ||
depends_on: | ||
- vic-elasticsearch-1 | ||
- vic-elasticsearch-2 | ||
- vic-elasticsearch-3 | ||
|
||
kibana-1: | ||
image: kibana:6.4.2 | ||
container_name: kibana1 | ||
ports: | ||
- 5601:5601 | ||
environment: | ||
# Kibana doesn't support talking directly to multiple elasticsearch nodes now | ||
- ELASTICSEARCH_URL="http://vic-elasticsearch-1:9200" | ||
- XPACK_SECURITY_ENCRYPTIONKEY="something_at_least_32_characters" | ||
# https://www.elastic.co/guide/en/kibana/current/settings.html | ||
# All environment variable for Kibana can be found in the link above | ||
# These environment variables are written in all capitals, with underscores as word separators | ||
networks: | ||
- es--net | ||
depends_on: | ||
- vic-elasticsearch-1 | ||
- vic-elasticsearch-2 | ||
- vic-elasticsearch-3 | ||
- logstash-1 | ||
- logstash-2 | ||
|
||
kibana-2: | ||
image: kibana:6.4.2 | ||
container_name: kibana2 | ||
ports: | ||
- 5602:5601 | ||
environment: | ||
# Kibana doesn't support talking directly to multiple elasticsearch nodes now | ||
- ELASTICSEARCH_URL="http://vic-elasticsearch-2:9200" | ||
- XPACK_SECURITY_ENCRYPTIONKEY="something_at_least_32_characters" | ||
networks: | ||
- es--net | ||
depends_on: | ||
- vic-elasticsearch-1 | ||
- vic-elasticsearch-2 | ||
- vic-elasticsearch-3 | ||
- logstash-1 | ||
- logstash-2 | ||
|
||
volumes: | ||
esdata1: | ||
driver: vsphere | ||
driver_opts: | ||
capacity: 10GB | ||
esdata2: | ||
driver: vsphere | ||
driver_opts: | ||
capacity: 10GB | ||
esdata3: | ||
driver: vsphere | ||
driver_opts: | ||
capacity: 10GB | ||
|
||
networks: | ||
es--net: |
25 changes: 25 additions & 0 deletions
25
tests/manual-test-cases/Group5-Functional-Tests/5-30-Docker-Compose-ELK.md
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,25 @@ | ||
Test 5-30 - Docker Compose ELK | ||
======= | ||
|
||
# Purpose: | ||
To verify that VIC appliance can work when deploying the docker ELK services | ||
|
||
# References: | ||
[1 - Docker Compose Overview](https://docs.docker.com/compose/overview/) | ||
[2 - Docker compose ELK](https://blogs.vmware.com/cloudnative/2018/07/19/getting-started-with-elastic-stack-on-vsphere-integrated-containers/) | ||
|
||
# Environment: | ||
This test requires access to VMWare Nimbus cluster for dynamic ESXi and vCenter creation | ||
|
||
# Test Steps: | ||
1. Deploy a new vCenter with 2 ESXi hosts in a cluster | ||
2. Deploy VIC appliance to the vSphere server | ||
3. Issue the following command in the docker elk app folder: | ||
```cd demos/compose/elk-app; COMPOSE_HTTP_TIMEOUT=300 DOCKER_HOST=<VCH IP> docker-compose up``` | ||
|
||
# Expected Outcome: | ||
Docker compose should return with success and all containers in the compose yaml file are up and running. | ||
Docker inspect data should show networks, alias, and IP address for the container. | ||
|
||
# Possible Problems: | ||
None |
109 changes: 109 additions & 0 deletions
109
tests/manual-test-cases/Group5-Functional-Tests/5-30-Docker-Compose-ELK.robot
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,109 @@ | ||
# Copyright 2016-2019 VMware, Inc. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License | ||
|
||
*** Settings *** | ||
Documentation Test 5-30 - docker compose ELK | ||
Resource ../../resources/Util.robot | ||
Suite Setup Deploy Environment | ||
Suite Teardown Run Keyword And Ignore Error Nimbus Cleanup ${list} | ||
|
||
*** Variables *** | ||
${NIMBUS_LOCATION} sc | ||
${NIMBUS_LOCATION_FULL} NIMBUS_LOCATION=${NIMBUS_LOCATION} | ||
|
||
*** Keywords *** | ||
Deploy Environment | ||
[Timeout] 110 minutes | ||
Run Keyword And Ignore Error Nimbus Cleanup ${list} ${false} | ||
${name}= Evaluate 'vic-iscsi-' + str(random.randint(1000,9999)) modules=random | ||
${out}= Deploy Nimbus Testbed %{NIMBUS_USER} %{NIMBUS_PASSWORD} spec=vic-cluster-2esxi-iscsi.rb args= --plugin testng --noSupportBundles --vcvaBuild ${VC_VERSION} --esxBuild ${ESX_VERSION} --testbedName vic-cluster-iscsi --runName ${name} | ||
Set Suite Variable @{list} %{NIMBUS_PERSONAL_USER}-${name}.vc.0 %{NIMBUS_PERSONAL_USER}-${name}.esx.0 %{NIMBUS_PERSONAL_USER}-${name}.esx.1 %{NIMBUS_PERSONAL_USER}-${name}.iscsi.0 | ||
Should Contain ${out} "deployment_result"=>"PASS" | ||
|
||
${out}= Execute Command ${NIMBUS_LOCATION_FULL} USER=%{NIMBUS_PERSONAL_USER} nimbus-ctl ip %{NIMBUS_PERSONAL_USER}-${name}.vc.0 | grep %{NIMBUS_PERSONAL_USER}-${name}.vc.0 | ||
${vc-ip}= Fetch From Right ${out} ${SPACE} | ||
|
||
${out}= Execute Command ${NIMBUS_LOCATION_FULL} USER=%{NIMBUS_PERSONAL_USER} nimbus-ctl ip %{NIMBUS_PERSONAL_USER}-${name}.esx.0 | grep %{NIMBUS_PERSONAL_USER}-${name}.esx.0 | ||
${esx0-ip}= Fetch From Right ${out} ${SPACE} | ||
|
||
${out}= Execute Command ${NIMBUS_LOCATION_FULL} USER=%{NIMBUS_PERSONAL_USER} nimbus-ctl ip %{NIMBUS_PERSONAL_USER}-${name}.esx.1 | grep %{NIMBUS_PERSONAL_USER}-${name}.esx.1 | ||
${esx1-ip}= Fetch From Right ${out} ${SPACE} | ||
|
||
Set Environment Variable GOVC_URL ${esx0-ip} | ||
Set Environment Variable GOVC_USERNAME root | ||
Set Environment Variable GOVC_PASSWORD e2eFunctionalTest | ||
Run govc host.esxcli network firewall set -e false | ||
Set Environment Variable GOVC_URL ${esx1-ip} | ||
Run govc host.esxcli network firewall set -e false | ||
|
||
Log To Console Set environment variables up for GOVC | ||
Set Environment Variable GOVC_URL ${vc-ip} | ||
Set Environment Variable GOVC_USERNAME Administrator@vsphere.local | ||
Set Environment Variable GOVC_PASSWORD Admin\!23 | ||
|
||
Log To Console Deploy VIC to the VC cluster | ||
Set Environment Variable TEST_URL_ARRAY ${vc-ip} | ||
Set Environment Variable TEST_USERNAME Administrator@vsphere.local | ||
Set Environment Variable TEST_PASSWORD Admin\!23 | ||
Set Environment Variable BRIDGE_NETWORK bridge | ||
Set Environment Variable PUBLIC_NETWORK vm-network | ||
Remove Environment Variable TEST_DATACENTER | ||
Set Environment Variable TEST_DATASTORE sharedVmfs-0 | ||
Set Environment Variable TEST_RESOURCE cls | ||
Set Environment Variable TEST_TIMEOUT 30m | ||
|
||
Check Service State | ||
[Arguments] ${containerName} | ||
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f {{.State.Running}} ${containerName} | ||
Log ${out} | ||
Should Contain ${out} true | ||
Should Be Equal As Integers ${rc} 0 | ||
|
||
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{range $key, $value := .NetworkSettings.Networks}}{{$key}}{{end}}' ${containerName} | ||
Log ${out} | ||
Should Not Be Empty ${out} | ||
Should Be Equal As Integers ${rc} 0 | ||
|
||
*** Test Cases *** | ||
Compose ELK Test | ||
Install VIC Appliance To Test Server certs=${true} vol=default additional-args=--cpu-reservation 1 --cpu-shares normal --memory-reservation 1 --memory-shares normal --endpoint-cpu 1 --endpoint-memory 2048 --base-image-size 8GB --bridge-network-range 172.17.0.0/12 --container-network-firewall vm-network:published --certificate-key-size 2048 | ||
|
||
${rc} ${out}= Run And Return Rc And Output docker-compose %{COMPOSE-PARAMS} --skip-hostname-check -f ${CURDIR}/../../../demos/compose/elk-app/docker-compose-elk.yml up -d | ||
Log ${out} | ||
Should Be Equal As Integers ${rc} 0 | ||
|
||
Check Service State elastic1 | ||
Check Service State elastic2 | ||
Check Service State elastic3 | ||
Check Service State logstash1 | ||
Check Service State logstash2 | ||
Check Service State kibana1 | ||
Check Service State kibana2 | ||
|
||
|
||
Sleep 10m | ||
Check Service State elastic1 | ||
Check Service State elastic2 | ||
Check Service State elastic3 | ||
Check Service State logstash1 | ||
Check Service State logstash2 | ||
Check Service State kibana1 | ||
Check Service State kibana2 | ||
|
||
${rc} ${out}= Run And Return Rc And Output docker-compose %{COMPOSE-PARAMS} --skip-hostname-check -f ${CURDIR}/../../../demos/compose/elk-app/docker-compose-elk.yml down | ||
Log ${out} | ||
Should Be Equal As Integers ${rc} 0 | ||
|
||
Cleanup VIC Appliance On Test Server | ||
|
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.