Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 2 | |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 3 | # Copyright 2019-present Open Networking Foundation |
| 4 | # |
Jeremy Ronquillo | 6046ce3 | 2020-06-18 11:06:29 -0700 | [diff] [blame] | 5 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 6 | |
Ajay Lotan Thakur | c3cd619 | 2020-10-12 20:12:38 -0500 | [diff] [blame] | 7 | APPLICATION=$1 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 8 | set -xe |
| 9 | |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 10 | mkdir -p /opt/cp/config |
| 11 | cd /opt/cp/config |
Hyunsun Moon | 1fc2447 | 2021-03-14 19:10:11 -0500 | [diff] [blame] | 12 | cp /etc/cp/config/{*.cfg,*.json,*.conf} . |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 13 | |
Ajay Lotan Thakur | c3cd619 | 2020-10-12 20:12:38 -0500 | [diff] [blame] | 14 | case $APPLICATION in |
| 15 | "ngic_controlplane") |
| 16 | echo "Starting ngic controlplane app" |
| 17 | if [ ! -d "/dev/hugepages" ]; then |
| 18 | MEMORY="--no-huge -m $((MEM_LIMIT-1024))" |
| 19 | fi |
| 20 | CORES="-c $(taskset -p $$ | awk '{print $NF}')" |
| 21 | EAL_ARGS="${CORES} ${MEMORY} --no-pci" |
| 22 | cat /opt/cp/config/subscriber_mapping.json |
| 23 | {{- if .Values.config.coreDump.enabled }} |
| 24 | cp /bin/ngic_controlplane /tmp/coredump/ |
| 25 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 26 | |
Ajay Lotan Thakur | c3cd619 | 2020-10-12 20:12:38 -0500 | [diff] [blame] | 27 | ngic_controlplane $EAL_ARGS -- -f /etc/cp/config/ |
| 28 | ;; |
| 29 | |
| 30 | "gx-app") |
| 31 | echo "Starting gx-app" |
| 32 | SPGWC_IDENTITY={{ tuple "spgwc" "identity" . | include "omec-control-plane.diameter_endpoint" | quote }}; |
| 33 | DIAMETER_HOST=$(echo $SPGWC_IDENTITY| cut -d'.' -f1) |
| 34 | DIAMETER_REALM={{ tuple "spgwc" "realm" . | include "omec-control-plane.diameter_endpoint" | quote }}; |
| 35 | chmod +x /bin/make_certs.sh |
| 36 | cp /bin/make_certs.sh /opt/cp/config |
| 37 | /bin/make_certs.sh $DIAMETER_HOST $DIAMETER_REALM |
| 38 | {{- if .Values.config.coreDump.enabled }} |
| 39 | cp /bin/gx_app /tmp/coredump/ |
| 40 | {{- end }} |
| 41 | cd /opt/cp/ |
| 42 | gx_app |
| 43 | ;; |
| 44 | |
| 45 | *) |
| 46 | echo "invalid app $APPLICATION" |
| 47 | ;; |
| 48 | esac |