Puppet Class: phabricator

Defined in:
manifests/init.pp

Summary

This class configures and installs Phabricator.

Overview

Class for installing Phabricator.

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

Parameters:

  • arcanist_revision (Phabricator::Revision) (defaults to: 'stable')

    The commit hash or branch for Arcanist.

  • libphutil_revision (Phabricator::Revision) (defaults to: 'stable')

    The commit hash or branch for libphutil.

  • phabricator_revision (Phabricator::Revision) (defaults to: 'stable')

    The commit hash or branch for Phabricator.

  • config_hash (Hash[String, Data]) (defaults to: {})

    Phabricator configuration. See / Configuration User Guide: Advanced Configuration.

  • install_fonts (Boolean) (defaults to: false)

    Whether to install additional fonts.

  • manage_diffusion (Boolean) (defaults to: false)

    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) (defaults to: false)

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

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

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

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

    The MySQL password for the storage upgrade user.

  • daemon_user (String) (defaults to: 'phd')
  • group (String) (defaults to: 'phabricator')
  • install_dir (Stdlib::Unixpath) (defaults to: '/usr/local/src')
  • logs_dir (Stdlib::Unixpath) (defaults to: '/var/log/phabricator')
  • pid_dir (Stdlib::Unixpath) (defaults to: '/run/phabricator')
  • repo_dir (Stdlib::Unixpath) (defaults to: '/var/repo')
  • vcs_user (String) (defaults to: 'diffusion')


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
# File 'manifests/init.pp', line 47

class phabricator(
  Phabricator::Revision $arcanist_revision = 'stable',
  Phabricator::Revision $libphutil_revision = 'stable',
  Phabricator::Revision $phabricator_revision = 'stable',
  Hash[String, Data] $config_hash = {},
  Boolean $install_fonts = false,
  Boolean $manage_diffusion = false,
  Boolean $storage_upgrade = false,
  Optional[String] $storage_upgrade_user = undef,
  Optional[String] $storage_upgrade_password = undef,

  String $daemon_user = 'phd',
  String $group = 'phabricator',
  Stdlib::Unixpath $install_dir = '/usr/local/src',
  Stdlib::Unixpath $logs_dir = '/var/log/phabricator',
  Stdlib::Unixpath $pid_dir = '/run/phabricator',
  Stdlib::Unixpath $repo_dir = '/var/repo',
  String $vcs_user = 'diffusion',
) {
  if $storage_upgrade {
    assert_type(String, $storage_upgrade_user)
    assert_type(String, $storage_upgrade_password)
  }

  $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.1. See https://secure.phabricator.com/T12101.')
  }

  include phabricator::config
  include phabricator::install
}