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

Update vert.x template to 4.x #285

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

pmlopes
Copy link

@pmlopes pmlopes commented Mar 2, 2022

Signed-off-by: Paulo Lopes pmlopes@gmail.com

Fixes #282

Description

This PR will update the template to:

  • JDK 17 (LTS)
  • Vert.x 4.2.4

Motivation and Context

The original template has several limitations and is using a almost unsupported release of Vert.x. The current template allows simple functions but lacks ways to configure features like, safe body parsing, CORS, JWTs...

This new template tries to address the issues as described in the linked issue.

How Has This Been Tested?

A basic unit test is added to the project and docker images built and tested.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Version change (see: Impact to existing users)

Impact to existing users

For existing users, the main function entry signature is changed, so it requires a small change to existing functions.

Old:

public class Handler implements io.vertx.core.Handler<RoutingContext> {

  public void handle(RoutingContext routingContext) {
    // user function body
  }
}

New:

public class OpenFaasFunction implements Function<RoutingContext, Future<JsonObject>> {

    public Future<JsonObject> apply(RoutingContext routingContext) {
      // user function body
    }
}

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Signed-off-by: Paulo Lopes <pmlopes@gmail.com>
@derek derek bot added the new-contributor label Mar 2, 2022
@pmlopes
Copy link
Author

pmlopes commented Mar 2, 2022

@alexellis please have a look at the PR and the discussion about upgrading the template. I believe this PR would make it easier to support all features of vert.x and user customization with a small breaking change.

If you wish to avoid the breaking change, I can adapt the function code itself to be closer to the original.

Signed-off-by: Paulo Lopes <pmlopes@gmail.com>
Signed-off-by: Paulo Lopes <pmlopes@gmail.com>
@pmlopes
Copy link
Author

pmlopes commented Mar 2, 2022

PR is updated to be fully backwards compatible and docs updated.

Signed-off-by: Paulo Lopes <pmlopes@gmail.com>
@pmlopes pmlopes changed the title Update vert.x template to 4.x and allow full customization Update vert.x template to 4.x Mar 2, 2022
@pmlopes
Copy link
Author

pmlopes commented Mar 2, 2022

Fixes #256

Signed-off-by: Paulo Lopes <pmlopes@gmail.com>
ENV PATH=$PATH:$GRADLE_HOME/bin

RUN mkdir -p /home/app/libs
FROM gradle:7-jdk11 as builder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JDK w/o Gradle is 213.44 MB and with Gradle this image is 403 MB

I'd be curious to know if the 400MB download is purely because Gradle is 200MB, I didn't think it was that large.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing the ZIP for 7.4 as: 113M gradle-7.4-bin.zip

Uncompressed:

du -h -d 1 gradle
123M gradle/gradle-7.4

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One alternative is switch to maven. While this should not change anything in terms of final artifacts, i know for sure that maven itself isn't that large

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

Successfully merging this pull request may close these issues.

Upgrade Vertx to 4.x
2 participants