puppet-consul icon indicating copy to clipboard operation
puppet-consul copied to clipboard

Systemd service does't work for 'package' install_method

Open wilful opened this issue 3 years ago • 6 comments

Hello! If i choose 'packege' install_methon. After installation i have broken systemd service on my server, like this (binary file placed in /usr/bin from official Hashicorp repository mirror):

# systemctl cat consul
# /etc/systemd/system/consul.service
# THIS FILE IS MANAGED BY PUPPET
[Unit]
Description=Consul Agent
After=network-online.target
Wants=network-online.target

[Service]
Type=exec
User=consul
Group=consul
ExecStart=/usr/local/bin/consul agent \
  -config-dir /etc/consul
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
LimitNOFILE=131072

[Install]
WantedBy=multi-user.target

Because default setting bin_dir work only for 'url' install_method, after changing this need to configure bin_dir too May be need set to default bin folder, when i choose 'package'?

wilful avatar Oct 04 '21 13:10 wilful

Or need disable overriding service file by puppet if i use package method, i don't know how set it

wilful avatar Oct 04 '21 13:10 wilful

bin_dir https://github.com/solarkennedy/puppet-consul/blob/e4d41bd4826b4e4fb27d9298b7dacb706232f2c3/manifests/init.pp#L37

You could argue this is a bug?

solarkennedy avatar Oct 04 '21 16:10 solarkennedy

By default Service overdid version from repository, and set to local/bin. If i set instal_method from package i expect what service file will be from rpm package or some

wilful avatar Oct 04 '21 16:10 wilful

Is this possibly related to the version of systemd being used? i know they have gone from camptocamp-systemd to puppet-systemd, and i have been tracking fora discussing unexpected behavior on the 3.x branch of the new module

rhandimartin avatar Nov 19 '21 22:11 rhandimartin

Hi,

I made that work commenting from the /etc/systemd/system/consul.service file the following lines:

User=consul Group=consul

If you run the process manually with root, it works, however if you tries the server unit, it doesn't work because it launches the service under consul user which apparently doesn't have permissions to do it, maybe adding a line to sudo file might solve the problem, i ignore if it is like that with other install method.

Hope this helps.

Regards

FcoCalero avatar Dec 05 '21 16:12 FcoCalero

Hi,

I made that work commenting from the /etc/systemd/system/consul.service file the following lines:

User=consul Group=consul

If you run the process manually with root, it works, however if you tries the server unit, it doesn't work because it launches the service under consul user which apparently doesn't have permissions to do it, maybe adding a line to sudo file might solve the problem, i ignore if it is like that with other install method.

Hope this helps.

Regards

***Update

The folder/files where the app is installed is not owned by consul user, i have done a chown to consul user and it works.

FcoCalero avatar Dec 05 '21 16:12 FcoCalero