-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.docker-compose.yaml
154 lines (143 loc) · 3.96 KB
/
1.docker-compose.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
143
144
145
146
147
148
149
150
151
152
153
154
version: "3.9"
services:
etcd1:
image: patronitraining/patroni
networks: [ postgresnetwork ]
hostname: etcd1
command: etcd
environment:
&etcd_env
ETCD_NAME: etcd1
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd1:2380
ETCD_INITIAL_CLUSTER: etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_INITIAL_CLUSTER_TOKEN: tutorial
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
etcd2:
image: patronitraining/patroni
networks: [ postgresnetwork ]
hostname: etcd2
command: etcd
environment:
<<: *etcd_env
ETCD_NAME: etcd2
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd2:2380
haproxy:
image: patronitraining/patroni
networks: [ postgresnetwork ]
hostname: haproxy
command: haproxy
environment:
&haproxy_env
PATRONI_SCOPE: demo
PATRONI_ETCD_HOSTS: "'etcd1:2379','etcd2:2379'"
PATRONI_RESTAPI_USERNAME: admin
PATRONI_RESTAPI_PASSWORD: admin
ETCDCTL_ENDPOINTS: http://etcd1:2379,http://etcd2:2379
ports:
- 5000:5000
- 5001:5001
patroni1:
image: patronitraining/patroni
networks: [ postgresnetwork ]
environment:
&patroni_env
<<: *haproxy_env
PATRONI_NAME: patroni1
PATRONI_SUPERUSER_USERNAME: postgres
PATRONI_SUPERUSER_PASSWORD: postgres
PATRONI_REPLICATION_USERNAME: replicator
PATRONI_REPLICATION_PASSWORD: replicate
PATRONI_admin_PASSWORD: admin
PATRONI_admin_OPTIONS: createdb,createrole
deploy:
replicas: 1
placement:
max_replicas_per_node: 1
constraints:
- node.labels.service == patroni1
patroni2:
image: patronitraining/patroni
networks: [ postgresnetwork ]
hostname: patroni2
environment:
<<: *patroni_env
PATRONI_NAME: patroni2
deploy:
replicas: 1
placement:
max_replicas_per_node: 1
constraints:
- node.labels.service == patroni2
aerospikedb1:
image: aerospike/aerospike-server
networks:
- aerospikenetwork
deploy:
replicas: 1
placement:
max_replicas_per_node: 1
constraints:
- node.labels.service == aerospike1
command: [ "--config-file", "/run/secrets/aerospike.conf" ]
secrets:
- source: conffile1
target: aerospike.conf
mode: 440
aerospikedb2:
image: aerospike/aerospike-server
networks:
- aerospikenetwork
deploy:
replicas: 1
placement:
max_replicas_per_node: 1
constraints:
- node.labels.service == aerospike2
command: [ "--config-file", "/run/secrets/aerospike.conf" ]
secrets:
- source: conffile2
target: aerospike.conf
mode: 440
zookeeper:
image: wurstmeister/zookeeper
networks:
- kafkanetwork
kafka:
image: wurstmeister/kafka:latest
environment:
HOSTNAME_COMMAND: "docker info | grep ^Name: | cut -d' ' -f 2"
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: INSIDE://:9092,OUTSIDE://_{HOSTNAME_COMMAND}:9094
KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9094
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
KAFKA_CREATE_TOPICS: "aggregates-events:2:1"
deploy:
replicas: 2
placement:
max_replicas_per_node: 1
constraints:
- node.labels.service == kafka
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- kafkanetwork
depends_on:
- zookeeper
networks:
aerospikenetwork:
driver: overlay
attachable: true
kafkanetwork:
driver: overlay
attachable: true
postgresnetwork:
driver: overlay
attachable: true
secrets:
conffile1:
file: ./services/aerospike/aerospike1.conf
conffile2:
file: ./services/aerospike/aerospike2.conf