You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Next »

This page will guide you through publishing your DAC app to the RDK ASMS cloud, then installing and running it on a Raspberry Pi (RPI). More detailed documentation of all the components used is available on their respective pages.

You will need

  • Raspberry Pi (RPI) 3B/3B+ or RPI 4
  • Balena Etcher to write the Raspberry Pi SD card: https://www.balena.io/etcher/
  • (lib32-)rdk-generic-mediaclient-image built for you RPI
  • Your own built DAC app: you only need the OCI image (.tar) and not a generated bundle (.tar.gz). See this wiki page. Not needed if you only want to install and run other people's published DAC apps.

Prepare your RPI

We will be installing and running DAC apps on the RPI so we need a good host image. The most recent RDK6 mediaclient image is ideal for this.

Build the mediaclient image for your RPI

The below commands must be run in an Ubuntu 18.04 environment with the necessary pre-requisites installed to run Bitbake. See here for the exact dependencies needed:
https://docs.yoctoproject.org/ref-manual/system-requirements.html#ubuntu-and-debian

For RPI3:

mkdir rpi3_mediaclient_nosrc_rdk6
cd rpi3_mediaclient_nosrc_rdk6

# Install 'repo' tool from: https://android.googlesource.com/tools/repo
repo init --no-clone-bundle -u https://code.rdkcentral.com/r/manifests -b rdk6-main -m rdkv-nosrc.xml
repo sync --no-clone-bundle -j$(getconf _NPROCESSORS_ONLN)

MACHINE=raspberrypi-rdk-mc source meta-cmf-raspberrypi/setup-environment
bitbake rdk-generic-mediaclient-image


For RPI4:

mkdir rpi4_mediaclient_nosrc_rdk6
cd rpi4_mediaclient_nosrc_rdk6

# Install 'repo' tool from: https://android.googlesource.com/tools/repo
repo init --no-clone-bundle -u https://code.rdkcentral.com/r/manifests -b rdk6-main -m rdkv-nosrc.xml
repo sync --no-clone-bundle -j$(getconf _NPROCESSORS_ONLN)

MACHINE=raspberrypi4-64-rdk-android-mc source meta-cmf-raspberrypi/setup-environment
bitbake lib32-rdk-generic-mediaclient-image

Flash it

  • Find and download the .wic.bz2 file from your build: find tmp/deploy/ -name *.wic.bz2
  • Flash it to the Raspberry Pi's SD card using Etcher. In principle it can handle a wic.bz2 directly but sometimes this doesn't work great. Unzipping it first can help: bzip2 -df xxx.wic.bz2
  • Resize the SD card using gParted so that the main ext3 partition is at least 2GB in size so that is has enough room to download and install all the apps you need
  • Insert the SD card back in the RaspberryPi and power up the Pi. Connect the Raspberry Pi to your network with an ethernet cable, and to your TV with a HDMI cable.
  • Make sure you can SSH into the Pi as this is important for later. The default user is root with no password
  • You should see the RDK Resident GUI application on your TV at bootup (after following some initial setup questions)

Configure ASMS

After boot-up you need to manually configure ASMS and the version+platform of your host:

  1. on your RPI, create the file /opt/appmanagerregistry.conf
  2. add the contents below to it in case you are using an RPI4.


{
  "app-catalog-cloud": {
    "url": "http://rdkm-asms-external-1156877020.eu-central-1.elb.amazonaws.com:8080/apps",
    "firmwareVersions": [
      {
        "platform": "rpi4",
        "ver": "1.0.0-e71889dc02521bfdc2f9f38f750b34224184c375-dbg"
      }
    ]
  }
}

For RPI3 you need a different platform and ver:

{
  "app-catalog-cloud": {
    "url": "http://rdkm-asms-external-1156877020.eu-central-1.elb.amazonaws.com:8080/apps",
    "firmwareVersions": [
      {
        "platform": "rpi3",
        "ver": "1.0.0-f4b0603d7d93dfa10ed932ddb0f324d334bc40f9-dbg"
      }
    ]
  }
}


The "ver" value can change sometimes when new features are added to DAC or when big platform changes happen. You can find the latest values in the dactest.py tool, also for other platforms.

Publish your DAC app

If you don't want to test or publish your own DAC app then you can skip this step and trie the already published demo apps in the next section. There are two ways to publish an app in ASMS:

  1. using the dactest.py test tool
  2. using the Swagger interface to manually publish the app

But before publishing the app into ASMS you first need to publish your DAC app's OCI image into a container registry that supports OCI compliant format.

Publish the OCI image in OCI registry

We offer 3 ways you as App developer can publish your OCI image in container registry :

  • You can publish your container image to any of public accessible OCI container registries on the internet. Requirement is that the registry supports OCI container format, the container is uploaded & stored there in the OCIcontainer image format (so not in docker format) and is fetchable/accessible (read only, without any user/login) from RDK DAC cloud system.
  • You can upload your OCI image to the private OCI registry "public.ecr.aws/a0v6o9z7" hosted as part of RDK DAC cloud. Procedure further detailed below. For that you do need to have/request an account & credentials for this registry, via email to Piotr Serafin  or bcatrysse@libertylgobal.com. (When there is time/money this should be improved and setup as part of registering as New Application maintainer in RDK DAC cloud system or Firebolt Connect system)
  • You can ask someone from RDK-M DAC cloud support team (who TBD, ad interim Piotr S or Stefan V or BartC ) to create repo associated with your app in this above registry and upload your provided OCI image there for version you specified

There are various tools to copy/upload/fetch oci images. 

Depending on the oci registry provider, there are various login/access credential procedures. We will not explain them all.

The instructions we are providing here below are specific to an amazon s3 OCI registry. And you will need the util programs  aws cli tools and skopeo.

Configure your profile, add to ~/.aws/credentials. Obviously you have to provide your own correct credentials:

[s3dacrdk]
aws_access_key_id = xxxxx
aws_secret_access_key = yyyyyy

Login, create repository and publish the OCI image:

# login
aws --profile s3dacrdk ecr-public get-login-password --region us-east-1 | skopeo login --username AWS --password-stdin public.ecr.aws/a0v6o9z7

# create repo
aws --profile s3dacrdk --region us-east-1 ecr-public create-repository --repository-name cobalt

# list repos
aws --profile s3dacrdk --region us-east-1 ecr-public describe-repositories

# upload image, the tag "latest" stand for latest version
skopeo copy oci-archive:dac-image-cobalt.tar docker://public.ecr.aws/a0v6o9z7/cobalt:latest


# download image (test)
skopeo copy docker://public.ecr.aws/a0v6o9z7/cobalt:latest oci:cobalttest

You have to remember the OCI image URL, which in this example is docker://public.ecr.aws/a0v6o9z7/cobalt:latest. You will need it when publishing the DAC app to ASMS.

Publish the DAC app using dactest.py tool

Among other things, dactest.py can be used list ASMS apps, add entries and remove entries. 

To add an entry to ASMS, i.e. to publish a DAC app you can follow these steps:

  1. on your development PC/laptop: install dactest.py dependencies. You need python3 and then pip3 install requests colorama websocket-client
  2. use ./dactest.py 192.168.0.117 (replace with your RPI IP)
  3. it will use the RDK ASMS to list apps available from the cloud. Use "A" to start the procedure to add an app to ASMS
  4. you will need to provide an id, name, version, the OCI image URL (see previous step) and a link to an icon to use. When prompted for "encryption" input "false". Unless you really want  to test encrypted DAC apps. But for this feature there is a separate wiki page to read. Extra steps are needed for encryption. You can skip that for now and don't use encryption.

Publish the DAC app using Swagger interface

This is the more difficult and manual way to add DAC apps. You can access the swagger UI here: http://rdkm-asms-external-1156877020.eu-central-1.elb.amazonaws.com:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config

You can use the POST /maintainers/{maintainerCode/apps RPC call to add an ASMS dac app. dactest.py uses "rdk" as maintainerCode. You will need to provide a POST body with the required contents.

Example POST body. Additionally you can check how dactest.py is doing it.

{
  "header": {
    "icon": "https://280222515084-default-apps-resources.s3.eu-central-1.amazonaws.com/images/apps/com.rdk.app.chocolate-doom.png",
    "name": "Chocolate Doom",
    "description": "Chocolate Doom aims to accurately reproduce the original DOS version of Doom and other games based on the Doom engine in a form that can be run on modern computers.",
    "type": "application/dac.native",
    "size": 10000000,
    "category": "application",
    "localization": [
      {
        "languageCode": "nld",
        "name": "Geweldige applicatie",
        "description": "Dit is een geweldige applicatie"
      }
    ],
    "id": "com.rdk.app.chocolate-doom",
    "version": "1.0.0",
    "visible": true,
    "encryption": false,
    "preferred": false,
    "ociImageUrl": "docker://public.ecr.aws/a0v6o9z7/chocolate-doom:latest"
  },
  "requirements": {
    "dependencies": [
      {
        "id": "com.libertyglobal.service.voice",
        "version": "1.0.0"
      }
    ],
    "platform": {
      "architecture": "arm",
      "variant": "v7",
      "os": "linux"
    },
    "hardware": {
      "ram": "512M",
      "dmips": "2000",
      "persistent": "60M",
      "cache": "200M"
    },
    "features": [
      {
        "name": "rdk.api.awc",
        "version": "2",
        "required": false
      }
    ]
  },
  "maintainer": {
    "code": "rdk",
    "name": "RDK",
    "address": "RDK Management, LLC",
    "homepage": "https://rdkcentral.com",
    "email": "support@rdkcentral.com"
  },
  "versions": [
    {
      "version": "1.0.0",
      "visible": true,
      "preferred": false,
      "encryption": false
    }
  ]
}


Install and run your DAC app from ASMS

There are two ways to install and run a DAC app from ASMS:

  1. using the RDK Resident UI
  2. using the dactest.py test tool

Using Resident UI

In the resident UI go to the icon with the 9 small squares (left bottom) to navigate to the DAC menu. There you will see three submenu items:

  1. My Apps: initially empty. From here you can start installed DAC apps. Use the "Home" key to exit a DAC app.
  2. App Catalog: these are the DAC apps from ASMS available for installation. If you published your app to ASMS you should see it here.
  3. Manage Apps: here you can uninstall DAC apps from your RPI

Using dactest.py tool

dactest.py can be used list, install, uninstall, start and stop DAC apps. It also connects to RDK ASMS to list available DAC apps in the cloud. The DAC apps downloaded from the cloud are generated to bundles inside that cloud and cached there. Sometimes the download can take a while if the bundle still needs to be generated for a specific platform and/or version.

So how to use dactest.py to install an app from ASMS:

  1. on your development PC/laptop: install dactest.py dependencies. You need python3 and then pip3 install requests colorama websocket-client
  2. by default the script is configured properly for RPI3. But for RPI4 you have to edit the script and set DEFAULT_ASMS_PLATFORM_RDK="rpi4" and DEFAULT_ASMS_FIRMWARE_RDK="1.0.0-e71889dc02521bfdc2f9f38f750b34224184c375-dbg". New: since recently dactest.py will fetch this configuration from LISA itself and use it. No need to edit these anymore.
  3. use ./dactest.py 192.168.0.117 (replace with your RPI IP)
  4. it will use the RDK ASMS to list apps available from the cloud. Use "Ix" where x is the number/index of the app you want to install. Later you can use "Ux" to remove it again.
  5. after successful installation you can start the app using "Sx" and stop it using "Tx". 

If you're interested to see what HTTP commands are sent to ASMS and what websocket commands are sent to LISA and RDKShell to support this demo then check the contents of dactest.py.

  • No labels