Publishing an App to Great Bear

This tutorial is the last part of the four part series showcasing the development of an application for Great Bear.

Other parts of the series:

This guide gives an example of how to publish the Bear Echo application developed in the previous guide to the Great Bear Application Store. If you haven’t created the Bear Echo application yet, then please take a look at Developing an App for Great Bear.

The guide assumes that you are already familiar with using docker and creating docker images, creating Helm charts for Kubernetes, and deploying applications to Kubernetes clusters using Helm charts. The guide also assumes that you have docker and helm installed, and have the required access credentials for Great Bear. For more information on the development process for Great Bear, see Creating, Publishing and Deleting Applications.

You are now going to publish the ‘Bear Echo’ application to Great Bear, which will make it appear in the Application Store and available to deploy to Great Bear managed sites. This is a two stage process, where:

Build and upload the application image

  1. First, navigate to the directory called bear-echo where you created the Python code, Dockerfile, and Helm chart for the application.

  2. Log in to the Great Bear system using docker. To do this, run the following command, replacing , and with the credentials provided to you by Cisco:

    docker login --username=<tenant-registry-username> --password=<tenant-registry-password> <tenant-registry-url>
    

    Alternatively, you can exclude the username and password from this command, and enter them when prompted.

  3. In order to publish an application you need to build the docker image. To do this, run the following command from the directory containing the Dockerfile, replacing , <application-name> and <version-number> to reflect the values in your Helm chart:

    docker build -t <tenant-registry-url>/<application-name>:<version-number> .
    

    Note: If you are building an application for multiple architectures, see Multi-architecture docker images.

    In this case, use bear-echo:0.0.1 for the application name and version.

  4. Push this image to the Great Bear repository. Run the following command, replacing , <application-name>, and <version-number> with the values used in the previous step:

    docker push <tenant-registry-url>/<application-name>:<version-number>
    

    In this case, use bear-echo:0.0.1 for the application name and version.

Publish Great Bear Application Package

  1. Follow the steps to install and configure the Great Bear Packaging SDK tool.

  2. Use the SDK tool to publish the echo-bear package to the Great Bear Application Store. Run the following command:

    gbear app publish echo-bear/GBAP
    

    Expected output:

    Validating Package: echo-bear/GBAP/
    -- Validating Application Metadata...
    -- Validating Chart Dependencies...
    -- Validating Kubernetes Resource Labels...
    Validation Complete:
    Application Metadata: Passed (Errors: 0, Warnings: 0)
    Chart Dependencies: Passed (Errors: 0, Warnings: 0)
    Kubernetes Resource Labels: Passed (Errors: 0, Warnings: 0)
    Building Package Archive File...
    Publishing Package Archive File: charts/bear-echo-0.0.1.tgz
    Publish Status: Success
    

Bear Echo App Store Bear Echo App Store

Deploy and access Bear Echo

The Bear Echo application you’ve created and published is one of the simplest apps you can deploy with Great Bear, and can be useful for testing purposes. Bear Echo uses python Flask to serve a simple webpage, and allow users to define a custom text message when deploying the app that is then used as header in the rendered web page.

Configuration

  • Message to say: The text message you want to be shown in the web page.
  • Access HTTP port: The TCP port the HTTP server listens to.

Bear Echo parameters Bear Echo parameters

Access

  1. Open a browser and access the HTTP server using the port previously configured.

    You will see a webpage containing the message you have configured.

    Bear Echo output Bear Echo output

    Note: To know which IP address to use, run ifconfig or ip a in a terminal on the node.

  2. (Optional) If you are deploying the Bear Echo app on a VM based node, then you can take following steps to view the message in a browser from the host machine:

    1. On the host machine, enable SSH port forwarding. How to do that depends on the type of the node. For example, on a vagrant node, run:

      vagrant ssh node-0 -- -L 31777:localhost:31777
      
    2. Open a browser and access the HTTP server on localhost:31777

      Bear Echo forward Bear Echo forward