2019-10-11 13:32:32 +02:00
// Module included in the following assemblies:
//
2020-05-11 14:48:40 +02:00
// * cli_reference/developer_cli_odo/creating-a-multicomponent-application-with-odo.adoc
2019-10-11 13:32:32 +02:00
[id="linking-both-components_{context}"]
= Linking both components
Components running on the cluster need to be connected in order to interact. {product-title} provides linking mechanisms to publish communication bindings from a program to its clients.
.Procedure
. List all the components that are running on the cluster:
+
2020-08-05 13:52:43 -04:00
[source,terminal]
2019-10-11 13:32:32 +02:00
----
$ odo list
2020-08-05 13:52:43 -04:00
----
+
.Example output
[source,terminal]
----
2020-10-01 10:02:53 -07:00
OpenShift Components:
2020-09-07 13:16:23 +02:00
APP NAME PROJECT TYPE SOURCETYPE STATE
app backend testpro openjdk18 binary Pushed
app frontend testpro nodejs local Pushed
2019-10-11 13:32:32 +02:00
----
. Link the current front-end component to the backend:
+
2020-08-05 13:52:43 -04:00
[source,terminal]
2019-10-11 13:32:32 +02:00
----
$ odo link backend --port 8080
2020-08-05 13:52:43 -04:00
----
+
.Example output
[source,terminal]
----
2019-10-11 13:32:32 +02:00
✓ Component backend has been successfully linked from the component frontend
Following environment variables were added to frontend component:
- COMPONENT_BACKEND_HOST
- COMPONENT_BACKEND_PORT
----
+
2020-08-05 13:52:43 -04:00
The configuration information of the back-end component is added to the front-end component and the front-end component restarts.