3 # ============LICENSE_START===============================================
4 # Copyright (C) 2023 Nordix Foundation. All rights reserved.
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
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.
17 # ============LICENSE_END=================================================
20 . scripts/get_influxdb2_token.sh
21 . scripts/populate_keycloak.sh
24 echo "Usage: pmlog-setup.sh"
37 echo "Cleaning previously started containers..."
43 if [ -z "$(docker images -q $1)" ]; then
44 echo "Pulling image... "$1
51 export INFLUXDB_IMAGE="influxdb:2.6.1"
52 pull_image $INFLUXDB_IMAGE
54 export PMLOG_IMAGE="nexus3.o-ran-sc.org:10001/o-ran-sc/nonrtric-plt-pmlog:1.0.0"
55 pull_image $PMLOG_IMAGE
57 export AUTH_TOKEN_IMAGE=nexus3.o-ran-sc.org:10001/o-ran-sc/nonrtric-plt-auth-token-fetch:1.1.1
58 pull_image $AUTH_TOKEN_IMAGE
62 data_dir=./config/influxdb2/data
65 export INFLUXDB2_INSTANCE=influxdb2-0
66 export INFLUXDB2_USERNAME=admin
67 export INFLUXDB2_PASSWORD=mySuP3rS3cr3tT0keN
68 export INFLUXDB2_ORG=est
69 export INFLUXDB2_BUCKET=pm-logg-bucket
71 envsubst < docker-compose-influxdb.yaml > docker-compose-influxdb_gen.yaml
72 docker-compose -p influx -f docker-compose-influxdb_gen.yaml up -d
76 chmod 666 config/pmlog/token-cache/jwt.txt
79 create_clients nonrtric-realm $cid
81 generate_client_secrets nonrtric-realm $cid
84 export PMLOG_CLIENT_SECRET=$(< .sec_nonrtric-realm_$cid)
85 envsubst < docker-compose-pmlog.yaml > docker-compose-pmlog_gen.yaml
86 docker-compose -p pmlog -f docker-compose-pmlog_gen.yaml up -d
96 # Wait for influxdb2 to start
97 echo 'Waiting for influxdb2 to be ready'
98 until [ $(curl -s -w '%{http_code}' -o /dev/null 'http://localhost:8086/health') -eq 200 ];
105 INFLUXDB2_TOKEN=$(get_influxdb2_token $INFLUXDB2_INSTANCE)
106 echo $INFLUXDB2_TOKEN
107 export INFLUXDB2_TOKEN