08929ab22292e9a820cc9de6e5cb383947a26dbd
[cps.git] / docker-compose / docker-compose.yml
1 # ============LICENSE_START=======================================================
2 # Copyright (c) 2020 Pantheon.tech.
3 # Modifications Copyright (C) 2021 Bell Canada.
4 # Modifications Copyright (C) 2022-2023 Nordix Foundation.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=========================================================
18
19 services:
20
21   ### docker-compose --profile dmi-service up -d -> run CPS services incl. dmi-plugin ###
22   ### docker-compose --profile dmi-stub --profile monitoring up -d -> run CPS with stubbed dmi-plugin (for registration performance testing)
23   ### to disable notifications make notification.enabled to false & comment out kafka/zookeeper services ###
24
25   dbpostgresql:
26     container_name: dbpostgresql
27     image: postgres:14.1-alpine
28     ports:
29       - ${DB_PORT:-5432}:5432
30     environment:
31       POSTGRES_DB: cpsdb
32       POSTGRES_USER: ${DB_USERNAME:-cps}
33       POSTGRES_PASSWORD: ${DB_PASSWORD:-cps}
34     healthcheck:
35       test: ["CMD", "pg_isready"]
36       interval: 30s
37       timeout: 5s
38       retries: 5
39
40   cps-and-ncmp:
41     container_name: cps-and-ncmp
42     image: ${DOCKER_REPO:-nexus3.onap.org:10003}/onap/cps-and-ncmp:${CPS_VERSION:-latest}
43     ports:
44       - ${CPS_CORE_PORT:-8883}:8080
45       - ${CPS_CORE_MANAGEMENT_PORT:-8887}:8081
46     environment:
47       CPS_USERNAME: ${CPS_CORE_USERNAME:-cpsuser}
48       CPS_PASSWORD: ${CPS_CORE_PASSWORD:-cpsr0cks!}
49       DB_HOST: ${DB_HOST:-dbpostgresql}
50       DB_USERNAME: ${DB_USERNAME:-cps}
51       DB_PASSWORD: ${DB_PASSWORD:-cps}
52       DMI_USERNAME: ${DMI_USERNAME:-cpsuser}
53       DMI_PASSWORD: ${DMI_PASSWORD:-cpsr0cks!}
54       KAFKA_BOOTSTRAP_SERVER: kafka:9092
55       notification.enabled: 'true'
56       notification.async.executor.time-out-value-in-ms: 2000
57       NOTIFICATION_DATASPACE_FILTER_PATTERNS: '.*'
58       NCMP_TIMERS_ADVISED-MODULES-SYNC_SLEEP-TIME-MS: ${ADVISED_MODULES_SYNC_SLEEP_TIME_MS:-30000}
59       NCMP_TIMERS_CM-HANDLE-DATA-SYNC_SLEEP-TIME-MS: ${CMHANDLE_DATA_SYNC_SLEEP_TIME_MS:-30000}
60     restart: unless-stopped
61     depends_on:
62       - dbpostgresql
63
64   ### if kafka is not required comment out zookeeper and kafka ###
65   zookeeper:
66     image: confluentinc/cp-zookeeper:6.2.1
67     container_name: zookeeper
68     ports:
69       - '2181:2181'
70     environment:
71       ZOOKEEPER_CLIENT_PORT: 2181
72
73   kafka:
74     image: confluentinc/cp-kafka:6.2.1
75     container_name: kafka
76     ports:
77       - "19092:19092"
78     depends_on:
79       - zookeeper
80     environment:
81       KAFKA_BROKER_ID: 1
82       KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
83       KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,CONNECTIONS_FROM_HOST://localhost:19092
84       KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,CONNECTIONS_FROM_HOST:PLAINTEXT
85       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
86
87   ncmp-dmi-plugin:
88     container_name: ncmp-dmi-plugin
89     image: ${DOCKER_REPO:-nexus3.onap.org:10003}/onap/ncmp-dmi-plugin:${DMI_VERSION:-1.3.0-SNAPSHOT-latest}
90     ports:
91       - ${DMI_PORT:-8783}:8080
92       - ${DMI_MANAGEMENT_PORT:-8787}:8081
93     environment:
94       CPS_USERNAME: ${CPS_CORE_USERNAME:-cpsuser}
95       CPS_PASSWORD: ${CPS_CORE_PASSWORD:-cpsr0cks!}
96       CPS_CORE_HOST: ${CPS_CORE_HOST:-cps-and-ncmp}
97       CPS_CORE_PORT: ${CPS_CORE_PORT:-8080}
98       CPS_CORE_USERNAME: ${CPS_CORE_USERNAME:-cpsuser}
99       CPS_CORE_PASSWORD: ${CPS_CORE_PASSWORD:-cpsr0cks!}
100       SDNC_HOST: ${SDNC_HOST:-sdnc}
101       SDNC_PORT: ${SDNC_PORT:-8181}
102       SDNC_USERNAME: ${SDNC_USERNAME:-admin}
103       SDNC_PASSWORD: ${SDNC_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
104       DMI_SERVICE_URL: ${DMI_SERVICE_URL:-http://ncmp-dmi-plugin:8783}
105       DMI_USERNAME: ${DMI_USERNAME:-cpsuser}
106       DMI_PASSWORD: ${DMI_PASSWORD:-cpsr0cks!}
107       KAFKA_BOOTSTRAP_SERVER: kafka:9092
108       notification.data-updated.enabled: 'true'
109       NOTIFICATION_DATASPACE_FILTER_PATTERNS: '.*'
110     restart: unless-stopped
111     profiles:
112       - dmi-service
113
114   ncmp-dmi-plugin-stub:
115     container_name: ncmp-dmi-plugin-stub
116     image: wiremock/wiremock:2.33.2
117     ports:
118       - ${DMI_PORT:-8783}:8080
119     volumes:
120       - ../dmi-plugin-perf-stub/mappings:/home/wiremock/mappings
121       - ../dmi-plugin-perf-stub/files:/home/wiremock/__files
122     restart: unless-stopped
123     profiles:
124       - dmi-stub
125
126   init-db:
127     build: ${CPS_HOME:-.}/docker-compose/initfile
128     environment:
129       CPS_CORE_PORT: ${CPS_CORE_PORT:-8883}
130       CPS_CORE_MANAGEMENT_PORT: ${CPS_CORE_MANAGEMENT_PORT:-8887}
131     volumes:
132       - ${CPS_HOME:-.}/cps-ncmp-service/src/main/resources/model/:/model
133     depends_on:
134       cps-and-ncmp:
135         condition: service_started
136
137   prometheus:
138     container_name: prometheus-container
139     image: prom/prometheus:latest
140     ports:
141       - 9090:9090
142     restart: always
143     volumes:
144       - ./prometheus.yml:/etc/prometheus/prometheus.yml
145     profiles:
146       - monitoring
147
148   grafana:
149     image: grafana/grafana-oss:latest
150     user: ""
151     container_name: grafana-container
152     depends_on:
153       prometheus:
154         condition: service_started
155     ports:
156       - 3000:3000
157     volumes:
158       - grafana:/var/lib/grafana
159     environment:
160       - GF_SECURITY_ADMIN_PASSWORD=admin
161       - GF_SERVER_DOMAIN:localhost
162     profiles:
163       - monitoring
164
165 volumes:
166   grafana: