Skip to content

Commit a28782b

Browse files
committed
Update docs on live reload
Signed-off-by: Thomas Vitale <[email protected]>
1 parent 70acef7 commit a28782b

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

01-java/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,7 @@ Run the application on the local JVM as follows.
4040

4141
Now, try making some changes to the application (for example, updating the REST API) and save.
4242
Spring Boot Developer Tools will automatically reload the application with the new classes.
43+
44+
If you use Visual Studio Code, the live reload functionality works without any additional configuration.
45+
46+
If you use IntelliJ IDEA, refer to the [official documentation](https://www.jetbrains.com/help/idea/spring-boot.html#application-update-policies) to enable support for Spring Boot DevTools in the IDE.

02-container-image/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ You can also debug the application from your IDE. Check out the configuration in
6868
## Live Reload
6969

7070
Paketo, the Cloud Native Buildpacks implementation we used above, provides support for live-reload.
71-
You can enable it via the `BP_LIVE_RELOAD_ENABLED` environment variable, as demonstrated in `live-reload/book-service/build.gradle`.
71+
You can enable it via the `BP_LIVE_RELOAD_ENABLED` environment variable, as demonstrated in `live-reload/book-service/build.gradle`. For more information, refer to the [official documentation](https://paketo.io/docs/howto/java/#enable-process-reloading).
7272

7373
Then, you would need a tool like Spring Boot Developer Tools to take care of loading into the images the changed classes every time they are updated. We'll use the live reload capabilities provided by Buildpacks when working with Tilt.

04-tilt/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,26 @@ tilt up
2525

2626
Now you can work with the application, save your changes, and they will be automatically loaded into the container running in Kubernetes. You can also debug it by attaching a remote debugger from your IDE to the Pod.
2727

28+
The Tilt setup in the `Tiltfile` is tuned to work with Visual Studio Code without any additional configuration.
29+
30+
If you use IntelliJ IDEA, refer to the [official documentation](https://www.jetbrains.com/help/idea/spring-boot.html#application-update-policies) to enable live reload in the IDE. You also need to update the `Tiltfile` and change the folders monitored by Tilt for the live reload functionality. For more information on how it works, refer to the Paketo [official documentation](https://paketo.io/docs/howto/java/#enable-process-reloading).
31+
32+
```python
33+
custom_build(
34+
# Name of the container image
35+
ref = 'book-service',
36+
# Command to build the container image
37+
command = './gradlew bootBuildImage --imageName $EXPECTED_REF',
38+
# Files to watch that trigger a new build
39+
deps = [ 'build.gradle', './build/classes/java/main', './build/resources/main' ],
40+
# Enables live reload
41+
live_update = [
42+
sync('./build/classes/java/main', '/workspace/BOOT-INF/classes'),
43+
sync('./build/resources/main', '/workspace/BOOT-INF/classes')
44+
]
45+
)
46+
```
47+
2848
## Clean-up
2949

3050
When you're done, delete the cluster as follows.

05-skaffold/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,44 @@ skaffold dev --port-forward
2828

2929
Now you can work with the application, save your changes, and they will be automatically loaded into the container running in Kubernetes. You can also debug it by attaching a remote debugger from your IDE to the Pod by starting Skaffold with `skaffold debug`.
3030

31+
The Skaffold setup in the `skaffold.yml` file is tuned to work with Visual Studio Code without any additional configuration.
32+
33+
If you use IntelliJ IDEA, refer to the [official documentation](https://www.jetbrains.com/help/idea/spring-boot.html#application-update-policies) to enable live reload in the IDE. You also need to update the `skaffold.yml` file and change the folders monitored by Skaffold for the live reload functionality. For more information on how it works, refer to the Paketo [official documentation](https://paketo.io/docs/howto/java/#enable-process-reloading).
34+
35+
```yaml
36+
apiVersion: skaffold/v4beta10
37+
kind: Config
38+
metadata:
39+
name: book-service
40+
build:
41+
artifacts:
42+
- image: book-service
43+
buildpacks:
44+
# Change to docker.io/paketobuildpacks/builder-jammy-base on ARM64
45+
builder: docker.io/dashaun/builder:base
46+
trustBuilder: true
47+
env:
48+
- BP_JVM_VERSION=21
49+
- BP_LIVE_RELOAD_ENABLED=true
50+
dependencies:
51+
paths:
52+
- build.gradle
53+
- src/main/resources
54+
- build/classes/java/main
55+
- build/resources/main
56+
sync:
57+
manual:
58+
- src: "src/main/resources/**/*"
59+
dest: /workspace/BOOT-INF/classes
60+
strip: src/main/resources/
61+
- src: "build/classes/java/main/**/*"
62+
dest: /workspace/BOOT-INF/classes
63+
strip: build/classes/java/main/
64+
- src: "build/resources/main/**/*"
65+
dest: /workspace/BOOT-INF/classes
66+
strip: build/resources/main/
67+
```
68+
3169
## Clean-up
3270
3371
When you're done, delete the cluster as follows.

0 commit comments

Comments
 (0)