How to: Use the Multi-App Run template file

Note

Multi-App Run is currently a preview feature only supported in Linux/MacOS.

The Multi-App Run template file is a YAML file that you can use to run multiple applications at once. In this guide, you’ll learn how to:

  • Use the multi-app template
  • View started applications
  • Stop the multi-app template
  • Stucture the multi-app template file

You can use the multi-app template file in one of the following two ways:

When you provide a directory path, the CLI will try to locate the Multi-App Run template file, named by default in the directory. If the file is not found, the CLI will return an error.

Execute by providing a file path

If the Multi-App Run template file is named something other than dapr.yaml, then you can provide the relative or absolute file path to the command:

    View the started applications

    Once the multi-app template is running, you can view the started applications with the following command:

    Stop the multi-app run template anytime with either of the following commands:

    1. # the template file needs to be called `dapr.yaml` by default if a directory path is given
    2. dapr stop -f

    or:

    Template file structure

    1. version: 1
    2. common: # optional section for variables shared across apps
    3. resourcesPath: ./app/components # any dapr resources to be shared across apps
    4. env: # any environment variable shared across apps
    5. DEBUG: true
    6. apps:
    7. - appID: webapp # optional
    8. appDirPath: .dapr/webapp/ # REQUIRED
    9. resourcesPath: .dapr/resources # (optional) can be default by convention
    10. configFilePath: .dapr/config.yaml # (optional) can be default by convention too, ignore if file is not found.
    11. appProtocol: http
    12. appHealthCheckPath: "/healthz"
    13. command: ["python3" "app.py"]
    14. - appID: backend # optional
    15. appDirPath: .dapr/backend/ # REQUIRED
    16. appProtocol: grpc
    17. appPort: 3000
    18. env:
    19. - DEBUG: false
    20. command: ["./backend"]

    Important

    The following rules apply for all the paths present in the template file:

    • If the path is absolute, it is used as is.
    • All relative paths under comman section should be provided relative to the template file path.
    • appDirPath under apps section should be provided relative to the template file path.
    • All relative paths under app section should be provided relative to the appDirPath.

    The properties for the Multi-App Run template align with the dapr run CLI flags, listed in the CLI reference documentation.

    Next steps

    Watch this video for an overview on Multi-App Run: