Skip to content

Commit

Permalink
Refactor to facilitate deployment of multiple instances of a service
Browse files Browse the repository at this point in the history
  • Loading branch information
herlesupreeth committed Jan 17, 2025
1 parent fa9a798 commit 661def8
Show file tree
Hide file tree
Showing 31 changed files with 2,564 additions and 199 deletions.
18 changes: 9 additions & 9 deletions 4g-external-ims-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=hss-1
- COMPONENT_NAME=hss
volumes:
- ./hss:/mnt/hss
- ./log:/open5gs/install/var/log/open5gs
Expand All @@ -67,7 +67,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=sgwc-1
- COMPONENT_NAME=sgwc
volumes:
- ./sgwc:/mnt/sgwc
- ./log:/open5gs/install/var/log/open5gs
Expand All @@ -88,7 +88,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=sgwu-1
- COMPONENT_NAME=sgwu
volumes:
- ./sgwu:/mnt/sgwu
- ./log:/open5gs/install/var/log/open5gs
Expand All @@ -108,7 +108,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=smf-1
- COMPONENT_NAME=smf
- DEPLOY_MODE=4G
volumes:
- ./smf:/mnt/smf
Expand All @@ -135,7 +135,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=upf-1
- COMPONENT_NAME=upf
volumes:
- ./upf:/mnt/upf
- ./log:/open5gs/install/var/log/open5gs
Expand Down Expand Up @@ -165,7 +165,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=mme-1
- COMPONENT_NAME=mme
volumes:
- ./mme:/mnt/mme
- ./log:/open5gs/install/var/log/open5gs
Expand All @@ -190,7 +190,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=pcrf-1
- COMPONENT_NAME=pcrf
depends_on:
- mongo
volumes:
Expand Down Expand Up @@ -275,7 +275,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=osmomsc-1
- COMPONENT_NAME=osmomsc
depends_on:
- osmohlr
expose:
Expand All @@ -295,7 +295,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=osmohlr-1
- COMPONENT_NAME=osmohlr
expose:
- "4222/tcp"
networks:
Expand Down
26 changes: 13 additions & 13 deletions 4g-volte-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=hss-1
- COMPONENT_NAME=hss
volumes:
- ./hss:/mnt/hss
- ./log:/open5gs/install/var/log/open5gs
Expand All @@ -69,7 +69,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=sgwc-1
- COMPONENT_NAME=sgwc
volumes:
- ./sgwc:/mnt/sgwc
- ./log:/open5gs/install/var/log/open5gs
Expand All @@ -90,7 +90,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=sgwu-1
- COMPONENT_NAME=sgwu
volumes:
- ./sgwu:/mnt/sgwu
- ./log:/open5gs/install/var/log/open5gs
Expand All @@ -110,7 +110,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=smf-1
- COMPONENT_NAME=smf
- DEPLOY_MODE=4G
volumes:
- ./smf:/mnt/smf
Expand Down Expand Up @@ -139,7 +139,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=upf-1
- COMPONENT_NAME=upf
volumes:
- ./upf:/mnt/upf
- ./log:/open5gs/install/var/log/open5gs
Expand Down Expand Up @@ -170,7 +170,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=mme-1
- COMPONENT_NAME=mme
volumes:
- ./mme:/mnt/mme
- ./log:/open5gs/install/var/log/open5gs
Expand All @@ -197,7 +197,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=pcrf-1
- COMPONENT_NAME=pcrf
depends_on:
- mongo
volumes:
Expand Down Expand Up @@ -308,7 +308,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=icscf-1
- COMPONENT_NAME=icscf
depends_on:
- dns
- mysql
Expand All @@ -332,7 +332,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=scscf-1
- COMPONENT_NAME=scscf
depends_on:
- dns
- mysql
Expand All @@ -359,7 +359,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=pcscf-1
- COMPONENT_NAME=pcscf
- DEPLOY_MODE=4G
depends_on:
- dns
Expand Down Expand Up @@ -390,7 +390,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=smsc-1
- COMPONENT_NAME=smsc
depends_on:
- dns
- mysql
Expand All @@ -411,7 +411,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=osmomsc-1
- COMPONENT_NAME=osmomsc
depends_on:
- osmohlr
expose:
Expand All @@ -431,7 +431,7 @@ services:
env_file:
- .env
environment:
- COMPONENT_NAME=osmohlr-1
- COMPONENT_NAME=osmohlr
expose:
- "4222/tcp"
networks:
Expand Down
90 changes: 45 additions & 45 deletions base/open5gs_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion custom_deployments/with_eupf/nr-gnb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
env_file:
- .custom_env
environment:
- COMPONENT_NAME=ueransim-gnb-1
- COMPONENT_NAME=ueransim-gnb
expose:
- "38412/sctp"
- "2152/udp"
Expand Down
2 changes: 1 addition & 1 deletion custom_deployments/with_eupf/nr-ue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
env_file:
- .custom_env
environment:
- COMPONENT_NAME=ueransim-ue-1
- COMPONENT_NAME=ueransim-ue
expose:
- "4997/udp"
cap_add:
Expand Down
Loading

0 comments on commit 661def8

Please sign in to comment.