Fix Grafana deployment over Docker Swarm
[osm/devops.git] / installers / docker / docker-compose.yaml
1 ##
2 # Copyright 2019 ETSI
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 #         http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15 ##
16
17 ########################################################################
18
19 version: '3'
20 volumes:
21   ro:
22   ro_db:
23   mongo_db:
24   mon_db:
25   pol_db:
26   osm_packages:
27   prom_db:
28 networks:
29   netOSM:
30     external:
31       name: ${OSM_NETWORK:-netosm}
32     #driver: overlay
33     #driver_opts:
34     #  com.docker.network.driver.mtu: "1446"
35 services:
36   zookeeper:
37     image: wurstmeister/zookeeper:${ZOOKEEPER_TAG:-latest}
38 #    ports:
39 #      - "2181:2181"
40     networks:
41       - netOSM
42     healthcheck:
43       test: echo stat | nc localhost 2181
44       interval: 10s
45       timeout: 10s
46       retries: 3
47     logging:
48       driver: "json-file"
49       options:
50         max-size: "100m"
51         max-file: "2"
52   kafka:
53     image: wurstmeister/kafka:${KAFKA_TAG:-latest}
54     ports:
55       - "9092"
56     networks:
57       - netOSM
58     environment:
59       KAFKA_ADVERTISED_HOST_NAME: kafka
60       KAFKA_ADVERTISED_PORT: 9092
61       KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
62       KAFKA_LOG_RETENTION_HOURS: 24
63     volumes:
64       - /var/run/docker.sock:/var/run/docker.sock
65     healthcheck:
66       test: zookeeper-shell.sh zookeeper:2181 ls /brokers/ids 2>&1 | grep "Node does not exist" && exit 1 || exit 0
67       interval: 20s
68       timeout: 10s
69       retries: 5
70     logging:
71       driver: "json-file"
72       options:
73         max-size: "100m"
74         max-file: "2"
75     #depends_on:
76     #  - zookeeper
77   mongo:
78     image: mongo
79 #    ports:
80 #      - "27017:27017"
81     networks:
82       - netOSM
83     volumes:
84       - mongo_db:/data/db
85   prometheus:
86     image: prom/prometheus:${PROMETHEUS_TAG:-latest}
87     hostname: prometheus
88     ports:
89       - "${OSM_PROM_PORTS:-9091:9090}"
90     volumes:
91       - ./prometheus/:/etc/prometheus/
92       - prom_db:/prometheus
93     command:
94       - '--config.file=/etc/prometheus/prometheus.yml'
95       - '--web.enable-lifecycle'
96     networks:
97       - netOSM
98     logging:
99       driver: "json-file"
100       options:
101         max-size: "100m"
102         max-file: "2"
103   prometheus-cadvisor:
104     image: google/cadvisor:${PROMETHEUS_CADVISOR_TAG:-latest}
105     ports:
106       - "${OSM_PROM_CADVISOR_PORTS:-8080:8080}"
107     volumes:
108       - /:/rootfs:ro
109       - /var/run:/var/run:ro
110       - /sys:/sys:ro
111       - /var/lib/docker/:/var/lib/docker:ro
112       - /dev/disk/:/dev/disk:ro
113     networks:
114       - netOSM
115   keystone:
116     image: ${DOCKER_USER:-opensourcemano}/keystone:${TAG:-7}
117     networks:
118       - netOSM
119     environment:
120       DB_HOST: mysql
121     env_file:
122       - ./keystone.env
123     ports:
124       - "${OSM_KEYSTONE_PORTS:-5000:5000}"
125     logging:
126       driver: "json-file"
127       options:
128         max-size: "100m"
129         max-file: "2"
130   nbi:
131     image: ${DOCKER_USER:-opensourcemano}/nbi:${TAG:-7}
132     networks:
133       - netOSM
134     volumes:
135       - osm_packages:/app/storage
136     environment:
137       OSMNBI_DATABASE_HOST: mongo
138       OSMNBI_MESSAGE_HOST: kafka
139     env_file:
140       - ./nbi.env
141     ports:
142       - "${OSM_NBI_PORTS:-9999:9999}"
143     logging:
144       driver: "json-file"
145       options:
146         max-size: "100m"
147         max-file: "2"
148     #depends_on:
149     #  - kafka
150     #  - mongo
151   lcm:
152     image: ${DOCKER_USER:-opensourcemano}/lcm:${TAG:-7}
153     networks:
154       - netOSM
155     volumes:
156       - osm_packages:/app/storage
157     environment:
158       OSMLCM_RO_HOST: ro
159       OSMLCM_DATABASE_HOST: mongo
160       OSMLCM_MESSAGE_HOST: kafka
161     env_file:
162       - ./lcm.env
163     logging:
164       driver: "json-file"
165       options:
166         max-size: "100m"
167         max-file: "2"
168     #depends_on:
169     #  - kafka
170     #  - mongo
171     #  - ro
172   mysql:
173     image: mysql:5
174     networks:
175       netOSM:
176         aliases:
177           - ro-db
178     volumes:
179       - ro_db:/var/lib/mysql
180     env_file:
181       - ./ro-db.env
182     logging:
183       driver: "json-file"
184       options:
185         max-size: "100m"
186         max-file: "2"
187 #    ports:
188 #      - "3306:3306"
189   ro:
190     image: ${DOCKER_USER:-opensourcemano}/ro:${TAG:-7}
191     networks:
192       - netOSM
193     environment:
194       RO_DB_HOST: mysql
195     env_file:
196       - ./ro.env
197     #depends_on:
198     #  - mysql
199     volumes:
200       - ro:/var/log/osm
201     ports:
202       - "${OSM_RO_PORTS:-9090:9090}"
203     logging:
204       driver: "json-file"
205       options:
206         max-size: "100m"
207         max-file: "2"
208   mon:
209     image: ${DOCKER_USER:-opensourcemano}/mon:${TAG:-7}
210     networks:
211       - netOSM
212     volumes:
213       - mon_db:/app/database
214     environment:
215       OSMMON_MESSAGE_HOST: kafka
216       OSMMON_MESSAGE_PORT: 9092
217     env_file:
218       - ./mon.env
219     ports:
220       - "${OSM_MON_PORTS:-8662:8662}"
221     #depends_on:
222     #  - kafka
223     logging:
224         driver: "json-file"
225         options:
226             max-file: 5
227             max-size: 10m
228   pol:
229     image: ${DOCKER_USER:-opensourcemano}/pol:${TAG:-7}
230     networks:
231       - netOSM
232     volumes:
233       - pol_db:/app/database
234     environment:
235       OSMPOL_MESSAGE_HOST: kafka
236       OSMPOL_MESSAGE_PORT: 9092
237     env_file:
238       - ./pol.env
239     #depends_on:
240     #  - kafka
241     #  - mon
242     logging:
243       driver: "json-file"
244       options:
245         max-file: 5
246         max-size: 10m
247   light-ui:
248     image: ${DOCKER_USER:-opensourcemano}/light-ui:${TAG:-7}
249     networks:
250       - netOSM
251     environment:
252       OSM_SERVER: nbi
253     #depends_on:
254     #  - nbi
255     env_file:
256       - ./lwui.env
257     ports:
258       - "${OSM_UI_PORTS:-80:80}"
259     logging:
260       driver: "json-file"
261       options:
262         max-size: "100m"
263         max-file: "2"
264   grafana:
265     image: grafana/grafana
266     volumes:
267       - ./grafana/dashboards-osm.yml:/etc/grafana/provisioning/dashboards/dashboards-osm.yml
268       - ./grafana/osm-sample-dashboard.json:/etc/grafana/provisioning/dashboards/osm-sample-dashboard.json
269       - ./grafana/osm-system-dashboard.json:/etc/grafana/provisioning/dashboards/osm-system-dashboard.json
270       - ./grafana/datasource-prometheus.yml:/etc/grafana/provisioning/datasources/datasource-prometheus.yml
271     hostname: grafana
272     ports:
273       - "${OSM_GRAFANA_PORTS:-3000:3000}"
274     networks:
275       - netOSM
276     logging:
277       driver: "json-file"
278       options:
279         max-size: "100m"
280         max-file: "2"
281