A collection of Google Cloud Platform (GCP) Go services, Cloud Run functions (Cloud Functions 2nd gen), Pub/Sub dead-letter topic workflows, Dialogflow CX webhooks, and gRPC implementations.
The repository is organized as a Go multi-module workspace (go.work):
| Directory | Description | Technologies |
|---|---|---|
df-v2/ |
Dialogflow CX fulfillment webhook and HTTP Cloud Run functions (HelloShirts, Echo, LogTestV2) using log/slog structured JSON logging. |
Cloud Run functions, log/slog, Go 1.26 |
dead_letter_tests/ |
Pub/Sub retry mechanisms, dead-letter topics (pluto-dead-letter), and OIDC push authentication configurations for Cloud Run functions. |
Pub/Sub, CloudEvent, Cloud Run, IAM |
grpc_tests/ |
Complete gRPC service (NotesService) showcasing protobuf definitions, client, and Dockerized server deployed to Cloud Run with HTTP/2. |
gRPC, Protobuf, Docker, Cloud Run HTTP/2 |
-
Go: Version
1.26or higher -
Google Cloud SDK (
gcloud): Authenticated and configured with your project -
Docker: For local testing and container image builds (for
grpc_tests) -
Protocol Buffers (
protoc): For compiling.protofiles (forgrpc_tests)
Ensure the required Google Cloud APIs are enabled:
gcloud services enable \
run.googleapis.com \
cloudfunctions.googleapis.com \
pubsub.googleapis.com \
artifactregistry.googleapis.com \
cloudbuild.googleapis.com \
logging.googleapis.comCreate the Docker Artifact Registry repository (one-time setup for grpc_tests):
gcloud artifacts repositories create notes-grpc-server \
--repository-format=docker \
--location=us-west2 \
--description="Docker repository for Notes gRPC service" \
--project="$GCP_PROJECT"Each module includes a Makefile that runs formatters, linters (golangci-lint, go vet), unit tests, and compilation checks before deployment.
# Run full quality pipeline (fmt, vet, lint, test, build) across all modules
make check
# Update all Go dependencies to latest versions and tidy across all modules
make update
# Or individual checks and maintenance
make fmt # Format all Go files with gofmt
make vet # Run go vet across all modules
make lint # Run golangci-lint across all modules
make test # Run unit tests across all modules
make build # Compile all modules
make tidy # Run go mod tidy across all modulesEach sub-directory contains its own Makefile with dedicated pre-flight checks and gcloud deployment shortcuts:
# Deploy df-v2 Cloud Run functions
make -C df-v2 deploy-all
# Deploy dead_letter_tests Cloud Functions (gen2) & configure push subscription
make -C dead_letter_tests deploy-all
make -C dead_letter_tests config-push-sub
# Build container and deploy gRPC service to Cloud Run with HTTP/2
make -C grpc_tests deploy-allImplements Dialogflow CX webhook handling (HandleWebhookRequest) and HTTP utility functions.
-
Structured Logging: Uses standard library
log/slogconfigured for JSON output toos.Stdout, which Cloud Run and Cloud Logging ingest automatically. -
Deployment with
gcloud run deploy:
# Deploy Dialogflow CX Webhook
gcloud run deploy cx-webhook \
--source=df-v2 \
--function=HandleWebhookRequest \
--base-image=go126 \
--project="$GCP_PROJECT" \
--region="us-central1" \
--no-allow-unauthenticated
# Deploy HTTP Echo function
gcloud run deploy echo \
--source=df-v2 \
--function=Echo \
--base-image=go126 \
--project="$GCP_PROJECT" \
--region="us-central1" \
--no-allow-unauthenticatedSee df-v2/README.md for detailed deployment patterns, URL resolution, and testing scripts.
Demonstrates how to configure Pub/Sub push subscriptions with dead-letter forwarding, retry limits, and secure OIDC authentication.
radio-pluto
│
▼
[Source Subscription]
│
├── Retries on HTTP 500 (BadAckFunc)
└── After max delivery attempts (e.g. 5)
│
▼
pluto-dead-letter (Topic)
│
▼
dead-letter-reader (Push Subscription with OIDC)
│
▼
AckPubMessage (Cloud Run Function -> HTTP 200)
- Push Authentication & Audience: Proper configuration to ensure Cloud Run accepts OIDC ID tokens without 401/403 errors.
-
Topic URL Routing: Setting push endpoint path patterns to
/projects/PROJECT_ID/topics/TOPIC_NAMEfor proper Functions Framework topic detection.
See dead_letter_tests/README.md for step-by-step IAM permissions, subscription commands, and test verification.
Demonstrates an end-to-end gRPC service (NotesService) running on Cloud Run:
-
grpc_tests/notes: Protobuf definitions and generated Go stubs. -
grpc_tests/server: Multi-stage Dockerfile packaging the gRPC server. -
grpc_tests/client: Demo client connecting over TLS / HTTP/2.
# Deploy gRPC server with HTTP/2 enabled
make -C grpc_tests deploy-all
# Test gRPC client against live Cloud Run deployment
make -C grpc_tests client-cloud
# Test gRPC client locally against localhost:8080
make -C grpc_tests client-localSee grpc_tests/README.md for proto compilation, local Docker testing, and Cloud Run deployment details.
This project is licensed under the MIT License - see the LICENSE file for details.