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:
- First part: Developing an App for Great Bear
- Second part: Adding Liveness Probe to an app
- Third part: Adding Prometheus metrics to an app
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:
- First you build and upload a docker image that will run our application, then
- you publish the Great Bear Application Package that describes and deploys that docker image.
Build and upload the application image
-
First, navigate to the directory called
bear-echo
where you created the Python code, Dockerfile, and Helm chart for the application. -
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.
-
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. -
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
-
Follow the steps to install and configure the Great Bear Packaging SDK tool.
-
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
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.
Access
-
Open a browser and access the HTTP server using the port previously configured.
You will see a webpage containing the message you have configured.
Note: To know which IP address to use, run
ifconfig
orip a
in a terminal on the node. -
(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: