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

GraalVM sample for a restful spring application. #783

Closed
iTchTheRightSpot opened this issue Jan 15, 2024 · 8 comments
Closed

GraalVM sample for a restful spring application. #783

iTchTheRightSpot opened this issue Jan 15, 2024 · 8 comments

Comments

@iTchTheRightSpot
Copy link

Hey I have been trying to convert and deploy software/unicorn-store-spring to graalvm native image to lambda but I can't figure it out yet. I have been at it for some days now so if a sample can be made. Thank you in advance.

@deki
Copy link
Contributor

deki commented Jan 15, 2024

Hi @emmanuelU17,
were you following the description in our workshop https://catalog.workshops.aws/java-on-aws-lambda/en-US/01-migration/graalvm? Which step didn't work for you?

If you prefer to join a direct call with us, please reach out via your AWS account team (or using https://aws.amazon.com/contact-us/sales-support/ in case you don't know).

@iTchTheRightSpot
Copy link
Author

iTchTheRightSpot commented Jan 15, 2024

Hi @deki,
I am indeed following the description in the workshop but the only difference is I am manually uploading a zip file which I built using docker. I can see from my logs, my application booted up but it times out because there was is communication between lambda and my application. I attached a repo I am trying to replicate https://github.com/emmanuelU17/server-side-event/tree/lambda/backend

@deki
Copy link
Contributor

deki commented Jan 16, 2024

Thanks for sharing your repo. The way you've implemented it is actually not supported right now, but it's already being worked on (see aws/serverless-java-container#335 and aws/serverless-java-container#739).

To get it running today you'd need to follow our sample https://github.com/aws-samples/aws-lambda-java-workshop/tree/main/labs/unicorn-store/software/alternatives/unicorn-store-spring-graalvm and implement a Spring Cloud Function Handler.

I'll keep this issue open until an updated sample is available (likely beginning of next month).

@iTchTheRightSpot
Copy link
Author

Ohh thank you for the clarification. I been at this for some days now to the extent I almost started questioning myself. I'll definitely be on the lookout for see aws/serverless-java-container#335 and aws/serverless-java-container#739 and this issue.

Thank you again for the clarification.

@iTchTheRightSpot
Copy link
Author

Looks like https://github.com/aws/serverless-java-container/issues/335 has solved this issue but before it is closed I got a quick question. What if I want to my source code to be saved in ECR instead of S3. For one

  1. Is this possible? I mean deploying via ECR instead of S3.
  2. If it is possible, would the entry point in my Dockerfile look something like this ENTRYPOINT ["/app/pet-store-native"] (ps. I can update this issue to what my Dockerfile would look like)?

@deki
Copy link
Contributor

deki commented Feb 12, 2024

You can use ECR but that's a different deployment model. See https://docs.aws.amazon.com/lambda/latest/dg/images-create.html for more details.

@iTchTheRightSpot
Copy link
Author

iTchTheRightSpot commented Feb 13, 2024

Hey, I was able to deploy my source code based on the sample repo. I would like to try a different way of deployment to lambda via ECR. I understand because I am using a custom runtime, I'll have to define a bootstrap file (which I did in the root folder) which lambda can use to invoke my bytecode. In the root of my project, I have a Dockerfile.ecr where the entry point is the bootstrap file. After I successfully deployed to ecr and then manually upload the image to lambda function for testing, I get an error where there is not communication between. If you do not mind, can you take a look at my repo and guide me on what I am doing wrong.

Thank you again

@iTchTheRightSpot
Copy link
Author

Never mind I got it figured out. Realized I was missing copying bytecode into ${LAMBDA_TASK_ROOT}. These examples helped for anyone finding issues.Python example and R example

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