Skip to content

Commit e96742c

Browse files
committed
Fix deploy instruction.
1 parent 6cdcc1f commit e96742c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

examples/cloud_run_async/README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,50 @@
33
This sample shows how to deploy asynchronous functions to [Cloud Run functions](https://cloud.google.com/functions) with the Functions Framework. It includes examples for both HTTP and CloudEvent functions, which can be found in the `main.py` file.
44

55
## Dependencies
6+
67
Install the dependencies for this example:
8+
79
```sh
810
pip install -r requirements.txt
911
```
1012

1113
## Running locally
1214

1315
### HTTP Function
16+
1417
To run the HTTP function locally, use the `functions-framework` command:
18+
1519
```sh
1620
functions-framework --target=hello_async_http
1721
```
22+
1823
Then, send a request to it from another terminal:
24+
1925
```sh
2026
curl localhost:8080
2127
# Output: Hello, async world!
2228
```
2329

2430
### CloudEvent Function
31+
2532
To run the CloudEvent function, specify the target and set the signature type:
33+
2634
```sh
2735
functions-framework --target=hello_async_cloudevent --signature-type=cloudevent
2836
```
37+
2938
Then, in another terminal, send a sample CloudEvent using the provided script:
39+
3040
```sh
3141
python send_cloud_event.py
3242
```
3343

3444
## Deploying to Cloud Run
45+
3546
You can deploy these functions to Cloud Run using the `gcloud` CLI.
3647

3748
### HTTP Function
49+
3850
```sh
3951
gcloud run deploy async-http-function \
4052
--source . \
@@ -44,14 +56,16 @@ gcloud run deploy async-http-function \
4456
```
4557

4658
### CloudEvent Function
59+
4760
```sh
4861
gcloud run deploy async-cloudevent-function \
4962
--source . \
5063
--function hello_async_cloudevent \
5164
--base-image python312 \
52-
--region <YOUR_REGION> \
53-
--set-env-vars=FUNCTION_SIGNATURE_TYPE=cloudevent
65+
--region <YOUR_REGION>
5466
```
67+
5568
After deploying, you can invoke the CloudEvent function by sending an HTTP POST request with a CloudEvent payload to its URL.
69+
5670
```
5771

0 commit comments

Comments
 (0)