YAML Schema Reference
This document provides a reference for some of the crucial, reusable YAML definitions used throughout the config.cap.yaml.
Check out the full document at: https://platform.cloudbear.it/schemas/cap.v1.schema.json
Resources
There are two main ways to define resources for your application components: computeResources and resources.
computeResources
This object is used to define CPU and memory allocation for components like http servers, workers, and cronjobs.
cpu: The amount of CPU to allocate. Can be an integer (e.g.,1for 1 full core) or a string representing millicores (e.g.,"500m"for half a core).memory: The amount of memory to allocate. Can be an integer (in bytes) or a string with a unit (e.g.,"512Mi","1Gi").
Example:
http:
resources:
cpu: 500m
memory: 512Mi
resources
This object is used by stateful services (like databases) that require persistent storage. It includes all the properties of computeResources plus storage.
storage: The amount of persistent storage to allocate. Can be an integer (in bytes) or a string with a unit (e.g.,"10Gi").
Example:
services:
db:
type: mariadb
resources:
cpu: 1
memory: 2Gi
storage: 20Gi
gitlabEnv
This object is used within the env block to reference a secret stored in GitLab's CI/CD project variables.
gitlab: The name (key) of the variable in GitLab. Can be a string, or an object with anameproperty. Ifnull, the name of the environment variable itself is used.
Example:
env:
API_KEY:
gitlab: "MY_PRODUCTION_API_KEY"
SHARED_SECRET:
gitlab:
name: "PROJECT_WIDE_SECRET"
SAME_NAME_SECRET:
gitlab: null # Looks for a GitLab variable named "SAME_NAME_SECRET"
cron-expression
This definition is used in the schedule property of cronjobs. It accepts standard cron expressions or a predefined alias.
- Standard Cron Expression: A five-part string (e.g.,
"*/5 * * * *"for every 5 minutes). - Alias: A string alias for common schedules.
| Alias | Equivalent | Description |
|---|---|---|
@yearly |
0 0 1 1 * |
Run once a year. |
@monthly |
0 0 1 * * |
Run once a month. |
@weekly |
0 0 * * 0 |
Run once a week. |
@daily |
0 0 * * * |
Run once a day (midnight). |
@hourly |
0 * * * * |
Run once an hour. |
Example:
cronjobs:
my-task:
schedule: "*/15 * * * *" # Every 15 minutes
daily-report:
schedule: "@daily"
Commands (command and task)
These definitions are used to specify commands for workers and cronjobs.
command
The command object specifies what to run. It can be one of two properties:
command: The full command to run, including the binary (e.g.,php,node). Can be a string or an array.subcommand: A command to run with the application type's framework binary (e.g.,artisan,bin/console). Can be a string or an array.
Example:
workers:
full-command-worker:
command: "php /app/my_script.php" # or ["php", "/app/my_script.php"]
subcommand-worker:
subcommand: "queue:work" # Will be prefixed by the framework binary
task
A task is a combination of a command and computeResources. This is the object used to define a worker or cronjob.
Example:
cronjobs:
heavy-job:
schedule: "@hourly"
subcommand: "process:heavy-stuff"
resources:
cpu: "1000m"
memory: "2Gi"