-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.yml.j2
130 lines (121 loc) · 3.36 KB
/
compose.yml.j2
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
#this is work in progress
#WIP
networks:
int-network:
internal: true
ext-network:
internal: false
# Settings and configurations that are common for all containers
x-minio-common: &minio-common
image: quay.io/minio/minio:latest
command: server --console-address ":9001" http://minio{1...4}/data{1...2}
expose:
- "9000"
- "9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
MINIO_ACCESS_KEY: test
MINIO_SECRET_KEY: testlongkey
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 5
networks:
- int-network
x-loki-common: &loki-common
image: grafana/loki:latest
command: ["-config.file=/etc/loki.yml", "-config.expand-env=true"]
user: root:root
expose:
- "3100" #loki
- "9095" #grpc
- "7946" #memberlist
working_dir: /data
depends_on:
- minio1
- minio2
- minio3
- minio4
networks:
- int-network
x-mimir-common: &mimir-common
image: grafana/mimir:latest
command: ["-config.file=/etc/mimir.yml", "-config.expand-env=true"]
expose:
- "8080" #mimir
- "9095" #grpc
- "7946" #memberlist
depends_on:
- minio1
- minio2
- minio3
- minio4
networks:
- int-network
x-amgt-common: &amgt-common
image: grafana/mimir:latest
command: ["-config.file=/etc/amgt.yml", "-config.expand-env=true"]
expose:
- "8080" #mimir/amgt
- "9095" #grpc
- "7946" #memberlist
depends_on:
- minio1
- minio2
- minio3
- minio4
networks:
- int-network
services:
nginx:
image: nginx:latest
hostname: nginx
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "127.0.0.1:9000:9000"
- "127.0.0.1:9001:9001"
- "127.0.0.1:3100:3100"
- "127.0.0.1:9009:9009"
- "127.0.0.1:8080:8080"
networks:
- int-network
- ext-network
depends_on:
- minio1
- minio2
- minio3
- minio4
{%raw%}
{%endraw%}
{%- set services = [
{'name': 'minio', 'common': '*minio-common', 'count': 4, 'volumes': ['- {name}{i}-1:/data1', '- {name}{i}-2:/data2']},
{'name': 'loki', 'common': '*loki-common', 'count': 4,'volumes': ['- {name}{i}-1:/data'], 'environment': ['LOKI_ADDR', 'LOKI_NODEN'], 'config_file': './loki/loki.yml'},
{'name': 'mimir', 'common': '*mimir-common', 'count': 4,'volumes': ['- {name}{i}-1:/data'], 'environment': ['MIMIR_ADDR', 'MIMIR_NODEN'], 'config_file': './mimir/mimir.yml'},
{'name': 'amgt', 'common': '*amgt-common', 'count': 4,'volumes': ['- {name}{i}-1:/data'], 'environment': ['AMGT_ADDR', 'AMGT_NODEN'], 'config_file': './amgt/amgt.yml'}
] -%}
{%- for service in services %}
{%- for i in range(1, service.count + 1) %}
{{ service.name }}{{ i }}:
<<: {{ service.common }}
hostname: {{ service.name }}{{ i }}
container_name: {{ service.name }}{{ i }}
{%- if service.environment is defined %}
environment:
{%- for var in service.environment %}
{{ var }}: {{ service.name }}{{ i }}
{%- endfor %}
{%- endif %}
volumes:
{%- if service.config_file is defined %}
- {{ service.config_file }}:/etc/{{ service.name }}.yml
{%- endif %}
{%- if service.volumes is defined %}
{%- for volume in service.volumes %}
{{ volume.format(name=service.name, i=i) }}
{%- endfor %}
{%- endif %}
{%- endfor %}
{%- endfor %}