Compare commits

..

1 Commits

Author SHA1 Message Date
3ec0498098 Init elastic 2018-11-30 17:18:29 +01:00
7 changed files with 96 additions and 79 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
tags tags
storage storage
influxdb/

View File

@ -1,18 +0,0 @@
log:
level: DEBUG
providers:
docker:
exposedByDefault: true
network: inbound
defaultRule: "Host(`{{ trimPrefix `/` .Name }}.docker.localhost`)"
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
api:
dashboard: true
debug: true
global:
sendAnonymousUsage: false
checkNewVersion: true

View File

@ -1,11 +1,9 @@
version: '3.8' version: '2'
services: services:
consul: consul:
image: consul image: consul
restart: always restart: always
container_name: consul container_name: consul_elena
command: consul agent -server -dev -client=0.0.0.0 -ui -bootstrap -log-level warn -datacenter dev command: consul agent -server -dev -client=0.0.0.0 -ui -bootstrap -log-level warn -datacenter dev
environment: environment:
SERVICE_8400_NAME: consul SERVICE_8400_NAME: consul
@ -18,28 +16,16 @@ services:
- "8400:8400" - "8400:8400"
- "8500:8500" - "8500:8500"
- "8600:8600/udp" - "8600:8600/udp"
expose:
- "8500"
networks:
- inbound
labels:
- "traefik.docker.network=inbound"
- "traefik.http.routers.consul.rule=Host(`consul.docker.localhost`)"
- "traefik.http.routers.consul.service=consul"
- "traefik.http.services.consul.loadbalancer.server.port=8500"
registrator: registrator:
restart: always restart: always
container_name: registrator container_name: registrator_elena
depends_on: depends_on:
- consul - consul
image: gliderlabs/registrator:master image: gliderlabs/registrator:master
command: -ttl=120 -ttl-refresh=10 -cleanup=true -resync=10 -internal consul://consul:8500 command: -internal consul://consul:8500
volumes: volumes:
- /var/run/docker.sock:/tmp/docker.sock - /var/run/docker.sock:/tmp/docker.sock
networks:
- inbound
links: links:
- consul - consul
environment: environment:
@ -47,54 +33,52 @@ services:
portainer: portainer:
restart: always restart: always
container_name: portainer container_name: portainer_elena
image: portainer/portainer-ce:latest image: portainer/portainer
command: -H unix:///var/run/docker.sock command: -H unix:///var/run/docker.sock
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- ./storage/portainer:/data - portainer_data:/data
networks:
- inbound
labels:
- "traefik.docker.network=inbound"
- "traefik.http.routers.portainer.rule=Host(`portainer.docker.localhost`)"
- "traefik.http.routers.portainer.service=portainer"
- "traefik.http.services.portainer.loadbalancer.server.port=9000"
traefik: fluentd:
image: traefik:latest build: ./fluentd
container_name: traefik
restart: always restart: always
networks: container_name: fluentd_elena
- traefik
- inbound
volumes: volumes:
- ./configs/traefik.yml:/etc/traefik/traefik.yml - ./fluentd/conf:/fluentd/etc
- /var/run/docker.sock:/var/run/docker.sock links:
- "influxdb"
ports: ports:
- target: 80 - 24224:24224
published: 80 environment:
mode: host SERVICE_24224_NAME: 'fluentd'
- target: 443 SERVICE_5140_NAME: 'fluentd'
published: 443
mode: host influxdb:
- target: 8080 image: influxdb:latest
published: 8090 restart: always
protocol: tcp container_name: influxdb_elena
mode: ingress volumes:
labels: - ./storage/influxdb/data:/var/lib/influxdb
- "traefik.http.routers.api.rule=Host(`traefik.docker.localhost`)" environment:
- "traefik.http.routers.api.service=api@internal" INFLUXDB_DATA_ENGINE: 'tsm1'
INFLUXDB_REPORTING_DISABLED: 'false'
SERVICE_8086_NAME: 'influxdb'
elasticsearch:
image: elasticsearch:6.5.1
expose:
- 9200
ports:
- "9200:9200"
kibana:
image: kibana:6.5.1
links:
- "elasticsearch"
ports:
- "5601:5601"
networks: volumes:
traefik: portainer_data:
driver: bridge
name: traefik
inbound:
driver: bridge
name: inbound
configs:
traefik_config:
file: ./configs/traefik.yml

26
fluent.conf Normal file
View File

@ -0,0 +1,26 @@
<source>
@type forward
@id input1
@label @mainstream
port ${LISTEN_PORT}
source_hostname_key hostname
</source>
<label @mainstream>
<filter **>
@type record_transformer
<record>
tag ${tag}
hostname ${hostname}
</record>
</filter>
<match **>
type influxdb
host ${DB_HOST}
port ${DB_PORT}
dbname ${DB_NAME}
collection ${DB_COLLECTION}
flush_interval ${FLUSH_INTERVAL}
</match>
</label>

3
fluentd/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM fluent/fluentd:latest
RUN ["gem", "install", "fluent-plugin-elasticsearch", "--no-rdoc", "--no-ri"]

23
fluentd/conf/fluent.conf Normal file
View File

@ -0,0 +1,23 @@
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<match *.**>
@type copy
<store>
@type elasticsearch
host elastic_elena
logstash_format true
logstash_prefix fluentd
logstash_dateformat %Y%m%d
include_tag_key true
type_name access_log
tag_key @log_name
flush_interval 1s
</store>
<store>
@type stdout
</store>
</match>

0
plugins/.gitkeep Normal file
View File