voxpupuli / puppet-puppetwebhook

Manage the installation and configuration of the puppet_webhook gem
Apache License 2.0
0 stars 7 forks source link

puppet_webhook does not start #10

Closed Dan33l closed 5 years ago

Dan33l commented 5 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

  class { 'puppetwebhook' :
    pkg_provider  => 'gem',
    server_cfg    => {
      server_type => 'daemon',
      host        => $facts['networking']['ip'],
      logfile     => '/var/log/puppet_webhook/webhook.log',
      loglevel    => 'WARN',
      pidfile     => '/var/run/webhook.pid',
      port        => 8088,
      enable_ssl  => false,

    },
    webhook_user  => 'puppet',
    webhook_group => 'puppet',
  }

What are you seeing

puppet apply hang on command /bin/systemctl start puppet_webhook and the process does not start.

What behaviour did you expect instead

Output log

Debug output:

Debug: Prefetching gem resources for package
Debug: Executing: '/usr/bin/gem list --local'
Debug: Prefetching puppet_gem resources for package
Debug: Executing: '/opt/puppetlabs/puppet/bin/gem list --local'
Debug: Prefetching apt resources for package
Debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n''
Debug: Executing: '/bin/systemctl is-active puppet_webhook'
Debug: Executing: '/bin/systemctl is-enabled puppet_webhook'
Debug: Executing: '/bin/systemctl unmask puppet_webhook'
Debug: Executing: '/bin/systemctl start puppet_webhook'

And hang here.

Any additional information you'd like to impart

The systemd unit is:

[Unit]
Description=R10K Webhook Service
After=syslog.target network.target

[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/webhook
RuntimeDirectory=puppet_webhook
User=puppet
TimeoutStartSec=90
TimeoutStopSec=30
RestartSec=10000

ExecStart=/opt/puppetlabs/puppet/bin/puppet_webhook -c /etc/puppet_webhook/server.yml
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
StandardOutput=syslog

[Install]
WantedBy=multi-user.target

But the file is in /usr/local/bin/puppet_webhook. On Debian like systems it should be EnvironmentFile=-/etc/default/webhook

Dan33l commented 5 years ago

In the class call, they are two problems.

Firstly, it is defined server_type => 'daemon', and so the process puppet_webhook daemonize. But the systemd unit is with Type=simple (not forking), so systemd expects something that does not daemonize.

Secondly, it is defined pkg_provider => 'gem',, but systemd unit use /opt/puppetlabs/puppet/bin/puppet_webhook and so it is needed to use provider puppet_gem instead of gem.

I close the issue so.