Google Cloud
Design notes for running Celerity applications on Google Cloud
Design notes
This target environment is part of the vision and is not available yet. These notes come from early research into how Celerity resource types are likely to work on it. They are kept as a reference for when it is implemented, and will change when it is.
Google Cloud is envisioned as two deploy targets: gcloud, which runs the Celerity runtime on Cloud Run or GKE, and gcloud-serverless, which deploys handlers to Cloud Functions. Compute resource types describe each separately. Infrastructure resource types work the same way with both deploy targets.
celerity/api
Cloud Run and GKE
On Cloud Run and GKE, APIs are deployed as a containerised version of the Celerity runtime. Authentication, authorisation and CORS configuration defined for the API is taken care of by the runtime.
APIs can be deployed to Cloud Run, as well as Google Kubernetes Engine (GKE) in Autopilot or Standard mode. You can use compute configuration shared between compute resource types in the app deploy configuration file to fine-tune the compute configuration for your application.
Cloud Run
Cloud Run is a relatively simple environment to deploy applications to, the API is deployed as a containerised application that is fronted by either an internal or external load balancer.
Autoscaling is configured with the use of Cloud Run annotations through autoscaling.knative.dev/minScale and autoscaling.knative.dev/maxScale annotations. The knative autoscaler will scale the number of instances based on the number of requests and the CPU and memory usage of the instances. By default, for production app environments, the application will be configured to scale the number of instances with a minimum of 2 instance and a maximum of 5 instances. The default values for development app environments are a minimum of 1 instance and a maximum of 3 instances. Deploy configuration can be used to override this behaviour.
When domain configuration is provided and the load balancer is public-facing and Google-managed, a managed TLS certificate is created for the domain and attached to the load balancer, you will need to verify the domain ownership before the certificate can be used.
For Cloud Run, the API will not be associated with a VPC, defining custom VPCs for Cloud Run applications is not supported. Creating and linking a VPC to the API (see VPC annotations) will enable the Internal networking mode in the network ingress settings. celerity.api.vpc.subnetType has no effect for Cloud Run deployments, the API will always be deployed to a network managed by Google Cloud. Setting celerity.api.vpc.lbSubnetType to private will have the same affect as attaching a VPC to the application, making the application load balancer private. Setting celerity.api.vpc.lbSubnetType to public will have the same effect as not attaching a VPC to the API, making the application load balancer public. public is equivalent to the "Internal and Cloud Load Balancing" ingress setting.
Memory and CPU resources allocated to the API can be defined in the deploy configuration, when not defined, memory and CPU will be derived from the handlers configured for the API. If memory and CPU is not defined in the deploy configuration and can not be derived from the handlers, some defaults will be set. The Cloud Run service will be allocated a limit of 2GB of memory and 1 vCPU per instance in production app environments. For development app environments, the service will be allocated a limit of 1GB of memory and 0.5 vCPUs per instance.
A sidecar OpenTelemetry Collector container is deployed in the service with the API to collect traces and metrics, this will take up a small portion of the memory and CPU allocated to the API. Traces will only be collected if tracing is enabled for the API.
GKE
When an API is first deployed to GKE, a new cluster is created for the API unless you specify an existing cluster to use in the deploy configuration.
Using existing clusters
When using an existing cluster, the cluster must be configured in a way that is compatible with the VPC annotations configured for the API as well as the target compute type.
Cost of running on GKE
Running a Celerity application on GKE will often not be the most cost-effective option for APIs with low traffic or applications that are not expected to use a lot of resources. All GKE clusters have a fixed cost of around $72 per month for cluster management (control plane etc.), in addition to the cost of the nodes (VMs) that are used to run the application pods along with cost of the load balancer, data transfer and networking components. If you are looking for a cost-effective solution for low-traffic/low-load applications on Google Cloud, consider using Cloud Run or switching to a serverless deployment instead.
When in standard mode, for production app environments, the cluster will be regional with 2 zones for better availability guarantees. A node pool is created with autoscaling enabled, by default, for production app environments, the pool will have a minimum of 1 node and a maximum of 3 nodes per zone. As the cluster has 2 zones, this will be a minimum of 2 nodes and a maximum of 6 nodes overall. The cluster autoscaler is used to manage scaling and choosing the appropriate instance type to use given the requirements of the API service. For development app environments, the cluster will be regional with 1 zone. The node pool will have a minimum of 1 node and a maximum of 3 nodes in the single zone for development app environments. The minimum and maximum number of nodes can be overridden in the deploy configuration.
For standard mode, the machine type configured for node pools is determined by the CPU and memory requirements defined in the deploy configuration or derived from the handlers of the API, if the requirements can not be derived, a default machine type will be selected. For production app environments, the default machine type will be n2-highcpu-4 with 4 vCPUs and 4GB of memory. For development app environments, the default machine type will be n1-highcpu-2 with 2 vCPUs and 2GB of memory. The machine type for node pools can be overridden in the deploy configuration.
When in autopilot mode, Google manages scaling, security and node pools. Based on memory and CPU limits applied at the pod-level, appropriate node instance types will be selected and will be scaled automatically. There is no manual autoscaling configuration when running in autopilot mode, GKE Autopilot is priced per pod request rather than provisioned infrastructure, depending on the nature of your workloads, it could be both a cost-effective and convenient way to run your APIs. Read more about autopilot mode pricing.
In standard mode, the Kubernetes Horizontal Pod Autoscaler is used to scale the number of pods running the API based on CPU utilisation and average memory utilisation. In development app environments, the minimum number of pods is set to 1 and the maximum number of pods is set to 3 by default. In production app environments, the minimum number of pods is set to 2 and the maximum number of pods is set to 6 by default. The minimum and maximum number of pods can be overridden in the deploy configuration.
When domain configuration is provided and the load balancer that powers the Ingress service is public-facing and Google-managed, a managed TLS certificate is created for the domain and attached to the Ingress object, you will need to verify the domain ownership before the certificate can be used.
When it comes to networking, a GKE cluster is deployed as a private cluster, nodes that the pods for the API run on only use internal IP addresses, isolating them from the public internet. The Control plane has both internal and external endpoints, the external endpoint can be disabled from the Google Cloud/Kubernetes side. When celerity.api.vpc.lbSubnetType is set to public, an Ingress service is provisioned using an external Application Load Balancer. When celerity.api.vpc.lbSubnetType is set to private, an Ingress service is provisioned using an internal Application Load Balancer. The Ingress service is used to route traffic from the public internet to the service running the API.
Warning
celerity.api.vpc.subnetType has no effect for GKE clusters, the API will always be deployed to a private network, the API is exposed through the ingress service if the ingress is configured to be public.
If memory and CPU is not defined in the deploy configuration and can not be derived from the handlers, some defaults will be set. Limits of 1,792MB of memory and 1.6 vCPUs will be set for the pods that run the API in production app environments. For development app environments, the pods will be deployed with 870MB of memory and 0.8 vCPUs.
The OpenTelemetry Operator is used to configure a sidecar collector container for the API to collect traces and metrics. Traces will only be collected if tracing is enabled for the API.
Cloud Functions
On Google Cloud Functions, REST/HTTP APIs are deployed as Google Cloud API Gateways with Google Cloud Functions for the handlers.
JWT authentication for API Gateway is used for JWT auth guards. Only the RSA using SHA-256 (RS256) algorithm is supported when deploying to Google Cloud API Gateway.
Custom authorisers are not supported by Google Cloud API Gateway; to get around this, Celerity will bundle the custom authoriser handler code with each protected handler and the handlers SDK that is used to build a Celerity application will take care of calling the custom authoriser before the actual handler is called.
When tracing is enabled, the built-in Google Cloud metrics and tracing offerings will be used to collect traces and metrics for the handlers. Traces and metrics can be collected into tools like Grafana with plugins that use Google Cloud Trace as a data source. Logs and metrics are captured out of the box for the API Gateway and will be collected in Google Cloud Logging and Monitoring. You can export logs and metrics to other tools like Grafana with plugins that use Google Cloud Logging and Monitoring as a data source.
Tracing on Google Cloud Functions
Google Cloud API Gateway does not currently support tracing.
About WebSockets
Google Cloud API Gateway does not support WebSocket APIs.
To deploy a WebSockets API to Google Cloud, you will need to use the Cloud Run or GKE target (gcloud) and deploy the API as a containerised application.
celerity/handler
Cloud Run and GKE
On Cloud Run and GKE, handlers are loaded into the Celerity runtime in a single process. Depending on links and configuration, the handler will be wired up to the appropriate HTTP route, WebSocket route, event source, stream or scheduled trigger. Google Cloud Pub/Sub will be wired up directly to the application in the runtime that will forward messages to the handler, other event sources will have some glue components such as a Pub/Sub topic that the application will poll for events. The Celerity runtime works in tandem with the Bluelink deploy engine to make sure that handlers are wired up correctly to the event sources even when there is no direct connection between the application running in the Celerity runtime and the event source.
Cloud Functions
On Cloud Functions, handlers are deployed as Google Cloud Functions.
Depending on the links and configuration, the handler will be wired up to the appropriate HTTP route, event source, stream or scheduled trigger. HTTP handlers will be wired up to Google Cloud API Gateway, event sources such as Google Cloud Pub/Sub, Google Cloud Storage and Google Cloud Firestore will be wired up to the Cloud Function directly. For scheduled triggers, Cloud Scheduler and Pub/Sub will be combined to trigger the function. For queues, Google Cloud Pub/Sub topics will be configured as triggers for the Cloud Function. Workflows can not be deployed to the Google Cloud Serverless target environment, so handlers used as steps in a workflow are deployed with the gcloud target, loaded into the container of the Celerity workflow runtime (read more).
Warning
Google Cloud Serverless does not support WebSocket APIs, meaning handlers linked from WebSocket APIs can not be deployed to Google Cloud Functions.
The maximum timeout for a Cloud Function is 3600 seconds (60 minutes). For handlers that need to run longer, Cloud Run or GKE would be the alternative.
Runtime mapping
Celerity runtime identifiers would map to Google Cloud as follows.
| Environment | Example for python3.13.x | Example for os-only.debian13 |
|---|---|---|
| Cloud Run and GKE | Celerity runtime container image | Celerity runtime container image |
| Cloud Functions | python313 | Not supported |
Google Cloud Functions and OS-only runtimes
Google Cloud Functions does not offer a custom-runtime mechanism, so OS-only runtimes, where a pre-compiled handler binary is uploaded and executed directly, can not be deployed there. Languages that compile ahead of time are supported (Go to a native binary, Java and .NET to bytecode on a virtual machine), but the platform builds your handler from source rather than running a binary you provide.
celerity/consumer
Cloud Run and GKE
On Cloud Run and GKE, consumer applications are deployed as a containerised version of the Celerity runtime.
Consumer applications can be deployed to Cloud Run, as well as Google Kubernetes Engine (GKE) in Autopilot or Standard mode using deploy configuration for the Google Cloud target environment.
Cloud Run
Cloud Run is a relatively simple environment to deploy applications to, the consumer application is deployed as a containerised application.
When the sourceId is a Celerity topic, a Pub/Sub subscription is created without the need for any intermediary infrastructure.
For other event sources, an integration is set up to receive events from the source data store, bucket or queue and forward them to the consumer application via a Pub/Sub topic. The Celerity runtime will then receive messages from the Pub/Sub topic.
For consumer applications, Cloud Run uses a push model where a Pub/Sub push subscription is configured for a Cloud Run app. Due to this, the Celerity runtime will not be configured to poll a message source, a HTTP API will be set up instead to receive messages from the Pub/Sub push subscription.
Autoscaling is configured with the use of Cloud Run annotations through autoscaling.knative.dev/minScale and autoscaling.knative.dev/maxScale annotations. The knative autoscaler will scale the number of instances based on the number of requests and the CPU and memory usage of the instances. By default, for production app environments, the application will be configured to scale the number of instances with a minimum of 2 instances and a maximum of 5 instances. The default values for development app environments are a minimum of 1 instance and a maximum of 3 instances. Deploy configuration can be used to override this behaviour.
For Cloud Run, the consumer application will not be associated with a VPC, defining custom VPCs for Cloud Run applications is not supported. Creating and linking a VPC to the consumer application will enable the Internal networking mode in the network ingress settings. celerity.consumer.vpc.subnetType has no effect for Cloud Run deployments, the application will always be deployed to a network managed by Google Cloud. Setting celerity.consumer.vpc.ingressType to private will have the same affect as attaching a VPC to the application, making the run trigger endpoint private. Setting celerity.consumer.vpc.ingressType to public will have the same effect as not attaching a VPC to the consumer application, making the Cloud Run service public if an external application load balancer is configured to route traffic to the Cloud Run service. public is equivalent to the "Internal and Cloud Load Balancing" ingress setting.
Memory and CPU resources allocated to the consumer application can be defined in the deploy configuration, when not defined, memory and CPU will be derived from the handlers configured for the application. If memory and CPU is not defined in the deploy configuration and can not be derived from the handlers, some defaults will be set. The Cloud Run service will be allocated a limit of 2GB of memory and 1 vCPU per instance in production app environments. For development app environments, the service will be allocated a limit of 1GB of memory and 0.5 vCPUs per instance.
A sidecar OpenTelemetry Collector container is deployed in the service with the consumer application to collect traces and metrics, this will take up a small portion of the memory and CPU allocated to the application. Traces will only be collected if tracing is enabled for the handlers that process messages.
GKE
In the GKE environment, the Celerity runtime will use a pull subscription to poll a Pub/Sub topic for messages. For other event sources, an integration is set up to receive events from the source data store, bucket or queue and forward them to the consumer application via a Pub/Sub topic. The Celerity runtime will then pull messages from the Pub/Sub topic.
When a consumer application is first deployed to GKE, a new cluster is created for the application unless you specify an existing cluster to use in the deploy configuration.
Using existing clusters
When using an existing cluster, the cluster must be configured in a way that is compatible with the VPC annotations configured for the application as well as the target compute type.
Cost of running on GKE
Running a Celerity application on GKE will often not be the most cost-effective option for APIs with low traffic or applications that are not expected to use a lot of resources. All GKE clusters have a fixed cost of around $72 per month for cluster management (control plane etc.), in addition to the cost of the nodes (VMs) that are used to run the application pods along with cost of data transfer and networking components. If you are looking for a cost-effective solution for low-load applications on Google Cloud, consider using Cloud Run or switching to a serverless deployment instead.
When in standard mode, for production app environments, the cluster will be regional with 2 zones for better availability guarantees. A node pool is created with autoscaling enabled, by default, the pool will have a minimum of 1 node and a maximum of 3 nodes per zone. As the cluster has 2 zones, this will be a minimum of 2 nodes and a maximum of 6 nodes overall. The cluster autoscaler is used to manage scaling and choosing the appropriate instance type to use given the requirements of the consumer application service. For development app environments, the cluster will be regional with 1 zone. The node pool will have a minimum of 1 node and a maximum of 3 nodes in the single zone. The minimum and maximum number of nodes can be overridden in the deploy configuration.
For standard mode, the machine type configured for node pools is determined by the CPU and memory requirements defined in the deploy configuration or derived from the handlers of the consumer aplication, if the requirements can not be derived, a default machine type will be selected. For production app environments, the default machine type will be n2-highcpu-4 with 4 vCPUs and 4GB of memory. For development app environments, the default machine type will be n1-highcpu-2 with 2 vCPUs and 2GB of memory. The machine type for node pools can be overridden in the deploy configuration.
When in autopilot mode, Google manages scaling, security and node pools. Based on memory and CPU limits applied at the pod-level, appropriate node instance types will be selected and will be scaled automatically. There is no manual autoscaling configuration when running in autopilot mode, GKE Autopilot is priced per pod request rather than provisioned infrastructure, depending on the nature of your workloads, it could be both a cost-effective and convenient way to run your applications. Read more about autopilot mode pricing.
In standard mode, the Kubernetes Horizontal Pod Autoscaler is used to scale the number of pods running the consumer application based on CPU utilisation and average memory utilisation. In development app environments, the minimum number of pods is set to 1 and the maximum number of pods is set to 3 by default. In production app environments, the minimum number of pods is set to 2 and the maximum number of pods is set to 6 by default. The minimum and maximum number of pods can be overridden in the deploy configuration.
When it comes to networking, a GKE cluster is deployed as a private cluster, nodes that the pods for the application run on only use internal IP addresses, isolating them from the public internet. The Control plane has both internal and external endpoints, the external endpoint can be disabled from the Google Cloud/Kubernetes side.
Warning
celerity.consumer.vpc.subnetType has no effect for GKE clusters, the application will always be deployed to a private network.
If memory and CPU is not defined in the deploy configuration and can not be derived from the handlers, some defaults will be set. Limits of 1,792MB of memory and 1.6 vCPUs will be set for the pods that run the application in production app environments. For development app environments, the pods will be deployed with 870MB of memory and 0.8 vCPUs.
The OpenTelemetry Operator is used to configure a sidecar collector container for the application to collect traces and metrics. Traces will only be collected if tracing is enabled for the handlers that process messages.
Cloud Functions
On Cloud Functions, consumer applications are deployed as Google Cloud Functions that are triggered by a Pub/Sub topic.
When the sourceId is a Celerity topic, a Pub/Sub subscription is created without the need for any intermediary infrastructure.
For other event sources, direct triggers are set up for the consumer handlers for the configured data store, storage bucket or queue event source.
Configuration mappings. celerity/consumer fields would map to Pub/Sub triggers and Firestore triggers for Cloud Functions as follows. Firestore event triggers aren't stream-based, but are the closest analogue to DynamoDB Streams. Google Cloud has no data stream service equivalent to Amazon Kinesis, so dataStream sources would not be supported.
N/A means the service has no equivalent setting; — means the field doesn't apply to that source type.
| Celerity Consumer | Pub/Sub | Firestore trigger |
|---|---|---|
batchSize | N/A | N/A |
visibilityTimeout | N/A | — |
waitTimeSeconds | N/A | — |
partialFailures | N/A | N/A |
dbStreamId | — | {database}(:{collectionGroup})? (maps to event filters) |
startFromBeginning | — | N/A |
For Celerity topic sources, the dead letter queue would be a dead letter topic configured for the consumer's subscription, with celerity.consumer.deadLetterQueueMaxAttempts mapping to maxDeliveryAttempts (default: 5, min: 5, max: 100).
When tracing is enabled, the built-in Google Cloud metrics and tracing offerings will be used to collect traces and metrics for the handlers. Traces and metrics can be collected in to tools like Grafana with plugins that use Google Cloud Trace as a data source. You can export logs and metrics to other tools like Grafana with plugins that use Google Cloud Logging and Monitoring as a data source.
celerity/schedule
Cloud Run and GKE
On Cloud Run and GKE, schedule applications are deployed as a containerised version of the Celerity runtime.
Schedule applications can be deployed to Cloud Run, as well as Google Kubernetes Engine (GKE) in Autopilot or Standard mode using deploy configuration for the Google Cloud target environment.
Cloud Run
Cloud Run is a relatively simple environment to deploy applications to, the schedule application is deployed as a containerised application.
For scheduled applications, a Cloud Scheduler job is created to run on the schedule defined in the schedule field of the celerity/schedule resource. The Cloud Scheduler job is configured to send a message to a Pub/Sub topic that is then pushed to the Cloud Run service.
For schedule applications, Cloud Run uses a push model where a Pub/Sub push subscription is configured for a Cloud Run app. Due to this, the Celerity runtime will not be configured to poll a message source, a HTTP API will be set up instead to receive messages from the Pub/Sub push subscription.
Autoscaling is configured with the use of Cloud Run annotations through autoscaling.knative.dev/minScale and autoscaling.knative.dev/maxScale annotations. The knative autoscaler will scale the number of instances based on the number of requests and the CPU and memory usage of the instances. By default, for production app environments, the application will be configured to scale the number of instances with a minimum of 2 instances and a maximum of 5 instances. The default values for development app environments are a minimum of 1 instance and a maximum of 3 instances. Deploy configuration can be used to override this behaviour.
For Cloud Run, the schedule application will not be associated with a VPC, defining custom VPCs for Cloud Run applications is not supported. Creating and linking a VPC to the application will enable the Internal networking mode in the network ingress settings. celerity.schedule.vpc.subnetType has no effect for Cloud Run deployments, the application will always be deployed to a network managed by Google Cloud. Setting celerity.schedule.vpc.ingressType to private will have the same affect as attaching a VPC to the application, making the run trigger endpoint private. Setting celerity.schedule.vpc.ingressType to public will have the same effect as not attaching a VPC to the application, making the Cloud Run service public if an external application load balancer is configured to route traffic to the Cloud Run service. public is equivalent to the "Internal and Cloud Load Balancing" ingress setting.
Memory and CPU resources allocated to the schedule application can be defined in the deploy configuration, when not defined, memory and CPU will be derived from the handlers configured for the application. If memory and CPU is not defined in the deploy configuration and can not be derived from the handlers, some defaults will be set. The Cloud Run service will be allocated a limit of 2GB of memory and 1 vCPU per instance in production app environments. For development app environments, the service be allocated a limit of 1GB of memory and 0.5 vCPUs per instance.
A sidecar OpenTelemetry Collector container is deployed in the service with the schedule application to collect traces and metrics, this will take up a small portion of the memory and CPU allocated to the application. Traces will only be collected if tracing is enabled for the handlers that process messages.
GKE
When a schedule application is deployed to GKE, a Cloud Scheduler job is created to run on the schedule defined in the schedule field of the celerity/schedule resource. The Cloud Scheduler job is configured to send a message to a Pub/Sub topic which the Celerity runtime will poll for messages.
The schedule's queueId output would be the ID of this Pub/Sub topic, for example projects/my-project/topics/my-topic.
In the GKE environment, the Celerity runtime will use a pull subscription to poll a Pub/Sub topic for messages from a Pub/Sub topic.
When a schedule application is first deployed to GKE, a new cluster is created for the application unless you specify an existing cluster to use in the deploy configuration.
Using existing clusters
When using an existing cluster, the cluster must be configured in a way that is compatible with the VPC annotations configured for the application as well as the target compute type.
Cost of running on GKE
Running a Celerity application on GKE will often not be the most cost-effective option for APIs with low traffic or applications that are not expected to use a lot of resources. All GKE clusters have a fixed cost of around $72 per month for cluster management (control plane etc.), in addition to the cost of the nodes (VMs) that are used to run the application pods along with cost of data transfer and networking components. If you are looking for a cost-effective solution for low-load applications on Google Cloud, consider using Cloud Run or switching to a serverless deployment instead.
When in standard mode, for production app environments, the cluster will be regional with 2 zones for better availability guarantees. A node pool is created with autoscaling enabled, by default, the pool will have a minimum of 1 node and a maximum of 3 nodes per zone. As the cluster has 2 zones, this will be a minimum of 2 nodes and a maximum of 6 nodes overall. The cluster autoscaler is used to manage scaling and choosing the appropriate instance type to use given the requirements of the schedule application service. For development app environments, the cluster will be regional with 1 zone. The node pool will have a minimum of 1 node and a maximum of 3 nodes in the single zone. The minimum and maximum number of nodes can be overridden in the deploy configuration.
When in autopilot mode, Google manages scaling, security and node pools. Based on memory and CPU limits applied at the pod-level, appropriate node instance types will be selected and will be scaled automatically. There is no manual autoscaling configuration when running in autopilot mode, GKE Autopilot is priced per pod request rather than provisioned infrastructure, depending on the nature of your workloads, it could be both a cost-effective and convenient way to run your applications. Read more about autopilot mode pricing.
For standard mode, the machine type configured for node pools is determined by the CPU and memory requirements defined in the deploy configuration or derived from the handlers of the schedule aplication, if the requirements can not be derived, a default machine type will be selected. For production app environments, the default machine type will be n2-highcpu-4 with 4 vCPUs and 4GB of memory. For development app environments, the default machine type will be n1-highcpu-2 with 2 vCPUs and 2GB of memory. The machine type for node pools can be overridden in the deploy configuration.
When it comes to networking, a GKE cluster is deployed as a private cluster, nodes that the pods for the application run on only use internal IP addresses, isolating them from the public internet. The Control plane has both internal and external endpoints, the external endpoint can be disabled from the Google Cloud/Kubernetes side.
Warning
celerity.schedule.vpc.subnetType has no effect for GKE clusters, the application will always be deployed to a private network.
If memory and CPU is not defined in the deploy configuration and can not be derived from the handlers, some defaults will be set. Limits of 1,792MB of memory and 1.6 vCPUs will be set for pods that run the application in production app environments. For development app environments, the pods will be deployed with 870MB of memory and 0.8 vCPUs.
The OpenTelemetry Operator is used to configure a sidecar collector container for the application to collect traces and metrics. Traces will only be collected if tracing is enabled for the handlers that process messages.
Cloud Functions
On Cloud Functions, scheduled applications are deployed as Google Cloud Functions that are triggered by a Pub/Sub topic to which a Cloud scheduler job sends messages at the scheduled time or interval defined in the schedule field of the celerity/schedule resource.
The schedule field would be converted to a Cloud Scheduler cron expression (see Cloud Scheduler with Pub/Sub and Cloud Functions), and input delivered in the message body to the handler.
When tracing is enabled, the built-in Google Cloud metrics and tracing offerings will be used to collect traces and metrics for the handlers. Traces and metrics can be collected in to tools like Grafana with plugins that use Google Cloud Trace as a data source. You can export logs and metrics to other tools like Grafana with plugins that use Google Cloud Logging and Monitoring as a data source.
celerity/datastore
In Google Cloud, celerity/datastore is envisioned to be implemented with Google Cloud Firestore. Detailed notes have not been written yet beyond the following.
Where composite keys are not supported, a data store's sort key would be combined with its partition key to create additional composite indexes. The data store's id output would be a collection path such as projects/my-project/databases/(default)/documents/users.
Local development for the gcloud and gcloud-serverless deploy targets would use the Firebase Emulator in place of DynamoDB Local.
celerity/sqlDatabase
SQL databases will be provisioned using Google Cloud SQL for PostgreSQL and MySQL. The database's id output will take a form such as projects/my-project/instances/orders.
When authMode is set to "password", static credentials are generated and used. When authMode is set to "iam", Celerity enables IAM Database Authentication on the Cloud SQL instance. The handler's service account is registered as a Cloud SQL IAM user and granted roles/cloudsql.client and roles/cloudsql.instanceUser. The SDK uses the Cloud SQL Connector to generate OAuth2 access tokens at runtime, and the credentials provider's user field holds the service account email.
celerity/cache
Caches will be provisioned using Google Cloud Memorystore for Valkey.
When authMode is set to "password", a static AUTH token is generated and used. When authMode is set to "iam", Celerity enables IAM Authentication on the Memorystore instance. The handler's service account is granted the necessary Memorystore IAM roles. The SDK uses OAuth2 access tokens for authentication at runtime.
celerity/bucket
In Google Cloud, the celerity/bucket resource is implemented using Google Cloud Storage buckets.
When replication is enabled, Celerity will create a dual-region replication configuration for the bucket with the region for the deployment of the bucket and a single region to replicate to.
Warning
When more than one region is specified for replication, only the first region will be used, as Celerity only supports dual-region replication for Google Cloud Storage buckets.
Replication regions would be given as Cloud Storage location identifiers, such as US-WEST2.
When versioning status is Suspended, object versioning would be Disabled with soft delete Enabled.
Lifecycle rules would map to Cloud Storage lifecycle rules, except for expirationDate, which has no equivalent. Storage classes would map as follows:
| Celerity Bucket Storage Class | Google Cloud Storage |
|---|---|
| hot | STANDARD |
| cool | NEARLINE |
| archive | ARCHIVE |
celerity/queue
In the Google Cloud environment, a queue is either implemented with Google Cloud Pub/Sub or Google Cloud Tasks.
Pub/Sub
A queue is implemented with Google Cloud Pub/Sub when the queue is configured to be FIFO as only Pub/Sub supports FIFO semantics in Google Cloud with ordering keys. A queue is also implemented with Google Cloud Pub/Sub when the queue is a part of a dead-letter queue link. In these cases, a Pub/Sub topic is created with a subscription that are combined to act as a queue.
The maximum size for a message is fixed at 10 MB, with a request limit of 10 MB and a maximum of 1,000 messages per request.
Message retention can be configured for topics in Google Cloud Pub/Sub, with a default of 7 days and a maximum of 31 days. This can be configured in the app deploy configuration file.
The visibilityTimeout in the queue spec is not applicable for Pub/Sub queues as they are pull-based and do not have a visibility timeout. Instead, the subscription will be configured with a ackDeadline that determines how long a message will be retained in the subscription before it is considered unacknowledged and can be redelivered.
When a celerity/queue is configured to be a dead-letter queue for another, when deployed to Google Cloud Pub/Sub, it will be configured as a dead-letter topic configured at the subscription level for the Celerity consumer(s) that process messages from the queue.
Cloud Tasks
A queue is implemented with Google Cloud Tasks when the queue is not configured to be FIFO and is not part of a dead-letter queue link. In this case, the queue is created as a Cloud Tasks queue with a push integration via a webhook to the consumer application that processes messages from the queue. The Celerity runtime will configure a webhook endpoint in the consumer application to receive messages from the Cloud Tasks queue.
You can find a detailed comparison of the two services here. If you don't require FIFO semantics but Cloud Tasks is not suitable for your use case, you should consider using a celerity/topic instead of a queue.
The maximum size for a message in Cloud Tasks is fixed at 1 MB.
The message retention period for Cloud Tasks is 30 days and cannot be configured.
As Cloud Tasks is a push-based service with a single target, the visibilityTimeout in the queue spec is not applicable.
There is no support for dead-letter queues in Cloud Tasks, when a relationship is identified in a blueprint that indicates that a queue is a dead-letter queue for another queue, Celerity will opt to use Pub/Sub instead of Cloud Tasks for the queue.
App Deploy Configuration
gcloud.pubsub.topicAsQueue.messageRetentionPeriod
The message retention period for Google Cloud Pub/Sub topics used for queues.
You can disable message retention by setting this property to disabled.
Type
string
Deploy Targets
gcloud, gcloud-serverless
Default Value
7d
Minimum Value
10m
Maximum Value
31d
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.pubsub.topicAsQueue.messageRetentionPeriod": "14d"
}
}
}gcloud.pubsub.topicAsQueue.<queue>.messageRetentionPeriod
The message retention period for a specific Google Cloud Pub/Sub topic used for queues.
<queue> is the name (key) of the queue resource in the blueprint, not the topic name in Google Cloud.
You can disable message retention by setting this property to disabled.
Type
string
Deploy Targets
gcloud, gcloud-serverless
Default Value
7d
Minimum Value
10m
Maximum Value
31d
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.pubsub.topicAsQueue.myQueue.messageRetentionPeriod": "14d"
}
}
}celerity/topic
In the Google Cloud environment, a topic is implemented as a Google Cloud Pub/Sub topic.
For tracing, a trace context is propagated through the topic, allowing for distributed tracing of messages published to the topic. For Celerity applications that consume messages from the topic, the trace context will be extracted and used to trace the processing of the message in the consumer application using libraries such as OpenTelemetry.
When fifo is set to true, the message ordering feature of Google Cloud Pub/Sub will be used in subscriptions to the topic. An ordering key must be provided when publishing messages to the topic to ensure that messages are delivered in the order they were published.
Message retention can be configured for topics regardless of whether they use message ordering or not, the default retention period is 7 days. This can be configured in the app deploy configuration file.
When a celerity/consumer uses the topic as its source (its sourceId set to the topic's exported ID), a subscription would be created to receive messages from the topic and wired up to the consumer application.
App Deploy Configuration
gcloud.pubsub.topic.messageRetentionPeriod
The message retention period for Google Cloud Pub/Sub topics.
You can disable message retention by setting this property to disabled.
type
string
Deploy Targets
gcloud, gcloud-serverless
default value
7d
minimum value
10m
maximum value
31d
examples
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.pubsub.topic.messageRetentionPeriod": "14d"
}
}
}gcloud.pubsub.topic.<topic>.messageRetentionPeriod
The message retention period for a specific Google Cloud Pub/Sub topic.
<topic> is the name (key) of the topic resource in the blueprint, not the topic name in Google Cloud.
You can disable message retention by setting this property to disabled.
type
string
Deploy Targets
gcloud, gcloud-serverless
default value
7d
minimum value
10m
maximum value
31d
examples
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.pubsub.topic.myTopic.messageRetentionPeriod": "14d"
}
}
}celerity/config
In the Google Cloud environment, secrets and configuration is stored with the Google Cloud Secret Manager service.
A secret store will be stored as a single secret in the Secret Manager service as a JSON-encoded string of key/value pairs. The store's id output would take a form such as projects/my-project/secrets/my-secret.
The maximum size of a secret in Google Cloud Secret Manager is 64KB, if the secret store exceeds this size, saving the secret will fail. To get around this you can split your secrets and configuration across multiple celerity/config resources.
If replicate is set to true, the secret store will be replicated across multiple regions in a way that is managed by Google Cloud through the Automatic replication policy.
When encryptionKeyId is provided, it would be used as a customer-managed encryption key (CMEK) from Cloud KMS for the secret. encryptionKeyId would be the key's full resource name (projects/<project>/locations/<location>/keyRings/<keyRing>/cryptoKeys/<key>). With the automatic replication policy used when replicate is true, the key must be in the global Cloud KMS location. When replicate is not set, the secret would use a user-managed replication policy with a single replica in the deployment's region, and the key must be in that region. Celerity would grant the Secret Manager service agent the roles/cloudkms.cryptoKeyEncrypterDecrypter role on the key, which Secret Manager needs to use it. When encryptionKeyId is not provided, Google Cloud manages the encryption keys.
Rotation
When the rotation field is set in the celerity/config resource, Celerity would automatically rotate secrets that are managed by Celerity.
This is only applicable to secrets that are auto-populated by Celerity for links between handlers or application resource types and infrastructure resources.
A google cloud function will be created to rotate secrets, which will be triggered by a Cloud Scheduler job to rotate the secrets in the store based on the period (in days) specified in the rotation configuration.
This google cloud function will have permissions to update the specific infrastructure resources that the config store is linked to, such as an SQL database or a cache.
celerity/vpc
Celerity VPCs are provisioned in Google Cloud using the VPC resource type in custom mode along with associated networking resources. The Celerity VPC presets map to configurations of subnets, routing and access controls required for resources such as applications, databases and caches to be placed in the VPC. A referenced VPC is resolved by its Celerity name (via network labelling); Google Cloud VPCs are global, so no region needs to match.
On GKE, a VPC linked to a celerity/api, celerity/consumer or celerity/schedule would place the application component itself. On Cloud Run, the component is not placed in a custom VPC; linking a VPC switches its ingress to Internal instead (see celerity/api). The VPC's id output would take a form such as projects/my-project/global/networks/my-vpc.
The celerity.handler.vpc.subnetType annotation, and the component-level celerity.<component>.vpc.subnetType that cascades to handlers on gcloud-serverless, would have no effect: Cloud Functions attach to a VPC through a Serverless VPC Access connector and egress settings, which does not offer a choice of public or private subnet.
Compute Configuration
These options would be set in the deployTarget.config object in the app deploy configuration file for the gcloud target. They apply to every compute resource type: celerity/api, celerity/consumer, celerity/schedule and celerity/workflow.
gcloud.compute.containerService
Determine the container service to use when deploying to the gcloud target environment.
Type
string
Deploy Targets
gcloud
Allowed Values
gke | cloudrun
Default Value
cloudrun
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.containerService": "gke"
}
}
}gcloud.compute.cloudrun.instanceMemoryLimit
The maximum amount of memory that can be used by a single instance of the application running on Cloud Run. See Cloud Run Limits for more information on the combination of CPU and memory limits that can be set for Cloud Run.
Type
string
Deploy Targets
gcloud
Default Value
If memory usage is set in the application blueprint for handlers in the application, these will be used to determine reasonable memory limits for instances instead.
If not set in the blueprint, by default, this will be 1Gi for development app environments and 2Gi for production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.cloudrun.instanceMemoryLimit": "2Gi"
}
}
}gcloud.compute.cloudrun.instanceCPULimit
The maximum amount of CPU units that can be used by a single instance of the application running on Cloud Run. See Cloud Run Limits for more information on the combination of CPU and memory limits that can be set for Cloud Run.
Type
number
Deploy Targets
gcloud
Default Value
If CPU usage is set in the application blueprint for handlers in the application, these will be used to determine reasonable CPU limits for instances instead.
If not set in the blueprint, by default, this will be 0.5 for development app environments and 1 for production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.cloudrun.instanceCPULimit": 1
}
}
}gcloud.compute.cloudrun.autoscaling.minScale
The minimum number of instances to run for the Knative autoscaler that runs under the hood for Cloud Run. This is the autoscaling.knative.dev/minScale annotation.
Type
number
Deploy Targets
gcloud
Default Value
By default, this will be 1 for development app environments and 2 for production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.cloudrun.autoscaling.minScale": 2
}
}
}gcloud.compute.cloudrun.autoscaling.maxScale
The maximum number of instances to run for the Knative autoscaler that runs under the hood for Cloud Run. This is the autoscaling.knative.dev/maxScale annotation.
Type
number
Deploy Targets
gcloud
Default Value
By default, this will be 3 for development app environments and 5 for production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.cloudrun.autoscaling.maxScale": 5
}
}
}gcloud.compute.gke.mode
The mode to use when deploying to the gcloud target environment and the container service is gke.
This determines whether the application will be deployed in standard or autopilot mode.
Type
string
Deploy Targets
gcloud
Allowed Values
standard | autopilot
Default Value
standard
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.mode": "autopilot"
}
}
}gcloud.compute.gke.autoscaling.minNodesPerZone
The minimum number of nodes per zone to use when deploying to the gcloud target environment, the container service is gke and the mode is standard.
When deploying to a production app environment, there will be 2 zones used for the application, so this value will be multiplied by 2 to determine the minimum number of total nodes for the application.
When deploying to a development app environment, there will be 1 zone used for the application, so this value will be used as the minimum number of total nodes for the application.
Type
number
Deploy Targets
gcloud
Default Value
1
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.autoscaling.minNodesPerZone": 2
}
}
}gcloud.compute.gke.autoscaling.maxNodesPerZone
The maximum number of nodes per zone to use when deploying to the gcloud target environment, the container service is gke and the mode is standard.
When deploying to a production app environment, there will be 2 zones used for the application, so this value will be multiplied by 2 to determine the maximum number of total nodes for the application.
When deploying to a development app environment, there will be 1 zone used for the application, so this value will be used as the maximum number of total nodes for the application.
Type
number
Deploy Targets
gcloud
Default Value
3
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.autoscaling.maxNodesPerZone": 5
}
}
}gcloud.compute.gke.machineType
The machine type to use when deploying to the gcloud target environment, the container service is gke and the mode is standard.
Type
string
Deploy Targets
gcloud
Default Value
If not set and the machine type can not be derived from the application handlers, the default machine type will be n2-highcpu-2 for development app environments and n2-highcpu-4 for production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.machineType": "n4-standard-4"
}
}
}gcloud.compute.gke.podMemory
The amount of memory that can be used by a single pod running the application.
This is used when deploying to the gcloud target environment and the container service is gke.
Type
string
Deploy Targets
gcloud
Default Value
If memory usage is set in the application blueprint for handlers in the application, these will be used to determine reasonable memory limits for pods instead.
If not set in the blueprint, by default, this will be 870Mi for development app environments and 1792Mi for production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.podMemory": "2Gi"
}
}
}gcloud.compute.gke.podCPU
The amount of CPU that can be used by a single pod running the application.
This is used when deploying to the gcloud target environment and the container service is gke.
Type
string
Deploy Targets
gcloud
Default Value
If CPU usage is set in the application blueprint for handlers in the application, these will be used to determine reasonable CPU limits for pods instead.
If not set in the blueprint, by default, this will be 0.8 for development app environments and 1.6 for production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.podCPU": "1"
}
}
}gcloud.compute.gke.hpa.minReplicas
The minimum number of replicas of a pod that should be running at any time for the Kubernetes horizontal pod autoscaler. This is used when deploying to the gcloud target environment and the container service is gke.
Type
number
Deploy Targets
gcloud
Default Value
By default, this will be 1 for development app environments and 2 for production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.hpa.minReplicas": 2
}
}
}gcloud.compute.gke.hpa.maxReplicas
The maximum number of replicas of a pod that should be running at any time for the Kubernetes horizontal pod autoscaler. This is used when deploying to the gcloud target environment and the container service is gke.
Type
number
Deploy Targets
gcloud
Default Value
By default, this will be 3 for development app environments and 6 for production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.hpa.maxReplicas": 5
}
}
}gcloud.compute.gke.hpa.targetCPUUtilizationPercentage
The target CPU utilisation percentage for the Kubernetes horizontal pod autoscaler. This will be used in forming the scaling policy for pods running the application.
If gcloud.compute.gke.hpa.targetCPUAverageValue is also set, this value will take precedence.
This is used when deploying to the gcloud target environment and the container service is gke.
Type
number
Deploy Targets
gcloud
Default Value
By default, this will be 50 (percent) for both development and production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.hpa.targetCPUUtilizationPercentage": 45
}
}
}gcloud.compute.gke.hpa.targetCPUAverageValue
The target CPU exact average value for the Kubernetes horizontal pod autoscaler. This will be used in forming the scaling policy for pods running the application.
If gcloud.compute.gke.hpa.targetCPUUtilizationPercentage is also set, this value will be ignored.
This is used when deploying to the gcloud target environment and the container service is gke.
Type
string
Deploy Targets
gcloud
Default Value
If not set, this will not be used, a utilisation percentage will be used instead.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.hpa.targetCPUAverageValue": "1000m"
}
}
}gcloud.compute.gke.hpa.targetMemoryUtilizationPercentage
The target memory utilisation percentage for the Kubernetes horizontal pod autoscaler. This will be used in forming the scaling policy for pods running the application.
If gcloud.compute.gke.hpa.targetMemoryAverageValue is also set, this value will take precedence.
This is used when deploying to the gcloud target environment and the container service is gke.
Type
number
Deploy Targets
gcloud
Default Value
By default, this will be 70 (percent) for both development and production app environments.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.hpa.targetMemoryUtilizationPercentage": 65
}
}
}gcloud.compute.gke.hpa.targetMemoryAverageValue
The target memory exact average value for the Kubernetes horizontal pod autoscaler. This will be used in forming the scaling policy for pods running the application.
If gcloud.compute.gke.hpa.targetMemoryUtilizationPercentage is also set, this value will be ignored.
This is used when deploying to the gcloud target environment and the container service is gke.
Type
string
Deploy Targets
gcloud
Default Value
If not set, this will not be used, a utilisation percentage will be used instead.
Example
{
"deployTarget": {
"name": "gcloud",
"appEnv": "production",
"config": {
"gcloud.compute.gke.hpa.targetMemoryAverageValue": "2000Mi"
}
}
}gcloud.compute.gke.apiserver
Details to connect to an existing Kubernetes cluster API server to deploy the application. Options for connecting to an existing cluster are not designed yet.
Last updated on