From 7966b996b88d7d0330600c5a5d83821d5c2a14c8 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Wed, 3 Dec 2014 21:33:37 +0000 Subject: [PATCH 01/11] Replace class dependencies with ensure_resource This allows the module to co-exist with other uses of its dependencies. Issue: martasd/puppet-mediawiki#12 --- manifests/init.pp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 6a80a8b..f9af789 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -58,18 +58,18 @@ Class['mysql::server'] -> Class['mediawiki'] Class['mysql::config'] -> Class['mediawiki'] - class { 'apache': } - class { 'apache::mod::php': } + ensure_resource('class', 'apache') + ensure_resource('class', 'apache::mod::php') # Manages the mysql server package and service by default - class { 'mysql::server': - config_hash => { 'root_password' => $db_root_password }, - } + ensure_resource('class', 'mysql::server', + { 'root_password' => $db_root_password }, + ) - package { $mediawiki::params::packages: + ensure_resource('package', $mediawiki::params::packages, { ensure => $package_ensure, - } + }) # Make sure the directories and files common for all instances are included file { 'mediawiki_conf_dir': From 2dce897742f617c7be2abcaabd3557bb53356b32 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Thu, 4 Dec 2014 06:43:24 +0000 Subject: [PATCH 02/11] Remove dependency to legacy mysql::config This does no longer appear in the the Puppet MySQL module, causing the Puppet to fail. --- manifests/init.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index f9af789..7e24e9d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -56,8 +56,7 @@ # Specify dependencies Class['mysql::server'] -> Class['mediawiki'] - Class['mysql::config'] -> Class['mediawiki'] - + ensure_resource('class', 'apache') ensure_resource('class', 'apache::mod::php') From 6d5202338f8121e6e3377e4e21f6a8f646a0c0a0 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Thu, 4 Dec 2014 06:48:33 +0000 Subject: [PATCH 03/11] Update MediaWiki download URL to current version --- manifests/params.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 107dd47..cf6e810 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -21,7 +21,7 @@ # class mediawiki::params { - $tarball_url = 'http://download.wikimedia.org/mediawiki/1.19/mediawiki-1.19.1.tar.gz' + $tarball_url = 'http://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.0.tar.gz' $conf_dir = '/etc/mediawiki' $apache_daemon = '/usr/sbin/apache2' $installation_files = ['api.php', From 94e84ff54b896f3be64fea2edcd85f2feedeccfc Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Thu, 4 Dec 2014 10:04:44 +0000 Subject: [PATCH 04/11] Allow wikis to be defined by virtual host name Add instance option that allows a wiki to be accessed through a unique virtual host name, rather than a unique path. --- manifests/instance.pp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/manifests/instance.pp b/manifests/instance.pp index 44429c0..89360e7 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -12,6 +12,10 @@ # [*server_aliases*] - an array of mediawiki web server aliases # [*ensure*] - the current status of the wiki instance # - options: present, absent, deleted +# [*vhost_type*] - Whether the wiki will be defined by the name of the +# host or its path +# - options: host, path +# [*server_name*] - Unique server name to use for host-based wikis # # === Examples # @@ -44,7 +48,9 @@ $ip = '*', $port = '80', $server_aliases = '', - $ensure = 'present' + $ensure = 'present', + $vhost_type = 'path', + $server_name = $mediawiki::server_name, ) { validate_re($ensure, '^(present|absent|deleted)$', @@ -59,13 +65,24 @@ # Make the configuration file more readable $admin_email = $mediawiki::admin_email $db_root_password = $mediawiki::db_root_password - $server_name = $mediawiki::server_name $doc_root = $mediawiki::doc_root $mediawiki_install_path = $mediawiki::mediawiki_install_path $mediawiki_conf_dir = $mediawiki::params::conf_dir $mediawiki_install_files = $mediawiki::params::installation_files $apache_daemon = $mediawiki::params::apache_daemon + # Configure according to whether the wiki instance will be accessed + # through a unique host name or through a unique path + $vhost_root = $vhost_type ? { + 'path' => $doc_root, + 'host' => "$doc_root/$name", + } + + $script_path = $vhost_type ? { + 'path' => "/${name}", + 'host' => "''", + } + # Figure out how to improve db security (manually done by # mysql_secure_installation) case $ensure { @@ -77,7 +94,7 @@ --pass puppet \ --email ${admin_email} \ --server http://${server_name} \ - --scriptpath /${name} \ + --scriptpath ${script_path} \ --dbtype mysql \ --dbserver localhost \ --installdbuser root \ @@ -131,7 +148,7 @@ # Each instance has a separate vhost configuration apache::vhost { $name: port => $port, - docroot => $doc_root, + docroot => $vhost_root, serveradmin => $admin_email, servername => $server_name, vhost_name => $ip, @@ -165,7 +182,7 @@ apache::vhost { $name: port => $port, - docroot => $doc_root, + docroot => $vhost_root, ensure => 'absent', } } From f762a3e17090f7543d16d39d3b4a80a1dd801359 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Thu, 4 Dec 2014 10:15:39 +0000 Subject: [PATCH 05/11] Wiki admin name and password configuration options --- manifests/instance.pp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/manifests/instance.pp b/manifests/instance.pp index 89360e7..7a0554f 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -16,6 +16,8 @@ # host or its path # - options: host, path # [*server_name*] - Unique server name to use for host-based wikis +# [*admin_name*] - name of the wiki's administrator (admin by default) +# [*admin_password*] - password for the wiki's administrator (puppet by default) # # === Examples # @@ -51,6 +53,8 @@ $ensure = 'present', $vhost_type = 'path', $server_name = $mediawiki::server_name, + $admin_name = 'admin', + $admin_password = 'puppet', ) { validate_re($ensure, '^(present|absent|deleted)$', @@ -90,8 +94,9 @@ exec { "${name}-install_script": cwd => "${mediawiki_install_path}/maintenance", - command => "/usr/bin/php install.php ${name} admin \ - --pass puppet \ + command => "/usr/bin/php install.php ${name} \ + ${admin_name} \ + --pass ${admin_password} \ --email ${admin_email} \ --server http://${server_name} \ --scriptpath ${script_path} \ From ecc94cefd67e87afce4067a5113cfeab136d588d Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Thu, 18 Dec 2014 10:56:14 +0200 Subject: [PATCH 06/11] Add language configuration --- manifests/instance.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manifests/instance.pp b/manifests/instance.pp index 7a0554f..0891e90 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -18,6 +18,7 @@ # [*server_name*] - Unique server name to use for host-based wikis # [*admin_name*] - name of the wiki's administrator (admin by default) # [*admin_password*] - password for the wiki's administrator (puppet by default) +# [*language*] - language to be used for the wiki # # === Examples # @@ -55,6 +56,7 @@ $server_name = $mediawiki::server_name, $admin_name = 'admin', $admin_password = 'puppet', + $language = 'en', ) { validate_re($ensure, '^(present|absent|deleted)$', @@ -108,7 +110,7 @@ --dbuser ${db_user} \ --dbpass ${db_password} \ --confpath ${mediawiki_conf_dir}/${name} \ - --lang en", + --lang ${language}", creates => "${mediawiki_conf_dir}/${name}/LocalSettings.php", subscribe => File["${mediawiki_conf_dir}/${name}/images"], } From 550c41498ec470cffec364f634e8c20e88e8d4ae Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Thu, 18 Dec 2014 11:15:48 +0200 Subject: [PATCH 07/11] Allow configuring images directory with a link --- manifests/instance.pp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/manifests/instance.pp b/manifests/instance.pp index 0891e90..2b571a3 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -57,6 +57,7 @@ $admin_name = 'admin', $admin_password = 'puppet', $language = 'en', + $images_dir = '', ) { validate_re($ensure, '^(present|absent|deleted)$', @@ -129,15 +130,25 @@ } # Each instance needs a separate folder to upload images - file { "${mediawiki_conf_dir}/${name}/images": - ensure => directory, - group => $::operatingsystem ? { + $images_group = $::operatingsystem ? { /(?i)(redhat|centos)/ => 'apache', /(?i)(debian|ubuntu)/ => 'www-data', default => undef, - } } - + + if $images_dir == '' { + file { "${mediawiki_conf_dir}/${name}/images": + ensure => directory, + group => $images_group + } + } else { + file { "${mediawiki_conf_dir}/${name}/images": + ensure => link, + target => $images_dir, + group => $images_group + } + } + # Ensure that mediawiki configuration files are included in each instance. mediawiki::symlinks { $name: conf_dir => $mediawiki_conf_dir, From 9a68ceb713b7f97c80e4fd6184913e7a10d784a1 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Tue, 2 Feb 2016 17:51:17 +0200 Subject: [PATCH 08/11] Update for 1.26.2 --- manifests/params.pp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index cf6e810..0227379 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -21,19 +21,22 @@ # class mediawiki::params { - $tarball_url = 'http://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.0.tar.gz' + $tarball_url = 'http://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.2.tar.gz' $conf_dir = '/etc/mediawiki' $apache_daemon = '/usr/sbin/apache2' $installation_files = ['api.php', 'api.php5', - 'bin', + 'autoload.php', + 'composer.json', 'docs', 'extensions', + 'Gruntfile.js', 'img_auth.php', 'img_auth.php5', 'includes', 'index.php', 'index.php5', + 'jsduck.json', 'languages', 'load.php', 'load.php5', @@ -41,10 +44,10 @@ 'mw-config', 'opensearch_desc.php', 'opensearch_desc.php5', + 'phpcs.xml', 'profileinfo.php', - 'redirect.php', - 'redirect.php5', - 'redirect.phtml', + 'profileinfo.php5', + 'Rakefile', 'resources', 'serialized', 'skins', @@ -54,6 +57,7 @@ 'thumb_handler.php5', 'thumb.php', 'thumb.php5', + 'vendor', 'wiki.phtml'] case $::operatingsystem { From 491103d220d47616f16b224a9b3b2ae805ec2534 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Tue, 2 Feb 2016 18:03:17 +0200 Subject: [PATCH 09/11] Expose used versions This can be used to automate the database update process. --- manifests/params.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 0227379..1908a86 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -21,7 +21,9 @@ # class mediawiki::params { - $tarball_url = 'http://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.2.tar.gz' + $major = '1.26' + $minor = '2' + $tarball_url = "http://releases.wikimedia.org/mediawiki/$major/mediawiki-$major.$minor.tar.gz" $conf_dir = '/etc/mediawiki' $apache_daemon = '/usr/sbin/apache2' $installation_files = ['api.php', From 9a6e5c4b8d319d4f9557ff2793c6421979c9a4db Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Mon, 20 Feb 2017 10:58:49 +0200 Subject: [PATCH 10/11] Add SSL support --- manifests/instance.pp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/manifests/instance.pp b/manifests/instance.pp index 2b571a3..07ffa11 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -49,7 +49,7 @@ $db_name = $name, $db_user = "${name}_user", $ip = '*', - $port = '80', + $port = '', $server_aliases = '', $ensure = 'present', $vhost_type = 'path', @@ -58,8 +58,22 @@ $admin_password = 'puppet', $language = 'en', $images_dir = '', + $ssl = false, + $ssl_chain = '', + $ssl_key = '', + $ssl_cert = '', ) { - + + if $port == '' { + if $ssl { + $server_port = 443 + } else { + $server_port = 80 + } + } else { + $server_port = $port + } + validate_re($ensure, '^(present|absent|deleted)$', "${ensure} is not supported for ensure. Allowed values are 'present', 'absent', and 'deleted'.") @@ -165,13 +179,17 @@ # Each instance has a separate vhost configuration apache::vhost { $name: - port => $port, + port => $server_port, docroot => $vhost_root, serveradmin => $admin_email, servername => $server_name, vhost_name => $ip, serveraliases => $server_aliases, ensure => $ensure, + ssl => $ssl, + ssl_chain => $ssl_chain, + ssl_key => $ssl_key, + ssl_cert => $ssl_cert, } } 'deleted': { From ebf079f470c481ca93ae8e5c04eabbebf0bddcda Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Thu, 12 Oct 2017 19:12:03 +0300 Subject: [PATCH 11/11] Update to version 1.29.1 --- manifests/params.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 1908a86..e590aae 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -21,8 +21,8 @@ # class mediawiki::params { - $major = '1.26' - $minor = '2' + $major = '1.29' + $minor = '1' $tarball_url = "http://releases.wikimedia.org/mediawiki/$major/mediawiki-$major.$minor.tar.gz" $conf_dir = '/etc/mediawiki' $apache_daemon = '/usr/sbin/apache2' @@ -66,17 +66,17 @@ redhat, centos: { $web_dir = '/var/www/html' $doc_root = "${web_dir}/wikis" - $packages = ['php-gd', 'php-mysql', 'wget'] + $packages = ['php-gd', 'php-mysql', 'php-xml', 'php-mbstring', 'wget'] } debian: { $web_dir = '/var/www' $doc_root = "${web_dir}/wikis" - $packages = ['php5', 'php5-mysql', 'wget'] + $packages = ['php', 'php-mysql', 'php-xml', 'php-mbstring', 'wget'] } ubuntu: { $web_dir = '/var/www' $doc_root = "${web_dir}/wikis" - $packages = ['php5', 'php5-mysql', 'wget'] + $packages = ['php5', 'php5-mysql', 'php-xml', 'php-mbstring', 'wget'] } default: { fail("Module ${module_name} is not supported on ${::operatingsystem}")