[PATCH Configure] Configure apache to use dropfiles

Greg Blomquist gblomqui at redhat.com
Mon Jun 4 18:52:58 UTC 2012


On 06/01/2012 01: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                   |   36 +++++++++----
>  6 files changed, 122 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 670eb58..894207a 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 240490b..074f889 100644
> --- a/recipes/apache/manifests/init.pp
> +++ b/recipes/apache/manifests/init.pp
> @@ -46,17 +46,29 @@ class apache {
>    }
>  }
>  
> -define apache::site ( $ensure = 'present', $source = '') {
> -  $apache_dir          = "/etc/httpd"
> -  $apache_conf_dir     = "${apache_dir}/conf.d"
> -
> -	$site_file = "${apache_conf_dir}/${name}.conf"
> -	file {
> -		$site_file:
> -			ensure  => $ensure,
> -			source  => $source,
> -			notify  => Exec["reload-apache"],
> -      require => Service['httpd']
> +
> +## 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"
> +
> +    $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] ]
>  	}
>  }
> -


Nack: needs rebasing ... new patch is otw.



More information about the aeolus-devel mailing list