Skip to content

Commit cda8809

Browse files
committed
9_debugging.adoc
1 parent 1b88315 commit cda8809

File tree

4 files changed

+105
-9
lines changed

4 files changed

+105
-9
lines changed

9_debugging.adoc

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Burr Sutter <burrsuter@gmail.com>
33

44
== Java
5-
mvn fabric8:debug
65

76
https://hub.docker.com/r/fabric8/java-jboss-openjdk8-jdk/
87

@@ -12,5 +11,93 @@ https://code.visualstudio.com/docs/java/java-kubernetes
1211

1312
https://code.visualstudio.com/blogs/2017/09/28/java-debug
1413

14+
For springboot
15+
16+
Create a directory hello/springboot/src/main/fabric8
17+
18+
Create a file called service.yml
19+
20+
----
21+
apiVersion: v1
22+
kind: Service
23+
spec:
24+
type: NodePort
25+
----
26+
27+
mvn io.fabric8:fabric8-maven-plugin:3.5.40:setup
28+
29+
mvn fabric8:debug
30+
31+
----
32+
...
33+
[INFO] Using namespace: default
34+
Trying internal type for name:Service
35+
Trying internal type for name:Deployment
36+
[INFO] Updating a Service from kubernetes.yml
37+
[INFO] Updated Service: target/fabric8/applyJson/default/service-boot-demo-1.json
38+
[INFO] F8: Enabling debug on Deployment boot-demo
39+
[WARNING] The client is using resource type 'deployments' with unstable version 'v1beta1'
40+
[INFO] F8: Waiting for debug pod with selector LabelSelector(matchExpressions=[], matchLabels={app=boot-demo, provider=fabric8, group=com.burrsutter}, additionalProperties={}) and environment variables {JAVA_DEBUG_SUSPEND=false, JAVA_ENABLE_DEBUG=true}
41+
Trying internal type for name:Pod
42+
[INFO] F8:[W] boot-demo-bd7bcfd87-smthv status: Pending
43+
[INFO] F8:[W] boot-demo-55d8cc66fd-qpws4 status: Running Ready
44+
[INFO] F8:[W] boot-demo-bd7bcfd87-smthv status: Pending
45+
[INFO] F8:[W] boot-demo-55d8cc66fd-qpws4 status: Running
46+
[INFO] F8:[W] boot-demo-bd7bcfd87-smthv status: Running Ready
47+
[INFO] F8:[W] boot-demo-55d8cc66fd-qpws4 status: Running
48+
[INFO] F8:[W] boot-demo-55d8cc66fd-qpws4 status: Running
49+
[INFO] F8: Port forwarding to port 5005 on pod boot-demo-bd7bcfd87-smthv using command /Users/burrsutter/minikube_0.28.1/bin/kubectl
50+
[INFO] F8:[W] boot-demo-55d8cc66fd-qpws4 status: Running : Pod Deleted
51+
----
52+
53+
Visual Studio Code
54+
55+
Debug - Add Configuration
56+
57+
which creates a Launch.json file, then comment it like so
58+
----
59+
{
60+
// Use IntelliSense to learn about possible attributes.
61+
// Hover to view descriptions of existing attributes.
62+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
63+
"version": "0.2.0",
64+
"configurations": [
65+
// {
66+
// "type": "java",
67+
// "name": "Debug (Launch)",
68+
// "request": "launch",
69+
// "cwd": "${workspaceFolder}",
70+
// "console": "internalConsole",
71+
// "stopOnEntry": false,
72+
// "mainClass": "",
73+
// "args": ""
74+
// },
75+
// {
76+
// "type": "java",
77+
// "name": "Debug (Launch)-HellobootApplication<boot-demo>",
78+
// "request": "launch",
79+
// "cwd": "${workspaceFolder}",
80+
// "console": "internalConsole",
81+
// "stopOnEntry": false,
82+
// "mainClass": "com.burrsutter.HellobootApplication",
83+
// "args": "",
84+
// "projectName": "boot-demo"
85+
// },
86+
{
87+
"type": "java",
88+
"name": "Debug (Attach)",
89+
"request": "attach",
90+
"hostName": "localhost",
91+
"port": "5005"
92+
}
93+
]
94+
}
95+
----
96+
97+
with port 5005
98+
99+
100+
15101
== Node.js
16-
https://developers.redhat.com/blog/2018/05/15/debug-your-node-js-application-on-openshift-with-chrome-devtools/
102+
https://developers.redhat.com/blog/2018/05/15/debug-your-node-js-application-on-openshift-with-chrome-devtools/
103+

hello/springboot/Dockerfile

Lines changed: 0 additions & 6 deletions
This file was deleted.

hello/springboot/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@
4141
<groupId>org.springframework.boot</groupId>
4242
<artifactId>spring-boot-maven-plugin</artifactId>
4343
</plugin>
44+
<plugin>
45+
<groupId>io.fabric8</groupId>
46+
<artifactId>fabric8-maven-plugin</artifactId>
47+
<version>3.5.40</version>
48+
<executions>
49+
<execution>
50+
<id>fmp</id>
51+
<goals>
52+
<goal>resource</goal>
53+
<goal>helm</goal>
54+
<goal>build</goal>
55+
</goals>
56+
</execution>
57+
</executions>
58+
</plugin>
4459
</plugins>
4560
</build>
4661

hello/springboot/src/main/java/com/burrsutter/MyRESTController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class MyRESTController {
2222
@RequestMapping("/")
2323
public String sayHello() {
2424
System.out.println("/ " + hostname);
25-
return "Aloha from Spring Boot! " + count++ + " on " + hostname + "\n";
25+
return "G'Day from Spring Boot! " + count++ + " on " + hostname + "\n";
2626
}
2727

2828
@RequestMapping("/sysresources")

0 commit comments

Comments
 (0)