Updates in docker-compose for policy framework
The updates are needed for getting it to work with policy participant
and control-loop runtime.
Change-Id: Ia268270250cd6b582ae565f0dd04d82bdb366bd8
Issue-ID: NONRTRIC-553
Signed-off-by: RehanRaza <muhammad.rehan.raza@est.tech>
diff --git a/docker-compose/docker-compose-policy-framework/config/api/defaultConfig.json b/docker-compose/docker-compose-policy-framework/config/api/defaultConfig.json
new file mode 100644
index 0000000..b78b753
--- /dev/null
+++ b/docker-compose/docker-compose-policy-framework/config/api/defaultConfig.json
@@ -0,0 +1,53 @@
+{
+ "name": "ApiGroup",
+ "restServerParameters": {
+ "host": "0.0.0.0",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "https": false,
+ "aaf": false
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.mariadb.jdbc.Driver",
+ "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin",
+ "databaseUser": "root",
+ "databasePassword": "strong_pitchou",
+ "persistenceUnit": "PolicyMariaDb"
+ },
+ "preloadPolicyTypes": [
+ "policytypes/onap.policies.monitoring.tcagen2.yaml",
+ "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml",
+ "policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml",
+ "policytypes/onap.policies.Optimization.yaml",
+ "policytypes/onap.policies.optimization.Resource.yaml",
+ "policytypes/onap.policies.optimization.Service.yaml",
+ "policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml",
+ "policytypes/onap.policies.optimization.resource.DistancePolicy.yaml",
+ "policytypes/onap.policies.optimization.resource.HpaPolicy.yaml",
+ "policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml",
+ "policytypes/onap.policies.optimization.resource.PciPolicy.yaml",
+ "policytypes/onap.policies.optimization.service.QueryPolicy.yaml",
+ "policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml",
+ "policytypes/onap.policies.optimization.resource.Vim_fit.yaml",
+ "policytypes/onap.policies.optimization.resource.VnfPolicy.yaml",
+ "policytypes/onap.policies.controlloop.guard.Common.yaml",
+ "policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml",
+ "policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml",
+ "policytypes/onap.policies.controlloop.guard.common.MinMax.yaml",
+ "policytypes/onap.policies.controlloop.guard.common.Filter.yaml",
+ "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml",
+ "policytypes/onap.policies.Naming.yaml",
+ "policytypes/onap.policies.Match.yaml",
+ "policytypes/onap.policies.native.Drools.yaml",
+ "policytypes/onap.policies.native.Xacml.yaml",
+ "policytypes/onap.policies.native.Apex.yaml",
+ "policytypes/onap.policies.controlloop.operational.Common.yaml",
+ "policytypes/onap.policies.controlloop.operational.common.Drools.yaml"
+ ],
+ "preloadPolicies" : [
+ "policies/sdnc.policy.naming.input.tosca.yaml"
+ ]
+}
diff --git a/docker-compose/docker-compose-policy-framework/config/db/bootstrap-database.sh b/docker-compose/docker-compose-policy-framework/config/db/bootstrap-database.sh
new file mode 100755
index 0000000..ac2d0a5
--- /dev/null
+++ b/docker-compose/docker-compose-policy-framework/config/db/bootstrap-database.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+###
+# ============LICENSE_START=======================================================
+# ONAP CLAMP
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 2021 Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+
+mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < /docker-entrypoint-initdb.d/create-db.sql
+mysql -uroot -p$MYSQL_ROOT_PASSWORD --execute "CREATE USER 'policy'@'%' IDENTIFIED BY 'P01icY';"
+mysql -uroot -p$MYSQL_ROOT_PASSWORD --execute "GRANT ALL PRIVILEGES ON controlloop.* TO 'policy'@'%';"
\ No newline at end of file
diff --git a/docker-compose/docker-compose-policy-framework/config/db/create-db.sql b/docker-compose/docker-compose-policy-framework/config/db/create-db.sql
new file mode 100644
index 0000000..bc64431
--- /dev/null
+++ b/docker-compose/docker-compose-policy-framework/config/db/create-db.sql
@@ -0,0 +1,13 @@
+#
+# Create CLDS database objects (tables, etc.)
+#
+#
+CREATE DATABASE IF NOT EXISTS `cldsdb4`;
+CREATE DATABASE IF NOT EXISTS `policyadmin`;
+CREATE DATABASE IF NOT EXISTS `controlloop`;
+USE `cldsdb4`;
+DROP USER 'clds';
+CREATE USER 'clds';
+GRANT ALL on cldsdb4.* to 'clds' identified by 'sidnnd83K' with GRANT OPTION;
+FLUSH PRIVILEGES;
+
diff --git a/docker-compose/docker-compose-policy-framework/config/db/db.conf b/docker-compose/docker-compose-policy-framework/config/db/db.conf
deleted file mode 100644
index 22b37f8..0000000
--- a/docker-compose/docker-compose-policy-framework/config/db/db.conf
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2019,2021 AT&T Intellectual Property. All rights reserved
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-MYSQL_ROOT_PASSWORD=secret
-MYSQL_USER=policy_user
-MYSQL_PASSWORD=policy_user
diff --git a/docker-compose/docker-compose-policy-framework/config/db/db.sh b/docker-compose/docker-compose-policy-framework/config/db/db.sh
deleted file mode 100755
index a5c8129..0000000
--- a/docker-compose/docker-compose-policy-framework/config/db/db.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash -xv
-# Copyright 2019,2021 AT&T Intellectual Property. All rights reserved
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-for db in support onap_sdk log migration operationshistory10 pooling policyadmin operationshistory
-do
- mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};"
- mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "GRANT ALL PRIVILEGES ON \`${db}\`.* TO '${MYSQL_USER}'@'%' ;"
-done
-
-mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;"
diff --git a/docker-compose/docker-compose-policy-framework/config/drools-apps/env/base.conf b/docker-compose/docker-compose-policy-framework/config/drools-apps/env/base.conf
index a56dbaa..b8ca10e 100644
--- a/docker-compose/docker-compose-policy-framework/config/drools-apps/env/base.conf
+++ b/docker-compose/docker-compose-policy-framework/config/drools-apps/env/base.conf
@@ -46,8 +46,8 @@
# Relational (SQL) DB access
SQL_HOST=mariadb
-SQL_USER=policy_user
-SQL_PASSWORD=policy_user
+SQL_USER=root
+SQL_PASSWORD=strong_pitchou
# AAF
diff --git a/docker-compose/docker-compose-policy-framework/config/drools/env/base.conf b/docker-compose/docker-compose-policy-framework/config/drools/env/base.conf
index 8189419..fa1f8f1 100644
--- a/docker-compose/docker-compose-policy-framework/config/drools/env/base.conf
+++ b/docker-compose/docker-compose-policy-framework/config/drools/env/base.conf
@@ -46,8 +46,8 @@
# Relational (SQL) DB access
SQL_HOST=mariadb
-SQL_USER=policy_user
-SQL_PASSWORD=policy_user
+SQL_USER=root
+SQL_PASSWORD=strong_pitchou
# AAF
diff --git a/docker-compose/docker-compose-policy-framework/config/pap/defaultConfig.json b/docker-compose/docker-compose-policy-framework/config/pap/defaultConfig.json
index 369a37c..8c4ea64 100644
--- a/docker-compose/docker-compose-policy-framework/config/pap/defaultConfig.json
+++ b/docker-compose/docker-compose-policy-framework/config/pap/defaultConfig.json
@@ -24,8 +24,8 @@
"implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
"databaseDriver": "org.mariadb.jdbc.Driver",
"databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin",
- "databaseUser": "policy_user",
- "databasePassword": "policy_user",
+ "databaseUser": "root",
+ "databasePassword": "strong_pitchou",
"persistenceUnit": "PolicyMariaDb"
},
"topicParameterGroup": {
@@ -57,7 +57,7 @@
"port": 6969,
"userName": "healthcheck",
"password": "zb!XztG34",
- "useHttps": true,
+ "useHttps": false,
"allowSelfSignedCerts" : true,
"basePath": "policy/api/v1/healthcheck"
}]
diff --git a/docker-compose/docker-compose-policy-framework/config/runtime-controlloop/ClRuntimeParameters.json b/docker-compose/docker-compose-policy-framework/config/runtime-controlloop/ClRuntimeParameters.json
new file mode 100644
index 0000000..429e1af
--- /dev/null
+++ b/docker-compose/docker-compose-policy-framework/config/runtime-controlloop/ClRuntimeParameters.json
@@ -0,0 +1,63 @@
+{
+ "name": "ControlLoopRuntimeGroup",
+ "supervisionScannerIntervalSec": 1000,
+ "participantStateChangeIntervalSec": 1000,
+ "participantClUpdateIntervalSec": 1000,
+ "participantClStateChangeIntervalSec": 1000,
+ "restServerParameters": {
+ "host": "0.0.0.0",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "https": true,
+ "aaf": false
+ },
+ "participantParameters": {
+ "heartBeatMs": 120000,
+ "updateParameters": {
+ "maxRetryCount": 1,
+ "maxWaitMs": 30000
+ },
+ "stateChangeParameters": {
+ "maxRetryCount": 1,
+ "maxWaitMs": 30000
+ }
+ },
+ "databaseProviderParameters": {
+ "name": "PolicyProviderParameterGroup",
+ "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+ "databaseDriver": "org.mariadb.jdbc.Driver",
+ "databaseUrl": "jdbc:mariadb://localhost:3306/controlloop",
+ "databaseUser": "policy",
+ "databasePassword": "P01icY",
+ "persistenceUnit": "CommissioningMariaDb"
+ },
+ "topicParameterGroup": {
+ "topicSources": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap",
+ "fetchTimeout": 15000
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ },
+ {
+ "topic": "POLICY-NOTIFICATION",
+ "servers": [
+ "localhost"
+ ],
+ "topicCommInfrastructure": "dmaap"
+ }
+ ]
+ }
+}
diff --git a/docker-compose/docker-compose-policy-framework/docker-compose.yml b/docker-compose/docker-compose-policy-framework/docker-compose.yml
index 406cbeb..4878357 100644
--- a/docker-compose/docker-compose-policy-framework/docker-compose.yml
+++ b/docker-compose/docker-compose-policy-framework/docker-compose.yml
@@ -27,10 +27,13 @@
image: nexus3.onap.org:10001/mariadb:10.5.8
container_name: mariadb
hostname: mariadb
- command: ['--lower-case-table-names=1', '--wait_timeout=28800']
- env_file: config/db/db.conf
volumes:
- - ./config/db:/docker-entrypoint-initdb.d:ro
+ - db-vol:/var/lib/mysql
+ - "./config/db/:/docker-entrypoint-initdb.d:rw"
+ environment:
+ - MYSQL_ROOT_PASSWORD=strong_pitchou
+ ports:
+ - "3306:3306"
expose:
- 3306
api:
@@ -40,10 +43,11 @@
- mariadb
hostname: policy-api
ports:
- - "6969:6969"
+ - "6869:6969"
expose:
- - 6969
+ - 6869
volumes:
+ - ./config/api/defaultConfig.json:/opt/app/policy/api/etc/defaultConfig.json:ro
- ./config/ks.jks:/opt/app/policy/api/etc/ssl/policy-keystore.jks:ro
- ./wait_for_port.sh:/opt/app/policy/api/bin/wait_for_port.sh:ro
entrypoint: ./wait_for_port.sh
@@ -183,3 +187,5 @@
'pap', '6969',
'apex-pdp', '6969'
]
+volumes:
+ db-vol:
\ No newline at end of file