Skip to Content

Recipes

Complete examples for common setups.

Each recipe is a full set of files that you can copy into a repository and adapt.

Web app with Postgres

A public web app on a verified domain, reading its database credentials from a lease.

clusters/hetzner-fsn1.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
provider: hetzner
region: fsn1
pools:
  - name: control-plane
    role: control_plane
  - name: general
projects/blog/project.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
name: blog
cluster: hetzner-fsn1
projects/blog/apps/db.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
source:
  template: postgres
  version: "16"
databases:
  blog:
    roles:
      app:
        owner: true
backup:
  enabled: true
projects/blog/apps/web.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
source:
  image: ghcr.io/example/blog:1.0.0
port: 3000
domains:
  - domain: blog.example.com
http:
  https_redirect: true
env:
  DATABASE_URL:
    from: app/db
    lease: blog/app
    output: url
connections:
  - to: db
    ports:
      - port: 5432

blog.example.com must be covered by a verified domain. Making app the owner is held until someone confirms it.

Public assets in a bucket

A bucket whose public/ folder anyone can read, with the app told where it is.

clusters/hetzner-fsn1.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
provider: hetzner
region: fsn1
pools:
  - name: control-plane
    role: control_plane
  - name: general
projects/media/project.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
name: media
cluster: hetzner-fsn1
buckets:
  - name: media-assets
    quota_gb: 25
    public_paths:
      - public/
projects/media/apps/uploader.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
source:
  image: ghcr.io/example/uploader:2.3.0
port: 8080
env:
  ASSETS_PUBLIC_URL:
    from: bucket/media-assets
    output: public_url
storage_bindings:
  - bucket: media-assets

The binding gives the app the bucket's credentials as S3_* variables; the reference adds its public URL. See references and bucket access.

A locked-down project

A project whose apps can only reach one outside API.

clusters/hetzner-fsn1.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
provider: hetzner
region: fsn1
pools:
  - name: control-plane
    role: control_plane
  - name: general
projects/billing/project.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
name: billing
cluster: hetzner-fsn1
egress:
  mode: isolated
  rules:
    - kind: fqdn
      value: api.example.net
      port: 443
      protocol: tcp
projects/billing/apps/invoicer.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
source:
  image: ghcr.io/example/invoicer:1.2.0
port: 8080

See outbound traffic.

On this page