You can deploy multiple Porter apps alongside multiple Porter addons in a single porter.yaml file. This is particularly useful when you need to deploy related services that work together, such as a web application with its associated database or cache.

This feature is currently in beta

Usage

To enable this feature, set the PORTER_ADDON_YAML environment variable while running the apply command.

PORTER_ADDON_YAML=true porter apply -f porter.yaml

Example Configuration

apps:
  - version: v2
    name: backend
    services:
      - name: server
        run: ""
        type: web
        instances: 1
        cpuCores: 0.2
        ramMegabytes: 100
        terminationGracePeriodSeconds: 30
        port: 80
        sleep: false
        private: true
    envGroups: # Environment groups can be used to inject environment variables from the addons into the service.
      - cache
      - db
    image:
      repository: nginx
      tag: latest
  - version: v2
    name: frontend
    services:
      - name: dashboard
        run: ""
        type: web
        instances: 1
        cpuCores: 0.2
        ramMegabytes: 100
        terminationGracePeriodSeconds: 30
        port: 80
        sleep: false
        private: true
    envGroups: # Environment groups can be used to inject environment variables from the addons into the service.
      - cache
      - db
    image:
      repository: nginx
      tag: latest
  - version: v2
    name: api
    services:
      - name: worker
        run: ""
        type: worker
        instances: 1
        cpuCores: 0.2
        ramMegabytes: 100
        terminationGracePeriodSeconds: 30
        port: 80
        sleep: false
    envGroups:
      - cache
      - db
    image:
      repository: nginx
      tag: latest
addons:
  - name: cache
    type: MANAGED-REDIS
    engine: REDIS
    values:
      config:
        name: cache
        masterUserPassword: password
        allocatedStorage: 2 # Persistent storage size in GB. Cannot be changed after creation.
        cpuCores: 0.1
        ramMegabytes: 110
  - name: db
    type: MANAGED-POSTGRES
    engine: POSTGRES
    values:
      config:
        name: db
        masterUserPassword: password
        allocatedStorage: 2 # Persistent storage size in GB. Cannot be changed after creation.
        cpuCores: 0.1
        ramMegabytes: 110