standalone

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 39 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 GetDaprRuntimePath added in v1.10.0

func GetDaprRuntimePath(daprRuntimePath string) (string, error)

GetDaprRuntimePath returns the dapr runtime installation path. daprRuntimePath is based on the --runtime-path command line flag. The order of precedence is:

  1. From --runtime-path command line flag appended with `.dapr`
  2. From DAPR_RUNTIME_PATH environment variable appended with `.dapr`
  3. default $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"`
	AppPID             int    `csv:"APP PID"   json:"appPid"             yaml:"appPid"`
	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"`
	AppLogPath         string `csv:"APP_LOG_PATH"  json:"appLogPath"            yaml:"appLogPath"`
	DaprDLogPath       string `csv:"DAPRD_LOG_PATH"  json:"daprdLogPath"            yaml:"daprdLogPath"`
	RunTemplateName    string `json:"runTemplateName"            yaml:"runTemplateName"` // specifically omitted in csv output.
}

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

func List

func List() ([]ListOutput, error)

List outputs all the applications.

type LogDestType added in v1.11.0

type LogDestType string
const (
	Console             LogDestType = "console"
	File                LogDestType = "file"
	FileAndConsole      LogDestType = "fileAndConsole"
	DefaultDaprdLogDest             = File
	DefaultAppLogDest               = FileAndConsole
)

func (LogDestType) IsValid added in v1.11.0

func (l LogDestType) IsValid() error

func (LogDestType) String added in v1.11.0

func (l LogDestType) String() string

type RunConfig

type RunConfig struct {
	SharedRunConfig   `yaml:",inline"`
	AppID             string   `env:"APP_ID" arg:"app-id" annotation:"dapr.io/app-id" yaml:"appID"`
	AppChannelAddress string   `env:"APP_CHANNEL_ADDRESS" arg:"app-channel-address" ifneq:"127.0.0.1" yaml:"appChannelAddress"`
	AppPort           int      `env:"APP_PORT" arg:"app-port" annotation:"dapr.io/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" annotation:"dapr.io/metrics-port" yaml:"metricsPort" default:"-1"`
	UnixDomainSocket  string   `arg:"unix-domain-socket" annotation:"dapr.io/unix-domain-socket-path" yaml:"unixDomainSocket"`
	InternalGRPCPort  int      `arg:"dapr-internal-grpc-port" yaml:"daprInternalGRPCPort" default:"-1"`
}

RunConfig represents the application configuration parameters.

func (*RunConfig) GetAnnotations added in v1.12.0

func (config *RunConfig) GetAnnotations() map[string]string

func (*RunConfig) GetEnv added in v1.12.0

func (config *RunConfig) GetEnv() map[string]string

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

func (*RunConfig) ValidateK8s added in v1.12.0

func (config *RunConfig) ValidateK8s() error

type SharedRunConfig added in v1.10.0

type SharedRunConfig struct {
	// Specifically omitted from annotations see https://github.com/dapr/cli/issues/1324
	ConfigFile         string `arg:"config" yaml:"configFilePath"`
	AppProtocol        string `arg:"app-protocol" annotation:"dapr.io/app-protocol" yaml:"appProtocol" default:"http"`
	APIListenAddresses string `arg:"dapr-listen-addresses" annotation:"dapr.io/sidecar-listen-address" yaml:"apiListenAddresses"`
	EnableProfiling    bool   `arg:"enable-profiling" annotation:"dapr.io/enable-profiling" yaml:"enableProfiling"`
	LogLevel           string `arg:"log-level" annotation:"dapr.io.log-level" yaml:"logLevel"`
	MaxConcurrency     int    `arg:"app-max-concurrency" annotation:"dapr.io/app-max-concurrerncy" yaml:"appMaxConcurrency" default:"-1"`
	// Speicifcally omitted from annotations similar to config file path above.
	PlacementHostAddr string `arg:"placement-host-address" yaml:"placementHostAddress"`
	// Speicifcally omitted from annotations similar to config file path above.
	ComponentsPath string `arg:"components-path"` // Deprecated in run template file: use ResourcesPaths instead.
	// Speicifcally omitted from annotations similar to config file path above.
	ResourcesPath string `yaml:"resourcesPath"` // Deprecated in run template file: use ResourcesPaths instead.
	// Speicifcally omitted from annotations similar to config file path above.
	ResourcesPaths []string `arg:"resources-path" yaml:"resourcesPaths"`
	// Speicifcally omitted from annotations as appSSL is deprecated.
	AppSSL             bool   `arg:"app-ssl" yaml:"appSSL"`
	MaxRequestBodySize int    `arg:"dapr-http-max-request-size" annotation:"dapr.io/http-max-request-size" yaml:"daprHTTPMaxRequestSize" default:"-1"`
	HTTPReadBufferSize int    `arg:"dapr-http-read-buffer-size" annotation:"dapr.io/http-read-buffer-size" yaml:"daprHTTPReadBufferSize" default:"-1"`
	EnableAppHealth    bool   `arg:"enable-app-health-check" annotation:"dapr.io/enable-app-health-check" yaml:"enableAppHealthCheck"`
	AppHealthPath      string `arg:"app-health-check-path" annotation:"dapr.io/app-health-check-path" yaml:"appHealthCheckPath"`
	AppHealthInterval  int    `arg:"app-health-probe-interval" annotation:"dapr.io/app-health-probe-interval" ifneq:"0" yaml:"appHealthProbeInterval"`
	AppHealthTimeout   int    `arg:"app-health-probe-timeout" annotation:"dapr.io/app-health-probe-timeout" ifneq:"0" yaml:"appHealthProbeTimeout"`
	AppHealthThreshold int    `arg:"app-health-threshold" annotation:"dapr.io/app-health-threshold" ifneq:"0" yaml:"appHealthThreshold"`
	EnableAPILogging   bool   `arg:"enable-api-logging" annotation:"dapr.io/enable-api-logging" yaml:"enableApiLogging"`
	// Specifically omitted from annotations see https://github.com/dapr/cli/issues/1324 .
	DaprdInstallPath    string            `yaml:"runtimePath"`
	Env                 map[string]string `yaml:"env"`
	DaprdLogDestination LogDestType       `yaml:"daprdLogDestination"`
	AppLogDestination   LogDestType       `yaml:"appLogDestination"`
}

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.

Jump to

Keyboard shortcuts

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