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

Delta Between Two Patch Sets: modules/updateserver/manifests/init.pp

Issue 5071748311547904: Issue 1094 - Generate update manifests on the update server (Closed)
Left Patch Set: Addressed comments Created July 25, 2014, 10:30 a.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « modules/updateserver/files/sitescripts ('k') | modules/updateserver/templates/update_update_manifests.erb » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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,
(...skipping 10 matching lines...) Expand all
21 require => Package['nginx'] 21 require => Package['nginx']
22 } 22 }
23 23
24 $update_dir = '/var/www/update' 24 $update_dir = '/var/www/update'
25 25
26 file {$update_dir: 26 file {$update_dir:
27 ensure => directory, 27 ensure => directory,
28 mode => 0755 28 mode => 0755
29 } 29 }
30 30
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
31 $update_manifest_dirs = ["${update_dir}/gecko", 45 $update_manifest_dirs = ["${update_dir}/gecko",
32 "${update_dir}/adblockplusandroid", 46 "${update_dir}/adblockplusandroid",
33 "${update_dir}/adblockplussafari"] 47 "${update_dir}/adblockplussafari"]
34 48
35 file {$update_manifest_dirs: 49 file {$update_manifest_dirs:
36 ensure => directory, 50 ensure => directory,
37 mode => 0755 51 mode => 0755,
52 owner => 'sitescripts',
53 group => 'sitescripts'
38 } 54 }
39 55
40 file {"${update_dir}/adblockplusie": 56 file {"${update_dir}/adblockplusie":
41 ensure => directory, 57 ensure => directory,
42 mode => 0755 58 mode => 0755
43 } 59 }
44 60
45 file {"${update_dir}/adblockplusie/update.json": 61 file {"${update_dir}/adblockplusie/update.json":
46 ensure => file, 62 ensure => file,
47 source => 'puppet:///modules/updateserver/adblockplusie/update.json', 63 source => 'puppet:///modules/updateserver/adblockplusie/update.json',
48 mode => 0644 64 mode => 0644
49 } 65 }
50 66
51 nginx::hostconfig{$domain: 67 nginx::hostconfig{$domain:
52 source => 'puppet:///modules/updateserver/site.conf', 68 source => 'puppet:///modules/updateserver/site.conf',
53 is_default => $is_default, 69 is_default => $is_default,
54 certificate => $certificate, 70 certificate => $certificate,
55 private_key => $private_key, 71 private_key => $private_key,
56 log => 'access_log_update' 72 log => 'access_log_update'
57 } 73 }
58 74
59 class {'sitescripts': 75 class {'sitescripts':
60 sitescriptsini_source => 'puppet:///modules/updateserver/sitescripts' 76 sitescriptsini_source => 'puppet:///modules/updateserver/sitescripts'
61 } 77 }
62 78
63 $base_dir = '/var/lib/adblockplus' 79 $safari_certificate_path = "${sitescripts_var_dir}/adblockplussafari.pem"
64
65 file {$base_dir:
66 ensure => directory,
67 mode => 0755
68 }
69
70 $safari_certificate_path = "${base_dir}/adblockplussafari.pem"
71 80
72 file {$safari_certificate_path: 81 file {$safari_certificate_path:
73 source => 'puppet:///modules/private/adblockplussafari.pem' 82 source => 'puppet:///modules/private/adblockplussafari.pem'
74 } 83 }
75 84
76 $repositories_to_sync = ['downloads', 'adblockplus', 'adblockplusandroid', 85 $repositories_to_sync = ['downloads', 'adblockplus', 'adblockplusandroid',
77 'adblockpluschrome', 'elemhidehelper', 'abpwatcher', 86 'adblockpluschrome', 'elemhidehelper', 'abpwatcher',
78 'abpcustomization', 'urlfixer'] 87 'abpcustomization', 'urlfixer']
79 88
80 define fetch_repository() { 89 define fetch_repository() {
81 $repository_path = "${updateserver::base_dir}/${title}" 90 $repository_path = "${updateserver::sitescripts_var_dir}/${title}"
82 exec {"fetch_repository_${title}": 91 exec {"fetch_repository_${title}":
83 command => "hg clone -U https://hg.adblockplus.org/${title} ${repository_p ath}", 92 command => "hg clone -U https://hg.adblockplus.org/${title} ${repository_p ath}",
84 path => '/usr/local/bin:/usr/bin:/bin', 93 path => '/usr/local/bin:/usr/bin:/bin',
94 user => 'sitescripts',
85 timeout => 0, 95 timeout => 0,
86 onlyif => "test ! -d ${repository_path}", 96 onlyif => "test ! -d ${repository_path}",
87 require => [Package['mercurial'], File[$updateserver::base_dir]] 97 require => [Package['mercurial'], File[$updateserver::sitescripts_var_dir] ]
88 } 98 }
89 } 99 }
90 100
91 fetch_repository {$repositories_to_sync: } 101 fetch_repository {$repositories_to_sync: }
92 102
93 $update_update_manifests_script = '/usr/local/bin/update_update_manifests' 103 $update_update_manifests_script = '/usr/local/bin/update_update_manifests'
94 104
95 file {$update_update_manifests_script: 105 file {$update_update_manifests_script:
96 mode => '0755', 106 mode => '0755',
97 content => template('updateserver/update_update_manifests.erb') 107 content => template('updateserver/update_update_manifests.erb')
98 } 108 }
99 109
100 $update_update_manifests_dependencies = ['python-m2crypto', 'python-jinja2'] 110 $update_update_manifests_dependencies = ['python-m2crypto', 'python-jinja2']
101 111
102 package {$update_update_manifests_dependencies:} 112 package {$update_update_manifests_dependencies:}
103 113
104 exec {'update_update_manifests': 114 exec {'update_update_manifests':
105 command => $update_update_manifests_script, 115 command => $update_update_manifests_script,
116 user => 'sitescripts',
106 timeout => 0, 117 timeout => 0,
107 require => [Exec['fetch_sitescripts'], 118 require => [Exec['fetch_sitescripts'],
108 Fetch_repository[$repositories_to_sync], 119 Fetch_repository[$repositories_to_sync],
109 File[$update_update_manifests_script], 120 File[$update_update_manifests_script],
110 File[$update_manifest_dirs], File[$safari_certificate_path], 121 File[$update_manifest_dirs], File[$safari_certificate_path],
111 Package[$update_update_manifests_dependencies]] 122 Package[$update_update_manifests_dependencies]]
112 } 123 }
113 124
114 cron {'update_update_manifests': 125 cron {'update_update_manifests':
115 ensure => present, 126 ensure => present,
116 environment => ['MAILTO=admins@adblockplus.org'], 127 environment => ['MAILTO=admins@adblockplus.org'],
117 command => $update_update_manifests_script, 128 command => $update_update_manifests_script,
129 user => 'sitescripts',
118 minute => '*/10', 130 minute => '*/10',
119 require => Exec['update_update_manifests'] 131 require => Exec['update_update_manifests']
120 } 132 }
121 } 133 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld