Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: scheduler init data dir #1430

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func init() {
InitCmd.Flags().String("network", "", "The Docker network on which to deploy the Dapr runtime")
InitCmd.Flags().StringVarP(&fromDir, "from-dir", "", "", "Use Dapr artifacts from local directory for self-hosted installation")
InitCmd.Flags().StringVarP(&imageVariant, "image-variant", "", "", "The image variant to use for the Dapr runtime, for example: mariner")
InitCmd.Flags().StringVarP(&schedulerVolume, "scheduler-volume", "", "dapr_scheduler", "Self-hosted only. Specify a volume for the scheduler service data directory.")
InitCmd.Flags().StringVarP(&schedulerVolume, "scheduler-volume", "", "", "Self-hosted only. Specify a volume for the scheduler service data directory.")
InitCmd.Flags().BoolP("help", "h", false, "Print this help message")
InitCmd.Flags().StringArrayVar(&values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
InitCmd.Flags().String("image-registry", "", "Custom/private docker image repository URL")
Expand Down
17 changes: 16 additions & 1 deletion pkg/standalone/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,23 @@ func runSchedulerService(wg *sync.WaitGroup, errorChan chan<- error, info initIn
"-d",
"--entrypoint", "./scheduler",
}

if info.schedulerVolume != nil {
args = append(args, "--volume", *info.schedulerVolume+":/var/lib/dapr/scheduler")
if *info.schedulerVolume == "" {
schedulerDataDir := path_filepath.Join(info.installDir, "data/scheduler")
if err = os.MkdirAll(schedulerDataDir, 0o755); err != nil {
errorChan <- err
return
}
// if dir exists, change the permissions.
if err = os.Chmod(schedulerDataDir, 0o777); err != nil {
errorChan <- err
return
}
args = append(args, "--volume", schedulerDataDir+":/var/lib/dapr/scheduler")
} else {
args = append(args, "--volume", *info.schedulerVolume+":/var/lib/dapr/scheduler")
}
}

if info.dockerNetwork != "" {
Expand Down
Loading