forked from riferrei/otel-with-golang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-with-collector.yaml
142 lines (134 loc) · 4.41 KB
/
run-with-collector.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
version: '2.4'
services:
hello-app:
build: .
image: hello-app:latest
container_name: hello-app
hostname: hello-app
ports:
- "8888:8888"
depends_on:
- collector
environment:
- EXPORTER_ENDPOINT=collector:55680
healthcheck:
interval: 5s
retries: 10
test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:8888/hello
collector:
image: otel/opentelemetry-collector:latest
container_name: collector
hostname: collector
depends_on:
fleet-server:
condition: service_healthy
command: ["--config=/etc/collector-config.yaml"]
volumes:
- ./collector-config.yaml:/etc/collector-config.yaml
ports:
- "13133:13133"
- "55680:55680"
fleet-server:
image: docker.elastic.co/beats/elastic-agent:8.1.0
container_name: fleet-server
hostname: fleet-server
depends_on:
elasticsearch:
condition: service_healthy
kibana:
condition: service_healthy
entrypoint: "/bin/bash"
command:
- "-l"
- "-c"
- "export && elastic-agent container -d *"
ports:
- "8220:8220"
- "8200:8200"
environment:
FLEET_ELASTICSEARCH_HOST: "http://elasticsearch:9200"
FLEET_SERVER_ENABLE: "1"
FLEET_SERVER_HOST: "0.0.0.0"
FLEET_SERVER_POLICY_ID: "${FLEET_SERVER_POLICY_ID:-fleet-server-apm-policy}"
FLEET_SERVER_PORT: "8220"
KIBANA_FLEET_HOST: "http://kibana:5601"
KIBANA_FLEET_SETUP: "1"
FLEET_SERVER_INSECURE_HTTP: "1"
FLEET_SERVER_ELASTICSEARCH_INSECURE: "1"
volumes:
- ./environment:/usr/share/elastic-agent/.bash_profile
healthcheck:
test: ["CMD-SHELL", "curl -s -k http://localhost:8220/api/status | grep -q 'HEALTHY'"]
retries: 300
interval: 1s
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.1.0
container_name: elasticsearch
hostname: elasticsearch
environment:
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- "network.host="
- "transport.host=127.0.0.1"
- "http.host=0.0.0.0"
- "cluster.routing.allocation.disk.threshold_enabled=false"
- "discovery.type=single-node"
- "xpack.security.authc.anonymous.roles=remote_monitoring_collector"
- "xpack.security.authc.realms.file.file1.order=0"
- "xpack.security.authc.realms.native.native1.order=1"
- "xpack.security.enabled=true"
- "xpack.license.self_generated.type=trial"
- "xpack.security.authc.token.enabled=true"
- "xpack.security.authc.api_key.enabled=true"
- "logger.org.elasticsearch=${ES_LOG_LEVEL:-error}"
- "action.destructive_requires_name=false"
ports:
- "9200:9200"
volumes:
- "./fleet-server/elasticsearch/roles.yml:/usr/share/elasticsearch/config/roles.yml"
- "./fleet-server/elasticsearch/users:/usr/share/elasticsearch/config/users"
- "./fleet-server/elasticsearch/users_roles:/usr/share/elasticsearch/config/users_roles"
healthcheck:
interval: 20s
retries: 10
test: ["CMD-SHELL", "curl -s http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=500ms"]
service-token:
image: python:3.9-slim
container_name: service-token
hostname: service-token
depends_on:
elasticsearch:
condition: service_healthy
environment:
ELASTICSEARCH_HOST: http://elasticsearch:9200
ELASTICSEARCH_USERNAME: "${KIBANA_ES_USER:-admin}"
ELASTICSEARCH_PASSWORD: "${KIBANA_ES_PASS:-changeme}"
command:
- "/bin/bash"
- "-c"
- "pip install requests && python /tmp/init-fleet.py"
volumes:
- ./fleet-server/init-fleet.py:/tmp/init-fleet.py
- ./:/out
kibana:
image: docker.elastic.co/kibana/kibana:8.1.0
container_name: kibana
hostname: kibana
depends_on:
elasticsearch:
condition: service_healthy
environment:
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
ELASTICSEARCH_USERNAME: "${KIBANA_ES_USER:-kibana_system_user}"
ELASTICSEARCH_PASSWORD: "${KIBANA_ES_PASS:-changeme}"
STATUS_ALLOWANONYMOUS: 'true'
ports:
- "5601:5601"
volumes:
- ./fleet-server/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml
healthcheck:
interval: 10s
retries: 20
test: ["CMD-SHELL", "curl -s http://localhost:5601/api/status | grep -q 'All services are available'"]
networks:
default:
name: otel-with-golang