Adds Readme to GCP sample app

Also, fixing a bug in the default constructor of the invoker.

Fixes: #478.
This commit is contained in:
Mike Eltsufin
2020-04-02 11:56:45 -04:00
parent aa721a7b43
commit 24e5b13adc
2 changed files with 55 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
: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 `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.gcloud.FunctionInvoker \
--runtime java11 \
--trigger-http \
--source deploy \
--memory 512MB
----
Invoke the HTTP function:
----
curl https://REGION-PROJECT_ID.cloudfunctions.net/function-sample-gcp -d "hello"
----