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

Add support for reloadable process types RFC #59

Merged
merged 1 commit into from
Oct 4, 2021
Merged

Add support for reloadable process types RFC #59

merged 1 commit into from
Oct 4, 2021

Conversation

dmikusa
Copy link
Contributor

@dmikusa dmikusa commented Oct 4, 2021

Summary

  • If BP_LIVE_RELOAD_ENABLED is set and true
    • the CNB will require watchexec
    • the CNB will add a process type called reload that calls watchexec -r <normal command>
    • the CNB will set the default process type to be reload

This can be used in conjunction with a Tiltfile like:

custom_build(
   'example-java-image',
   'pack build --pull-policy=if-not-present -e BP_LIVE_RELOAD_ENABLED=true -e BP_GRADLE_BUILT_ARTIFACT=build/distributions/*-boot-*.zip',
   ['pom.xml', 'build/libs/demo-0.0.1-SNAPSHOT.jar'],
   live_update = [
       sync('build/libs/demo-0.0.1-SNAPSHOT.jar', '/workspace/demo-boot-0.0.1-SNAPSHOT/lib/demo-0.0.1-SNAPSHOT.jar'),
   ],
   tag="dev"
)
k8s_yaml('kubernetes.yaml')
k8s_resource('example-java', port_forwards=8000)

When code changes are made to a watched directory, Tilt will push the changes out to the container. Those will be observed by watchexec and the main process will reload, reloading your changes. With DistZip this is a little bit less practical because you are pushing up a ZIP file that contains a JAR file with all of your application files in that. You cannot easily recompile and upload a few class files. It is technically possible though to recompile and send your entire JAR file. When done, watchexec will see the change and reload the application.

Use Cases

Implement the Reloadable Process Type RFC

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

- If `BP_LIVE_RELOAD_ENABLED` is set and true
 - the CNB will require `watchexec`
 - the CNB will add a process type called `reload` that calls `watchexec -r <normal command>`
 - the CNB will set the default process type to be `reload`

This can be used in conjunction with a Tiltfile like:

```
custom_build(
   'example-java-image',
   'pack build --pull-policy=if-not-present -e BP_LIVE_RELOAD_ENABLED=true -e BP_GRADLE_BUILT_ARTIFACT=build/distributions/*-boot-*.zip',
   ['pom.xml', 'build/libs/demo-0.0.1-SNAPSHOT.jar'],
   live_update = [
       sync('build/libs/demo-0.0.1-SNAPSHOT.jar', '/workspace/demo-boot-0.0.1-SNAPSHOT/lib/demo-0.0.1-SNAPSHOT.jar'),
   ],
   tag="dev"
)
k8s_yaml('kubernetes.yaml')
k8s_resource('example-java', port_forwards=8000)
```

When code changes are made to a watched directory, Tilt will push the changes out to the container. Those will be observed by `watchexec` and the main process will reload, reloading your changes. With DistZip this is a little bit less practical because you are pushing up a ZIP file that contains a JAR file with all of your application files in that. You cannot easily recompile and upload a few class files. It is technically possible though to recompile and send your entire JAR file. When done, `watchexec` will see the change and reload the application.

Signed-off-by: Daniel Mikusa <dmikusa@vmware.com>
@dmikusa dmikusa added semver:minor A change requiring a minor version bump type:enhancement A general enhancement labels Oct 4, 2021
@dmikusa dmikusa requested a review from a team October 4, 2021 18:52
@dmikusa dmikusa merged commit 71d57d5 into main Oct 4, 2021
@dmikusa dmikusa deleted the reloadable branch October 4, 2021 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor A change requiring a minor version bump type:enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant