Files
spring-cloud-function/spring-cloud-function-samples/function-sample-gcp
dzou 17c3f185bc Move Layout into adapter class
pr comments, mv package, make work locally.

revert pom change to parent

Rm provided scope - this is problematic for spring-boot-maven plugin to build jar

Detach sample from spring-cloud-function-parent

Update readmes

cleanup

Add comment

fix javadoc
Resolves #518
2020-05-20 15:25:48 +02:00
..
2020-05-20 15:23:52 +02:00
2020-05-20 15:25:48 +02:00
2020-05-20 15:25:48 +02:00

:branch: master

=== Google Cloud Functions Sample Application

===== Test locally

Run the function:

----
mvn function:run
----

Invoke the HTTP function:

----
curl http://localhost:8080/ -d "hello"
----

===== Deploy to GCP

As of March 2020, Google Cloud Functions for Java is in Alpha.
You can get on the https://docs.google.com/forms/d/e/1FAIpQLScC98jGi7CfG0n3UYlj7Xad8XScvZC8-BBOg7Pk3uSZx_2cdQ/viewform[whitelist] to try it out.

Package the application.

----
mvn package
----

You should see the fat jar in the `target/deploy` directory.

Make sure that you have the https://cloud.google.com/sdk/install[Cloud SDK CLI] installed.

Run the following command from the project root to deploy.

----
gcloud alpha functions deploy function-sample-gcp \
--entry-point org.springframework.cloud.function.adapter.gcp.GcfJarLauncher \
--runtime java11 \
--trigger-http \
--source target/deploy \
--memory 512MB
----

Invoke the HTTP function:

----
curl https://REGION-PROJECT_ID.cloudfunctions.net/function-sample-gcp -d "hello"
----