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
This commit is contained in:
Clark Boylan 2015-03-13 12:17:35 -07:00
parent ac6b7c3ead
commit e0ecfcd1f7
3 changed files with 19 additions and 10 deletions

View File

@ -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',

View File

@ -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",

View File

@ -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