standalone

package
v1.10.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 40 Imported by: 7

Documentation

Index

Constants

View Source
const (
	DefaultDaprDirName      = ".dapr"
	DefaultConfigFileName   = "config.yaml"
	DefaultResourcesDirName = "resources"
)
View Source
const (

	// DaprPlacementContainerName is the container name of placement service.
	DaprPlacementContainerName = "dapr_placement"
	// DaprRedisContainerName is the container name of redis.
	DaprRedisContainerName = "dapr_redis"
	// DaprZipkinContainerName is the container name of zipkin.
	DaprZipkinContainerName = "dapr_zipkin"
)
View Source
const SocketFormat = "/tmp/dapr-%s-http.socket"

Variables

This section is empty.

Functions

func GetAppCommand added in v1.10.0

func GetAppCommand(config *RunConfig) *exec.Cmd

func GetBuildInfo added in v1.3.0

func GetBuildInfo(inputInstallPath string, version string) (string, error)

GetBuildInfo returns build info for the CLI and the local Dapr runtime.

func GetCLIPIDCountMap added in v1.10.0

func GetCLIPIDCountMap(apps []ListOutput) map[int]int

GetCLIPIDCountMap returns a map of CLI PIDs to number of apps started with it.

func GetDaprCommand added in v1.10.0

func GetDaprCommand(config *RunConfig) (*exec.Cmd, error)

func GetDaprComponentsPath added in v1.10.0

func GetDaprComponentsPath(daprDir string) string

func GetDaprConfigPath added in v1.10.0

func GetDaprConfigPath(daprDir string) string

func GetDaprPath

func GetDaprPath(inputInstallPath string) (string, error)

GetDaprPath returns the dapr installation path. The order of precedence is:

  1. From --dapr-path command line flag
  2. From DAPR_PATH environment variable
  3. $HOME/.dapr

func GetDashboardVersion added in v0.10.0

func GetDashboardVersion(inputInstallPath string) (string, error)

GetDashboardVersion returns the version for the local Dapr dashboard.

func GetRuntimeVersion added in v0.10.0

func GetRuntimeVersion(inputInstallPath string) (string, error)

GetRuntimeVersion returns the version for the local Dapr runtime.

func Init

func Init(runtimeVersion, dashboardVersion string, dockerNetwork string, slimMode bool, imageRegistryURL string, fromDir string, containerRuntime string, imageVariant string, daprInstallPath string) error

Init installs Dapr on a local machine using the supplied runtimeVersion.

func NewDashboardCmd added in v0.11.0

func NewDashboardCmd(inputInstallPath string, port int) (*exec.Cmd, error)

NewDashboardCmd creates the command to run dashboard.

func Stop

func Stop(appID string, cliPIDToNoOfApps map[int]int, apps []ListOutput) error

Stop terminates the application process.

func StopAppsWithRunFile added in v1.10.0

func StopAppsWithRunFile(runTemplatePath string) error

StopAppsWithRunFile terminates the daprd and application processes with the given run file.

func Uninstall

func Uninstall(uninstallAll bool, dockerNetwork string, containerRuntime string, inputInstallPath string) error

Uninstall reverts all changes made by init. Deletes all installed containers, removes default dapr folder, removes the installed binary and unsets env variables.

Types

type Client added in v1.0.0

type Client interface {
	// Invoke is a command to invoke a remote or local dapr instance.
	Invoke(appID, method string, data []byte, verb string, socket string) (string, error)
	// Publish is used to publish event to a topic in a pubsub for an app ID.
	Publish(publishAppID, pubsubName, topic string, payload []byte, socket string, metadata map[string]interface{}) error
}

Client is the interface the wraps all the methods exposed by the Dapr CLI.

func NewClient added in v1.0.0

func NewClient() Client

type DaprMeta added in v1.6.0

type DaprMeta struct {
	ExistingIDs   map[string]bool
	ExistingPorts map[int]bool
}

type DaprProcess added in v1.0.0

type DaprProcess interface {
	List() ([]ListOutput, error)
}

type ListOutput

type ListOutput struct {
	AppID              string `csv:"APP ID"    json:"appId"              yaml:"appId"`
	HTTPPort           int    `csv:"HTTP PORT" json:"httpPort"           yaml:"httpPort"`
	GRPCPort           int    `csv:"GRPC PORT" json:"grpcPort"           yaml:"grpcPort"`
	AppPort            int    `csv:"APP PORT"  json:"appPort"            yaml:"appPort"`
	MetricsEnabled     bool   `csv:"-"         json:"metricsEnabled"     yaml:"metricsEnabled"` // Not displayed in table, consumed by dashboard.
	Command            string `csv:"COMMAND"   json:"command"            yaml:"command"`
	Age                string `csv:"AGE"       json:"age"                yaml:"age"`
	Created            string `csv:"CREATED"   json:"created"            yaml:"created"`
	DaprdPID           int    `csv:"DAPRD PID" json:"daprdPid"           yaml:"daprdPid"`
	CliPID             int    `csv:"CLI PID"   json:"cliPid"             yaml:"cliPid"`
	MaxRequestBodySize int    `csv:"-"         json:"maxRequestBodySize" yaml:"maxRequestBodySize"` // Additional field, not displayed in table.
	HTTPReadBufferSize int    `csv:"-"         json:"httpReadBufferSize" yaml:"httpReadBufferSize"` // Additional field, not displayed in table.
	RunTemplatePath    string `csv:"RUN_TEMPLATE_PATH"  json:"runTemplatePath"            yaml:"runTemplatePath"`
}

ListOutput represents the application ID, application port and creation time.

func List

func List() ([]ListOutput, error)

List outputs all the applications.

type RunConfig

type RunConfig struct {
	SharedRunConfig  `yaml:",inline"`
	AppID            string   `env:"APP_ID" arg:"app-id" yaml:"appID"`
	AppPort          int      `env:"APP_PORT" arg:"app-port" yaml:"appPort" default:"-1"`
	HTTPPort         int      `env:"DAPR_HTTP_PORT" arg:"dapr-http-port" yaml:"daprHTTPPort" default:"-1"`
	GRPCPort         int      `env:"DAPR_GRPC_PORT" arg:"dapr-grpc-port" yaml:"daprGRPCPort" default:"-1"`
	ProfilePort      int      `arg:"profile-port" yaml:"profilePort" default:"-1"`
	Command          []string `yaml:"command"`
	MetricsPort      int      `env:"DAPR_METRICS_PORT" arg:"metrics-port" yaml:"metricsPort" default:"-1"`
	UnixDomainSocket string   `arg:"unix-domain-socket" yaml:"unixDomainSocket"`
	InternalGRPCPort int      `arg:"dapr-internal-grpc-port" yaml:"daprInternalGRPCPort" default:"-1"`
}

RunConfig represents the application configuration parameters.

func (*RunConfig) SetDefaultFromSchema added in v1.10.0

func (config *RunConfig) SetDefaultFromSchema()

func (*RunConfig) Validate added in v1.10.0

func (config *RunConfig) Validate() error

type SharedRunConfig added in v1.10.0

type SharedRunConfig struct {
	ConfigFile         string            `arg:"config" yaml:"configFilePath"`
	AppProtocol        string            `arg:"app-protocol" yaml:"appProtocol" default:"http"`
	APIListenAddresses string            `arg:"dapr-listen-addresses" yaml:"apiListenAddresses"`
	EnableProfiling    bool              `arg:"enable-profiling" yaml:"enableProfiling"`
	LogLevel           string            `arg:"log-level" yaml:"logLevel"`
	MaxConcurrency     int               `arg:"app-max-concurrency" yaml:"appMaxConcurrency" default:"-1"`
	PlacementHostAddr  string            `arg:"placement-host-address" yaml:"placementHostAddress"`
	ComponentsPath     string            `arg:"components-path"`
	ResourcesPath      string            `arg:"resources-path" yaml:"resourcesPath"`
	AppSSL             bool              `arg:"app-ssl" yaml:"appSSL"`
	MaxRequestBodySize int               `arg:"dapr-http-max-request-size" yaml:"daprHTTPMaxRequestSize" default:"-1"`
	HTTPReadBufferSize int               `arg:"dapr-http-read-buffer-size" yaml:"daprHTTPReadBufferSize" default:"-1"`
	EnableAppHealth    bool              `arg:"enable-app-health-check" yaml:"enableAppHealthCheck"`
	AppHealthPath      string            `arg:"app-health-check-path" yaml:"appHealthCheckPath"`
	AppHealthInterval  int               `arg:"app-health-probe-interval" ifneq:"0" yaml:"appHealthProbeInterval"`
	AppHealthTimeout   int               `arg:"app-health-probe-timeout" ifneq:"0" yaml:"appHealthProbeTimeout"`
	AppHealthThreshold int               `arg:"app-health-threshold" ifneq:"0" yaml:"appHealthThreshold"`
	EnableAPILogging   bool              `arg:"enable-api-logging" yaml:"enableApiLogging"`
	DaprdInstallPath   string            `yaml:"daprPath"`
	Env                map[string]string `yaml:"env"`
}

SharedRunConfig represents the application configuration parameters, which can be shared across many apps.

type Standalone added in v1.0.0

type Standalone struct {
	// contains filtered or unexported fields
}

func (*Standalone) Invoke added in v1.0.0

func (s *Standalone) Invoke(appID, method string, data []byte, verb string, path string) (string, error)

Invoke is a command to invoke a remote or local dapr instance.

func (*Standalone) Publish added in v1.0.0

func (s *Standalone) Publish(publishAppID, pubsubName, topic string, payload []byte, socket string, metadata map[string]interface{}) error

Publish publishes payload to topic in pubsub referenced by pubsubName.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL