Stage Definitions #

đź’ˇ You can replace the default values of the commands for PROJECT, STAGE and APPNAME in the form on the right side! A standard pattern might be myproject, production and web (see concepts).

You will use a Stage Definition to describe your stage and apply the definition to take your changes live.

Dump Current Definition #

After creating a stage, you can run stage:dump to get the current definition of the stage. Often you want to write this to a file to modify the definition and apply it again later on.

setops -p <PROJECT> -s <STAGE> stage:dump > stage.setops.yaml

Definition Schema #

The stage definition is described as YAML and is validated against the Stage Definition JSON schema. If you do not have set up the schema in Visual Studio Code yet, we highly recommend that you do so now.

On the highest level, the stage definition (version 1) has this structure:

schema_version: "1"
project: <PROJECT>
stage: <STAGE>
  <APPNAME>: ...
  <SERVICE>: ...
log_retention: 14

Let’s have a look at the individual fields:

schema_version #

The version of the schema used. This will be "1" as long as new changes are backwards compatible, like new fields which are optional.

project #

The name of the project the stage belongs to

stage #

The name of the stage

apps #

This field is a dictionary/map and uses the app name as a key. To read more about the app configuration, see the dedicated app section.

services #

This field is a dictionary/map and uses the service name as a key. To read more about the service configuration, see the dedicated service section.

log_retention #

log_retention configures the number of days for which logs are kept. This field is optional and defaults to 14 days.

notifications #

This field is a dictionary/map and uses the notification name as a key. To read more about the notification configuration, see the dedicated notification section.

Apply Definition #

To apply this definition after you performed changes to it, run stage:apply

setops -p <PROJECT> -s <STAGE> stage:apply -f stage.setops.yaml
+ apps:
+   ...
+ notifications:
+   ...
  schema_version: "1"
  project: "<PROJECT>"
+ services:
+   ...
  stage: "<STAGE>"

If you want to apply the changes, type 'yes'

◢ Initializing…
◤ Planning…
◣ Applying… (17/28)
Commit successful!

Now this definition has been applied and your stage should be in the state you defined in the stage definition

Going further #

Create your first App.