jbossdemocentral / service-interconnect-sandbox-demo

3 stars 4 forks source link

Connect your services across different environments with Red Hat Service Interconnect

This guide introduces Red Hat Service Interconnect (Skupper) to create a Virtual Applications Network (also known as a service network) and create connections across multiple clouds.

In this guide you will discover how to build a service network to connect disparate services across different environments using Red Hat Service Interconnect.

What is Red Hat Service Interconnect?

Red Hat Service Interconnect enables application and service connectivity across different environments through layer 7 addressing and routing. Using a simple command line interface, interconnections are created in a matter of minutes, avoiding extensive networking planning, and overhead. All interconnections between environments use mutual TLS(mTLS) to keep your organization’s infrastructure and data protected. Red Hat Service Interconnect is based on the open source Skupper project.

Overview

This example is a simple database-backed patient portal web application that shows how you can use Skupper to access a database at a remote site(local laptop) without exposing it to the public internet.

It contains two services:

A PostgreSQL database running on your local machine which we assume as a private data center.

A web frontend service running on OpenShift Sandbox in the public cloud. It uses the PostgreSQL database in the local machine or data centre to display the names of doctors and patients. architecture.png

This example uses the Red Hat Developer Sandbox and your local laptop to deploy the frontend and the database respectively. Below are list of perquisites:

Install the Frontend app on your OpenShift Cluster

copy-login.png

- The final command will display the OpenShift route URL for the front end app. Copy and paste that URL into the browser. The URL will look somewhat similar to the below

patient-portal-frontend-vravula-redhat-dev.apps.sandbox-m4.g2pi.p1.openshiftapps.com


- You should be able to see the front end of the patient portal without any patient names or doctor names as we have not established the connection with the database
![patient_portal_empty.png](images/patient_portal_empty.png)

## Install the Database on your laptop
The Database contains a list of patients and doctors, that will show on the patient portal front end page once we make the connections using Red Hat Service Interconnect (Skupper). In a real world scenario the database could be on a VM, private data centre or other bare metal environments. In this example we will be leveraging either Docker or podman on your local laptop or computer to deploy the database.

- Run the database on your local environment (Reminder this steps assume that you have already installed docker or podman locally)
     - Deploy the database on Mac M1
 docker run --name database --detach --rm -p 5432:5432 quay.io/redhatintegration/patient-portal-database-arm64
 ```
 - Deploy the database on Amd 64 or x86 environments ex: Macs with am Intel chip
 ```
 docker run --name database --detach --rm -p 5432:5432 quay.io/redhatintegration/patient-portal-database
 ```
 - Deploy the database with podman on RHEL machine
 ```
 podman run --name database --detach --rm -p 5432:5432 quay.io/redhatintegration/patient-portal-database
 ```

Connect the database to the frontend using Red Hat Service Interconnect

The challenge for us is now to enable the patient portal frontend deployed on the sandbox to connect to the database. For obvious reasons, we do not want to expose the database over the public internet, so a private, secure link needs to be setup between the OpenShift sandbox instance and the database on your computer. This can be accomplished with a VPN between the public cloud and the data center. However a VPN can be hard to set up, and requires deep networking expertise. Developers also need to request the network admins and go through a time taking approval process for the VPNs to be setup. Red Hat Service Interconnect on the other hand creates a dedicated layer 7 service network and is a lot easier to set up. It allows application Developers to establish secure interconnection with other services and applications in different environments without relying on network specialists. With Service Interconnect developers can now create secure virtual application networks without the cumbersome overhead, complexity and delays of traditional connectivity solutions.

Note: We are not exposing the database and payment processor service to the internet. Only the services which are part of the service network enabled by Red Hat Service Interconnect can access them

The database service is the proxy service created by exposing the database deployment on your local environment over the service network.

Note: If the patient data still doesn't show up after establishing the connection, try restarting the frontend pod

oc get pods
oc delete pod <podname>

Congratulations! You successfully used Red Hat Service Interconnect to build a secure service network between services on two different environments and allowed application to connect and communicate over the secure network. To learn more visit our website