47 lines
831 B
Plaintext
47 lines
831 B
Plaintext
: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
|
|
|
|
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 functions deploy function-sample-gcp-http \
|
|
--entry-point org.springframework.cloud.function.adapter.gcp.GcfJarLauncher \
|
|
--runtime java17 \
|
|
--trigger-http \
|
|
--source target/deploy \
|
|
--memory 512MB
|
|
----
|
|
|
|
Invoke the HTTP function:
|
|
|
|
----
|
|
curl https://REGION-PROJECT_ID.cloudfunctions.net/function-sample-gcp-http -d "hello"
|
|
----
|