aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mirrorbrain
diff options
context:
space:
mode:
authorThomas Backlund <tmb@mageia.org>2016-03-14 22:24:36 +0200
committerThomas Backlund <tmb@mageia.org>2016-03-14 22:24:36 +0200
commit661e478ba3956ff38f86e6a5492939eadc75432d (patch)
treef9943a14b4f6b59d42accf1e4a2909f85438e9a0 /modules/mirrorbrain
parent2362f0803cbe7514214b5abc1b96c971e349c302 (diff)
downloadpuppet-661e478ba3956ff38f86e6a5492939eadc75432d.tar
puppet-661e478ba3956ff38f86e6a5492939eadc75432d.tar.gz
puppet-661e478ba3956ff38f86e6a5492939eadc75432d.tar.bz2
puppet-661e478ba3956ff38f86e6a5492939eadc75432d.tar.xz
puppet-661e478ba3956ff38f86e6a5492939eadc75432d.zip
add mirrorbrain module
Diffstat (limited to 'modules/mirrorbrain')
-rw-r--r--modules/mirrorbrain/manifests/init.pp107
-rw-r--r--modules/mirrorbrain/templates/geoip.conf5
-rw-r--r--modules/mirrorbrain/templates/mirrorbrain.conf14
-rw-r--r--modules/mirrorbrain/templates/webapp.conf14
4 files changed, 140 insertions, 0 deletions
diff --git a/modules/mirrorbrain/manifests/init.pp b/modules/mirrorbrain/manifests/init.pp
new file mode 100644
index 00000000..e682ac82
--- /dev/null
+++ b/modules/mirrorbrain/manifests/init.pp
@@ -0,0 +1,107 @@
+rclass mirrorbrain {
+
+ $mb_user = 'mirrorbrain'
+ $mb_home = "/var/lib/${mb_user}"
+ $mb_repo = "${mb_home}/mirror"
+ $mb_vhost = "dl.${::domain}"
+
+ $mb_pgsql_pw = extlookup('mirrorbrain_pgsql','x')
+
+ group { $mb_user:
+ ensure => present
+ }
+
+ user { $mb_user:
+ ensure => present,
+ home => $mb_home
+ }
+
+ file { $mb_home:
+ ensure => directory,
+ owner => $mb_user,
+ group => $mb_user,
+ mode => '0750'
+ }
+
+ file { $mb_repo:
+ ensure => directory,
+ owner => $mb_user,
+ group => $mb_user,
+ mode => '0755'
+ }
+
+ package {['mirrorbrain',
+ 'mirrorbrain-scanner',
+ 'mirrorbrain-tools',
+ 'apache-mod_mirrorbrain']: }
+
+
+ postgresql::remote_db_and_user { 'mirrorbrain':
+ description => 'Mirrorbrain database',
+ password => $mb_pgsql_password,
+ }
+
+ file { '/etc/httpd/conf/geoip.conf':
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ content => template('mirrorbrain/geoip.conf')
+ }
+
+ file { '/etc/mirrorbrain.conf':
+ owner => 'root',
+ group => 'apache',
+ mode => '0640',
+ content => template('mirrorbrain/mirrorbrain.conf')
+ }
+
+ apache::vhost::base { "${mb_vhost}":
+ vhost => "${mb_vhost}",
+ location => "${mb_repo}"
+ }
+
+ apache::vhost::base { "ssl_${mb_vhost}":
+ vhost => "${mb_vhost}",
+ use_ssl => true,
+ location => "${mb_repo}"
+ }
+
+ apache::webapp_other { 'mirrorbrain':
+ webapp_file => 'mirrorbrain/webapp.conf',
+ }
+
+ cron { 'GeoIP update':
+ command => 'sleep $(($RANDOM/1024)); /usr/bin/geoip-lite-update',
+ user => 'root',
+ minute => 30,
+ hour => 3,
+ weekday => 0
+ }
+
+ cron { 'fake mirror update':
+ command => "/usr/bin/null-rsync rsync.mageia.org::mageia ${mb_repo}/",
+ user => "$mb_user",
+ user => 'root',
+ minute => 5
+ }
+
+ cron { 'mirror online status check':
+ command => '/usr/bin/mirrorprobe',
+ user => "$mb_user",
+ minute => 5
+ }
+
+ cron { 'mirror scanning':
+ command => '/usr/bint/mb scan --quiet --jobs 4 --all',
+ user => "$mb_user",
+ minute => 30
+ }
+
+ cron { 'mirror database cleanup':
+ command => '/usr/bint/mb db vacuum',
+ user => "$mb_user",
+ minute => 30,
+ hour => 2,
+ weekday => 1
+ }
+}
diff --git a/modules/mirrorbrain/templates/geoip.conf b/modules/mirrorbrain/templates/geoip.conf
new file mode 100644
index 00000000..1f71a67d
--- /dev/null
+++ b/modules/mirrorbrain/templates/geoip.conf
@@ -0,0 +1,5 @@
+<IfModule mod_geoip.c>
+ GeoIPEnable On
+ GeoIPDBFile /var/lib/GeoIP/GeoLiteCity.dat.updated
+ GeoIPOutput Env
+</IfModule>
diff --git a/modules/mirrorbrain/templates/mirrorbrain.conf b/modules/mirrorbrain/templates/mirrorbrain.conf
new file mode 100644
index 00000000..6dd3c0ac
--- /dev/null
+++ b/modules/mirrorbrain/templates/mirrorbrain.conf
@@ -0,0 +1,14 @@
+[general]
+instances = main
+
+[main]
+dbuser = mirrorbrain
+dbpass = <%= pgsql_password %>
+dbdriver = postgresql
+dbhost = pgsql.<%= domain %>
+# optional: dbport = ...
+dbname = mirrorbrain
+
+[mirrorprobe]
+# logfile = /var/log/mirrorbrain/mirrorprobe.log
+# loglevel = INFO
diff --git a/modules/mirrorbrain/templates/webapp.conf b/modules/mirrorbrain/templates/webapp.conf
new file mode 100644
index 00000000..787bbc7b
--- /dev/null
+++ b/modules/mirrorbrain/templates/webapp.conf
@@ -0,0 +1,14 @@
+<Directory ${mb_repo}>
+ MirrorBrainEngine On
+ MirrorBrainDebug Off
+ FormGET On
+ MirrorBrainHandleHEADRequestLocally Off
+ #MirrorBrainMinSize 2048
+ #MirrorBrainExcludeUserAgent rpm/4.4.2*
+ #MirrorBrainExcludeUserAgent *APT-HTTP*
+ #MirrorBrainExcludeMimeType application/pgp-keys
+ Options FollowSymLinks Indexes
+ AllowOverride None
+ Order allow,deny
+ Require all granted
+</Directory> \ No newline at end of file