Compare commits

..

3 Commits

Author SHA1 Message Date
7u83 b9f0a04e93 Creates a cron job to process matomo data 2020-10-16 13:06:21 +02:00
7u83 cccdfde5b7 Stes most settings in config.ini.php 2020-10-16 10:48:29 +02:00
7u83 2270694130 Runs now w/o errors 2020-10-15 16:16:04 +02:00
2 changed files with 115 additions and 24 deletions

View File

@ -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,7 +100,75 @@ 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 {
@ -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"
}
}

View File

@ -54,8 +54,8 @@ class wmdeit_piwik::params{
"$phpver-mysql",
"$phpver-mbstring",
"$phpver-gd",
"$phpver-dom",
"$phpver-simplexml",
# "$phpver-dom",
# "$phpver-simplexml",
]