GCP Cloud Functions with spring cloud function and spring native - spring-boot

I have been trying to deploy a GCP cloud function using Spring Cloud Function and Spring Native unfortunately it seems that GCP is blocking the AOT mode as shown in the photo "AOT mode disabled"
Does anyone had success deploying a native spring cloud function ?
Jonathan.

As Mentioned by #guillaume blaquiere,
AOT isn’t supported by Cloud Functions, you can use Cloud Run instead, to compile and deploy your container.
You can also try referring to this codelabs quickstart to get you started with the Spring Native on Google Cloud.

Related

Warmup of a Spring cloud functions based solution in azure

We are working in a spring cloud functions based solution, this solution will be deployed into azure.
We have implemented several functions but we have some warmup time when we start the spring context that we would like to remove.
I have been following Microsoft documentation (https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-functions/functions-bindings-warmup.md)
I have created trigger that is called when the instances are created but I am unable to load the spring context.
Is there any support for this type of binding in the azure java libraries or in spring cloud functions?

Deploy Spring Cloud Function to OpenFaaS

Spring Cloud Function is a way to write serverless functions with Spring Boot. There are only adapters for AWS, Azure, etc. but no way to deploy to OpenFaaS yet.
How do I deploy a Spring Cloud Function to OpenFaaS?
I created something using the official Java11 template but I am not sure if this is a good solution. You can find the code here: https://github.com/PySualk/spring-cloud-function-openfaas

Can we deploy spring micro services on AWS Lambda?

Is it recommended to deploy spring micro services on Lambda. I have recently deployed a sample spring boot app returning a sample data from AWS RDS Oracle DB on Lambda, Just analyzing the possibility if we could deploy two micro services in different Lambda functions and configure them using API gateway.
I am entirely new to it and trying to understand if Lambda can really support micro services patterns like Service discovery/Circuit breaker or Saga patterns if I deploy two or more services on different lambda functions. Would Lambda be used for such scenarios in Real Time ?
Can anyone help me if there would be limitations other than package/payload size limit or timeout limitations ?
Thanks in Advance
If you use java for serverless application like AWS lambdas I would recommend for looking a framework which supports Ahead-of-Time compilation which will boost a lot your application start. If your application is not bit it will be very easy to be rewritten with Micronaut (very similar to Spring boot development)
For instance have a look at Micronaut, Quarkus using with Graalvm. Spring Boot is not the best option using with directly with AWS lambdas, it is big package size + really a lot of initial time, not good for API services.
Target of max package sizes of 25 MB for small cold start with adjustable memory starting from 256MB, with spring boot this is not doable.
In case you are referring to Spring Boot Cloud Functions that's exactly they were made for.
Google Cloud Functions already have an Alpha product for running Java functions.
AWS Lambda seems to have support for this as well.
In case you simply wrote a Spring Boot app with embedded Tomcat that you packaged in a Docker container which you're spinning up on demand, beware that cold start can be an issue, especially with the overhead of the Tomcat.

How to auto instrument my Spring Boot web api call tracing and send to Google Cloud Trace

I am trying to figure out how to auto instrument my Spring Boot web api call tracing to Google Cloud Trace. (My Spring Boot app is in GKE).
I did similar thing for my Node service, which could use OpenTememetry js package auto instrument express calls and use Google Cloud Trace exporter.
But for my Spring Boot app, I tried a few ways, but I guess due to lack of knowledge I am not able to achieve what I want.
I try to use OpenTelemetry java lib, it mentioned it can auto instrument spring boot, but I don't know how to achieve it and I didn't find an export to Google Cloud Trace(stackdriver) neither
I try to use OpenCensus, It has a Google Cloud Trace export, but I didn't see any document mentioned how to auto instrument spring boot.
I try to use OpenTelmetry and instead of use an export, I deployed an OpenTelemtry Collector, but I don't know how the config the collector and the SDK to let the auto instrumented tracing spans got to the OpenTelemetry collector.
Does anyone has experiences using OpenCensus/OpenTelemetry to generate tracing information and forward it to Google Cloud Trace(StackDrivers).
take a look of this link, you will have to use an otel extension and set the GOOGLE_CLOUD_PROJECT and GOOGLE_APPLICATION_CREDENTIALS env vars

Deploy my spring boot application into google cloud computer engine

I got a query to ask you all. I am looking for guides that help me deploy my spring boot application on google cloud computer engine, I type in my instance IP address when I test my spring boot application I unable to access it in REST API.
May I know do you have any guides or steps for me to follow to deploy successfully in google cloud computing engine. Why do I need to deploy in computer engine is because I deployed my angular at it and I deploy it both it seems that my angular project being replaced by my spring boot application.
Codelabs GCP / Spring series has deployment tutorials:
https://codelabs.developers.google.com/spring/
GCP has some "Getting Started" tutorials you can use here:
https://cloud.google.com/java/docs/
where the specific one for deploying a java app to GCE is here:
https://cloud.google.com/java/docs/tutorials/bookshelf-on-compute-engine
But the basic steps are as follows:
Write your Spring app
Build your Spring app
Run / test your jar locally
Push your jar to a location in Storage
Create a startup script for your GCE instance
Create a new GCE VM which uses your startup script using Console, Deployment API, or gcloud tool
After that, you need to ensure you have the proper network rules in place to be able to access your API publicly. If you do not wish to learn how to use GCE, I would suggest you look into using App Engine instead because then you do not need to learn how to deploy and instead can concentrate on your api. Here is a guide to do that

Resources