fbpx

faastruby.yml Reference

faastruby.yml Reference

Every function must have a configuration file called faastruby.yml, in addition to the handler. This document will cover all the options that are configurable via this file.

Configuration keys

before_build

Required: no
Parent: n/a
Type: Array
Default: empty

Allows you to run commands locally before creating the deployment package. Some use cases are:

  • Compile static assets
  • Download a file to be included in the package
  • Build a static HTML page from a Markdown template

Example:

before_build:
  - curl https://some.url --output some.file
  - uglifyjs your.js -c -m -o your.min.js

cli_version

Required: yes
Parent: n/a
Type: String
Default: n/a

This is the CLI version at the time that this file was created. It is used by the API when your function is being deployed.

Example:

cli_version: 0.5.15

name

Required: yes
Parent: n/a
Type: String
Default: n/a
Valid characters: letters, numbers, forward slashes, dots, dashes and underscores.
Minimum length: 1 character

The function name. It reflects the URL path once the function is deployed.

Example:

name: foo/bar

Once deployed, the function above will be available at https://[workspace_name].tor1.faast.cloud/foo/bar


runtime

Required: yes
Parent: n/a
Type: String
Default: ruby:2.5.3
Valid values: ruby:2.5.3 | ruby:2.6.0 | ruby:2.6.1 | crystal:0.27.0 | crystal:0.27.2

The runtime name and version to be used by your function in the cloud platform.

Example:

runtime: ruby:2.6.1

schedule

Required: no
Parent: n/a
Type: Hash
Default: empty

Schedule a function to run periodically. Each job is a key inside the schedule key.

Example:

schedule:
  job1:
    when: every 2 hours
    body: {"foo": "bar"}
    method: POST
    query_params: {"param": "value"}
    headers: {"Content-Type": "application/json"}
  job2:
    when: 0 3 * * *

body

Required: no
Parent: jobX
Type: String
Default: empty

The body that will be sent on the request to execute the function. Available as event.body within the function.

Example:

body: {"foo": "bar"}

headers

Required: no
Parent: jobX
Type: JSON String
Default: empty

The request headers used when invoking the function through the periodic scheduler.

Example:

headers: {"Content-Type": "application/json"}

jobX

Required: yes, within the context of a schedule
Parent: schedule
Type: Hash
Default: n/a

The name of a schedule job.


method

Required: no
Parent: jobX
Type: String
Valid inputs: GET | POST | PUT | PATCH | DELETE
Default: GET when body is empty, and POST when body is not empty

The request method to be used when invoking the function through the periodic scheduler.

Example:

method: GET

query_params

Required: no
Parent: jobX
Type: JSON String
Default: empty

The URL query params that will be used when invoking the function through the periodic scheduler.

Example:

query_params: {"param": "value"}

when

Required: yes, within the context of a job
Parent: jobX
Type: String
Valid input: Plain english or Cron syntax, as described in the Fugit gem documentation
Default: n/a

The time in which the function will be executed. It could be a one-time thing or periodic.
IMPORTANT: the server is running on UTC time, so take that into consideration when scheduling a job.

Examples:

# Plain english
when: every tuesday at 5 pm

# Cron syntax (everyday at 3am)
when: 0 3 * * *