This patch adds an apache configuration dropfile location that allows other projects to take advantage of Conductor's apache vhost configuation. The dropfile location is created at:
/etc/httpd/conf.d/aeolus-conductor.d
The aeolus-conductor.conf puppet file has been changed to a template to allow for templatizing the dropfile location when calling the apache::site define.
The aeolus-conductor.conf apache configuration file does a wildcard include of all configuration files under the dropfile directory.
No configuration files are added to the dropfile directory during the aeolus-configure run. Other projects' configuration tools will be responsible for adding configuration files to this dropfile directory.
Initially, the only other project to use the dropfile directory will be the audrey configserver; which will allow configserver and conductor to run from the same server and be surfaced by the same apache vhost.
From: Greg Blomquist gblomqui@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://%%7BHTTP_HOST%7D%%7BREQUEST_URI%7D -</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://%%7BHTTP_HOST%7D%%7BREQUEST_URI%7D +</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] ] } }
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)
* recipes/apache/manifests/init.pp does not have to be included in this patch, it's just a whitespace change
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.
-Mo
On 06/04/2012 08:54 PM, gblomqui@redhat.com wrote:
From: Greg Blomquist gblomqui@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://%%7BHTTP_HOST%7D%%7BREQUEST_URI%7D
-</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'}
} else{apache::site {"aeolus-conductor": source => 'aeolus/aggregator-httpd-ssl.conf'}
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://%%7BHTTP_HOST%7D%%7BREQUEST_URI%7D
+</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] ]
}
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@redhat.com wrote:
From: Greg Blomquist gblomqui@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://%%7BHTTP_HOST%7D%%7BREQUEST_URI%7D
-</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'}
} else{apache::site {"aeolus-conductor": source => 'aeolus/aggregator-httpd-ssl.conf'}
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://%%7BHTTP_HOST%7D%%7BREQUEST_URI%7D
+</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] ]
}
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.).
No I'm suggesting that you may want to have seperate dropdirs for the ssl and no-ssl apache configurations. The dropdirs can be configured in the same way they are now, eg through a puppet template.
-Mo
On Thu, 07 Jun 2012 11:56:53 +0200, Mo Morsi mmorsi@redhat.com wrote:
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.).
No I'm suggesting that you may want to have seperate dropdirs for the ssl and no-ssl apache configurations. The dropdirs can be configured in the same way they are now, eg through a puppet template.
-Mo
You're only going to have one aeolus-conductor.conf at any given time, which is either the SSL or plaintext vhost depending on enable_https. It seems unnecessary to have a different dropdir for each, when only one or the other will ever be active at a given time.
If you really wanted to segment the two, it would make more sense to change the usage of apache::site in conductor.pp to have different titles depending on whether enable_https is set. Currently both just use "aeolus-conductor"; the SSL case could be "aeolus-conductor-ssl", which would result in aeolus-conductor-ssl.conf and aeolus-conductor-ssl.d.
On 06/08/2012 09:38 PM, John Eckersberg wrote:
On Thu, 07 Jun 2012 11:56:53 +0200, Mo Morsi mmorsi@redhat.com wrote:
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.).
No I'm suggesting that you may want to have seperate dropdirs for the ssl and no-ssl apache configurations. The dropdirs can be configured in the same way they are now, eg through a puppet template.
-Mo
You're only going to have one aeolus-conductor.conf at any given time, which is either the SSL or plaintext vhost depending on enable_https. It seems unnecessary to have a different dropdir for each, when only one or the other will ever be active at a given time.
If you really wanted to segment the two, it would make more sense to change the usage of apache::site in conductor.pp to have different titles depending on whether enable_https is set. Currently both just use "aeolus-conductor"; the SSL case could be "aeolus-conductor-ssl", which would result in aeolus-conductor-ssl.conf and aeolus-conductor-ssl.d.
True, I was speaking more for the convenience of other tools so they would not have to determine if ssl is enabled for Aeolus.
From aeolus & configure's perspective agree the single dropdir makes
more sense.
-Mo
aeolus-devel@lists.fedorahosted.org