mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
107 lines
2.3 KiB
Plaintext
107 lines
2.3 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * cli_reference/developer_cli_odo/creating-a-single-component-application-with-odo
|
|
// * cli_reference/developer_cli_odo/using-odo-in-a-restricted-environment/creating-and-deploying-a-component-to-the-restricted-cluster
|
|
ifeval::["{context}" == "creating-a-single-component-application-with-odo"]
|
|
:single:
|
|
endif::[]
|
|
ifeval::["{context}" == "creating-a-multicomponent-application-with-odo"]
|
|
:multi:
|
|
endif::[]
|
|
|
|
[id="creating-a-nodejs-application-with-odo_{context}"]
|
|
= Creating a Node.js application with {odo-title}
|
|
|
|
To create a Node.js component, download the Node.js application and push the source code to your cluster with `{odo-title}`.
|
|
|
|
.Procedure
|
|
|
|
ifdef::single[]
|
|
|
|
. Create a directory for your components:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ mkdir my_components $$ cd my_components
|
|
----
|
|
|
|
. Download the example Node.js application:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ git clone https://github.com/openshift/nodejs-ex
|
|
----
|
|
endif::single[]
|
|
|
|
ifdef::multi[]
|
|
|
|
. Download the example front-end application:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ git clone https://github.com/openshift-evangelists/Wild-West-Frontend frontend
|
|
----
|
|
|
|
endif::multi[]
|
|
|
|
|
|
. Change the current directory to the directory with your application:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ cd <directory name>
|
|
----
|
|
|
|
. Add a component of the type Node.js to your application:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ odo create nodejs
|
|
----
|
|
+
|
|
NOTE: By default, the latest image is used. You can also explicitly specify an image version by using `odo create openshift/nodejs:8`.
|
|
|
|
. Push the initial source code to the component:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ odo push
|
|
----
|
|
+
|
|
Your component is now deployed to {product-title}.
|
|
|
|
. Create a URL and add an entry in the local configuration file as follows:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ odo url create --port 8080
|
|
----
|
|
+
|
|
. Push the changes. This creates a URL on the cluster.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ odo push
|
|
----
|
|
+
|
|
. List the URLs to check the desired URL for the component.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ odo url list
|
|
----
|
|
+
|
|
. View your deployed application using the generated URL.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ curl <URL>
|
|
----
|
|
|
|
ifeval::["{context}" == "creating-a-single-component-application-with-odo"]
|
|
:!single:
|
|
endif::[]
|
|
ifeval::["{context}" == "creating-a-multicomponent-application-with-odo"]
|
|
:!multi:
|
|
endif::[]
|