Skip to content

Commit

Permalink
create systemd dir when use systemd user mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Yujie-Xie committed Jan 29, 2024
1 parent 5811bbb commit 2944665
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion embed/templates/systemd/system.service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LimitCORE={{.LimitCORE}}
LimitNOFILE=1000000
LimitSTACK=10485760

{{- if .GrantCapNetRaw}}
{{- if and .GrantCapNetRaw (eq .SystemdMode "system")}}
AmbientCapabilities=CAP_NET_RAW
{{- end}}
{{- if eq .SystemdMode "system"}}
Expand Down
8 changes: 5 additions & 3 deletions pkg/cluster/manager/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ func buildScaleOutTask(
dirs = append(dirs, spec.Abs(globalOptions.User, dirname))
}
}

if systemdMode == spec.UserMode {
dirs = append(dirs, spec.Abs(globalOptions.User, ".config/systemd/user"))
}
t := task.NewBuilder(m.logger).
RootSSH(
instance.GetManageHost(),
Expand Down Expand Up @@ -434,7 +436,7 @@ type hostInfo struct {
func buildMonitoredDeployTask(
m *Manager,
uniqueHosts map[string]hostInfo, // host -> ssh-port, os, arch
noAgentHosts set.StringSet, // hosts that do not deploy monitor agents
noAgentHosts set.StringSet, // hosts that do not deploy monitor agents
globalOptions *spec.GlobalOptions,
monitoredOptions *spec.MonitoredOptions,
gOpt operator.Options,
Expand Down Expand Up @@ -508,7 +510,7 @@ func buildMonitoredCertificateTasks(
m *Manager,
name string,
uniqueHosts map[string]hostInfo, // host -> ssh-port, os, arch
noAgentHosts set.StringSet, // hosts that do not deploy monitor agents
noAgentHosts set.StringSet, // hosts that do not deploy monitor agents
globalOptions *spec.GlobalOptions,
monitoredOptions *spec.MonitoredOptions,
gOpt operator.Options,
Expand Down
4 changes: 3 additions & 1 deletion pkg/cluster/manager/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ func (m *Manager) Deploy(
if strings.HasPrefix(globalOptions.DataDir, "/") {
dirs = append(dirs, globalOptions.DataDir)
}

if systemdMode == spec.UserMode {
dirs = append(dirs, spec.Abs(globalOptions.User, ".config/systemd/user"))
}
t := task.NewBuilder(m.logger).
RootSSH(
host,
Expand Down

0 comments on commit 2944665

Please sign in to comment.