summaryrefslogtreecommitdiff
path: root/web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/manifests/init.pp
diff options
context:
space:
mode:
Diffstat (limited to 'web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/manifests/init.pp')
-rw-r--r--web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/manifests/init.pp240
1 files changed, 240 insertions, 0 deletions
diff --git a/web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/manifests/init.pp b/web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/manifests/init.pp
new file mode 100644
index 0000000..c6e50a2
--- /dev/null
+++ b/web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/manifests/init.pp
@@ -0,0 +1,240 @@
+# gnu.org/nongnu.org webpages hosting system
+# Copyright (C) 2014 Sylvain Beucler
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+class wwwgnu-nongnu {
+ ensure_packages(['apache2', 'libapache2-mod-python'])
+ service { 'apache2': require => Package['apache2'] }
+ file {
+ '/etc/apache2/sites-enabled/000-default':
+ ensure => absent,
+ require => Package['apache2'],
+ notify => Service['apache2'];
+ }
+
+ exec { 'a2enmod include':
+ provider => shell,
+ creates => '/etc/apache2/mods-enabled/include.load',
+ require => Package['apache2'],
+ notify => Service['apache2'],
+ }
+ exec { 'a2enmod rewrite':
+ provider => shell,
+ creates => '/etc/apache2/mods-enabled/rewrite.load',
+ require => Package['apache2'],
+ notify => Service['apache2'],
+ }
+ exec { 'a2enmod expires':
+ provider => shell,
+ creates => '/etc/apache2/mods-enabled/expires.load',
+ require => Package['apache2'],
+ notify => Service['apache2'],
+ }
+ exec { 'a2enmod vhost_alias':
+ provider => shell,
+ creates => '/etc/apache2/mods-enabled/vhost_alias.load',
+ require => Package['apache2'],
+ notify => Service['apache2'],
+ }
+
+ file {
+ '/etc/apache2/sites-available/www.gnu.org':
+ ensure => file,
+ source => 'puppet:///modules/wwwgnu-nongnu/www.gnu.org',
+ require => Package['apache2'],
+ notify => Service['apache2'];
+ '/etc/apache2/sites-available/www.gnu.org-common':
+ ensure => file,
+ source => 'puppet:///modules/wwwgnu-nongnu/www.gnu.org-common',
+ require => Package['apache2'],
+ notify => Service['apache2'];
+ '/etc/apache2/sites-enabled/www.gnu.org':
+ ensure => symlink,
+ target => '../sites-available/www.gnu.org',
+ require => Package['apache2'],
+ notify => Service['apache2'];
+
+ '/etc/apache2/sites-available/www.nongnu.org':
+ ensure => file,
+ source => 'puppet:///modules/wwwgnu-nongnu/www.nongnu.org',
+ require => Package['apache2'],
+ notify => Service['apache2'];
+ '/etc/apache2/sites-enabled/001-www.nongnu.org':
+ ensure => symlink,
+ target => '../sites-available/www.nongnu.org',
+ require => Package['apache2'],
+ notify => Service['apache2'];
+
+ '/etc/apache2/sites-available/star.nongnu.org':
+ ensure => file,
+ source => 'puppet:///modules/wwwgnu-nongnu/star.nongnu.org',
+ require => Package['apache2'],
+ notify => Service['apache2'];
+ '/etc/apache2/sites-enabled/002-star.nongnu.org':
+ ensure => symlink,
+ target => '../sites-available/star.nongnu.org',
+ require => Package['apache2'],
+ notify => Service['apache2'];
+
+ '/var/www/gnu-404.html':
+ ensure => file,
+ content => "404\n",
+ require => Package['apache2'];
+ }
+
+ # .symlinks handling
+ # https://www.gnu.org/server/standards/README.webmastering.html#symlinks
+ user { 'wwwcvs':
+ ensure => present,
+ managehome => true; # install skel files
+ }
+ file {
+ '/home/wwwcvs/':
+ ensure => directory,
+ mode => 0700,
+ owner => wwwcvs,
+ group => wwwcvs;
+ '/home/wwwcvs/update-symlinks.sh':
+ ensure => file,
+ mode => '0755',
+ source => 'puppet:///modules/wwwgnu-nongnu/update-symlinks.sh';
+ '/home/wwwcvs/update-symlinks-xargs.py':
+ ensure => file,
+ mode => '0755',
+ source => 'puppet:///modules/wwwgnu-nongnu/update-symlinks-xargs.py';
+ '/etc/sudoers.d/wwwcvs':
+ ensure => file,
+ mode => '0600',
+ content => "wwwcvs ALL= NOPASSWD: /usr/sbin/apache2ctl graceful\n";
+ # TODO: requires '/srv/data/www-mirror/'?
+ '/home/wwwcvs/update-gnu-rewritemaps':
+ ensure => file,
+ mode => '0755',
+ source => 'puppet:///modules/wwwgnu-nongnu/update-gnu-rewritemaps';
+ '/home/wwwcvs/symlinks/':
+ ensure => directory,
+ mode => '0755',
+ owner => wwwcvs,
+ group => wwwcvs;
+ '/etc/apache2/symlinks/':
+ ensure => directory,
+ mode => '0775',
+ owner => root,
+ group => wwwcvs;
+ }
+ # Populate those from prod's /etc/apache2/symlinks/:
+ file {
+ '/home/wwwcvs/symlinks/dir-map.txt':
+ ensure => present,
+ owner => wwwcvs,
+ group => wwwcvs;
+ '/home/wwwcvs/symlinks/html-map.txt':
+ ensure => present,
+ owner => wwwcvs,
+ group => wwwcvs;
+ '/home/wwwcvs/symlinks/nonhtml-map.txt':
+ ensure => present,
+ owner => wwwcvs,
+ group => wwwcvs;
+ '/etc/apache2/symlinks/dir-map.txt':
+ ensure => present,
+ owner => wwwcvs,
+ group => wwwcvs;
+ '/etc/apache2/symlinks/html-map.txt':
+ ensure => present,
+ owner => wwwcvs,
+ group => wwwcvs;
+ '/etc/apache2/symlinks/nonhtml-map.txt':
+ ensure => present,
+ owner => wwwcvs,
+ group => wwwcvs;
+ '/etc/apache2/symlinks/symlinks-gnu.conf':
+ ensure => present,
+ owner => wwwcvs,
+ group => wwwcvs;
+ '/etc/apache2/symlinks/symlinks-nongnu.conf':
+ ensure => present,
+ owner => wwwcvs,
+ group => wwwcvs;
+ '/etc/apache2/symlinks/symlinks-nongnu-vhost.conf':
+ ensure => present,
+ owner => wwwcvs,
+ group => wwwcvs;
+ }
+ # Used by www.gnu.org-common
+ # TODO: locate and bundle "gen-include-file-list" ?
+ ensure_packages(['cvs'])
+ exec { '/var/www/server/include-file-list.txt':
+ provider => shell,
+ command => 'cd / && cvs -d:pserver:anonymous@cvs.savannah.gnu.org:/web/www co -d var/www/server/ www/server/include-file-list.txt',
+ creates => '/var/www/server/include-file-list.txt',
+ require => Package['apache2', 'cvs'],
+ notify => Service['apache2'];
+ }
+
+ # Update webpages from CVS repo
+ file {
+ '/var/www/savannah-checkouts/':
+ ensure => directory,
+ mode => '0755';
+ '/var/www/savannah-checkouts/gnu/':
+ ensure => directory,
+ mode => '0775',
+ owner => 'root',
+ group => 'wwwcvs';
+ '/var/www/savannah-checkouts/non-gnu/':
+ ensure => directory,
+ mode => '0775',
+ owner => 'root',
+ group => 'wwwcvs';
+ '/var/log/wwwcvs/':
+ ensure => directory,
+ mode => '0775',
+ owner => 'root',
+ group => 'wwwcvs';
+ # http://www.gnu.org/new-savannah-project/new.py
+ '/var/www/new-savannah-project/':
+ ensure => directory,
+ mode => '0755';
+ '/var/www/new-savannah-project/new.py':
+ ensure => file,
+ source => 'puppet:///modules/wwwgnu-nongnu/new.py';
+ # # 'new.py' seems to conflict sometimes with /usr/lib/python2.7/new.py ?
+ # '/var/www/new-savannah-project2/':
+ # ensure => directory,
+ # mode => '0755';
+ # '/var/www/new-savannah-project2/new2.py':
+ # ensure => file,
+ # source => 'puppet:///modules/wwwgnu-nongnu/new.py';
+ # dir where new will specify which dirs to update
+ '/usr/local/to-update/':
+ ensure => directory,
+ mode => '0775',
+ owner => wwwcvs,
+ group => www-data;
+ }
+ file {
+ '/usr/local/bin/update-cvs.sh':
+ ensure => file,
+ mode => '0755',
+ source => 'puppet:///modules/wwwgnu-nongnu/update-cvs.sh';
+ }
+ cron { 'update-cvs.sh':
+ ensure => present,
+ user => 'wwwcvs',
+ minute => '*/2',
+ command => '/usr/bin/flock -w5 -x /tmp/update-cvs.lock /usr/local/bin/update-cvs.sh',
+ }
+}