|
|
|
@ -48,11 +48,18 @@ class wmdeit_piwik(
|
|
|
|
|
$localnginx = true,
|
|
|
|
|
$localsql = true,
|
|
|
|
|
$piwikdbuser = "piwik",
|
|
|
|
|
$piwikdbname = "piwikdb",
|
|
|
|
|
$piwikdbpassword = "piwik",
|
|
|
|
|
|
|
|
|
|
$piwikdbhost = "localhost",
|
|
|
|
|
$ssl = false,
|
|
|
|
|
$piwiksalt = undef,
|
|
|
|
|
|
|
|
|
|
) inherits wmdeit_piwik::params
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$piwikini = "$wwwdir/piwik/config/config.ini.php"
|
|
|
|
|
|
|
|
|
|
if $localnginx {
|
|
|
|
|
$fpm_listen = "/tmp/fpm"
|
|
|
|
|
$fpm_type ="unix:"
|
|
|
|
@ -93,8 +100,76 @@ class wmdeit_piwik(
|
|
|
|
|
File[$wwwdir],
|
|
|
|
|
],
|
|
|
|
|
creates => "$wwwdir/piwik",
|
|
|
|
|
} ->
|
|
|
|
|
file{"$piwikini":
|
|
|
|
|
ensure => file,
|
|
|
|
|
owner => $wwwuser
|
|
|
|
|
} ->
|
|
|
|
|
ini_setting {"$piwikini proxy":
|
|
|
|
|
ensure => present,
|
|
|
|
|
section => "General",
|
|
|
|
|
path => "$piwikini",
|
|
|
|
|
setting => "browser_archiving_disabled_enforce",
|
|
|
|
|
value => "1",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if $piwiksalt {
|
|
|
|
|
ini_setting {"$piwikini salt":
|
|
|
|
|
ensure => present,
|
|
|
|
|
section => "General",
|
|
|
|
|
path => "$piwikini",
|
|
|
|
|
setting => "salt",
|
|
|
|
|
value => "\"$piwiksalt\"",
|
|
|
|
|
require => File["$piwikini"],
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ini_setting {"$piwikini dbhost":
|
|
|
|
|
ensure => present,
|
|
|
|
|
section => "database",
|
|
|
|
|
path => "$piwikini",
|
|
|
|
|
setting => "host",
|
|
|
|
|
value => "\"$piwikdbhost\"",
|
|
|
|
|
require => File["$piwikini"],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ini_setting {"$piwikini dbname":
|
|
|
|
|
ensure => present,
|
|
|
|
|
section => "database",
|
|
|
|
|
path => "$piwikini",
|
|
|
|
|
setting => "dbname",
|
|
|
|
|
value => "\"$piwikdbname\"",
|
|
|
|
|
require => File["$piwikini"],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ini_setting {"$piwikini dbuser":
|
|
|
|
|
ensure => present,
|
|
|
|
|
section => "database",
|
|
|
|
|
path => "$piwikini",
|
|
|
|
|
setting => "username",
|
|
|
|
|
value => "\"$piwikdbuser\"",
|
|
|
|
|
require => File["$piwikini"],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ini_setting {"$piwikini dbpass":
|
|
|
|
|
ensure => present,
|
|
|
|
|
section => "database",
|
|
|
|
|
path => "$piwikini",
|
|
|
|
|
setting => "password",
|
|
|
|
|
value => "\"$piwikdbpassword\"",
|
|
|
|
|
require => File["$piwikini"],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if $ssl {
|
|
|
|
|
$ssl_redirect = true
|
|
|
|
|
$ssl_port = 443
|
|
|
|
|
$ssl_key = "/etc/ssl/private/wikimedia.de.key"
|
|
|
|
|
$ssl_cert = "/etc/ssl/certs/wikimedia.de.chained.pem"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if $localnginx {
|
|
|
|
|
|
|
|
|
|
class {"nginx":
|
|
|
|
@ -106,28 +181,34 @@ class wmdeit_piwik(
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nginx::resource::server { "${domain}_http":
|
|
|
|
|
listen_port => 80,
|
|
|
|
|
ensure => present,
|
|
|
|
|
access_log => "off",
|
|
|
|
|
error_log => "off",
|
|
|
|
|
server_name => ["$domain"],
|
|
|
|
|
server_cfg_append => {
|
|
|
|
|
"return" => '301 https://$server_name$request_uri'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
# nginx::resource::server { "${domain}_http":
|
|
|
|
|
# listen_port => 80,
|
|
|
|
|
# ensure => present,
|
|
|
|
|
# access_log => "off",
|
|
|
|
|
# error_log => "off",
|
|
|
|
|
# server_name => ["$domain"],
|
|
|
|
|
# server_cfg_append => {
|
|
|
|
|
# "return" => '301 https://$server_name$request_uri'
|
|
|
|
|
# }
|
|
|
|
|
#
|
|
|
|
|
# }
|
|
|
|
|
|
|
|
|
|
nginx::resource::server { "$domain":
|
|
|
|
|
listen_port => 443,
|
|
|
|
|
|
|
|
|
|
ssl_redirect => $ssl,
|
|
|
|
|
ssl_port => $ssl_port,
|
|
|
|
|
ssl_key => $ssl_key,
|
|
|
|
|
ssl_cert => $ssl_cert,
|
|
|
|
|
|
|
|
|
|
server_name => ["$domain"],
|
|
|
|
|
|
|
|
|
|
# listen_port => 443,
|
|
|
|
|
ensure => present,
|
|
|
|
|
www_root => "$wwwdir/piwik",
|
|
|
|
|
access_log => "off",
|
|
|
|
|
error_log => "off",
|
|
|
|
|
|
|
|
|
|
ssl_cert => "$ssldir/certs/wikimedia.de.chained.pem",
|
|
|
|
|
ssl_key => "$ssldir/private/wikimedia.de.key",
|
|
|
|
|
ssl => true,
|
|
|
|
|
# ssl => true,
|
|
|
|
|
server_cfg_append => {
|
|
|
|
|
"ssl_session_cache" => "shared:SSL:10m",
|
|
|
|
|
# " ssl_session_timeout" => "10m;"
|
|
|
|
@ -146,8 +227,8 @@ class wmdeit_piwik(
|
|
|
|
|
nginx::resource::location { "${domain}_x2":
|
|
|
|
|
ensure => present,
|
|
|
|
|
server => "$domain",
|
|
|
|
|
ssl => true,
|
|
|
|
|
ssl_only => true,
|
|
|
|
|
# ssl => true,
|
|
|
|
|
# ssl_only => true,
|
|
|
|
|
www_root => "$wwwdir/piwik/",
|
|
|
|
|
location => '~* ^.+\.(?:css|gif|html?|jpe?g|js|png|swf)$',
|
|
|
|
|
location_cfg_append=> {
|
|
|
|
@ -164,8 +245,8 @@ class wmdeit_piwik(
|
|
|
|
|
nginx::resource::location { "${domain}_root":
|
|
|
|
|
ensure => present,
|
|
|
|
|
server => "$domain",
|
|
|
|
|
ssl => true,
|
|
|
|
|
ssl_only => true,
|
|
|
|
|
# ssl => true,
|
|
|
|
|
# ssl_only => true,
|
|
|
|
|
www_root => "$wwwdir/piwik/",
|
|
|
|
|
location => '~ \.php$',
|
|
|
|
|
index_files => ['index.php', 'index.html', 'index.htm'],
|
|
|
|
@ -195,13 +276,23 @@ class wmdeit_piwik(
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql::db { 'piwikdb':
|
|
|
|
|
mysql::db { "$piwikdbname":
|
|
|
|
|
user => "$piwikdbuser",
|
|
|
|
|
password => "$piwikdbpassword",
|
|
|
|
|
host => 'localhost',
|
|
|
|
|
host => "$piwikdbhost",
|
|
|
|
|
grant => ['ALL'],
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cron {"refresh matomo":
|
|
|
|
|
ensure => present,
|
|
|
|
|
hour => '*',
|
|
|
|
|
minute => '*/15',
|
|
|
|
|
command => "/usr/bin/php $wwwdir/piwik/console core:archive --url https://$domain",
|
|
|
|
|
user => "$wwwuser"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|