[PATCH Configure] Configure apache to use dropfiles

Greg Blomquist gblomqui at redhat.com
Wed Jun 6 18:14:19 UTC 2012


On 06/06/2012 04:53 AM, Mo Morsi wrote:
> OK patch works as intended against the latest configure HEAD on F16.
> 
> As previously discussed doing something like this could lead to
> incongruences if additional incompatible configs are dropped into the
> dropdir.
> 
> That being said this is the simplest way forward for a shared apache
> config, so I am willing to ACK this patch provided the following is true:
> 
>   * we are not responsible for debugging configure, conductor, other
> other components w/ additional non-standard config in this directory.
> Any users that has custom config in there will be asked to temporarily
> move it to reproduce issues for debugging purposes
> 
>   * the 'Include dropdir' directive in the new apache config should go
> _before_ the aeolus / conductor config so that our config overrides any
> custom config. Eventually the conductor config can go into the dropdir
> like the other config, provided there is a way to prioritize
> configuration loading (this could easily be accomplished by prepending
> priority numbers on filenames in this directory)

Agreed.  I'll change that and resubmit.

> 
>   * recipes/apache/manifests/init.pp does not have to be included in
> this patch, it's just a whitespace change

D'oh ... I thought I reset that file.

> 
> One additional thing that you may want to consider when pushing this
> patch is if you want to distinguish between which files are loaded from
> the dropdir in the ssl and no-ssl cases. It might be simpler to load
> different files to be included in the vhost config than to
> conditionalize the config files themselves.

I'm not following here...

Are you suggesting that the config files not be templates?  And, instead
make them files that have a hard-coded include?

I went back and forth a few times on how to make this work, so I may
have crossed some streams of consciousness in the final implementation.
 It might work to move the templates back to files and have hard coded
dropdir Includes since the files come from the aeolus module (i.e., are
specific to aeolus, so can reference aeolus-specific names, etc.).

> 
>   -Mo
> 
> On 06/04/2012 08:54 PM, gblomqui at redhat.com wrote:
>> From: Greg Blomquist <gblomqui at redhat.com>
>>
>> This patch modifies the Conductor apache configurations to be able to read
>> additional configurations from a dropfile location.  The dropfile location is
>> added by invoking the apache::site define.
>> ---
>>  recipes/aeolus/files/aggregator-httpd-ssl.conf     |   53 -------------------
>>  recipes/aeolus/files/aggregator-httpd.conf         |   41 ---------------
>>  recipes/aeolus/manifests/conductor.pp              |    4 +-
>>  recipes/aeolus/templates/aggregator-httpd-ssl.conf |   54 ++++++++++++++++++++
>>  recipes/aeolus/templates/aggregator-httpd.conf     |   42 +++++++++++++++
>>  recipes/apache/manifests/init.pp                   |    2 -
>>  recipes/apache/manifests/site.pp                   |   32 ++++++++----
>>  7 files changed, 120 insertions(+), 108 deletions(-)
>>  delete mode 100644 recipes/aeolus/files/aggregator-httpd-ssl.conf
>>  delete mode 100644 recipes/aeolus/files/aggregator-httpd.conf
>>  create mode 100644 recipes/aeolus/templates/aggregator-httpd-ssl.conf
>>  create mode 100644 recipes/aeolus/templates/aggregator-httpd.conf
>>
>> diff --git a/recipes/aeolus/files/aggregator-httpd-ssl.conf b/recipes/aeolus/files/aggregator-httpd-ssl.conf
>> deleted file mode 100644
>> index b739317..0000000
>> --- a/recipes/aeolus/files/aggregator-httpd-ssl.conf
>> +++ /dev/null
>> @@ -1,53 +0,0 @@
>> -NameVirtualHost *:443
>> -<VirtualHost *:443>
>> -
>> -  ErrorLog /etc/httpd/logs/error_log
>> -  TransferLog /etc/httpd/logs/access_log
>> -  LogLevel debug
>> -
>> -  KeepAlive On
>> -  ProxyRequests Off
>> -  RewriteEngine On
>> -  SSLEngine On
>> -  SSLCertificateFile /etc/pki/tls/certs/localhost.crt
>> -  SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
>> -  ProxyPreserveHost Off
>> -  RequestHeader set X_FORWARDED_PROTO 'https'
>> -
>> -  Timeout 5400
>> -  ProxyTimeout 5400
>> -
>> -Alias /conductor/stylesheets "/usr/share/aeolus-conductor/public/stylesheets"
>> -Alias /conductor/graphics "/usr/share/aeolus-conductor/public/images"
>> -Alias /conductor/errors "/usr/share/aeolus-conductor/public/errors"
>> -Alias /conductor/javascripts "/usr/share/aeolus-conductor/public/javascripts"
>> -Alias /fonts "/usr/share/aeolus-conductor/public/fonts"
>> -
>> -RewriteRule ^/conductor/images/(.*).(png|jpg|gif|svg)$ /conductor/graphics/$1.$2 [R]
>> -
>> -ExpiresActive on
>> -ExpiresByType text/css "access plus 1 year"
>> -ExpiresByType text/javascript "access plus 1 year"
>> -ExpiresByType application/javascript "access plus 1 year"
>> -ExpiresByType image/png "access plus 1 year"
>> -
>> -ProxyPass /conductor/graphics !
>> -ProxyPass /conductor/stylesheets !
>> -ProxyPass /conductor/errors !
>> -ProxyPass /conductor/javascripts !
>> -ProxyPass /conductor http://localhost:3000/conductor
>> -ProxyPassReverse /conductor http://localhost:3000/conductor
>> -ProxyPassReverse /conductor/graphics !
>> -ProxyPassReverse /conductor/stylesheets !
>> -ProxyPassReverse /conductor/errors !
>> -ProxyPassReverse /conductor/javascripts !
>> -
>> -</VirtualHost>
>> -
>> -NameVirtualHost *:80
>> -<VirtualHost *:80>
>> -  RewriteEngine On
>> -  RewriteCond %{HTTPS} off
>> -  RewriteRule /conductor(.*) https://%{HTTP_HOST}%{REQUEST_URI}
>> -</VirtualHost>
>> -
>> diff --git a/recipes/aeolus/files/aggregator-httpd.conf b/recipes/aeolus/files/aggregator-httpd.conf
>> deleted file mode 100644
>> index 36accad..0000000
>> --- a/recipes/aeolus/files/aggregator-httpd.conf
>> +++ /dev/null
>> @@ -1,41 +0,0 @@
>> -NameVirtualHost *:80
>> -<VirtualHost *:80>
>> -
>> -  ErrorLog /etc/httpd/logs/error_log
>> -  TransferLog /etc/httpd/logs/access_log
>> -  LogLevel warn
>> -
>> -  KeepAlive On
>> -  ProxyRequests Off
>> -  RewriteEngine On
>> -
>> -  Timeout 5400
>> -  ProxyTimeout 5400
>> -
>> -Alias /conductor/stylesheets "/usr/share/aeolus-conductor/public/stylesheets"
>> -Alias /conductor/graphics "/usr/share/aeolus-conductor/public/images"
>> -Alias /conductor/errors "/usr/share/aeolus-conductor/public/errors"
>> -Alias /conductor/javascripts "/usr/share/aeolus-conductor/public/javascripts"
>> -Alias /fonts "/usr/share/aeolus-conductor/public/fonts"
>> -
>> -RewriteRule ^/conductor/images/(.*).(png|jpg|gif|svg)$ /conductor/graphics/$1.$2 [R]
>> -
>> -ExpiresActive on
>> -ExpiresByType text/css "access plus 1 year"
>> -ExpiresByType text/javascript "access plus 1 year"
>> -ExpiresByType application/javascript "access plus 1 year"
>> -ExpiresByType image/png "access plus 1 year"
>> -
>> -ProxyPass /conductor/graphics !
>> -ProxyPass /conductor/stylesheets !
>> -ProxyPass /conductor/errors !
>> -ProxyPass /conductor/javascripts !
>> -ProxyPass /conductor http://localhost:3000/conductor
>> -ProxyPassReverse /conductor http://localhost:3000/conductor
>> -ProxyPassReverse /conductor/graphics !
>> -ProxyPassReverse /conductor/stylesheets !
>> -ProxyPassReverse /conductor/errors !
>> -ProxyPassReverse /conductor/javascripts !
>> -
>> -</VirtualHost>
>> -
>> diff --git a/recipes/aeolus/manifests/conductor.pp b/recipes/aeolus/manifests/conductor.pp
>> index 20fdfb2..5733f2d 100644
>> --- a/recipes/aeolus/manifests/conductor.pp
>> +++ b/recipes/aeolus/manifests/conductor.pp
>> @@ -56,9 +56,9 @@ class aeolus::conductor inherits aeolus {
>>    ### Setup apache for deltacloud
>>      include apache
>>      if $enable_https {
>> -      apache::site{"aeolus-conductor": source => 'puppet:///modules/aeolus/aggregator-httpd-ssl.conf'}
>> +      apache::site {"aeolus-conductor": source => 'aeolus/aggregator-httpd-ssl.conf'}
>>      } else{
>> -      apache::site{"aeolus-conductor": source => 'puppet:///modules/aeolus/aggregator-httpd.conf'}
>> +      apache::site {"aeolus-conductor": source => 'aeolus/aggregator-httpd.conf'}
>>      }
>>  
>>      service { ['aeolus-conductor',
>> diff --git a/recipes/aeolus/templates/aggregator-httpd-ssl.conf b/recipes/aeolus/templates/aggregator-httpd-ssl.conf
>> new file mode 100644
>> index 0000000..403f94b
>> --- /dev/null
>> +++ b/recipes/aeolus/templates/aggregator-httpd-ssl.conf
>> @@ -0,0 +1,54 @@
>> +NameVirtualHost *:443
>> +<VirtualHost *:443>
>> +
>> +  ErrorLog /etc/httpd/logs/error_log
>> +  TransferLog /etc/httpd/logs/access_log
>> +  LogLevel debug
>> +
>> +  KeepAlive On
>> +  ProxyRequests Off
>> +  RewriteEngine On
>> +  SSLEngine On
>> +  SSLCertificateFile /etc/pki/tls/certs/localhost.crt
>> +  SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
>> +  ProxyPreserveHost Off
>> +  RequestHeader set X_FORWARDED_PROTO 'https'
>> +
>> +  Timeout 5400
>> +  ProxyTimeout 5400
>> +
>> +Alias /conductor/stylesheets "/usr/share/aeolus-conductor/public/stylesheets"
>> +Alias /conductor/graphics "/usr/share/aeolus-conductor/public/images"
>> +Alias /conductor/errors "/usr/share/aeolus-conductor/public/errors"
>> +Alias /conductor/javascripts "/usr/share/aeolus-conductor/public/javascripts"
>> +Alias /fonts "/usr/share/aeolus-conductor/public/fonts"
>> +
>> +RewriteRule ^/conductor/images/(.*).(png|jpg|gif|svg)$ /conductor/graphics/$1.$2 [R]
>> +
>> +ExpiresActive on
>> +ExpiresByType text/css "access plus 1 year"
>> +ExpiresByType text/javascript "access plus 1 year"
>> +ExpiresByType application/javascript "access plus 1 year"
>> +ExpiresByType image/png "access plus 1 year"
>> +
>> +ProxyPass /conductor/graphics !
>> +ProxyPass /conductor/stylesheets !
>> +ProxyPass /conductor/errors !
>> +ProxyPass /conductor/javascripts !
>> +ProxyPass /conductor http://localhost:3000/conductor
>> +ProxyPassReverse /conductor http://localhost:3000/conductor
>> +ProxyPassReverse /conductor/graphics !
>> +ProxyPassReverse /conductor/stylesheets !
>> +ProxyPassReverse /conductor/errors !
>> +ProxyPassReverse /conductor/javascripts !
>> +
>> +Include <%= dropdir %>/*.conf
>> +
>> +</VirtualHost>
>> +
>> +NameVirtualHost *:80
>> +<VirtualHost *:80>
>> +  RewriteEngine On
>> +  RewriteCond %{HTTPS} off
>> +  RewriteRule /conductor(.*) https://%{HTTP_HOST}%{REQUEST_URI}
>> +</VirtualHost>
>> diff --git a/recipes/aeolus/templates/aggregator-httpd.conf b/recipes/aeolus/templates/aggregator-httpd.conf
>> new file mode 100644
>> index 0000000..4560771
>> --- /dev/null
>> +++ b/recipes/aeolus/templates/aggregator-httpd.conf
>> @@ -0,0 +1,42 @@
>> +NameVirtualHost *:80
>> +<VirtualHost *:80>
>> +
>> +  ErrorLog /etc/httpd/logs/error_log
>> +  TransferLog /etc/httpd/logs/access_log
>> +  LogLevel warn
>> +
>> +  KeepAlive On
>> +  ProxyRequests Off
>> +  RewriteEngine On
>> +
>> +  Timeout 5400
>> +  ProxyTimeout 5400
>> +
>> +Alias /conductor/stylesheets "/usr/share/aeolus-conductor/public/stylesheets"
>> +Alias /conductor/graphics "/usr/share/aeolus-conductor/public/images"
>> +Alias /conductor/errors "/usr/share/aeolus-conductor/public/errors"
>> +Alias /conductor/javascripts "/usr/share/aeolus-conductor/public/javascripts"
>> +Alias /fonts "/usr/share/aeolus-conductor/public/fonts"
>> +
>> +RewriteRule ^/conductor/images/(.*).(png|jpg|gif|svg)$ /conductor/graphics/$1.$2 [R]
>> +
>> +ExpiresActive on
>> +ExpiresByType text/css "access plus 1 year"
>> +ExpiresByType text/javascript "access plus 1 year"
>> +ExpiresByType application/javascript "access plus 1 year"
>> +ExpiresByType image/png "access plus 1 year"
>> +
>> +ProxyPass /conductor/graphics !
>> +ProxyPass /conductor/stylesheets !
>> +ProxyPass /conductor/errors !
>> +ProxyPass /conductor/javascripts !
>> +ProxyPass /conductor http://localhost:3000/conductor
>> +ProxyPassReverse /conductor http://localhost:3000/conductor
>> +ProxyPassReverse /conductor/graphics !
>> +ProxyPassReverse /conductor/stylesheets !
>> +ProxyPassReverse /conductor/errors !
>> +ProxyPassReverse /conductor/javascripts !
>> +
>> +Include <%= dropdir %>/*.conf
>> +
>> +</VirtualHost>
>> diff --git a/recipes/apache/manifests/init.pp b/recipes/apache/manifests/init.pp
>> index 91f12a4..7aaa380 100644
>> --- a/recipes/apache/manifests/init.pp
>> +++ b/recipes/apache/manifests/init.pp
>> @@ -45,5 +45,3 @@ class apache {
>>  	  refreshonly => true,
>>    }
>>  }
>> -
>> -
>> diff --git a/recipes/apache/manifests/site.pp b/recipes/apache/manifests/site.pp
>> index ca534e1..1df7b97 100644
>> --- a/recipes/apache/manifests/site.pp
>> +++ b/recipes/apache/manifests/site.pp
>> @@ -1,13 +1,25 @@
>> -define apache::site ( $ensure = 'present', $source = '') {
>> -  $apache_dir          = "/etc/httpd"
>> -  $apache_conf_dir     = "${apache_dir}/conf.d"
>> +## Creates apache configs with optional drop files
>> +define apache::site ($ensure = 'present', $source = '') {
>> +    $apache_dir          = "/etc/httpd"
>> +    $apache_conf_dir     = "${apache_dir}/conf.d"
>> +    $site                = "${apache_conf_dir}/${name}"
>> +    $dropdir             = "${site}.d"
>>  
>> -	$site_file = "${apache_conf_dir}/${name}.conf"
>> -	file {
>> -		$site_file:
>> -			ensure  => $ensure,
>> -			source  => $source,
>> -			notify  => Exec["reload-apache"],
>> -      require => Service['httpd']
>> +    $drop_dir_ensure = $ensure ? {
>> +        "absent"    => "absent",
>> +        default     => directory
>> +    }
>> +    file { $dropdir:
>> +        ensure => $drop_dir_ensure,
>> +        notify => Exec["reload-apache"],
>> +    }
>> +
>> +    # create the apache configuration with references to the created dropfiles
>> +	$site_file = "${site}.conf"
>> +	file { $site_file:
>> +        ensure  => $ensure,
>> +        content => template($source),
>> +        notify  => Exec["reload-apache"],
>> +        require => [ Service['httpd'], File[$dropdir] ]
>>  	}
>>  }
> 




More information about the aeolus-devel mailing list