Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/updateserver/manifests/init.pp

Issue 5071748311547904: Issue 1094 - Generate update manifests on the update server (Closed)
Patch Set: Run as user sitescripts Created July 25, 2014, 2:17 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 class updateserver( 1 class updateserver(
2 $domain, 2 $domain,
3 $certificate, 3 $certificate,
4 $private_key, 4 $private_key,
5 $is_default=false 5 $is_default=false
6 ) { 6 ) {
7 class {'nginx': 7 class {'nginx':
8 worker_processes => 2, 8 worker_processes => 2,
9 worker_connections => 4000, 9 worker_connections => 4000,
10 ssl_session_cache => off, 10 ssl_session_cache => off,
11 } 11 }
12 12
13 File { 13 File {
14 owner => root, 14 owner => root,
15 group => root 15 group => root
16 } 16 }
17 17
18 file {'/var/www': 18 file {'/var/www':
19 ensure => directory, 19 ensure => directory,
20 mode => 0755, 20 mode => 0755,
21 require => Package['nginx'] 21 require => Package['nginx']
22 } 22 }
23 23
24 file {'/var/www/update': 24 $update_dir = '/var/www/update'
25
26 file {$update_dir:
25 ensure => directory, 27 ensure => directory,
26 mode => 0755 28 mode => 0755
27 } 29 }
28 30
29 file {'/var/www/update/adblockplusie': 31 $sitescripts_var_dir = '/var/lib/sitescripts'
Felix Dahlke 2014/07/25 14:21:01 This was /var/lib/adblockplus before. This is now
32
33 user {'sitescripts':
34 ensure => present,
35 home => $sitescripts_var_dir
36 }
37
38 file {$sitescripts_var_dir:
39 ensure => directory,
40 mode => 0755,
41 owner => 'sitescripts',
42 group => 'sitescripts'
43 }
44
45 $update_manifest_dirs = ["${update_dir}/gecko",
46 "${update_dir}/adblockplusandroid",
47 "${update_dir}/adblockplussafari"]
48
49 file {$update_manifest_dirs:
50 ensure => directory,
51 mode => 0755,
52 owner => 'sitescripts',
53 group => 'sitescripts'
54 }
55
56 file {"${update_dir}/adblockplusie":
30 ensure => directory, 57 ensure => directory,
31 mode => 0755 58 mode => 0755
32 } 59 }
33 60
34 file {'/var/www/update/adblockplusie/update.json': 61 file {"${update_dir}/adblockplusie/update.json":
35 ensure => file, 62 ensure => file,
36 source => 'puppet:///modules/updateserver/adblockplusie/update.json', 63 source => 'puppet:///modules/updateserver/adblockplusie/update.json',
37 mode => 0644 64 mode => 0644
38 } 65 }
39 66
40 nginx::hostconfig{$domain: 67 nginx::hostconfig{$domain:
41 source => 'puppet:///modules/updateserver/site.conf', 68 source => 'puppet:///modules/updateserver/site.conf',
42 is_default => $is_default, 69 is_default => $is_default,
43 certificate => $certificate, 70 certificate => $certificate,
44 private_key => $private_key, 71 private_key => $private_key,
45 log => 'access_log_update' 72 log => 'access_log_update'
46 } 73 }
74
75 class {'sitescripts':
76 sitescriptsini_source => 'puppet:///modules/updateserver/sitescripts'
77 }
78
79 $safari_certificate_path = "${sitescripts_var_dir}/adblockplussafari.pem"
80
81 file {$safari_certificate_path:
82 source => 'puppet:///modules/private/adblockplussafari.pem'
83 }
84
85 $repositories_to_sync = ['downloads', 'adblockplus', 'adblockplusandroid',
86 'adblockpluschrome', 'elemhidehelper', 'abpwatcher',
87 'abpcustomization', 'urlfixer']
88
89 define fetch_repository() {
90 $repository_path = "${updateserver::sitescripts_var_dir}/${title}"
91 exec {"fetch_repository_${title}":
92 command => "hg clone -U https://hg.adblockplus.org/${title} ${repository_p ath}",
93 path => '/usr/local/bin:/usr/bin:/bin',
94 user => 'sitescripts',
95 timeout => 0,
96 onlyif => "test ! -d ${repository_path}",
97 require => [Package['mercurial'], File[$updateserver::sitescripts_var_dir] ]
98 }
99 }
100
101 fetch_repository {$repositories_to_sync: }
102
103 $update_update_manifests_script = '/usr/local/bin/update_update_manifests'
104
105 file {$update_update_manifests_script:
106 mode => '0755',
107 content => template('updateserver/update_update_manifests.erb')
108 }
109
110 $update_update_manifests_dependencies = ['python-m2crypto', 'python-jinja2']
111
112 package {$update_update_manifests_dependencies:}
113
114 exec {'update_update_manifests':
115 command => $update_update_manifests_script,
116 user => 'sitescripts',
117 timeout => 0,
118 require => [Exec['fetch_sitescripts'],
119 Fetch_repository[$repositories_to_sync],
120 File[$update_update_manifests_script],
121 File[$update_manifest_dirs], File[$safari_certificate_path],
122 Package[$update_update_manifests_dependencies]]
123 }
124
125 cron {'update_update_manifests':
126 ensure => present,
127 environment => ['MAILTO=admins@adblockplus.org'],
128 command => $update_update_manifests_script,
129 user => 'sitescripts',
130 minute => '*/10',
131 require => Exec['update_update_manifests']
132 }
47 } 133 }
OLDNEW
« no previous file with comments | « modules/updateserver/files/sitescripts ('k') | modules/updateserver/templates/update_update_manifests.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld