Refactor to facilitate deployment of multiple instances of a service

This commit is contained in:
herlesupreeth
2025-01-17 18:14:21 +01:00
parent fa9a7983fa
commit 661def8dd2
31 changed files with 2563 additions and 198 deletions

View File

@@ -11,8 +11,8 @@
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# 2. Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
@@ -30,70 +30,70 @@ export LD_LIBRARY_PATH=/open5gs/install/lib/$(uname -m)-linux-gnu
if [[ -z "$COMPONENT_NAME" ]]; then
echo "Error: COMPONENT_NAME environment variable not set"; exit 1;
elif [[ "$COMPONENT_NAME" =~ ^(amf-[[:digit:]]+$) ]]; then
elif [[ "$COMPONENT_NAME" =~ ^(amf[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/amf/amf_init.sh && \
/mnt/amf/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-amfd
elif [[ "$COMPONENT_NAME" =~ ^(ausf-[[:digit:]]+$) ]]; then
elif [[ "$COMPONENT_NAME" =~ ^(ausf[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/ausf/ausf_init.sh && \
/mnt/ausf/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-ausfd
elif [[ "$COMPONENT_NAME" =~ ^(bsf-[[:digit:]]+$) ]]; then
elif [[ "$COMPONENT_NAME" =~ ^(bsf[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/bsf/bsf_init.sh && sleep 10 && \
/mnt/bsf/${COMPONENT_NAME}_init.sh && sleep 10 && \
cd install/bin && ./open5gs-bsfd
elif [[ "$COMPONENT_NAME" =~ ^(hss-[[:digit:]]+$) ]]; then
elif [[ "$COMPONENT_NAME" =~ ^(hss[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/hss/hss_init.sh && \
/mnt/hss/${COMPONENT_NAME}_init.sh && \
cd install/bin && sleep 10 && ./open5gs-hssd
elif [[ "$COMPONENT_NAME" =~ ^(mme-[[:digit:]]+$) ]]; then
elif [[ "$COMPONENT_NAME" =~ ^(mme[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/mme/mme_init.sh && \
/mnt/mme/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-mmed
elif [[ "$COMPONENT_NAME" =~ ^(nrf-[[:digit:]]+$) ]]; then
elif [[ "$COMPONENT_NAME" =~ ^(nrf[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/nrf/nrf_init.sh && \
cd install/bin && ./open5gs-nrfd
elif [[ "$COMPONENT_NAME" =~ ^(scp-[[:digit:]]+$) ]]; then
/mnt/nrf/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-nrfd
elif [[ "$COMPONENT_NAME" =~ ^(scp[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/scp/scp_init.sh && \
cd install/bin && ./open5gs-scpd
elif [[ "$COMPONENT_NAME" =~ ^(nssf-[[:digit:]]+$) ]]; then
/mnt/scp/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-scpd
elif [[ "$COMPONENT_NAME" =~ ^(nssf[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/nssf/nssf_init.sh && \
cd install/bin && ./open5gs-nssfd
elif [[ "$COMPONENT_NAME" =~ ^(pcf-[[:digit:]]+$) ]]; then
/mnt/nssf/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-nssfd
elif [[ "$COMPONENT_NAME" =~ ^(pcf[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/pcf/pcf_init.sh && sleep 10 && \
cd install/bin && ./open5gs-pcfd
elif [[ "$COMPONENT_NAME" =~ ^(pcrf-[[:digit:]]+$) ]]; then
/mnt/pcf/${COMPONENT_NAME}_init.sh && sleep 10 && \
cd install/bin && ./open5gs-pcfd
elif [[ "$COMPONENT_NAME" =~ ^(pcrf[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/pcrf/pcrf_init.sh && sleep 10 && \
cd install/bin && ./open5gs-pcrfd
elif [[ "$COMPONENT_NAME" =~ ^(sgwc-[[:digit:]]+$) ]]; then
/mnt/pcrf/${COMPONENT_NAME}_init.sh && sleep 10 && \
cd install/bin && ./open5gs-pcrfd
elif [[ "$COMPONENT_NAME" =~ ^(sgwc[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/sgwc/sgwc_init.sh && \
cd install/bin && ./open5gs-sgwcd
elif [[ "$COMPONENT_NAME" =~ ^(sgwu-[[:digit:]]+$) ]]; then
/mnt/sgwc/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-sgwcd
elif [[ "$COMPONENT_NAME" =~ ^(sgwu[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/sgwu/sgwu_init.sh && \
cd install/bin && ./open5gs-sgwud
elif [[ "$COMPONENT_NAME" =~ ^(smf-[[:digit:]]+$) ]]; then
/mnt/sgwu/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-sgwud
elif [[ "$COMPONENT_NAME" =~ ^(smf[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/smf/smf_init.sh && \
cd install/bin && ./open5gs-smfd
elif [[ "$COMPONENT_NAME" =~ ^(udm-[[:digit:]]+$) ]]; then
/mnt/smf/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-smfd
elif [[ "$COMPONENT_NAME" =~ ^(udm[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/udm/udm_init.sh && \
cd install/bin && ./open5gs-udmd
elif [[ "$COMPONENT_NAME" =~ ^(udr-[[:digit:]]+$) ]]; then
/mnt/udm/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-udmd
elif [[ "$COMPONENT_NAME" =~ ^(udr[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/udr/udr_init.sh && sleep 10 && \
cd install/bin && ./open5gs-udrd
elif [[ "$COMPONENT_NAME" =~ ^(upf-[[:digit:]]+$) ]]; then
/mnt/udr/${COMPONENT_NAME}_init.sh && sleep 10 && \
cd install/bin && ./open5gs-udrd
elif [[ "$COMPONENT_NAME" =~ ^(upf[[:digit:]]*$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/upf/upf_init.sh && \
cd install/bin && ./open5gs-upfd
/mnt/upf/${COMPONENT_NAME}_init.sh && \
cd install/bin && ./open5gs-upfd
elif [[ "$COMPONENT_NAME" =~ ^(webui) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
sleep 10 && /mnt/webui/webui_init.sh