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

Expand binding-tool to generate Spring Boot Maven & Gradle config snippets #8

Open
dmikusa opened this issue Nov 11, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@dmikusa
Copy link
Owner

dmikusa commented Nov 11, 2022

The binding-tool has helpers to make integrating with pack build easier, it should have commands to print out snippets of Maven or Gradle config to add for using it.

See SO

@dmikusa dmikusa added the enhancement New feature or request label Nov 11, 2022
@devcxl
Copy link

devcxl commented May 15, 2023

Hi. @dmikusa

My server administrator does not allow me to install binding-tool on the server (as it has not been reviewed). How should I configure it in Spring boot Maven Plugin.

Can you make changes to the creator to make it compatible with configurations like this, making it easier to use local JRE

<binding>/path/to/local/jre/:/layers/paketo-buildpacks_bellsoft-liberica/jre:rw</binding>

@dmikusa
Copy link
Owner Author

dmikusa commented May 15, 2023

You don't need to install bt on any servers. It's really meant to be run on your local dev machine. If you want to use it in a production setting, I'd recommend having someone run it and then transfer the binaries to a place where they can easily be shared, like an HTTPS server.

When bt generates all of the binding files, it will assume that you're running locally and generate file:// links but if you just change those to https:// and point them to the HTTPS server where you're hosting the files then you can have them downloaded from your HTTPS server, likely on your LAN. Then just include your modified bindings with your project & when you run through CI or wherever you're building, you can tell it to use those bindings (see the SO post I linked above).

I have an open issue to allow bt to generate the binding files pointing to a remote server, but I'm not exactly sure how that feature should work. If you do go this route, feel free to drop in some comments about your use case/experience getting this to work. #4

@devcxl
Copy link

devcxl commented May 15, 2023

This method is too cumbersome. If the /tmp/{sha256sum} directory exists with an externally mounted JRE, could we add a condition when downloading the BellSoft Liberica JRE: if the JRE file exists in /tmp/{sha256sum}, use the mounted JRE; otherwise, download the JRE from GitHub.

[INFO]     [creator]       BellSoft Liberica JRE 8.0.312: Contributing to layer
[INFO]     [creator]       Check  /tmp/{sha256sum}/bellsoft-jre8u312+7-linux-amd64.tar.gz exists (like this)
[INFO]     [creator]         Downloading from https://github.com/bell-sw/Liberica/releases/download/8u312+7/bellsoft-jre8u312+7-linux-amd64.tar.gz

Simple, straightforward, yet effective, isn't it?

@dmikusa
Copy link
Owner Author

dmikusa commented May 15, 2023

The binding tool does nothing beyond creating the binding files. How those are used is defined by Paketo buildpacks. In short, binding tool cannot change how the buildpacks behave.

That said, if you don't have a binding present the buildpack will download from Github. If you do have a binding present, it will download from wherever the binding tells it to, a file:// URL or an https:// URL. So it kind of already does what you're proposing.

@devcxl
Copy link

devcxl commented May 15, 2023

First of all, I would like to express my gratitude for your thorough explanation. As English is not my native language, I may have misunderstood certain aspects of this project. However, after carefully reading through your response, I have gained a general understanding of the configuration process. I will give it a try shortly and provide you with feedback later. Thank you very much for your assistance.

@dmikusa
Copy link
Owner Author

dmikusa commented May 15, 2023

No worries & happy to help. There is also more context on bindings here -> https://paketo.io/docs/howto/configuration/#dependency-mappings

@devcxl
Copy link

devcxl commented May 15, 2023

This is an example of my successful configuration.

configuration

$ sha256sum /tmp/jre/bellsoft-jre8u312+7-linux-amd64.tar.gz
$ 9850e06b83c891bd96b1b3757e1d04a287800cb4c1e7dc5e3044e1967ce64ef6

/path/to/you/config/9850e06b83c891bd96b1b3757e1d04a287800cb4c1e7dc5e3044e1967ce64ef6

file:///tmp/jre/bellsoft-jre8u312+7-linux-amd64.tar.gz

/path/to/you/config/type

dependency-mapping

pom.xml

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>${spring-boot.version}</version>
    <configuration>
        <excludes>
            <exclude>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
            </exclude>
        </excludes>
        <image>
            ...
            <bindings>
                <binding>/path/to/you/config/:/platform/bindings/dependency-mapping/</binding>
                <binding>/path/to/jre/:/tmp/jre/</binding>
            </bindings>
        </image>
    </configuration>
</plugin>

reference

Additionally, how should Paketo Syft be configured.
I haven't found any documentation about it, is it like bellsoft-jre configuration?

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

No branches or pull requests

2 participants