Skip to content

Commit 77e8224

Browse files
committed
Documentation: Debugging with OpenShift Toolkit
Signed-off-by: Parthvi Vala <[email protected]>
1 parent 6af2f9d commit 77e8224

File tree

8 files changed

+65
-0
lines changed

8 files changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Running an Application with OpenShift Toolkit
3+
sidebar_position: 1
4+
---
5+
6+
Debugging is an unavoidable part of development, and it can prove even more difficult when developing an application that runs remotely.
7+
8+
However, this task is made absurdly simple with the help of OpenShift Toolkit.
9+
10+
## OpenShift Toolkit
11+
[OpenShift Toolkit](https://github.com/redhat-developer/intellij-openshift-connector) is an IDE plugin that allows you to do all things that `odo` does, i.e. create, test, debug and deploy cloud-native applications on a cloud-native environment in simple steps.
12+
`odo` enables this plugin to do what it does.
13+
14+
## Prerequisites
15+
1. [You have logged in to your cluster](../../quickstart/nodejs.md#step-1-connect-to-your-cluster-and-create-a-new-namespace-or-project).
16+
2. [You have initialized a Node.js application with odo](../../quickstart/nodejs.md#step-2-initializing-your-application--odo-init-).
17+
3. Open the application in the IDE.
18+
4. Install OpenShift Toolkit Plugin in your preferred VS Code or a Jet Brains IDE.
19+
20+
In the plugin window, you should be able to see the cluster you are logged into in "APPLICATION EXPLORER" section, and your component "my-nodejs-app" in "COMPONENTS" section.
21+
22+
23+
## Step 1. Start the Dev session to run the application on cluster
24+
25+
Right click on "my-nodejs-app" and select "Start on Dev".
26+
27+
![](/docs/website/static/img/docs/user-guides/advanced/debugging/Start%20Dev%20Session.png "Starting Dev session")
28+
29+
Wait until the application is running on the cluster.
30+
31+
![](/docs/website/static/img/docs/user-guides/advanced/debugging/Wait%20until%20Dev%20Session%20finishes.png "Wait until Dev session finishes")
32+
33+
Our application is now available at 127.0.0.1:20001. The debug server is running at 127.0.0.1:20002.
34+
35+
## Step 2. Start the Debugging session
36+
37+
Right click on "my-nodejs-app" and select "Debug".
38+
39+
![](/docs/website/static/img/docs/user-guides/advanced/debugging/Select%20Debug%20Session.png "Select Debug")
40+
41+
Debug session should have started successfully at the debug port, in this case, 3000. And you must be looking at the "DEBUG CONSOLE".
42+
43+
![](/docs/website/static/img/docs/user-guides/advanced/debugging/Debug%20Session%20Starts.png "Debug session starts")
44+
45+
## Step 3. Set Breakpoints in the application
46+
47+
Now that the debug session is running, we can set breakpoints in the code.
48+
49+
Open 'server.js' file if you haven't opened it already. We will set a breakpoint on Line 55 by clicking the red dot that appears right next to line numbers.
50+
51+
![](/docs/website/static/img/docs/user-guides/advanced/debugging/Add%20Breakpoint.png "Add breakpoint")
52+
53+
From a new terminal, or a browser window, ping the url at which the application is available, in this case, it is 127.0.0.1:20001.
54+
55+
![](/docs/website/static/img/docs/user-guides/advanced/debugging/Ping%20Application.png "Ping Application")
56+
57+
The debug session should halt execution at the breakpoint, at which point you can start debugging the application.
58+
59+
![](/docs/website/static/img/docs/user-guides/advanced/debugging/Application%20Debugged.png "Application Debugged")
60+
61+
62+
To learn more about running and debugging an application on cluster with OpenShift Toolkit, see the links below.
63+
1. [Using OpenShift Toolkit - project with existing devfile](https://www.youtube.com/watch?v=2jfV0QqG8Sg)
64+
2. [Using OpenShift Toolkit with two microservices](https://www.youtube.com/watch?v=8SpV6UZ23_c)
65+
3. [Using OpenShift Toolkit - project without devfile](https://www.youtube.com/watch?v=sqqznqoWNSg)
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)