# brewless.yml

Every key of brewless.yml, what it means, and what Brewless does with it today.

<!-- Generated by `php artisan docs:generate` from the code. Do not edit this file by hand. -->

`brewless.yml` sits in the root of your project and belongs in the repository. It says which organisation and application the project is, and how each environment should be. Run `brewless plan` to see, per environment, what the file asks for next to what stands now; nothing is changed by it. A file with only `organisation`, `application`, `framework` and `php` is as valid as a long one.

```yaml brewless.yml
organisation: acme
application: shop
framework: laravel
php: "8.4"
default-environment: staging

environments:
  production:
    kind: production
    region: fr-par
    web:
      memory: 1024
      min: 1
      max: 10
    database: shop-main
    queue: sqs
    domains:
      - shop.example.eu
    variables:
      APP_LOCALE: nl
  staging:
    kind: staging
    web:
      max: 2
    scheduler: false
```

## Keys

A key under `environments.*` is set per environment, under its name. A key you leave out keeps what stands; the default is what an environment gets when Brewless sets it up. A key Brewless does not know is refused by name, so a typo does not go unnoticed.

| Key | Type | Default | What it is |
| --- | --- | --- | --- |
| `organisation` | string | – | The organisation at Brewless, as in its address. |
| `application` | string | – | The application within the organisation. |
| `framework` | laravel, symfony, generic | `generic` | How the application is built and released. |
| `php` | 8.3, 8.4, 8.5 | `8.4` | The PHP version a release is built for and runs on. |
| `default-environment` | string | – | The environment `brewless deploy` and `brewless plan` use when you name none. Has to be one under `environments`. |
| `build` | list of commands | – | Extra build commands, after those of the framework. |
| `release` | list of commands | – | The commands that run against a new release before it goes live, in this order. |
| `environments` | map of environments | – | The environments, by name: lowercase letters, digits and dashes. |
| `environments.*.kind` | production, staging, development | `staging` | What the environment is for. |
| `environments.*.region` | fr-par, nl-ams, pl-waw, it-mil | `fr-par` | The Scaleway region the environment runs in. |
| `environments.*.web.memory` | whole number, megabytes | `512` | Memory of the web container. |
| `environments.*.web.cpu` | whole number, thousandths of a vCPU | `500` | Processor time of the web container. |
| `environments.*.web.timeout` | whole number, seconds | `60` | How long one request may take. |
| `environments.*.web.min` | whole number, replicas | `0` | Replicas that keep running; 0 lets the container sleep. |
| `environments.*.web.max` | whole number, replicas | `2` | The most replicas it scales out to. |
| `environments.*.web.concurrency` | whole number, requests per replica | `50` | Requests one replica takes at once before another one starts. |
| `environments.*.web.tmp-storage` | whole number, megabytes | `1000` | Local disk of the web container, for files that do not have to outlive a request. |
| `environments.*.release.memory` | whole number, megabytes | `512` | Memory of the container the release commands run in. |
| `environments.*.release.cpu` | whole number, thousandths of a vCPU | `500` | Processor time of the release container. |
| `environments.*.release.timeout` | whole number, seconds | `900` | How long one call to the release container may take. Release commands themselves get 90 seconds per release. |
| `environments.*.release.min` | whole number, replicas | `0` | Replicas of the release container that keep running. |
| `environments.*.release.max` | whole number, replicas | `1` | The most replicas of the release container. |
| `environments.*.release.tmp-storage` | whole number, megabytes | `1000` | Local disk of the release container. |
| `environments.*.worker.memory` | whole number, megabytes | `512` | Memory of the container that works the queue and the schedule. |
| `environments.*.worker.cpu` | whole number, thousandths of a vCPU | `500` | Processor time of the worker container. |
| `environments.*.worker.timeout` | whole number, seconds | `120` | How long one run of the worker may take. |
| `environments.*.worker.min` | whole number, replicas | `0` | Replicas of the worker container that keep running. |
| `environments.*.worker.max` | whole number, replicas | `1` | The most replicas of the worker container. |
| `environments.*.worker.tmp-storage` | whole number, megabytes | `1000` | Local disk of the worker container. |
| `environments.*.worker.queues` | list of queue names | `default` | The queues the worker works, the first one being the default. |
| `environments.*.scheduler` | true or false | `true` | Whether the schedule runs every minute. |
| `environments.*.database` | name of a database, or false | – | The database the environment uses, by name; `false` for none. |
| `environments.*.queue` | sqs, database or false | – | Where jobs wait: Scaleway Queues, the database, or nowhere. |
| `environments.*.storage` | name of a bucket, or false | – | A private bucket for the files of the application, by name; `false` for none. |
| `environments.*.domains` | list of domain names | – | The domains the environment answers on. |
| `environments.*.variables` | map of plain values | – | Plain variables, such as `APP_LOCALE`. Never a secret. |
| `environments.*.services` | map of services | – | Services next to the application, by name: lowercase letters and digits, without dashes. Each runs in a container of its own on an image you build. See [Services](/running/services). |
| `environments.*.services.*.build` | path of a directory with a Dockerfile | – | The directory with the Dockerfile of the service, relative to `brewless.yml`. `brewless service:push` builds it on your machine. |
| `environments.*.services.*.memory` | whole number, megabytes | `1024` | Memory of the service's container. |
| `environments.*.services.*.cpu` | whole number, thousandths of a vCPU | `560` | Processor time of the service's container. |
| `environments.*.services.*.timeout` | whole number, seconds | `60` | How long one request to the service may take. |
| `environments.*.services.*.min` | whole number, replicas | `0` | Replicas of the service that keep running; 0 lets it sleep. |
| `environments.*.services.*.max` | whole number, replicas | `1` | The most replicas of the service. |

## Sizes

Memory is from 128 to 12288 megabytes and processor time from 70 to 6000 thousandths of a vCPU. Scaleway pairs the two: the memory has to be at least the processor time and at most 4 times it. Give only one of them and the other follows, as Scaleway pairs them (1024 MB with 560). Local disk (`tmp-storage`) is from 1000 megabytes up to 4 times the memory, at most 24456. A timeout is from 10 to 3600 seconds; `concurrency` from 1 to 80 requests. Release commands get 90 seconds per release, whatever the timeout of the release container.

## No secrets

A secret never belongs in a file in your repository. Under `variables`, a name that looks like one (it contains `KEY`, `SECRET`, `PASSWORD`, `TOKEN`, `CREDENTIALS`, `PRIVATE`, `DSN`, `SALT` or `AUTH` as a word) is refused. Keep secrets in Secret Manager with `brewless env:push`; see [Variables](/running/variables).

## What a deploy does with it today

A deploy sends the whole file along. Brewless builds the release for `php` with the `build` steps after those of the framework, runs the `release` commands instead of the application's own (this needs `brewless/laravel` 0.3 or later), gives each container the sizes, scale, timeout and local disk the file names, works the `worker.queues` and leaves the schedule out with `scheduler: false`. Plain `variables` go into a new revision of the environment's variables in your Secret Manager before the build; that needs the environment's variables kept through Brewless (push them once with `brewless env:push`). A rollback puts back what the file asked of the release it goes back to. What the file sets is shown in the console as set in `brewless.yml`, and the console and `brewless scale` leave it alone. `default-environment` is the environment `brewless deploy` uses when you name none. Before the release, a deploy makes an environment the file names that does not exist yet, with its `kind` and `region`, and sets up the `database`, `queue` and `storage` the file names; an environment that runs gets those it is missing. The `domains` it does not answer on yet are named, and added after a yes or with `brewless deploy --domains`, because adding one can move its visitors. What stands is never switched for something else: another region, kind, database, bucket or queue is refused before anything is made. `false` lets a database or a bucket go from the environment, while it keeps running at Scaleway. Removing a key from the file never removes anything: what it set stays as it is. `services` are put live with `brewless service:push`, which also gives their containers the sizes the file names; a deploy gives the application each service's address and secret, and is refused while a service it names does not run yet.
