This CLI (Command Line Interface) tool facilitates the creation of certificates, components, configuration, dockerfiles and docker-compose files necessary for integrating Dapr into your project.
Daprify automates the creation of essential files required for Dapr deployment.
Understanding the capabilities of Dapr and the components needed for your project is preferred before using this tool. This knowledge helps streamline your project's integration with Dapr. However, this CLI can also assist with generating additional files as new requirements emerge.
Read more at Dapr Resources
Table of content
- Define your project requirements in the
config.json
file located inDaprify/Commands
. Read more about the config.json at config properties - Run the available commands in your terminal: dotnet run gen_all --config config.json
- If project_path or solution_paths is given the outputs are saved directly into your project's root in <YOUR_PROJECT>/Dapr/.
- If not, they are saved in Daprify/Dapr/. Copy the Dapr directory into your own project's root directory.
- If using https: Specify the location of your certificate and password in the environment section for that service in docker-compose.yml.
- Run docker-compose up -d inside Dapr/Docker.
It is also possible to use specific commands in cases where you only need for instance only need one new component file. For more information about the available commands, use the CLI help function of dotnet run [command] -- -help or find the specific command below.
dotnet run -- [command] [options]
To get the help in terminal use:
dotnet run -- --help
Description:
CLI for creating all the necessary files for your Dapr project.
This includes the certificates, config, components, dockerfiles and docker-compose file(s)
Prefer to use gen_all command with specified options in Daprify/Commands/config.json
Usage:
Commands [command] [options]
Options:
--version Show version information
-?, -h, --help Show help and usage information
Commands:
gen_all Generates everything needed to use Dapr with docker (components, config, certificates, dockerfiles and docker-compose file(s))
Easiest to specify all your project needs in at Daprify/Commands/config.json and execute with --config config.json
If all your services has a PackageReference to Dapr use --solution_paths instead of --services.
Use dotnet run gen_all -- -help to see all available options.
Examples:
dotnet run gen_all --config config.json
dotnet run gen_all --components rabbitmq redis --services ServiceA ServiceB --settings mtls tracing --solution_paths ../../Backend
gen_certs Generates certificates needed for the Dapr sidecars and Sentry service.
Examples:
dotnet run gen_certs
gen_config Generates configuration file used by every Dapr service
Examples:
dotnet run gen_config
dotnet run gen_config --settings mtls tracing
gen_components Generates the desired Dapr components .yml files.
Examples:
dotnet run gen_components --components statestore
dotnet run gen_components --components statestore pubsub
gen_dockerfiles Generates dockerfiles for all your projects in the specified solutions.
Examples:
dotnet run gen_dockerfiles --solution_paths ../../Service1 ../../Service2
gen_compose Generates docker-compose.yml from your .Net solution(s) or for specified service(s).
Examples:
dotnet run gen_compose --components rabbitmq sentry
dotnet run gen_compose --settings mtls https --services ServiceA
dotnet run gen_compose --solution_paths ../../Backend
dotnet run gen_compose --components rabbitmq sentry --services Frontend Backend --solution_paths ../../Backend
Generates everything needed to use Dapr with docker-compose including certificates, components, config, dockerfiles and docker-compose files.
Prefer to specify your project requirements in config.json and use the --config option. Use the solution_paths option instead of services if all your services have a PackageReference to Dapr.
dotnet run gen_all -- [options]
Find available arguments for the options Here
dotnet run gen_all -- --help
Description:
Generates everything needed to use Dapr with docker (components, config, certificates, dockerfiles and docker-compose file(s))
Easiest to specify all your project needs in at Daprify/Commands/config.json and execute with --config config.json
If all your services has a PackageReference to Dapr use --solution_paths instead of --services.
Use dotnet run gen_all -- -help to see all available options.
Examples:
dotnet run gen_all --config config.json
dotnet run gen_all --components rabbitmq redis --services ServiceA ServiceB --settings mtls tracing --solution_paths ../../Backend
Usage:
Commands gen_all [options]
Options:
--config <config> Path to your config file (from executing path).
--c, --components <bindings|configstore|crypto|lock|pubsub|secretstore|statestore> The specific component(s) to generate docker-compose content to. [default: statestore|secretstore]
--pp, --project_path <project_path> The path to the root of your project (from executing path). Not needed if it's a git project. Used to
find correct paths.
--se, --services <services> The specific service(s) to generate docker-compose content to.
--s, --settings <https|logging|metric|middleware|mtls|tracing> Additional settings for your services.
--solution_paths, --sp <solution_paths> Path to your .Net sln file (from executing path). Adds all projects dependent on Dapr to docker-compose.
--v, --verbose Enable verbose logging
-?, -h, --help Show help and usage information
To secure your Dapr sidecars with mTLS, generate ca.crt, issuer.crt and issuer.key used by all the services, ensuring they can communicate securely. The sidecars are also dependent to have communication with the dapr sentry service.
dotnet run gen_certs -- [options]
dotnet run gen_certs -- --help
Description:
Generates certificates needed for the Dapr sidecars and Sentry service.
Examples:
dotnet run gen_certs
Usage:
Commands gen_certs [options]
Options:
--v, --verbose Enable verbose logging
-?, -h, --help Show help and usage information
To generate certificates for all services use:
dotnet run gen_certs
Generate necessary component files for your Dapr project. These files, once created, must be mounted to the respective sidecars and the component needs to have a server running. This will automatically happen in the generated docker-compose.
dotnet run gen_components -- [options]
Find available arguments for the options Here
dotnet run gen_components -- --help
Description:
Generates the desired Dapr components .yml files.
Examples:
dotnet run gen_components --components statestore
dotnet run gen_components --components statestore pubsub
Usage:
Commands gen_components [options]
Options:
--c, --components <bindings|configstore|crypto|lock|pubsub|secretstore|statestore> The specific component(s) to generate a file for. [default: pubsub|statestore]
--v, --verbose Enable verbose logging
-?, -h, --help Show help and usage information
To generate specific component(s) file use:
dotnet run gen_components -- components statestore pubsub
Available components are:
- bindings
- configstore
- crypto
- lock
- pubsub
- secretstore
- statestore
If there is need for other component files or editing the generated one, see more at: Dapr Components Reference
If no configuration file is mounted to the sidecar, the dapr sidecar will use the default config.yml file. However, if you are going to use any features you need to mount a config file to the sidecar with the settings you are going to use.
dotnet run gen_config -- [options]
Find available arguments for the options Here
dotnet run gen_config -- --help
Description:
Generates configuration file used by every Dapr service
Examples:
dotnet run gen_config
dotnet run gen_config --settings mtls tracing
Usage:
Commands gen_config [options]
Options:
--s, --settings <logging|metric|middleware|mtls|tracing> The specific setting(s) to add to the configuration
--v, --verbose Enable verbose logging
-?, -h, --help Show help and usage information
To generate specific component(s) file use:
dotnet run gen_config --settings mtls tracing
If there is need for other settings in your configuration file or editing the generated one, see more at: Dapr Config Reference
This command generates dockerfiles for your .Net project or specified services. The dockerfiles are needed in the docker-compose.yml. In case of special needs in the dockerfiles, add these after they are generated. e.g if you have a option.json file needed inside the docker container.
If you are using the --service option the path inside the dockerfile most likely not be correct! You need to manually update this path relative to you project
dotnet run gen_dockerfiles -- [options]
dotnet run gen_dockerfiles -- --help
Description:
Generates dockerfiles for all your projects in the specified solutions.
Examples:
dotnet run gen_dockerfiles --solution_paths ../../Service1 ../../Service2
Usage:
Commands gen_dockerfiles [options]
Options:
--pp, --project_path <project_path> The path to the root of your project (from executing path). Not needed if it's a git project. Used to find correct paths.
--se, --services <services> The specific service(s) to generate docker-compose content to.
--solution_paths, --sp <solution_paths> The path to your .Net solution file (from executing path). Used to generate dockerfile for all projects in the sln file.
--v, --verbose Enable verbose logging
-?, -h, --help Show help and usage information
If you are going to host your project with the sidecars in a docker container you can generate the docker-compose.yml file for the specified services and components you have in your project. If a docker-compose file already exists at the location it is written to, it will append the services and components to the file instead of overwriting it.
dotnet run gen_compose -- [options]
Find available arguments for the options Here
dotnet run gen_compose -- --help
Description:
Generates docker-compose.yml from your .Net solution(s) or for specified service(s).
Examples:
dotnet run gen_compose --components rabbitmq sentry
dotnet run gen_compose --settings mtls https --services ServiceA
dotnet run gen_compose --solution_paths ../../Backend
dotnet run gen_compose --components rabbitmq sentry --services Frontend Backend --solution_paths ../../Backend
Usage:
Commands gen_compose [options]
Options:
--c, --components <dashboard|placement|rabbitmq|redis|sentry|zipkin> The specific component(s) to generate docker-compose content to. [default: dashboard|placement|zipkin]
--s, --settings <https|mtls> Additional settings for your services.
--se, --services <services> The specific service(s) to generate docker-compose content to.
--solution_paths, --sp <solution_paths> The path to your .Net solution file (from executing path). Used to generate certificates for all services dependent
on Dapr.
--v, --verbose Enable verbose logging
-?, -h, --help Show help and usage information
To generate a docker-compose-yml with specific components and services:
dotnet run gen_compose --components rabbitmq sentry --services Frontend Backend
Command | Option | Available Arguments |
---|---|---|
gen_all |
config |
|
components |
dashboard, placement, rabbitmq, redis, sentry, zipkin, bindings, configstore, crypto, lock, pubsub, secretstore, statestore | |
project_path |
||
services |
||
settings |
logging, metric, middleware, mtls, tracing, https | |
solution_paths |
||
gen_certs |
||
gen_config |
settings |
logging, metric, middleware, mtls, tracing |
gen_components |
components |
bindings, configstore, crypto, lock, pubsub, secretstore, statestore |
gen_dockerfiles |
project_path |
|
services |
||
solution_paths |
||
gen_compose |
components |
dashboard, placement, rabbitmq, redis, sentry, zipkin |
settings |
https, mtls, | |
services |
||
solution_paths |
The config.json file simplifies the process of defining your projects needs. The paths should be relative from Daprify/Commands to the location of either your project path or solution paths.
- components: Used for creation of the specified component.yml files and adding the component to the docker-compose.yml if needed.
- services: This option is necessary for including services in your setup that does not have a PackageReference to Dapr.
- settings: Used for adding specified settings to Dapr's config.yml file mounted to each Dapr sidecar.
- project_path: Determines the relative path in each service's Dockerfile from your .csproj file to the root of your project.
- solution_paths: Automates the identification of projects in your solution that include a PackageReference to Dapr, and integrates these services into the docker-compose.yml.
Below is an illustrative example of config.json, encompassing all possible configurations. It's important to note that some components are more specialized, such as the rabbitmq being a specific type of pubsub component or redis being a specific type of statestore. the https setting should be used if your microservice uses a https, which setup
For further details on the various components and settings, refer to the Dapr Resources section.
{
"components": [
"bindings",
"configstore",
"crypto",
"lock",
"pubsub",
"secretstore",
"statestore",
"dashboard",
"placement",
"rabbitmq",
"redis",
"sentry",
"zipkin"
],
"services": ["ServiceA", "ServiceB"],
"settings": ["https", "logging", "metric", "middleware", "mtls", "tracing"],
"project_path": ["../../Project"],
"solution_paths": ["../../Project/MicroService1", "../../Project/MicroService2"]
}
For more detailed guidance and advanced usage scenarios, please refer to the following resources: