Skip to content

Commit 4977dd6

Browse files
committed
Init commit
0 parents  commit 4977dd6

24 files changed

+26144
-0
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.iml
2+
*.log
3+
*.iws
4+
*.ipr
5+
6+
.DS_Store
7+
.idea

.pre-commit-config.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
exclude: .key$
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.5.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: fix-byte-order-marker
10+
- id: mixed-line-ending
11+
- id: check-merge-conflict
12+
- id: check-case-conflict
13+
14+
- repo: https://github.com/Lucas-C/pre-commit-hooks
15+
rev: v1.5.4
16+
hooks:
17+
- id: remove-crlf
18+
- id: remove-tabs

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Romanov Alexey
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Docker Compose examples
2+
3+
* [Kafka](kafka/README.md)
4+
* [Monitoring](monitoring/README.md)
5+
* [Postgres](postgres/README.md)
6+
* [Logging](logging/README.md)
7+
* [ElasticSearch](elastic/README.md)

elastic/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ElasticSearch
2+
3+
* [Single Node](docker-compose.single-node.yml)
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: "3.9"
2+
services:
3+
elastic:
4+
image: elasticsearch:8.12.2
5+
container_name: elastic
6+
environment:
7+
discovery.type: single-node
8+
node.name: elastics
9+
bootstrap.memory_lock: true
10+
cluster.routing.allocation.disk.threshold_enabled: false
11+
xpack.security.enabled: false
12+
ES_JAVA_OPTS: "-Xms1024m -Xmx1024m"
13+
healthcheck:
14+
test: [ "CMD-SHELL", "curl -f http://localhost:9200/_cat/health | grep -q green" ]
15+
interval: 20s
16+
timeout: 20s
17+
retries: 10
18+
ports:
19+
- "9200:9200"
20+
- "9300:9300"
21+
volumes:
22+
- elastic:/usr/share/elasticsearch/data
23+
24+
kibana:
25+
image: kibana:8.12.2
26+
container_name: kibana
27+
environment:
28+
ELASTICSEARCH_HOSTS: http://elastic:9200
29+
healthcheck:
30+
test: [ "CMD-SHELL", "curl --silent --fail localhost:5601/api/status || exit 1" ]
31+
interval: 20s
32+
timeout: 10s
33+
retries: 10
34+
ports:
35+
- "5601:5601"
36+
volumes:
37+
- kibana:/usr/share/kibana/data
38+
depends_on:
39+
elastic:
40+
condition: service_healthy
41+
42+
volumes:
43+
elastic:
44+
kibana:

kafka/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Kafka and Zookeeper
2+
3+
* [Single Node](docker-compose.standalone.yml)

kafka/docker-compose.single-node.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
version: "3.9"
2+
services:
3+
zookeeper:
4+
image: confluentinc/cp-zookeeper:7.7.1
5+
container_name: zookeeper
6+
environment:
7+
ZOOKEEPER_CLIENT_PORT: 2181
8+
ZOOKEEPER_TICK_TIME: 2000
9+
healthcheck:
10+
test: [ "CMD-SHELL", "nc -z localhost 2181 || exit -1" ]
11+
interval: 10s
12+
timeout: 5s
13+
retries: 10
14+
ports:
15+
- "2181:2181"
16+
17+
kafka:
18+
image: confluentinc/cp-kafka:7.7.1
19+
container_name: kafka
20+
ports:
21+
- "9092:9092"
22+
environment:
23+
KAFKA_BROKER_ID: 1
24+
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
25+
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://localhost:9092
26+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
27+
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
28+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
29+
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
30+
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
31+
healthcheck:
32+
test: [ "CMD-SHELL", "kafka-topics --bootstrap-server localhost:9092 --list" ]
33+
interval: 10s
34+
timeout: 5s
35+
retries: 10
36+
depends_on:
37+
zookeeper:
38+
condition: service_healthy
39+
40+
console:
41+
image: docker.redpanda.com/redpandadata/console:latest
42+
container_name: console
43+
environment:
44+
KAFKA_BROKERS: kafka:29092
45+
ports:
46+
- "8081:8080"
47+
healthcheck:
48+
test: [ "CMD-SHELL", "curl --fail http://localhost:8080 || exit 1" ]
49+
interval: 5s
50+
timeout: 5s
51+
retries: 5
52+
depends_on:
53+
kafka:
54+
condition: service_healthy

logging/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fluent Bit

logging/docker-compose.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3.9"
2+
services:
3+
fluent-bit:
4+
image: fluent/fluent-bit:3.1.7-debug
5+
container_name: fluent-bit
6+
ports:
7+
- "5170:5170"
8+
healthcheck:
9+
test: [ "CMD-SHELL", "curl --silent --fail http://localhost:2020/api/v1/health" ]
10+
interval: 5s
11+
timeout: 2s
12+
retries: 5
13+
volumes:
14+
- ./fluent-bit/fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf

logging/fluent-bit/fluent-bit.conf

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[SERVICE]
2+
HTTP_Server On
3+
HTTP_Listen 127.0.0.1
4+
HTTP_PORT 2020
5+
Health_Check On
6+
7+
[INPUT]
8+
Name tcp
9+
Listen 0.0.0.0
10+
Port 5170
11+
Format json
12+
13+
[OUTPUT]
14+
Name es
15+
Host elastic
16+
Port 9200
17+
Index logs
18+
Match *
19+
Suppress_Type_Name On
20+
21+
[OUTPUT]
22+
Name stdout
23+
Match *

monitoring/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Monitoring

monitoring/docker-compose.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
services:
2+
prometheus:
3+
image: prom/prometheus:v2.41.0
4+
container_name: prometheus
5+
healthcheck:
6+
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090" ]
7+
interval: 10s
8+
timeout: 15s
9+
retries: 10
10+
ports:
11+
- "9090:9090"
12+
volumes:
13+
- ./prometheus/:/etc/prometheus/
14+
- prometheus:/prometheus
15+
command:
16+
- "--config.file=/etc/prometheus/prometheus.yml"
17+
- "--storage.tsdb.path=/prometheus/data"
18+
19+
node-exporter:
20+
image: prom/node-exporter:v1.6.1
21+
container_name: node-exporter
22+
command:
23+
- --path.procfs=/host/proc
24+
- --path.sysfs=/host/sys
25+
- --path.rootfs=/host/root
26+
- --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/)
27+
- --collector.netclass.ignored-devices=^(veth.*)$
28+
volumes:
29+
- /proc:/host/proc:ro
30+
- /sys:/host/sys:ro
31+
- /:/rootfs:ro
32+
depends_on:
33+
prometheus:
34+
condition: service_healthy
35+
36+
cadvisor:
37+
image: gcr.io/cadvisor/cadvisor:v0.49.1
38+
container_name: cadvisor
39+
privileged: true
40+
ports:
41+
- "8880:8080"
42+
devices:
43+
- /dev/kmsg
44+
volumes:
45+
- /:/rootfs:ro
46+
- /sys:/sys:ro
47+
- /var/run:/var/run:rw
48+
- /dev/disk/:/dev/disk:ro
49+
- /var/lib/docker/:/var/lib/docker:ro
50+
- /var/run/docker.sock:/var/run/docker.sock:rw
51+
depends_on:
52+
prometheus:
53+
condition: service_healthy
54+
55+
grafana:
56+
image: grafana/grafana:9.4.7
57+
container_name: grafana
58+
environment:
59+
- GF_AUTH_ANONYMOUS_ENABLED=true
60+
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
61+
- GF_AUTH_BASIC_ENABLED=false
62+
- GF_USERS_DEFAULT_THEME=light
63+
healthcheck:
64+
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health" ]
65+
interval: 10s
66+
timeout: 15s
67+
retries: 10
68+
ports:
69+
- "3000:3000"
70+
volumes:
71+
- grafana:/var/lib/grafana
72+
- ./grafana/:/etc/grafana/provisioning/
73+
depends_on:
74+
prometheus:
75+
condition: service_healthy
76+
77+
volumes:
78+
prometheus:
79+
grafana:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
apiVersion: 1
3+
providers:
4+
- name: "Node Exporter"
5+
type: file
6+
options:
7+
path: /etc/grafana/provisioning/dashboards/dashboards/node-exporter.json
8+
9+
- name: "cAdvisor"
10+
type: file
11+
options:
12+
path: /etc/grafana/provisioning/dashboards/dashboards/cadvisor.json

0 commit comments

Comments
 (0)