Skip to content

Commit 5d83e81

Browse files
author
Jan Kleinert
committed
More content updates
1 parent 0b7b93c commit 5d83e81

13 files changed

+164
-75
lines changed

workshop/content/030-deploy-an-app.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,25 @@ The output will look something like this:
6565

6666
`odo` has pushed the code into the component, built the application, and run it.
6767

68-
To visit your application, copy the URL from the terminal window, open a new browser window and paste it into the URL address bar.
68+
We can tail the logs to make sure the application is up and running:
69+
70+
```execute-1
71+
odo log -f
72+
```
73+
74+
You're looking for this message:
75+
76+
```
77+
Listening on 0.0.0.0, port 8080
78+
```
79+
80+
And then run:
81+
82+
```execute-1
83+
<ctrl+c>
84+
```
85+
86+
To visit your application, copy the URL from the top terminal window, open a new browser window and paste it into the URL address bar.
6987

7088
Alternatively, you can run the following command to get the URL:
7189

workshop/content/040-overview.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Title: Application overview
2+
Title: Interacting with OpenShift
33
PrevPage: 030-deploy-an-app
44
NextPage: 050-creating-an-application
55
---
@@ -10,6 +10,8 @@ The goal for this lab is to showcase `odo` and all of its primitives and to do s
1010

1111
Now although the intent is to show as much as possible of what `odo` can do, because of how the workshop environment works, we have skipped how you can log in to OpenShift using `odo`. In the workshop environment, you have already been logged in from the terminal window. You also have a project created for you in advance.
1212

13+
### Authentication
14+
1315
If you were using `odo` with your own cluster, you could log in to the cluster by using:
1416

1517
```bash
@@ -18,6 +20,8 @@ odo login
1820

1921
The command will interactively prompt you for details of the cluster. Alternatively you could supply the address of the OpenShift cluster as an argument.
2022

23+
### Projects
24+
2125
To create, change, or delete projects, you can use the `odo project` command. Run `odo project get` to show you the name of the current project you are working in:
2226

2327
```execute
@@ -33,3 +37,66 @@ odo project --help
3337
The `--help` option can be used on any `odo` command to see more details about what it can do.
3438

3539
Since we already have a project created for us, we are good to go though, and do not need to create one.
40+
41+
## Component configuration and global preferences
42+
43+
There are a couple other commands you can run to view component configuration and `odo` preferences that are global.
44+
45+
Run this command to view the values for global `odo` preferences:
46+
47+
```execute-1
48+
odo preference view
49+
```
50+
51+
The preference parameters are defined as follows:
52+
53+
54+
**NamePrefix** - Default prefix is the current directory name. Use this value to set a default name prefix
55+
56+
**Timeout** - Timeout (in seconds) for OpenShift server connection check
57+
58+
**UpdateNotification** - Controls if an update notification is shown or not (true or false)
59+
60+
61+
To view the current component configuration, run this command:
62+
63+
```execute-1
64+
odo config view
65+
```
66+
67+
The component configuration parameters are defined as follows:
68+
69+
70+
**Application** - Application is the name of application the component needs to be part of
71+
72+
**CPU** - The minimum and maximum CPU a component can consume
73+
74+
**Ignore** - Consider the .odoignore file for push and watch
75+
76+
**MaxCPU** - The maximum CPU a component can consume
77+
78+
**MaxMemory** - The maximum memory a component can consume
79+
80+
**Memory** - The minimum and maximum memory a component can consume
81+
82+
**MinCPU** - The minimum CPU a component can consume
83+
84+
**MinMemory** - The minimum memory a component is provided
85+
86+
**Name** - The name of the component
87+
88+
**Ports** - Ports to be opened in the component
89+
90+
**Project** - Project is the name of the project the component is part of
91+
92+
**Ref** - Git ref to use for creating component from git source
93+
94+
**SourceLocation** - The path indicates the location of binary file or git source
95+
96+
**SourceType** - Type of component source - git/binary/local
97+
98+
**Type** - The type of component
99+
100+
**Url** - URL to access the component
101+
102+

workshop/content/060-creating-new-binary-component.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ ComponentSettings:
8585
Name: frontend
8686
```
8787

88+
To view this in a more human-readable way, run:
89+
90+
```execute-1
91+
odo config view
92+
```
93+
8894
While we have this configuration defined, the application is not yet deployed on OpenShift.
8995

9096
When we run `odo push`, a container will be created with the Java application server and then, since this is a binary component, your JAR file will be pushed to that container.
@@ -114,20 +120,6 @@ When the push completes, ``odo`` will display output similar to:
114120
✓ Changes successfully pushed to component: frontend
115121
```
116122

117-
You can verify that the Java runtime has started your application by tailing the logs for your component:
118-
119-
```execute-1
120-
odo log -f
121-
```
122-
123-
Select the terminal window and enter:
124-
125-
```execute-1
126-
<ctrl+c>
127-
```
128-
129-
when you're finished checking out the logs.
130-
131123
## Component configuration
132124
When creating a component, some configuration will be inherited by default, but there is a way to override these defaults.
133125

workshop/content/061-exposing-components-to-public.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,27 @@ Similar to when we create a component, creating a URL sets that information in t
1616
odo push
1717
```
1818

19-
The URL created for the application will be displayed. Visit the URL in your web browser to view the application.
19+
Watch the logs and wait until the component is ready.
20+
21+
```execute-2
22+
cd ~/frontend
23+
odo log -f
24+
```
25+
26+
You're looking for a message like this:
27+
28+
```
29+
2019-04-26 23:55:05.355 INFO 752 --- [ main] c.o.evg.roadshow.ParksMapApplication
30+
: Started ParksMapApplication in 5.261 seconds (JVM running for 5.853)
31+
```
32+
33+
Once you see that, execute `ctrl+c`
34+
35+
```execute-2
36+
<ctrl+c>
37+
```
38+
39+
The URL created for the application will be displayed in the output of the `odo push` command. Visit the URL in your web browser to view the application.
2040

2141
http://frontend-parksmap-%project_namespace%.%cluster_subdomain%
2242

workshop/content/070-deploying-component-from-source-code.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ We give this Node.js component the name ``backend``.
2424
odo create nodejs backend --app parksmap
2525
```
2626

27+
As we did for the ``frontend``, we'll also create a URL for the ``backend`` component.
28+
29+
```execute-1
30+
odo url create backend --port 8080
31+
```
2732
With the component configuration created, you can ``push`` the Node.js source code from the current directory, ``backend``.
2833

2934
```execute-1
@@ -49,31 +54,19 @@ When the push completes, ``odo`` will display output similar to:
4954
✓ Changes successfully pushed to component: backend
5055
```
5156

52-
Again, we can tail the logs to verify that our application is up and running:
57+
Again, we can look at the logs to verify that our application is up and running:
5358

5459
```execute-1
55-
odo log -f
60+
odo log
5661
```
5762

58-
Select the terminal window and enter:
63+
You may need to run the command a few times before the app is ready. The message you need to see before continuing is:
5964

60-
```execute-1
61-
<ctrl+c>
6265
```
63-
64-
when you're finished checking out the logs.
65-
66-
Once we have our application up and running, we need to test it works. We're going to create a URL for it, as we did before for the frontend.
67-
68-
```execute-1
69-
odo url create backend --port 8080
66+
Listening on 0.0.0.0, port 8080
7067
```
7168

72-
Then push again to create the URL on the cluster:
73-
74-
```execute-1
75-
odo push
76-
```
69+
Once we have our application up and running, we need to test it works.
7770

7871
This time we're going to test the application from command line, as it's a REST service.
7972

workshop/content/075-create-a-service.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,34 @@ When you don't specify any parameter to the creation of a service, you'll be int
2626

2727
- *Which kind of service do you wish to create* Select `database` with the arrows and hit enter.
2828
- *Which database service class should we use* As you type `mongo` the list will be filtered. From the two available options, select `mongodb-ephemeral`
29-
- For the following options, just accept the defaults.
29+
- For the following options, accept the defaults **except** for the last question. Answer **y** to "Wait for the service to be ready".
3030

3131
You will see something similar to this:
3232

3333
```bash
3434
odo service create
35-
? Which kind of service do you wish to create? database
36-
? Which database service class should we use? mongodb-ephemeral
35+
? Which kind of service do you wish to create database
36+
? Which database service class should we use mongodb-ephemeral
3737
? Enter a value for string property DATABASE_SERVICE_NAME (Database Service Name): mongodb
3838
? Enter a value for string property MEMORY_LIMIT (Memory Limit): 512Mi
3939
? Enter a value for string property MONGODB_DATABASE (MongoDB Database Name): sampledb
4040
? Enter a value for string property MONGODB_VERSION (Version of MongoDB Image): 3.2
4141
? Provide values for non-required properties No
4242
? How should we name your service mongodb-ephemeral
43-
✓ Service 'mongodb-ephemeral' was created
44-
Progress of the provisioning will not be reported and might take a long time.
45-
You can see the current status by executing 'odo service list'
43+
? Output the non-interactive version of the selected options No
44+
? Wait for the service to be ready Yes
45+
✓ Creating service
46+
✓ Waiting for service to come up
47+
✓ Service 'mongodb-ephemeral' is ready for use
4648
```
4749

48-
Now we can wait until the service is provisioned:
50+
Run the following to confirm that the service is provisioned:
4951

5052
```execute-1
5153
odo service list
5254
```
5355

54-
Keep re-running this command, and once provisioned, we should see similar output to this:
56+
You should see similar output to this:
5557

5658
```bash
5759
NAME TYPE STATUS

workshop/content/080-linking-components-to-services.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This will inject configuration into the backend about the mongodb and restart th
1717
We can see when our application has been restarted by looking at the logs of the backend.
1818

1919
```execute-1
20-
odo log backend
20+
odo log backend -f
2121
```
2222

2323
__NOTE__: As a redeployment is happening in OpenShift, this might take some time. Check the logs until the component has successfully restarted. The message you need to see before continuing is:
@@ -26,9 +26,15 @@ __NOTE__: As a redeployment is happening in OpenShift, this might take some time
2626
Listening on 0.0.0.0, port 8080
2727
```
2828

29+
Then enter:
30+
31+
```execute-1
32+
<ctrl+c>
33+
```
34+
2935
__NOTE__: Due to a bug this is currently taking a bit longer than expected, so be patient.
3036

31-
When the component finally restarts, you should now see a log showing the connection details to our database. We can now execute the same command we did before to load the database with data.
37+
When the component restarts, you should now see a log showing the connection details to our database. We can now execute the same command we did before to load the database with data.
3238

3339
First we verify there's no data in the database:
3440

workshop/content/081-change-active-component.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Now that our backend is fully functional, we need to connect to it from our `fro
88

99
As we're going to execute some actions with the `frontend` component, we need to set it as our active component.
1010

11-
__NOTE__: In the near future, the current component will be defined by the directory you're in with your shell, just like *Git* does. For now, there's a way to get and change the current selected component to which some of this commands will relate.
11+
The current, or active, component is defined by the directory you're in with your shell, just as in *Git*.
1212

1313
To get a list of existing components within your application do:
1414

@@ -25,16 +25,16 @@ ACTIVE NAME TYPE
2525
frontend java
2626
```
2727

28-
The active component is the `backend`. You can either take one of two paths, change your active component and execute the `in-context` actions on it or we can specify to any command to which component the command is related. Let's do the former, but this is how the latter would look like.
28+
The active component is the `backend`. You can either take one of two paths, change to the directory for your component and execute the `in-context` actions on it or we can specify to any command to which component the command is related. Let's do the former, but this is how the latter would look like.
2929

3030
```bash
3131
odo <COMMAND> --component frontend
3232
```
3333

34-
Now to set your active component, do:
34+
Now to set the frontend as your active component, do:
3535

3636
```execute-1
37-
odo component set frontend
37+
cd ~/frontend
3838
```
3939

4040
And verify that actually it was properly set:

workshop/content/091-linking-application-components.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@ __NOTE__: Here we have explicitly provided the component to which the link shoul
1616

1717
This will inject configuration into the frontend about the backend and restart the frontend.
1818

19-
Some components might expose multiple ports, and you need to select which one is the appropriate to use. In case you don't specify the port to use, you will see a nice warning message instructing you how to best proceed.
20-
21-
Your frontend component will be redeployed.
22-
23-
__NOTE__: We have found a bug in `odo` as we were testing this lab and you'll need to re-push your application again. This will be fixed in the coming week. Trust us :-D
19+
Now, re-push the component:
2420

2521
```execute-1
26-
cd ~/frontend
27-
odo push frontend
22+
odo push
2823
```
2924

3025
You can check the the startup logs:
@@ -46,3 +41,5 @@ Once the component has successfully been re-deployed you can see the changes in
4641
http://frontend-parksmap-%project_namespace%.%cluster_subdomain%
4742

4843
You should now see a nice map showing where you can find national parks.
44+
45+
![parksmap with data](parksmap-data.png)

workshop/content/100-making-changes-to-source-code.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@ NextPage: 105-whats-next
66

77
We've deployed the first version of our sample application and tested it by visiting it with a browser. Let's look at how OpenShift and ``odo`` help make it easier to iterate on that app once it's running.
88

9-
Let's first get back to our `nodejs backend` component.
10-
11-
```execute-1
12-
odo component set backend
13-
```
14-
15-
Let's also make sure we're in the right directory on the upper terminal:
9+
Let's first get back to our `backend` component.
1610

1711
```execute-1
1812
cd ~/backend
1913
```
2014

21-
and the lower terminal.
15+
Let's also make sure we're in the right directory on the lower terminal:
2216

2317
```execute-2
2418
cd ~/backend
@@ -30,7 +24,7 @@ Now we start the ``odo`` tool to ``watch`` for changes on the file system in the
3024
odo watch
3125
```
3226

33-
To change the displayed name for our backend, we edit the file `bin/config.js`.
27+
We will make a small change to the displayed name for our backend, from "National Parks" to "Worldwide National Parks". To change the displayed name for our backend, we edit the file `bin/config.js`.
3428

3529
```execute-1
3630
vi bin/config.js
@@ -56,7 +50,7 @@ Once it does, make a new query to the REST endpoint to validate it has changed.
5650
curl http://backend-parksmap-%project_namespace%.%cluster_subdomain%/ws/info/
5751
```
5852

59-
__NOTE__: The same bug as before also makes the watch operation missbehave and be slow. As we said before, this will be fixed in the coming week. Trust us :-D
53+
__NOTE__: The same bug as before also makes the watch operation be slow. As we said before, this will be fixed in the coming week. Trust us :-D
6054

6155
Hit:
6256

0 commit comments

Comments
 (0)