Puppet Class: phabricator::daemons

Defined in:
manifests/daemons.pp

Summary

This class manages Phabricator Daemons. See

Overview

Class for installing Phabricator Daemons.

/ Managing Daemons with phd.

TODO: Remove the default values after we drop support for Puppet 4.7.

Examples:

class { 'phabricator':
  config_hash => {
    'mysql.host' => 'localhost',
    'mysql.user' => 'user',
    'mysql.pass' => 'password',
  },

  storage_upgrade          => true,
  storage_upgrade_user     => 'root',
  storage_upgrade_password => 'password',
}

include phabricator::daemons

Parameters:

  • daemon (Optional[String]) (defaults to: undef)

    Launch the specified daemon using ‘./bin/phd launch` instead of starting all of the daemon daemons.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'manifests/daemons.pp', line 27

class phabricator::daemons(
  Optional[String] $daemon = undef,
) {
  # TODO: The `strict_indent` check doesn't seem to work properly here. See
  # https://github.com/relud/puppet-lint-strict_indent-check/issues/11.
  #
  # lint:ignore:strict_indent
  systemd::unit_file { 'phd.service':
    ensure  => 'file',
    content => epp('phabricator/daemons.systemd.epp', {
      command => "${phabricator::install_dir}/phabricator/bin/phd",
      daemon  => $daemon,
      user    => $phabricator::daemon_user,
      group   => $phabricator::group,
    }),
    notify  => Service['phd'],
  }
  # lint:endignore

  # TODO: Should we also specify `hasrestart => true`? According to the
  # documentation the default value is `false`, although I am somewhat
  # surprised by this.
  service { 'phd':
    ensure    => 'running',
    enable    => true,
    require   => [
      Exec['systemctl-daemon-reload'],
      File[$phabricator::logs_dir],
      File[$phabricator::pid_dir],
      Group[$phabricator::group],
      User[$phabricator::daemon_user],
    ],
    subscribe => [
      Class['php::cli'],
      File['phabricator/conf/local.json'],
      Vcsrepo['libphutil'],
      Vcsrepo['phabricator'],
    ],
  }

  # Restart the daemons if any PHP extensions are updated.
  Php::Extension <| |> ~> Service['phd']

  if $phabricator::storage_upgrade {
    Exec['bin/storage upgrade'] -> Service['phd']
  }

  logrotate::rule { 'phd':
    ensure        => 'present',
    path          => "${phabricator::logs_dir}/daemons.log",
    compress      => true,
    delaycompress => true,
    ifempty       => false,
    missingok     => true,
    rotate        => 4,
    rotate_every  => 'week',
    su            => true,
    su_owner      => 'root',
    su_group      => $phabricator::group,
  }
}