/satellite-link-example

Sample Satellite application using Satellite Link to access a service running in IBM Cloud

Primary LanguageHTMLApache License 2.0Apache-2.0

Satellite Link Example

This simple application allows to query a PostgreSQL database. The form prompts you for the database credentials. These credentials will be sent to the application running in the cluster and the connection will be made to the database over Satellite link.

This sample requires:

  • a running Satellite location,
  • an OpenShift cluster running in the location with its image registry correctly configured,
  • a Databases for PostgreSQL instance running in IBM Cloud.

Deploy the application on Red Hat OpenShift cluster

Connect to the OpenShift cluster in your CLI

  1. To log in, you need a token which can be generated after you log in to OpenShift Cluster web console. Click the drop-down under your name in the right corner of your screen and select Copy Login Command.
  2. A new window will open requesting the login token details. Copy the login token. Copy the login token
  3. In your terminal, paste the login token. Run the command.
  4. You are now connected to your OpenShift cluster.

Create the application

  1. Create a new project:
    oc new-project <project_name>
  2. Create a new application in the OpenShift project:
    oc new-app python~https://github.com/IBM/satellite-link-example.git --name link-example
  3. Wait for the first application build to complete by monitoring the logs:
    oc logs -f bc/link-example
  4. When the build is complete, create a secure route to access the application:
    oc create route edge link-example-https --service=link-example --port=8080
  5. Retrieve the created route:
    oc get route link-example-https

Test the application

Fill in the details as shown below.

In place of hostname and port, give your Satellite endpoint url and its port. All other details will be found in the credential section of the service.

Run the following sql commands

  1. Create a table
    CREATE TABLE EMPLOYEE(FIRST_NAME CHAR(20) NOT NULL,    LAST_NAME CHAR(20),    AGE INT,    SEX CHAR(1),    INCOME FLOAT )
  2. Insert a row
    INSERT INTO EMPLOYEE(FIRST_NAME, LAST_NAME, AGE, SEX, INCOME) VALUES ('John', 'Win', 30, 'M', 9000)
  3. List all rows
    SELECT * FROM EMPLOYEE
  4. Delete the table
    DROP TABLE EMPLOYEE

See the data rate in the Satellite dashboard

Test the application with Natural Language Understanding (NLU) service.

  1. Provision a NLU service from the IBM Cloud catalog with a Standard plan and choose Both Public & Private Network.
  2. Create a HTTPS Satellite link endpoint pointing to the NLU service FQDN. For example, api.us-east.natural-language-understanding.watson.cloud.ibm.com.
  3. In the deployed application, click on Switch to Natural Language Understanding and provide your Satellite endpoint under URL and NLU service API key. Click Connect. NLU login
  4. Provide text and click Analyze. NLU analyze
  5. Check the data rate by navigating to the Satellite link endpoint satellite data rate

Remove the application

Delete the project:

oc delete project <project_name>