Multi-App Run overview
Note
Multi-App Run is currently a preview feature only supported in Linux/MacOS.
Let’s say you want to run several applications locally to test them together, similar to a production scenario. With a local Kubernetes cluster, you’d be able to do this with helm/deployment YAML files. You’d also have to build them as containers and set up Kubernetes, which can add some complexity.
Instead, you simply want to run them as local executables in self-hosted mode. However, self-hosted mode requires you to:
- Run multiple commands
- Keep track of all ports opened (you cannot have duplicate ports for different applications).
- Recall all of the additional flags you used to tweak the
dapr run
command behavior (--app-health-check-path
,--dapr-grpc-port
,--unix-domain-socket
, etc.)
With Multi-App Run, you can start multiple applications in self-hosted mode using a single dapr run -f
command using a template file. The template file describes how to start multiple applications as if you had run many separate CLI run
commands. By default, this template file is called dapr.yaml
.
When you execute dapr run -f .
, it uses the multi-app template file (named dapr.yaml
) present in the current directory to run all the applications.
The following example includes some of the template properties you can customize for your applications. In the example, you can simultaneously launch 2 applications with app IDs of processor
and .
For a more in-depth example and explanation of the template properties, see .
You have options on where to place your applications’ resources and configuration files when using Multi-App Run.
You can set all of your applications resources and configurations at the ~/.dapr
root. This is helpful when all applications share the same resources path, like when testing on a local machine.
When using Multi-App Run, each application directory can have a .dapr
folder, which contains a config.yaml
file and a resources
directory. Otherwise, if the .dapr
directory is not present within the app directory, the default ~/.dapr/resources/
and ~/.dapr/config.yaml
locations are used.
You can also name each app directory’s directory something other than .dapr
, such as, webapp
, or backend
. This helps if you’d like to be explicit about resource or application directory paths.
Logs for application and daprd
are captured in separate files. These log files are created automatically under .dapr/logs
directory under each application directory (appDirPath
in the template). These log file names follow the pattern seen below:
<appID>_app_<timestamp>.log
(file name format forapp
log)<appID>_daprd_<timestamp>.log
(file name format fordaprd
log)
Even if you’ve decided to rename your resources folder to something other than .dapr
, the log files are written only to the folder (created in the application directory).