Puppet Class: electron

Defined in:
puppet/modules/electron/manifests/init.pp

Overview

Class: electron

Sets up the electron service which renders PDF files from web pages.

FIXME some of the config is in puppet/modules/restbase/templates/config.yaml.erb

Parameters

port

Port to listen on

secret

Secret needed to access the service

dir

Install directory

home_dir

Homedir for the headless browser used by electron. Must be ownable by the web user (ie. non-shared).

log_file

Log file for electron and xvfb.

Parameters:

  • port (Any)
  • secret (Any)
  • dir (Any)
  • home_dir (Any)
  • log_file (Any)


25
26
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
# File 'puppet/modules/electron/manifests/init.pp', line 25

class electron(
    $port,
    $secret,
    $dir,
    $home_dir,
    $log_file,
) {
    require_package([
        'xvfb',
        'libgtk2.0-0',
        'ttf-mscorefonts-installer',
        'libnotify4',
        'libgconf2-4',
        'libxss1',
        'libnss3',
        'dbus-x11',
    ])

    git::clone { 'electron-render-service':
        directory => $dir,
        remote    => 'https://github.com/wikimedia/mediawiki-services-electron-render.git',
    }

    npm::install { $dir:
        directory => $dir,
        require   => Git::Clone['electron-render-service'],
    }

    service::gitupdate { 'electron-render-service':
        type    => 'nodejs',
        update  => true,
        restart => true,
    }

    file { $home_dir:
        ensure  => directory,
        owner   => www-data,
        group   => www-data,
        require => Git::Clone['electron-render-service'],
    }

    systemd::service { 'electron-render-service':
        service_params => {
            subscribe => Npm::Install[$dir],
        },
        require        => [
            Git::Clone['electron-render-service'],
            File[$home_dir],
        ],
    }

    apache::reverse_proxy { 'electron':
        port => $port,
    }
}