From e0ecfcd1f7b9b09c4021b5fe11e73476e3a18431 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Fri, 13 Mar 2015 12:17:35 -0700 Subject: [PATCH] Don't host robots.txt from etherpad repo install Updating the robots.txt in the etherpad vcsrepo makes it hard to manage that repo properly. Solve this by serving the static robots.txt file directly from apache rather than via etherpad service. Use a mod_rewrite since we are already using that to set up the proxying. Change-Id: Iccccf1ef194060490512e6550c22bdb9d3478ba8 --- manifests/apache.pp | 16 +++++++++++++++- manifests/site.pp | 9 --------- templates/etherpadlite.vhost.erb | 4 ++++ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/manifests/apache.pp b/manifests/apache.pp index 7fe10d6..effaaab 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -2,6 +2,7 @@ # class etherpad_lite::apache ( $vhost_name = $::fqdn, + $docroot = '/srv/etherpad-lite', $serveradmin = "webmaster@${::fqdn}", $ssl_cert_file = '', $ssl_key_file = '', @@ -18,7 +19,7 @@ class etherpad_lite::apache ( include apache apache::vhost { $vhost_name: port => 443, - docroot => 'MEANINGLESS ARGUMENT', + docroot => $docroot, priority => '50', template => 'etherpad_lite/etherpadlite.vhost.erb', ssl => true, @@ -59,6 +60,19 @@ class etherpad_lite::apache ( } } + file { $docroot: + ensure => directory, + } + + file { "${docroot}/robots.txt": + ensure => present, + source => 'puppet:///modules/etherpad_lite/robots.txt', + owner => 'root', + group => 'root', + mode => '0444', + require => File[$docroot], + } + file { '/etc/ssl/certs': ensure => directory, owner => 'root', diff --git a/manifests/site.pp b/manifests/site.pp index 6dc3e11..fffff00 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -39,15 +39,6 @@ class etherpad_lite::site ( require => Class['etherpad_lite'], } - file { "${base}/etherpad-lite/src/static/robots.txt": - ensure => present, - source => 'puppet:///modules/etherpad_lite/robots.txt', - owner => $etherpad_lite::ep_user, - group => $etherpad_lite::ep_user, - mode => '0644', - require => Class['etherpad_lite'], - } - include logrotate logrotate::file { 'epliteerror': log => "${base}/${etherpad_lite::ep_user}/error.log", diff --git a/templates/etherpadlite.vhost.erb b/templates/etherpadlite.vhost.erb index e6711bb..5185362 100644 --- a/templates/etherpadlite.vhost.erb +++ b/templates/etherpadlite.vhost.erb @@ -47,6 +47,10 @@ RewriteCond %{HTTP_HOST} !<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> RewriteRule ^.*$ https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> [L,R=301] + # Server robots.txt directly so that it does not affect + # etherpad-lite installation. + RewriteRule ^/robots.txt$ <%= scope.lookupvar("etherpad_lite::apache::docroot") %>/robots.txt [L] + RewriteCond %{REQUEST_URI} !^/p/ RewriteCond %{REQUEST_URI} !^/locales/ RewriteCond %{REQUEST_URI} !^/locales.json