3 # Copyright © 2017 Amdocs, Bell Canada, AT&T
4 # Modifications Copyright © 2020 AT&T
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 # Script to configure and start the Policy components that are to run in the designated container,
20 # It is intended to be used as the entrypoint in the Dockerfile, so the last statement of the
21 # script just goes into a long sleep so that the script does not exit (which would cause the
22 # container to be torn down).
28 comps="base pap paplp console mysql elk"
31 comps="base pdp pdplp"
37 echo "Usage: do-start.sh pap|pdp|brmsgw" >&2
42 # skip installation if build.info file is present (restarting an existing container)
43 if [[ -f /opt/app/policy/etc/build.info ]]; then
44 echo "Found existing installation, will not reinstall"
45 . /opt/app/policy/etc/profile.d/env.sh
48 if [[ -d config ]]; then
52 for comp in $comps; do
53 echo "Installing component: $comp"
54 ./docker-install.sh --install $comp
56 for comp in $comps; do
57 echo "Configuring component: $comp"
58 ./docker-install.sh --configure $comp
61 . /opt/app/policy/etc/profile.d/env.sh
64 # override the policy keystore and truststore if present
65 if [[ -f config/policy-keystore ]]; then
66 cp config/policy-keystore $POLICY_HOME/etc/ssl
69 if [[ -f config/policy-truststore ]]; then
70 cp -f config/policy-truststore $POLICY_HOME/etc/ssl
73 if [[ -f config/$container-tweaks.sh ]] ; then
74 # file may not be executable; running it as an
75 # argument to bash avoids needing execute perms.
76 bash config/$container-tweaks.sh
79 if [[ $container == pap ]]; then
81 # now that DB is up, invoke database upgrade
82 # (which does nothing if the db is already up-to-date)
83 if [[ -v JDBC_USER ]]; then
86 dbuser=$(echo $(grep '^JDBC_USER=' base.conf | cut -f2 -d=))
89 if [[ -v JDBC_PASSWORD ]]; then
92 dbpw=$(echo $(grep '^JDBC_PASSWORD=' base.conf | cut -f2 -d=))
94 db_upgrade_remote.sh $dbuser $dbpw {{.Values.global.mariadb.service.name}}