From 264fa32a719d77b15e623cc3fc4574fd04837716 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 21 May 2013 17:42:40 -0400 Subject: change paths for leap webapp to be under /srv/leap/webapp from /srv/leap-webapp --- .../site_apache/templates/vhosts.d/api.conf.erb | 2 +- .../templates/vhosts.d/leap_webapp.conf.erb | 2 +- .../site_webapp/files/migrate_design_documents | 2 +- puppet/modules/site_webapp/manifests/couchdb.pp | 8 ++--- puppet/modules/site_webapp/manifests/init.pp | 36 +++++++++++----------- 5 files changed, 25 insertions(+), 25 deletions(-) (limited to 'puppet') diff --git a/puppet/modules/site_apache/templates/vhosts.d/api.conf.erb b/puppet/modules/site_apache/templates/vhosts.d/api.conf.erb index 20d3dc9a..ae894cd4 100644 --- a/puppet/modules/site_apache/templates/vhosts.d/api.conf.erb +++ b/puppet/modules/site_apache/templates/vhosts.d/api.conf.erb @@ -21,7 +21,7 @@ Listen 0.0.0.0:<%= api_port %> RequestHeader set X_FORWARDED_PROTO 'https' - DocumentRoot /srv/leap-webapp/public + DocumentRoot /srv/leap/webapp/public # Check for maintenance file and redirect all requests RewriteEngine On 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 2ccc4418..3055a7bb 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 @@ -21,7 +21,7 @@ RequestHeader set X_FORWARDED_PROTO 'https' - DocumentRoot /srv/leap-webapp/public + DocumentRoot /srv/leap/webapp/public RewriteEngine On # Check for maintenance file and redirect all requests diff --git a/puppet/modules/site_webapp/files/migrate_design_documents b/puppet/modules/site_webapp/files/migrate_design_documents index 88eb2e25..6e24aa5b 100644 --- a/puppet/modules/site_webapp/files/migrate_design_documents +++ b/puppet/modules/site_webapp/files/migrate_design_documents @@ -1,6 +1,6 @@ #!/bin/sh -cd /srv/leap-webapp +cd /srv/leap/webapp # use admin credentials cp config/couchdb.yml.admin config/couchdb.yml diff --git a/puppet/modules/site_webapp/manifests/couchdb.pp b/puppet/modules/site_webapp/manifests/couchdb.pp index 1dd346fd..7a3839c8 100644 --- a/puppet/modules/site_webapp/manifests/couchdb.pp +++ b/puppet/modules/site_webapp/manifests/couchdb.pp @@ -25,19 +25,19 @@ class site_webapp::couchdb { $key_path = "${x509::variables::keys}/${cert_name}.key" file { - '/srv/leap-webapp/config/couchdb.yml.admin': + '/srv/leap/webapp/config/couchdb.yml.admin': content => template('site_webapp/couchdb.yml.admin.erb'), owner => leap-webapp, group => leap-webapp, mode => '0600'; - '/srv/leap-webapp/config/couchdb.yml.webapp': + '/srv/leap/webapp/config/couchdb.yml.webapp': content => template('site_webapp/couchdb.yml.erb'), owner => leap-webapp, group => leap-webapp, mode => '0600'; - '/srv/leap-webapp/logs/production.log': + '/srv/leap/webapp/logs/production.log': owner => leap-webapp, group => leap-webapp, mode => '0666'; @@ -58,7 +58,7 @@ class site_webapp::couchdb { } exec { 'migrate_design_documents': - cwd => '/srv/leap-webapp', + cwd => '/srv/leap/webapp', command => '/usr/local/sbin/migrate_design_documents', require => Exec['bundler_update'], notify => Service['apache']; diff --git a/puppet/modules/site_webapp/manifests/init.pp b/puppet/modules/site_webapp/manifests/init.pp index 5c084a0c..f7a4b598 100644 --- a/puppet/modules/site_webapp/manifests/init.pp +++ b/puppet/modules/site_webapp/manifests/init.pp @@ -33,18 +33,18 @@ class site_webapp { allowdupe => false, gid => 'leap-webapp', groups => 'ssl-cert', - home => '/srv/leap-webapp', + home => '/srv/leap/webapp', require => [ Group['leap-webapp'] ]; } - file { '/srv/leap-webapp': + file { '/srv/leap/webapp': ensure => directory, owner => 'leap-webapp', group => 'leap-webapp', require => User['leap-webapp']; } - vcsrepo { '/srv/leap-webapp': + vcsrepo { '/srv/leap/webapp': ensure => present, revision => 'origin/master', provider => git, @@ -56,17 +56,17 @@ class site_webapp { } exec { 'bundler_update': - cwd => '/srv/leap-webapp', + cwd => '/srv/leap/webapp', command => '/bin/bash -c "/usr/bin/bundle check || /usr/bin/bundle install --path vendor/bundle"', unless => '/usr/bin/bundle check', user => 'leap-webapp', timeout => 600, - require => [ Class['bundler::install'], Vcsrepo['/srv/leap-webapp'] ], + require => [ Class['bundler::install'], Vcsrepo['/srv/leap/webapp'] ], notify => Service['apache']; } exec { 'compile_assets': - cwd => '/srv/leap-webapp', + cwd => '/srv/leap/webapp', command => '/bin/bash -c "/usr/bin/bundle exec rake assets:precompile"', user => 'leap-webapp', require => Exec['bundler_update'], @@ -74,55 +74,55 @@ class site_webapp { } file { - '/srv/leap-webapp/public/provider.json': + '/srv/leap/webapp/public/provider.json': content => $provider, owner => leap-webapp, group => leap-webapp, mode => '0644'; - '/srv/leap-webapp/public/ca.crt': + '/srv/leap/webapp/public/ca.crt': ensure => link, target => '/usr/local/share/ca-certificates/leap_api.crt'; - "/srv/leap-webapp/public/${api_version}": + "/srv/leap/webapp/public/${api_version}": ensure => directory, owner => leap-webapp, group => leap-webapp, mode => '0755'; - "/srv/leap-webapp/public/${api_version}/config/": + "/srv/leap/webapp/public/${api_version}/config/": ensure => directory, owner => leap-webapp, group => leap-webapp, mode => '0755'; - "/srv/leap-webapp/public/${api_version}/config/eip-service.json": + "/srv/leap/webapp/public/${api_version}/config/eip-service.json": content => $eip_service, owner => leap-webapp, group => leap-webapp, mode => '0644'; - "/srv/leap-webapp/public/${api_version}/config/soledad-service.json": + "/srv/leap/webapp/public/${api_version}/config/soledad-service.json": content => $soledad_service, owner => leap-webapp, group => leap-webapp, mode => '0644'; - "/srv/leap-webapp/public/${api_version}/config/smtp-service.json": + "/srv/leap/webapp/public/${api_version}/config/smtp-service.json": content => $smtp_service, owner => leap-webapp, group => leap-webapp, mode => '0644'; } try::file { - '/srv/leap-webapp/public/favicon.ico': + '/srv/leap/webapp/public/favicon.ico': ensure => 'link', target => $webapp['favicon']; - '/srv/leap-webapp/app/assets/stylesheets/tail.scss': + '/srv/leap/webapp/app/assets/stylesheets/tail.scss': ensure => 'link', target => $webapp['tail_scss']; - '/srv/leap-webapp/app/assets/stylesheets/head.scss': + '/srv/leap/webapp/app/assets/stylesheets/head.scss': ensure => 'link', target => $webapp['head_scss']; - '/srv/leap-webapp/public/img': + '/srv/leap/webapp/public/img': ensure => 'link', target => $webapp['img_dir']; } file { - '/srv/leap-webapp/config/config.yml': + '/srv/leap/webapp/config/config.yml': content => template('site_webapp/config.yml.erb'), owner => leap-webapp, group => leap-webapp, -- cgit v1.2.3 From 92b90bc4507f412497c3128f0817bd24e2628b1b Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 22 May 2013 12:53:47 -0400 Subject: add force => true parameter to webapp vcsrepo checkout this should have been added to d669a5fb56acf9101cf677ecbd30bcc47b092cd3 resolve #1722 after the vcsrepo module was updated to handle this, but it wasn't. --- puppet/modules/site_webapp/manifests/init.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'puppet') diff --git a/puppet/modules/site_webapp/manifests/init.pp b/puppet/modules/site_webapp/manifests/init.pp index f7a4b598..aac48188 100644 --- a/puppet/modules/site_webapp/manifests/init.pp +++ b/puppet/modules/site_webapp/manifests/init.pp @@ -46,6 +46,7 @@ class site_webapp { vcsrepo { '/srv/leap/webapp': ensure => present, + force => true, revision => 'origin/master', provider => git, source => 'git://code.leap.se/leap_web', -- cgit v1.2.3 From e0b591b063d3c49012a4266ee837737758f58dc2 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 22 May 2013 12:56:43 -0400 Subject: add requirements to the try::file resources normally a file resource would automatically require the parent directory first, but try::file doesn't do this so it has errors if /srv/leap/webapp doesn't exist yet: for example: - [web1] err: /Stage[main]/Site_webapp/Try::File[/srv/leap/webapp/public/img]/Exec[restore_/srv/leap/webapp/public/img]/returns: change from notrun to 0 failed: Working directory '/srv/leap/webapp/public' does not exist that was 'tried' before the vcsrepo was done which would have resolved that problem. This makes sure that the vcsrepo is done first --- puppet/modules/site_webapp/manifests/init.pp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'puppet') diff --git a/puppet/modules/site_webapp/manifests/init.pp b/puppet/modules/site_webapp/manifests/init.pp index aac48188..b01141ae 100644 --- a/puppet/modules/site_webapp/manifests/init.pp +++ b/puppet/modules/site_webapp/manifests/init.pp @@ -106,19 +106,23 @@ class site_webapp { try::file { '/srv/leap/webapp/public/favicon.ico': - ensure => 'link', - target => $webapp['favicon']; + ensure => 'link', + require => Vcsrepo['/srv/leap/webapp'], + target => $webapp['favicon']; '/srv/leap/webapp/app/assets/stylesheets/tail.scss': ensure => 'link', + require => Vcsrepo['/srv/leap/webapp'], target => $webapp['tail_scss']; '/srv/leap/webapp/app/assets/stylesheets/head.scss': ensure => 'link', + require => Vcsrepo['/srv/leap/webapp'], target => $webapp['head_scss']; '/srv/leap/webapp/public/img': ensure => 'link', + require => Vcsrepo['/srv/leap/webapp'], target => $webapp['img_dir']; } -- cgit v1.2.3