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.
- 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.
- A new window will open requesting the login token details. Copy the login token. Copy the login token
- In your terminal, paste the login token. Run the command.
- You are now connected to your OpenShift cluster.
- Create a new project:
oc new-project <project_name>
- Create a new application in the OpenShift project:
oc new-app python~https://github.com/IBM/satellite-link-example.git --name link-example
- Wait for the first application build to complete by monitoring the logs:
oc logs -f bc/link-example
- 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
- Retrieve the created route:
oc get route link-example-https
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.
- Create a table
CREATE TABLE EMPLOYEE(FIRST_NAME CHAR(20) NOT NULL, LAST_NAME CHAR(20), AGE INT, SEX CHAR(1), INCOME FLOAT )
- Insert a row
INSERT INTO EMPLOYEE(FIRST_NAME, LAST_NAME, AGE, SEX, INCOME) VALUES ('John', 'Win', 30, 'M', 9000)
- List all rows
SELECT * FROM EMPLOYEE
- Delete the table
DROP TABLE EMPLOYEE
- Provision a NLU service from the IBM Cloud catalog with a Standard plan and choose Both Public & Private Network.
- Create a
HTTPS
Satellite link endpoint pointing to the NLU service FQDN. For example,api.us-east.natural-language-understanding.watson.cloud.ibm.com
. - In the deployed application, click on Switch to Natural Language Understanding and provide your Satellite endpoint under
URL
and NLU serviceAPI key
. Click Connect. - Provide text and click Analyze.
- Check the data rate by navigating to the Satellite link endpoint
Delete the project:
oc delete project <project_name>