Puppet Class: phabricator

Defined in:
manifests/init.pp

Summary

This class configures and installs Phabricator.

Overview

Class for installing Phabricator.

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',
}

Parameters:

  • arcanist_revision (Phabricator::Revision)

    The commit hash or branch for Arcanist.

  • libphutil_revision (Phabricator::Revision)

    The commit hash or branch for libphutil.

  • phabricator_revision (Phabricator::Revision)

    The commit hash or branch for Phabricator.

  • config_hash (Hash[String, Data])

    Phabricator configuration. See Configuration User Guide: Advanced Configuration.

  • install_fonts (Boolean)

    Whether to install additional fonts.

  • manage_diffusion (Boolean)

    Whether to configure the host in order to be able to serve (either directly or by proxying to another host in the cluster). See Diffusion User Guide: Repository Hosting.

  • storage_upgrade (Boolean)

    A flag to enable storage upgrades. See Storage: Configuring MySQL.

  • storage_upgrade_user (Optional[String])

    The MySQL user with which to execute bin/storage upgrade.

  • storage_upgrade_password (Optional[String])

    The MySQL password for the storage upgrade user.

  • daemon_user (String)
  • group (String)
  • install_dir (Stdlib::Unixpath)
  • logs_dir (Stdlib::Unixpath)
  • pid_dir (Stdlib::Unixpath)
  • repo_dir (Stdlib::Unixpath)
  • vcs_user (String)


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
88
89
90
91
92
93
94
95
96
97
# File 'manifests/init.pp', line 45

class phabricator(
  Phabricator::Revision $arcanist_revision,
  Phabricator::Revision $libphutil_revision,
  Phabricator::Revision $phabricator_revision,
  Hash[String, Data]    $config_hash,
  Boolean               $install_fonts,
  Boolean               $manage_diffusion,
  Boolean               $storage_upgrade,
  Optional[String]      $storage_upgrade_user,
  Optional[String]      $storage_upgrade_password,

  String                $daemon_user,
  String                $group,
  Stdlib::Unixpath      $install_dir,
  Stdlib::Unixpath      $logs_dir,
  Stdlib::Unixpath      $pid_dir,
  Stdlib::Unixpath      $repo_dir,
  String                $vcs_user,
) {
  if $storage_upgrade {
    assert_type(String, $storage_upgrade_user)
    assert_type(String, $storage_upgrade_password)
  }

  if $pid_dir =~ /^\/run\// {
    $runtime_directory = regsubst($pid_dir, /^\/run\//, '')
  } else {
    fail('$pid_dir must be a descendent of /run.')
  }

  $config = merge(
    $config_hash,
    {
      'diffusion.ssh-user'            => $vcs_user,
      'environment.append-paths'      => ['/usr/lib/git-core'],
      'log.access.path'               => "${logs_dir}/access.log",
      'log.ssh.path'                  => "${logs_dir}/ssh.log",
      'phd.log-directory'             => $logs_dir,
      'phd.pid-directory'             => $pid_dir,
      'phd.user'                      => $daemon_user,
      'repository.default-local-path' => $repo_dir,
    }
  )

  # TODO: It's not currently possible to test for warnings with `rspec-puppet`.
  # See https://github.com/rodjek/rspec-puppet/issues/108.
  if $facts['phpversion'] != undef and versioncmp($facts['phpversion'], '7.0.0') >= 0 and versioncmp($facts['phpversion'], '7.1.0') < 0 {
    warning('Phabricator does not support PHP 7.0. See https://secure.phabricator.com/T12101.')
  }

  include phabricator::config
  include phabricator::install
}