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

create systemd dir when use systemd user mode #2373

Merged
merged 4 commits into from
Jan 31, 2024
Merged
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 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
3 changes: 0 additions & 3 deletions pkg/cluster/spec/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ func (i *BaseInstance) InitConfig(ctx context.Context, e ctxt.Executor, opt Glob
sudo := true
if opt.SystemdMode == UserMode {
systemdDir = "~/.config/systemd/user/"
if err := os.MkdirAll(systemdDir, os.ModePerm); err != nil {
return err
}
sudo = false
}
cmd := fmt.Sprintf("mv %s %s%s-%d.service", tgt, systemdDir, comp, port)
Expand Down
Loading