Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/85443
Change subject: Add Chromium class & role
......................................................................
Add Chromium class & role
This patch adds a 'chromium' Puppet class & associated role. When activated,
the beta channel version of chromium will be installed and configured to run in
headless mode on a virtual framebuffer. This is useful for various browser
automation projects.
Change-Id: I3c031c588944fa1ee68d12fb408427653fd3128e
---
M puppet/manifests/roles.pp
A puppet/modules/chromium/manifests/init.pp
A puppet/modules/chromium/templates/chromium.conf.erb
M puppet/modules/xvfb/manifests/init.pp
4 files changed, 94 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant
refs/changes/43/85443/1
diff --git a/puppet/manifests/roles.pp b/puppet/manifests/roles.pp
index e7e06f7..6ec10d6 100644
--- a/puppet/manifests/roles.pp
+++ b/puppet/manifests/roles.pp
@@ -472,3 +472,13 @@
require => Package['mediawiki-math', 'ocaml-native-compilers'],
}
}
+
+# == Class: role::chromium
+#
+# Chromium is the open source web browser project from which Google
+# Chrome draws its source code. This role provisions a browser instance
+# that runs in headless mode and that can be automated by various tools.
+#
+class role::chromium {
+ include ::chromium
+}
diff --git a/puppet/modules/chromium/manifests/init.pp
b/puppet/modules/chromium/manifests/init.pp
new file mode 100644
index 0000000..b0c0b61
--- /dev/null
+++ b/puppet/modules/chromium/manifests/init.pp
@@ -0,0 +1,64 @@
+# == Class: chromium
+#
+# Chromium is the open source web browser project from which Google
+# Chrome draws its source code. This Puppet module provisions a browser
+# instance that runs in headless mode and that can be automated by
+# various tools.
+#
+# === Parameters
+#
+# [*display*]
+# X display number. Default: 99.
+#
+# [*incognito*]
+# If true, runs Chromium in "incognito" mode, meaning history and
+# session data will not persist across runs. Default: true.
+#
+# [*remote_debugging_port*]
+# Port on which Chromium will listen for remote debugging clients.
+# See
<https://developers.google.com/chrome-developer-tools/docs/debugger-protocol>.
+# Default: 9222.
+#
+# [*extra_args*]
+# Additional arguments to pass to Chromium.
+# See <http://peter.sh/experiments/chromium-command-line-switches/>.
+# Default: no additional arguments.
+#
+# === Examples
+#
+# class { 'chromium':
+# remote_debugging_port => 9000,
+# extra_args => '--user-data-dir=/srv/chromium',
+#
+# }
+#
+class chromium(
+ $display = 99,
+ $incognito = true,
+ $remote_debugging_port = 9222,
+ $extra_args = '--',
+) {
+ include xvfb
+
+ user { 'chromium':
+ ensure => present,
+ managehome => true,
+ }
+
+ apt::ppa { 'chromium-daily/beta': }
+
+ package { [ 'chromium-browser', 'chromium-browser-l10n' ]:
+ require => Apt::Ppa['chromium-daily/beta'],
+ }
+
+ file { '/etc/init/chromium.conf':
+ content => template('chromium/chromium.conf.erb'),
+ require => [ Package['chromium-browser'], User['chromium'] ],
+ }
+
+ service { 'chromium':
+ ensure => running,
+ provider => 'upstart',
+ require => [ File['/etc/init/chromium.conf'], Service['xvfb'] ],
+ }
+}
diff --git a/puppet/modules/chromium/templates/chromium.conf.erb
b/puppet/modules/chromium/templates/chromium.conf.erb
new file mode 100644
index 0000000..c9e27ed
--- /dev/null
+++ b/puppet/modules/chromium/templates/chromium.conf.erb
@@ -0,0 +1,19 @@
+# chromium - Chromium web browser
+#
+# Chromium is the open source web browser project from which Google
+# Chrome draws its source code.
+#
+description "Chromium web browser"
+
+start on started xvfb
+
+setuid chromium
+
+respawn
+respawn limit 10 5
+
+exec chromium-browser \
+ <% if @incognito %>--incognito<% end %> \
+ --remote-debugging-port=<%= @remote_debugging_port %> \
+ --display=:<%= @display.to_s.sub(/\D/, '') %> \
+ <%= @extra_args %>
diff --git a/puppet/modules/xvfb/manifests/init.pp
b/puppet/modules/xvfb/manifests/init.pp
index 71333f8..ca1b3cf 100644
--- a/puppet/modules/xvfb/manifests/init.pp
+++ b/puppet/modules/xvfb/manifests/init.pp
@@ -47,6 +47,7 @@
}
service { 'xvfb':
+ ensure => running,
provider => 'upstart',
require => File['/etc/init/xvfb.conf'],
}
--
To view, visit https://gerrit.wikimedia.org/r/85443
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c031c588944fa1ee68d12fb408427653fd3128e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits