diff options
Diffstat (limited to 'puppet')
4 files changed, 23 insertions, 54 deletions
diff --git a/puppet/modules/site_apache/manifests/module/expires.pp b/puppet/modules/site_apache/manifests/module/expires.pp new file mode 100644 index 00000000..f73a5607 --- /dev/null +++ b/puppet/modules/site_apache/manifests/module/expires.pp @@ -0,0 +1,4 @@ +class site_apache::module::expires ( $ensure = present ) +{ + apache::module { 'expires': ensure => $ensure } +} diff --git a/puppet/modules/site_apache/templates/vhosts.d/leap_webapp.conf.erb b/puppet/modules/site_apache/templates/vhosts.d/leap_webapp.conf.erb index afc19782..a001552a 100644 --- a/puppet/modules/site_apache/templates/vhosts.d/leap_webapp.conf.erb +++ b/puppet/modules/site_apache/templates/vhosts.d/leap_webapp.conf.erb @@ -45,6 +45,14 @@ PassengerFriendlyErrorPages off SetEnv TMPDIR /var/tmp + # Allow rails assets to be cached for a very long time (since the URLs change whenever the content changes) + <Location /assets/> + Header unset ETag + FileETag None + ExpiresActive On + ExpiresDefault "access plus 1 year" + </Location> + <% if (defined? @services) and (@services.include? 'monitor') -%> <DirectoryMatch (/usr/share/nagios3/htdocs|/usr/lib/cgi-bin/nagios3|/etc/nagios3/stylesheets)> PassengerEnabled off diff --git a/puppet/modules/site_webapp/manifests/apache.pp b/puppet/modules/site_webapp/manifests/apache.pp index 6a199b9e..581922cb 100644 --- a/puppet/modules/site_webapp/manifests/apache.pp +++ b/puppet/modules/site_webapp/manifests/apache.pp @@ -21,6 +21,7 @@ class site_webapp::apache { include site_apache::module::headers include site_apache::module::rewrite include site_apache::module::alias + include site_apache::module::expires class { 'passenger': use_munin => false } diff --git a/puppet/modules/site_webapp/manifests/init.pp b/puppet/modules/site_webapp/manifests/init.pp index d5687804..c090c6a0 100644 --- a/puppet/modules/site_webapp/manifests/init.pp +++ b/puppet/modules/site_webapp/manifests/init.pp @@ -40,9 +40,9 @@ class site_webapp { vcsrepo { '/srv/leap/webapp': ensure => present, force => true, - revision => 'origin/master', + revision => $webapp['git']['revision'], provider => git, - source => 'https://leap.se/git/leap_web', + source => $webapp['git']['source'], owner => 'leap-webapp', group => 'leap-webapp', require => [ User['leap-webapp'], Group['leap-webapp'] ], @@ -63,6 +63,10 @@ class site_webapp { notify => Service['apache']; } + # + # NOTE: in order to support a webapp that is running on a subpath and not the root of the domain + # assets:precompile needs to be run with RAILS_RELATIVE_URL_ROOT=/application-root + # exec { 'compile_assets': cwd => '/srv/leap/webapp', command => '/bin/bash -c "RAILS_ENV=production /usr/bin/bundle exec rake assets:precompile"', @@ -110,72 +114,24 @@ class site_webapp { } try::file { - '/srv/leap/webapp/public/favicon.ico': - ensure => present, - owner => leap-webapp, - group => leap-webapp, - mode => '0644', - require => Vcsrepo['/srv/leap/webapp'], - source => $webapp['favicon']; - - '/srv/leap/webapp/app/assets/stylesheets/tail.scss': - ensure => present, - owner => leap-webapp, - group => leap-webapp, - mode => '0644', - require => Vcsrepo['/srv/leap/webapp'], - source => $webapp['tail_scss'], - before => Exec['bundler_update']; - - '/srv/leap/webapp/app/assets/stylesheets/head.scss': - ensure => present, - owner => leap-webapp, - group => leap-webapp, - mode => '0644', - require => Vcsrepo['/srv/leap/webapp'], - source => $webapp['head_scss'], - before => Exec['bundler_update']; - - '/srv/leap/webapp/public/img': + '/srv/leap/webapp/config/customization': ensure => directory, recurse => true, purge => true, force => true, owner => leap-webapp, group => leap-webapp, - mode => '0644', - require => Vcsrepo['/srv/leap/webapp'], - source => $webapp['img_dir']; - - '/srv/leap/webapp/app/views/home/index.html.haml': - ensure => present, - owner => leap-webapp, - group => leap-webapp, - mode => '0644', + mode => 'u=rwX,go=rX', require => Vcsrepo['/srv/leap/webapp'], - source => $webapp['home_page']; + notify => Exec['compile_assets'], + source => $webapp['customization_dir']; } git::changes { - 'app/assets/stylesheets/head.scss': - cwd => '/srv/leap/webapp', - require => Vcsrepo['/srv/leap/webapp'], - user => 'leap-webapp'; - - 'app/assets/stylesheets/tail.scss': - cwd => '/srv/leap/webapp', - require => Vcsrepo['/srv/leap/webapp'], - user => 'leap-webapp'; - 'public/favicon.ico': cwd => '/srv/leap/webapp', require => Vcsrepo['/srv/leap/webapp'], user => 'leap-webapp'; - - 'app/views/home/index.html.haml': - cwd => '/srv/leap/webapp', - require => Vcsrepo['/srv/leap/webapp'], - user => 'leap-webapp'; } file { |