Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How Tilt livereload works? #2

Open
demkom58 opened this issue Mar 20, 2024 · 1 comment
Open

How Tilt livereload works? #2

demkom58 opened this issue Mar 20, 2024 · 1 comment

Comments

@demkom58
Copy link

Can you explain a bit on how live-reload works in case of tilt?

# Build
custom_build(
    # Name of the container image
    ref = 'book-service',
    # Command to build the container image
    command = './gradlew bootBuildImage --imageName $EXPECTED_REF',
    # Files to watch that trigger a new build
    deps = ['build.gradle', './bin/main'],
    # Enables live reload
    live_update = [
        sync('./bin/main', '/workspace/BOOT-INF/classes')
    ]
)

# Deploy
k8s_yaml(['config/deployment.yml', 'config/service.yml'])

# Manage
k8s_resource('book-service', port_forwards=['8080:8080', '9090:9090'])

In particular, what exactly is './bin/main'? I'm asking this question because I can't get this work and official examples are completely different.

@ThomasVitale
Copy link
Owner

@demkom58 thanks for your question. I have updated the documentation to add a bit more information: https://github.com/ThomasVitale/developer-experience-java-kubernetes/tree/main/04-tilt

The live reload functionality is based on three main aspects:

  1. The IDE continuously compiling your Java classes upon change (by default in Visual Studio Code, it must be configured in IntelliJ IDEA).
  2. The container image supporting reloading the Java process running inside the container when a Java class is changed (Paketo Buildpacks ensures that support when using the Base builder).
  3. A tool like Tilt or Skaffold transferring compiled Java classes from the local folder (./bin/main in Visual Studio Code, ./build/classes/java/main and ./build/resources/main in IntelliJ IDEA) into the container (/workspace/BOOT-INF/classes when using Paketo Buildpacks).

You can find additional information on the Paketo Buildpacks official documentation: https://paketo.io/docs/howto/java/#enable-process-reloading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants