Commit 26e505c8 authored by Mudassar Khan's avatar Mudassar Khan
Browse files

add demo11 to examples folder

parent d24a53e3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
# Demo11
Demo11 scenario showcases the used with AdvantEDGE or ETSI MEC Sandbox to demonstrate interactions between edge applications and Open CAPIF platform using MEC 011.
 No newline at end of file
+25 −0
Original line number Diff line number Diff line
#!/bin/bash

# Get full path to script directory
SCRIPT=$(readlink -f "$0")
BASEDIR=$(dirname "$SCRIPT")

echo ""
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ">>> Building Demo Service Frontend"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ""
"$BASEDIR/src/client/build.sh"
"$BASEDIR/src/frontend/build.sh"

DEMOBIN="$BASEDIR/bin/demo-server"

echo ""
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ">>> Building Demo 11 Go Server"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ""
"$BASEDIR/src/backend/build.sh" "$DEMOBIN"

echo ""
echo ">>> Demo Service build completed"
+20 −0
Original line number Diff line number Diff line
# This file defines the configuration of Demo11 edge application. All fields are required to run demo11 on MEC Sandbox 

# Set where mec application is running either on MEC Sandbox or AdvantEDGE. Expected fields: sandbox | advantedge
mode: 'sandbox'
# Set url of mec platform. Example field format: http://{MEC_IP_ADDRESS}/{SANDBOX_NAME}/{MEP_NAME}/ 
sandbox: '<sandbox_url>'
# Set if sandbox url uses https. Expected fields: true | false 
https: true 
# Set the mec platform name demo11 will run on. Example field: mep1
mecplatform: ''
# Set user-application ID that is generated on MEC Sandbox frontend. Example field format: 7930ba6d-4581-444c-b966-3312517f3a51
appid: ''
# Set host address of demo11. 
localurl: 'http://'
# Set host port number of demo11. Example field: '8093'
port: '8093'
# CAPIF credentials - used to onboard as API invoker and discover services
capif_admin_user: 'admin'
capif_admin_password: 'password123'
capif_user_password: 'password123'
+35 −0
Original line number Diff line number Diff line
#!/bin/bash

# Get full path to script directory
SCRIPT=$(readlink -f "$0")
BASEDIR=$(dirname "$SCRIPT")

DEMOBIN="$BASEDIR/bin/demo-server"

echo ""
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ">>> Dockerizing Demo11 Server"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ""

# Copy frontend to demo-server folder
rm -r "$DEMOBIN/static"
mkdir -p "$DEMOBIN/static"

# Copy frontend to static folder
echo ">>> Copying Demo Server"
cp -Rf "$BASEDIR/bin/demo-frontend/"* "$DEMOBIN/static"

# Copy Dockerfile & config to bin folder
cp "$BASEDIR/src/backend/Dockerfile" "$DEMOBIN"
# cp "$BASEDIR/src/backend/app_instance.yaml" "$DEMOBIN"
cp "$BASEDIR/entrypoint.sh" "$DEMOBIN"

echo ">>> Dockerizing"
cd "$DEMOBIN"
docker build --no-cache --rm -t meep-docker-registry:30001/demo11 .
docker push meep-docker-registry:30001/demo11
cd "$BASEDIR"

echo ""
echo ">>> Done"
+33 −0
Original line number Diff line number Diff line
#!/bin/bash
set -e

# Derive MEP name from injected env vars (e.g. MEP1_MEEP_APP_ENABLEMENT_SERVICE_HOST → mep1)
MEEP_MEP_NAME=$(env | grep -oP '^(MEP[^_]+)_MEEP_APP_ENABLEMENT_SERVICE_HOST' | head -1 | sed 's/_MEEP_APP_ENABLEMENT_SERVICE_HOST//' | tr '[:upper:]' '[:lower:]')

if [ -z "${MEEP_MEP_NAME}" ]; then
    echo "ERROR: Could not detect MEP name from environment variables" >&2
    exit 1
fi

# Build MEC platform base URL: http://<sandbox_ip>/<sandbox_name>/<mep_name>
MEEP_BASE_URL="https://${sandbox}/${MEEP_SANDBOX_NAME}/${MEEP_MEP_NAME}"

echo "mode: sandbox" >app_instance.yaml
echo "sandbox: ${MEEP_BASE_URL}" >>app_instance.yaml
echo "https: true" >>app_instance.yaml
echo "mecplatform: ${MEEP_MEP_NAME}" >>app_instance.yaml
echo "appid: ${MEEP_APP_ID}" >>app_instance.yaml
echo "localurl: ${MEEP_POD_NAME}" >>app_instance.yaml
echo "port: 80" >>app_instance.yaml
echo "capif_admin_user: '${CAPIF_ADMIN_USER:-admin}'" >>app_instance.yaml
echo "capif_admin_password: '${CAPIF_ADMIN_PASSWORD:-password123}'" >>app_instance.yaml
echo "capif_user_password: '${CAPIF_USER_PASSWORD:-password123}'" >>app_instance.yaml

# Generate self-signed TLS certificate if not already present
if [ ! -f server.crt ] || [ ! -f server.key ]; then
    openssl req -x509 -newkey rsa:2048 -keyout server.key -out server.crt \
        -days 3650 -nodes -subj "/CN=demo11"
fi

# Start service
exec /demo-server ./app_instance.yaml
Loading