Add serverless components to a service to deploy serverless functions, websites and webhooks
Serverless components are currently only supported on GCP.
Serverless components let you deploy serverless functions that are accessible over a public or internal https endpoint.
Serverless components run on your own infrastructure and use Knative. You can build serverless functions using our 7 built in languages, or add a Dockerfile to use a custom language.
We do not currently support serverless worker functions
We support the following built in runtimes for function components.
If you would like to use a custom runtime, simply specify a Dockerfile
You can add a dependency file for the language of your choice into your service directory. When you run
PowerTools will automatically install all dependencies for you.
function-public config looks like:
components: - type: function-public runtime: golang entry: main.py route: public-fn.example.com
You can add a `runtime_version` field to use a specific version such as `1.17` of a runtime..
function-internal config looks like:
components: - type: function-internal runtime: python3 entry: main.py route: internal-fn.example.com
You can run
pt schema validate at any time to validate a service config.
You can deploy as many function components as you would like in a service.
runtime_version - runtime version to use (other than defaulting to latest)
idle_timeout - default time a container can remain idle before being removed
max_tps_per_instance - maximum transactions/second a process will receive
max_instances - maximum processes that can be started
target_tps - number of transactions/second to target before autoscaling
min_instances - minimum number of processes to be run.
the max tps your service will receive is equal to (max_tps_per_instance * max_instances) if both
max_instances are set to values greater than 0
set a high
idle_timeout if you would like to keep containers around longer to avoid cold starts.