voxpupuli / puppet-consul

A Puppet Module to Manage Consul
Apache License 2.0
121 stars 316 forks source link

Systemd service does't work for 'package' install_method #584

Open wilful opened 2 years ago

wilful commented 2 years ago

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 commented 2 years ago

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

solarkennedy commented 2 years ago

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

You could argue this is a bug?

wilful commented 2 years ago

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

rhandimartin commented 2 years ago

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

FcoCalero commented 2 years ago

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 commented 2 years ago

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.