services:
elasticsearch:
logstash:
kibana:
nginx:
docker-compose run ngnix
docker-compose run kibana
services:
elasticsearch:
logstash:
kibana:
nginx:
async () => {
console.log('a');
await sleep(1000);
console.log('b');
}
var supertest = require('supertest');
describe('GET http://go-ethe:8545/', function () {
let request = supertest('http://go-ethe:8545')
it('respond with json 1', function (done) {
request.post('/')
.send({"jsonrpc":"2.0","method":"miner_start","params":[1],"id":1})
.expect('Content-Type', /json/)
.expect(200, done);
});
let gethcmd = {"jsonrpc":"2.0","method":"eth_mining","params":[],"id":1}
it('respond with json mining actively start ', function (done) {
request.post('/')
.send(gethcmd)
.expect('Content-Type', /json/)
.expect(200)
.expect((res)=>{if (!(true == res.body.result) ) throw new Error("mining actively start failed!"); })
.end(done);
});
it('respond with json 2', function (done) {
request.post('/')
.send({"jsonrpc":"2.0","method":"miner_stop","params":[],"id":1})
.expect('Content-Type', /json/)
.expect(200, done);
});
let gethcmd2 = {"jsonrpc":"2.0","method":"eth_mining","params":[],"id":1}
it('respond with json mining actively stop ', function (done) {
request.post('/')
.send(gethcmd2)
.expect('Content-Type', /json/)
.expect(200)
.expect((res)=>{if (!(false == res.body.result) ) throw new Error("mining actively stop failed!"); })
.end(done);
});
});
request.
.get('/')
.expect({message: "Hello, World!"}, done);
Kibanaconfig:
image: alpine
volumes:
- ./kibana/config/:/usr/share/kibana/config:ro
command:
- /bin/sh
- -c
- |
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
apk --no-cache upgrade
apk --no-cache add curl
id="c0c02200-e6e0-11e8-b183-ebb59b02f871"
echo "=====Kibana default index-pattern ========"
echo "=====Wait Kibana======="
until echo | nc -z -v kibana 5601; do
echo "Waiting for Kibana to start..."
sleep 1
done
echo "=====kibana import json======"
code=""
until [ $$code != 400 ]; do
echo "=====kibana importing json ======="
curl -v -XPOST kibana:5601/api/kibana/dashboards/import?force=true -H "kbn-xsrf:true" -H "Content-type:application/json" -d @/usr/share/kibana/config/export.json 2>/dev/null | head -n 1 | cut -d ':' -f2|cut -d ',' -f1 > code.txt
code=`cat code.txt`
echo "=====status code:$$code====="
sleep 3
done
echo "=====kibana setting default index-pattern====="
code=""
until [ $$code != 400 ]; do
echo "=====kibana setting ==================================="
curl -v -XPOST kibana:5601/api/kibana/settings/defaultIndex -H "kbn-xsrf:true" -H "Content-Type: application/json" -d '{"value": "$$id"}' 2>/dev/null | head -n 1 | cut -d ':' -f2|cut -d ',' -f1 > code.txt
code=`cat code.txt`
echo "=====status code:$$code====="
sleep 3
done
networks:
- elk
depends_on:
- elasticsearch
elasticsearch:
build:
context: elasticsearch/
volumes:
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
ports:
- "9200:9200"
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
- elk
logstash:
build:
context: logstash/
volumes:
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
- ./logstash/pipeline:/usr/share/logstash/pipeline:ro
ports:
- "5000:5000"
environment:
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
- elk
depends_on:
- elasticsearch
kibana:
build:
context: kibana/
volumes:
- ./kibana/config/:/usr/share/kibana/config:ro
ports:
- "5601:5601"
networks:
- elk
depends_on:
- elasticsearch