diff --git a/5gms-docker-setup/Dockerfile-Application-Function b/5gms-docker-setup/Dockerfile-Application-Function new file mode 100644 index 0000000..4da111c --- /dev/null +++ b/5gms-docker-setup/Dockerfile-Application-Function @@ -0,0 +1,62 @@ +# Use an official Ubuntu as a parent image +FROM ubuntu:24.04 + +# Avoid any questions +ARG DEBIAN_FRONTEND=noninteractive + +# Install dependencies +RUN apt-get update && \ + apt-get install -y \ + bison \ + build-essential \ + curl \ + flex \ + git \ + default-jdk \ + ninja-build wget \ + python3-pip \ + python3-venv \ + python3-setuptools \ + python3-wheel \ + python3-yaml \ + python3-aiofiles \ + python3-build \ + python3-h11 \ + python3-h2 \ + python3-httpx\ + python3-openssl \ + libsctp-dev \ + libgnutls28-dev \ + libgcrypt-dev \ + libssl-dev \ + libidn11-dev \ + libmongoc-dev \ + libbson-dev \ + libyaml-dev \ + libnghttp2-dev \ + libmicrohttpd-dev \ + libcurl4-gnutls-dev \ + libnghttp2-dev \ + libtins-dev \ + libtalloc-dev cmake \ + libpcre2-dev + +RUN apt-get update && apt-get install -y meson python3-venv python3-pip + +# Clone the repository +RUN git clone --recurse-submodules https://github.com/5G-MAG/rt-5gms-application-function.git + +# Set working directory +WORKDIR /rt-5gms-application-function + +# Update submodules +RUN git submodule update + +# Build the application +RUN meson build && ninja -C build + +# Install the application +RUN meson install --no-rebuild -C build + +# Command to run the application with the configuration file +CMD ["/usr/local/bin/open5gs-msafd", "-c", "/etc/open5gs/alternate-msaf.yaml"] diff --git a/5gms-docker-setup/Dockerfile-Application-Server b/5gms-docker-setup/Dockerfile-Application-Server new file mode 100644 index 0000000..97bbdb4 --- /dev/null +++ b/5gms-docker-setup/Dockerfile-Application-Server @@ -0,0 +1,38 @@ +# Use Ubuntu 22.04 as a parent image +FROM ubuntu:22.04 + +# Install dependencies +RUN apt-get update && \ + apt-get install -y \ + git \ + python3-pip \ + python3-venv \ + wget \ + default-jdk \ + && apt-get clean + +# Install Openresty +RUN apt-get -y install --no-install-recommends wget gnupg ca-certificates lsb-release && \ + wget -O - https://openresty.org/package/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/openresty.gpg && \ + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] http://openresty.org/package/arm64/ubuntu $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/openresty.list > /dev/null && \ + apt-get update && \ + apt-get -y install openresty + +# Add Openresty version of nginx to the path +ENV PATH="/usr/local/openresty/nginx/sbin:$PATH" + +# Disable and stop nginx and openresty services +RUN systemctl disable --now nginx.service openresty.service || true + +# Clone the repository +RUN git clone --recurse-submodules https://github.com/5G-MAG/rt-5gms-application-server.git /5gms-application-server + +# Set the working directory +WORKDIR /5gms-application-server + +# Install Python dependencies +RUN python3 -m pip install --upgrade pip setuptools && \ + python3 -m pip install . + +# Command to run the application +CMD ["5gms-application-server","-c","/etc/5gmag/as/conf/application-server.conf"] diff --git a/5gms-docker-setup/Readme.md b/5gms-docker-setup/Readme.md new file mode 100644 index 0000000..3273722 --- /dev/null +++ b/5gms-docker-setup/Readme.md @@ -0,0 +1,57 @@ +# 5G Media Streaming - Docker Compose Setup + +This project provides a docker-compose setup to run the 5GMS Application Function and the 5GMS Application Server +in a local Docker container environment. The setup includes Docker files for the Application Function and the Application +Server. In addition, it includes a Docker Compose file to +connect the two projects. The configuration files included in this project can be edited on the host machine and +are mounted to the respective Docker container during runtime. + +## Installation + +Navigate to the `5gms-docker-setup` folder of this repository: + +` cd 5gms-docker-setup` + +Start Docker Compose to build the containers and start the services: + +`docker-compose up` + +## Usage + +After the containers are built and started, the 5GMS Application Function and the 5GMS Application Server are available +via the host machine. As an example, running the following curl command will create a provisioning session via the `M1` +interface of the Application Function: + +````shell +curl -X POST http://localhost:5555/3gpp-m1/v2/provisioning-sessions \ + -H "Content-Type: application/json" \ + -d '{ + "aspId": "aspId", + "appId": "appId", + "provisioningSessionType": "DOWNLINK" + }' + +```` + +By default the following ports are exposed to the host machine: + +* Application Function `M1` interface: Port `5555` +* Application Function `M5` interface: Port `7778` +* Application Server `M4` interface: Port `80` + +## Configuration + +The configuration files for the 5GMS Application Function and the 5GMS Application Server are located in `msaf.yaml` and +`application-server.conf` respectively. The configuration files are mounted to the respective Docker container during +runtime. + +By default, the M1 and M5 interface of the Application Function run on ports +`5555` and `7778` and are exposed to the host machine. + +The Application Server runs on port `80` which is also available on the host machine. + +For details on the configuration options, please refer to our documentation of +the [Application Function](https://5g-mag.github.io/Getting-Started/pages/5g-media-streaming/usage/application-function/configuration-5GMSAF.html) +and +the [Application Server](https://5g-mag.github.io/Getting-Started/pages/5g-media-streaming/usage/application-server/testing-AS.html#testing). + diff --git a/5gms-docker-setup/application-server.conf b/5gms-docker-setup/application-server.conf new file mode 100644 index 0000000..3cde973 --- /dev/null +++ b/5gms-docker-setup/application-server.conf @@ -0,0 +1,214 @@ +############################################################################# +# 5G-MAG Reference Tools: 5GMS application server example configuration file +############################################################################# +# Author: David Waring +# License: 5G-MAG Public Licence v1.0 +# Copyright: © 2022 British Broadcasting Corporation +# +# For full license terms please see the LICENSE file distributed with this +# program. If this file is missing then the license can be retrieved from +# https://drive.google.com/file/d/1cinCiA778IErENZ3JN52VFW-1ffHpx7Z/view +############################################################################# +# +# This is an example configuration file for the 5G-MAG Reference Tools 5GMS +# Application Server. This file contains a description of the configuration +# settings available and their default values. +# + +### Defaults for the 5G-MAG Reference Tools: 5GMS applications +[DEFAULT] +#log_dir = /var/log/rt-5gms +#run_dir = /run/rt-5gms + + + +### 5GMS Application Server specific configurations +[5gms_as] +# log_level - The logging level for the 5GMS Application Server +# +# This sets the minimum logging level of the 5GMS Application Server. +# The field can be one of: debug, info, warn, error or fatal. +# +# Default is info +log_level = debug + +# cache_dir - The directory to hold cached objects in +# +# The actual format of files and subdirectories within this directory is +# dependant on the web proxy/server chosen at run-time. +# +# If this setting is empty or omitted then the web proxy/server will run +# without a disk cache. +# +# For the nginx web proxy it is advisable to locate this directory on the same +# filesystem partition as the temporary directories to make moving objects from +# temporary stores to the disk cache more efficient. +# +# Default is /var/cache/rt-5gms/as/cache +#cache_dir = /var/cache/rt-5gms/as/cache + +# docroot - The top level directory which will hold the document roots +# +# This is a directory which will hold the document roots for each virtual +# server. This prefix will be followed by the hostname of the server to which +# this root applies. +# +# Default is /var/cache/rt-5gms/as/docroots +#docroot = /var/cache/rt-5gms/as/docroots + +# http_port - The TCP port number to listen for HTTP requests on +# +# This determines which port the web proxy/server will bind to for distribution +# configurations without a security certificate. +# +# The default is port 80 +http_port = 80 + +# https_port - The TCP port number to listen for TLS based HTTP requests on +# +# This determines which port the web proxy/server will bind to for distribution +# configurations with an associated security certificate. +# +# The default port is 443 +#https_port = 443 + +# m3_listen - The IP address or hostname to listen for M3 requests on +# +# This determines which addresses the M3 configuration channel will bind to +# when listening for new connections from 5GMS Application Functions. +# This interface is used by the 5GMS Application Function to configure the +# 5GMS Application Server. +# +# See also: m3_port +# +# The default listening address is localhost +m3_listen = 0.0.0.0 + +# m3_port - The TCP port number to listen for M3 requests on +# +# This determines which port the M3 configuration channel will listen on. +# This interface is used by the 5GMS Application Function to configure the +# 5GMS Application Server. +# +# See also: m3_listen +# +# The default port is 7777 +m3_port = 7777 + +# access_log - The location to write the web proxy/server access log. +# +# This is the path to the file to log access requests in. +# +# The default is /var/log/rt-5gms/application-server-access.log +#access_log = %(log_dir)s/application-server-access.log + +# error_log - The location to write the web proxy/server access log. +# +# This is the path to the file to log access requests in. +# +# The default is /var/log/rt-5gms/application-server-error.log +#error_log = %(log_dir)s/application-server-error.log + +# pid_path - Path for the process identifier for the 5gms application server +# +# The top level process id will be written to this file. +# +# The default is /run/rt-5gms/application-server.pid +#pid_path = %(run_dir)s/application-server.pid + +# provisioning_session_id - Provisioning session for this application server +# +# This is the provisioning session identifier for this application server (AS) +# instance. This is the session ID as allocated to the application provider +# (AP) by the application function (AF) during the ProvisioningSessions. +# +# The default is d54a1fcc-d411-4e32-807b-2c60dbaeaf5f +#provisioning_session_id = d54a1fcc-d411-4e32-807b-2c60dbaeaf5f + +# m4d_path_prefix - Path prefix for the M4d interface +# +# This is the path prefix that will be used on all media accesses for this +# provisioning session. +# +# The default is /m4d/provisioning-session-/ +#m4d_path_prefix = /m4d/provisioning-session-%(provisioning_session_id)s/ + + +### 5GMS Application Server nginx specific configuration +[5gms_as.nginx] +# config_file - The path in which the NGINX configuration file will be stored +#config_file = /tmp/rt_5gms_as.conf + +# root_temp - variable to hold the top level temporary store directory +#root_temp = /var/cache/rt-5gms/as + +# client_body_temp - Temporary disk store for client request body contents +# +# nginx temporary storage area for client request body contents. This must be +# specified as a valid directory and cannot be empty. +# +# See: https://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_temp_path +# +# Default is /tmp/rt-5gms-as/client-body-tmp +#client_body_temp = %(root_temp)s/client-body-tmp + +# proxy_temp - Temporary disk store for proxied responses +# +# nginx temporary storage area for proxied response body contents. This must be +# specified as a valid directory and cannot be empty. +# +# It is advisable to place this directory on the same filesystem partition as +# the main cache directories (see 5gms_as.cache_dir above). +# +# See: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_temp_path +# +# Default is /tmp/rt-5gms-as/proxy-tmp +#proxy_temp = %(root_temp)s/proxy-tmp + +# fastcgi_temp - Temporary disk store for fastcgi server responses +# +# nginx storage area for responses from a backend fastcgi server. This must be +# specified as a valid directory and cannot be empty. +# +# See: https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_temp_path +# +# Default is /tmp/rt-5gms-as/fastcgi-tmp +#fastcgi_temp = %(root_temp)s/fastcgi-tmp + +# uwsgi_temp - Temporary disk store for uwsgi server responses +# +# nginx storage area for responses from a backend uwsgi server. This must be +# specified as a valid directory and cannot be empty. +# +# See: https://nginx.org/en/docs/http/ngx_http_uwsgi_module.html#uwsgi_temp_path +# +# Default is /tmp/rt-5gms-as/uwsgi-tmp +#uwsgi_temp = %(root_temp)s/uwsgi-tmp + +# scgi_temp - Temporary disk store for SCGI server responses +# +# nginx storage area for responses from a backend SCGI server. This must be +# specified as a valid directory and cannot be empty. +# +# See: https://nginx.org/en/docs/http/ngx_http_scgi_module.html#scgi_temp_path +# +# Default is /tmp/rt-5gms-as/scgi-tmp +#scgi_temp = %(root_temp)s/scgi-tmp + +# pid_path - File location to store the PID of the nginx process +# +# The nginx daemon will store the pid of its process in this file. +# +# See: https://nginx.org/en/docs/ngx_core_module.html#pid +# +# Default is /tmp/rt-5gms-as/5gms-as-nginx.pid +#pid_path = %(root_temp)s/5gms-as-nginx.pid + +# resolvers - DNS resolvers for NGinx +# +# This is a space separated list of DNS resolvers that Nginx should use. +# +# See: https://nginx.org/en/docs/ngx_http_core_module.html#resolver +# +# Default is 127.0.0.53 (use local systemd-resolved) +resolvers = 127.0.0.11 diff --git a/5gms-docker-setup/docker-compose.yml b/5gms-docker-setup/docker-compose.yml new file mode 100644 index 0000000..bfe4eb2 --- /dev/null +++ b/5gms-docker-setup/docker-compose.yml @@ -0,0 +1,23 @@ +services: + application-server: + build: + context: ./ + dockerfile: Dockerfile-Application-Server + ports: + - "80:80" + volumes: + - ./application-server.conf:/etc/5gmag/as/conf/application-server.conf + + application-function: + build: + context: ./ + dockerfile: Dockerfile-Application-Function + ports: + - "5555:5555" + - "7778:7778" + - "4444:4444" + volumes: + - ./msaf.yaml:/etc/open5gs/alternate-msaf.yaml + + +# See: https://docs.docker.com/compose/how-tos/networking/ diff --git a/5gms-docker-setup/msaf.yaml b/5gms-docker-setup/msaf.yaml new file mode 100644 index 0000000..8f6d204 --- /dev/null +++ b/5gms-docker-setup/msaf.yaml @@ -0,0 +1,300 @@ +# License: 5G-MAG Public License (v1.0) +# Author: Dev Audsin +# Copyright: (C) 2022-2023 British Broadcasting Corporation +# +# For full license terms please see the LICENSE file distributed with this +# program. If this file is missing then the license can be retrieved from +# https://drive.google.com/file/d/1cinCiA778IErENZ3JN52VFW-1ffHpx7Z/view +# +#=========================================================================== +# +logger: + level: info +# +# o Set OGS_LOG_INFO to all domain level +# - If `level` is omitted, the default level is OGS_LOG_INFO) +# - If `domain` is omitted, the all domain level is set from 'level' +# (Nothing is needed) +# +# o Set OGS_LOG_ERROR to all domain level +# - `level` can be set with none, fatal, error, warn, info, debug, trace +# level: error +# +# o Set OGS_LOG_DEBUG to mme/emm domain level +# level: debug +# domain: mme,emm +# +# o Set OGS_LOG_TRACE to all domain level +# level: trace +# domain: core,sbi,udm,event,tlv,mem,sock +# +# logger: +# file: /home/ubuntu/af/open5gs/build/log/msaf.log +# + +# sbi: +# Global SBI parameters +# +# o No Server TLS - Client connection can use TLS without certificates +# server: +# no_tls: true +# client: +# no_tls: true +# +# o Server TLS used - Client connection can use TLS without certificates +# server: +# no_tls: false +# cacert: /path/to/tls/trusted/ca.crt +# key: /path/to/tls/private/testserver.key +# cert: /path/to/tls/public/testserver.crt +# client: +# no_tls: true +# +# o Server TLS used - Client TLS certificates used +# server: +# no_tls: false +# cacert: /path/to/tls/trusted/ca.crt +# key: /path/to/tls/private/testserver.key +# cert: /path/to/tls/public/testserver.crt +# client: +# no_tls: false +# cacert: /path/to/tls/trusted/ca.crt +# key: /path/to/tls/private/testclient.key +# cert: /path/to/tls/public/testclient.crt +# +sbi: + server: + no_tls: true + client: + no_tls: true + +# udm: +# +# +# +# o SBI Server(http://:80) +# sbi: +# +# o SBI Server(http://:80) +# sbi: +# - addr: +# - 0.0.0.0 +# - ::0 +# port: 7777 +# +# o SBI Server(https://:443) +# sbi: +# - tls: +# key: udm.key +# pem: udm.pem +# +# o SBI Server(https://127.0.0.12:443, http://[::1]:80) +# sbi: +# - addr: 127.0.0.12 +# tls: +# key: udm.key +# pem: udm.pem +# - addr: ::1 +# +# o SBI Server(http://udm.open5gs.org:80) +# sbi: +# - name: udm.open5gs.org +# +# o SBI Server(http://127.0.0.12:7777) +# sbi: +# - addr: 127.0.0.12 +# port: 7777 +# +# o SBI Server(http://:80) +# sbi: +# - dev: eth0 +# +# o Provide custom SBI address to be advertised to NRF +# sbi: +# - dev: eth0 +# advertise: open5gs-udm.svc.local +# +# sbi: +# - addr: localhost +# advertise: +# - 127.0.0.99 +# - ::1 +# +# o SBI Option (Default) +# - tcp_nodelay : true +# - so_linger.l_onoff : false +# +# sbi: +# addr: 127.0.0.12 +# option: +# tcp_nodelay: false +# so_linger: +# l_onoff: true +# l_linger: 10 +# +# +# +# o NF Service Name(Default : all NF services available) +# service_name: +# +# o NF Service Name(Only some NF services are available) +# service_name: +# - nudm-sdm +# - nudm-uecm +# - nudm-ueau +# +# +# +# o (Default) If you do not set Query Parameter as shown below, +# +# sbi: +# - addr: 127.0.0.12 +# port: 7777 +# +# - 'service-names' is included. +# +# sbi: +# - addr: 127.0.0.12 +# port: 7777 +# discovery: +# option: +# no_service_names: false +# +# o To remove 'service-names' from URI query parameters in NS Discovery +# no_service_names: true +# +# * For Indirect Communication with Delegated Discovery, +# 'service-names' is always included in the URI query parameter. +# * That is, 'no_service_names' has no effect. +# +msaf: + open5gsIntegration: false + sbi: + - addr: 127.0.0.22 + port: 7777 + m1: + - addr: 0.0.0.0 + port: 5555 + m5: + - addr: 0.0.0.0 + port: 7778 + maf: + - addr: 127.0.0.25 + port: 7777 + applicationServers: + - canonicalHostname: localhost + urlPathPrefixFormat: /m4d/provisioning-session-{provisioningSessionId}/ + m3Port: 7777 + m3Host: application-server + certificateManager: "@default-certmgr@" + serverResponseCacheControl: + - maxAge: 60 + m1ProvisioningSessions: 60 + m1MetricsReportingConfiguration: 60 + m1ContentHostingConfigurations: 60 + m1ServerCertificates: 60 + m1ContentProtocols: 86400 + m1ConsumptionReportingConfiguration: 60 + m5ServiceAccessInformation: 60 + dataCollectionDir: "@data-collection-dir@" + offerNetworkAssistance: false +# networkAssistance: +# deliveryBoost: +# minDlBitRate: 1 Mbps +# boostPeriod: 30 + + +# nrf: +# +# > +# +# o SBI Client(http://127.0.0.10:7777) +# sbi: +# addr: 127.0.0.10 +# port: 7777 +# +# o SBI Client(https://127.0.0.10:443, http://nrf.open5gs.org:80) +# sbi: +# - addr: 127.0.0.10 +# tls: +# key: nrf.key +# pem: nrf.pem +# - name: nrf.open5gs.org +# +# o SBI Client(http://[fd69:f21d:873c:fa::1]:80) +# If prefer_ipv4 is true, http://127.0.0.10:80 is selected. +# +# sbi: +# addr: +# - 127.0.0.10 +# - fd69:f21d:873c:fa::1 +# +# o SBI Option (Default) +# - tcp_nodelay : true +# - so_linger.l_onoff : false +# +# sbi: +# addr: 127.0.0.10 +# option: +# tcp_nodelay: false +# so_linger: +# l_onoff: true +# l_linger: 10 +# +nrf: + sbi: + - addr: + - 127.0.0.10 + - ::1 + port: 7777 + +bsf: + notificationListener: + - addr: + - 127.0.0.99 + port: 7779 + +# +# parameter: +# +# o Disable use of IPv4 addresses (only IPv6) +# no_ipv4: true +# +# o Disable use of IPv6 addresses (only IPv4) +# no_ipv6: true +# +# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections. +# prefer_ipv4: true +# +parameter: + +# +# max: +# +# o Maximum Number of UE +# ue: 1024 +# o Maximum Number of Peer(S1AP/NGAP, DIAMETER, GTP, PFCP or SBI) +# peer: 64 +# +max: + +# +# time: +# +# o NF Instance Heartbeat (Default : 0) +# NFs will not send heart-beat timer in NFProfile +# NRF will send heart-beat timer in NFProfile +# +# o NF Instance Heartbeat (20 seconds) +# NFs will send heart-beat timer (20 seconds) in NFProfile +# NRF can change heart-beat timer in NFProfile +# +# nf_instance: +# heartbeat: 20 +# +# o Message Wait Duration (Default : 10,000 ms = 10 seconds) +# +# o Message Wait Duration (3000 ms) +# message: +# duration: 3000 +time: diff --git a/Readme.md b/Readme.md index c29b0fe..c23090e 100644 --- a/Readme.md +++ b/Readme.md @@ -12,6 +12,14 @@ new features for 5GMS. Additional information can be found at: https://5g-mag.github.io/Getting-Started/pages/5g-media-streaming/ +## 5G Media Streaming - Docker Compose Setup + +This project provides a docker-compose setup to run the 5GMS Application Function and the 5GMS Application Server +components in a local container environment. The setup includes +Docker files for the Application Function and the Application Server. In addition, it includes a Docker Compose file to +connect the two components. The configuration files included in this project can be edited on the host machine and +are mounted to the respective Docker container during runtime. + ## Express Mock AF This project provides a very simple HTTP server that implements two routes.