File: proc_deploying-sample-application-with-odo.adoc

package info (click to toggle)
golang-github-crc-org-crc 2.34.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,548 kB
  • sloc: sh: 398; makefile: 326; javascript: 40
file content (78 lines) | stat: -rw-r--r-- 1,933 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
= Deploying a sample application with `odo`

You can use [command]`odo` to create {openshift} projects and applications from the command line.
This procedure deploys a sample application to the {ocp} cluster running in the {prod} instance.

.Prerequisites
* You have installed [command]`odo`.
For more information, see link:{odo-docs-url-installing}[Installing `odo`] in the [command]`odo` documentation.
* {prod} is configured to use the {openshift} preset.
For more information, see link:{crc-gsg-url}#changing-the-selected-preset_gsg[Changing the selected preset].
* The {prod} instance is running.
For more information, see link:{crc-gsg-url}#starting-the-instance_gsg[Starting the instance].

.Procedure
. Log in to the running {ocp} cluster managed by {prod} as the `developer` user:
+
[subs="+quotes,attributes"]
----
$ odo login -u developer -p developer
----

. Create a project for your application:
+
[subs="+quotes,attributes"]
----
$ odo project create sample-app
----

. Create a directory for your components:
+
[subs="+quotes,attributes"]
----
$ mkdir sample-app
$ cd sample-app
----

. Clone an example Node.js application:
+
[subs="+quotes,attributes"]
----
$ git clone https://github.com/openshift/nodejs-ex
$ cd nodejs-ex
----

. Add a `nodejs` component to the application:
+
[subs="+quotes,attributes"]
----
$ odo create nodejs
----

. Create a URL and add an entry to the local configuration file:
+
[subs="+quotes,attributes"]
----
$ odo url create --port 8080
----

. Push the changes:
+
[subs="+quotes,attributes"]
----
$ odo push
----
+
Your component is now deployed to the cluster with an accessible URL.

. List the URLs and check the desired URL for the component:
+
[subs="+quotes,attributes"]
----
$ odo url list
----

. View the deployed application using the generated URL.

.Additional resources
* For more information about using [command]`odo`, see the link:{odo-docs-url}[`odo` documentation].