Skip to content

Commit

Permalink
Add a full example of using yml anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
nickhammond committed Dec 4, 2024
1 parent edc4ea9 commit a7af110
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _data/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
url: /docs/configuration/accessories/
- title: "Aliases"
url: /docs/configuration/aliases/
- title: "Anchors"
url: /docs/configuration/anchors/
- title: "Booting"
url: /docs/configuration/booting/
- title: "Builders"
Expand Down
30 changes: 30 additions & 0 deletions docs/configuration/anchors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: Anchors
---

# Anchors

You can re-use parts of your Kamal configuration by defining them as anchors and referencing them with aliases.

For example, you might need to define a shared healthcheck for multiple worker roles. Anchors
begin with `x-` and are defined at the root level of your deploy.yml file.

```yaml
x-worker-healthcheck: &worker-healthcheck
health-cmd: bin/worker-healthcheck
health-start-period: 5s
health-retries: 5
health-interval: 5s
```
To use this anchor in your deploy configuration, reference it via the alias.
```yaml
servers:
worker:
hosts:
- 867.53.0.9
cmd: bin/jobs
options:
<<: *worker-healthcheck
```

0 comments on commit a7af110

Please sign in to comment.