From 427113774d1475364153564c9c70d2ceb6915e3a Mon Sep 17 00:00:00 2001 From: Paulo Tada Date: Tue, 15 Dec 2015 12:41:51 -0200 Subject: [PATCH] Adding db config kalibro_configurations prezento --- cookbooks/mezuro/recipes/kalibro_configurations.rb | 29 ++++++++++++++++++++++------- cookbooks/mezuro/recipes/prezento.rb | 30 +++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/cookbooks/mezuro/recipes/kalibro_configurations.rb b/cookbooks/mezuro/recipes/kalibro_configurations.rb index b77e900..a50326e 100644 --- a/cookbooks/mezuro/recipes/kalibro_configurations.rb +++ b/cookbooks/mezuro/recipes/kalibro_configurations.rb @@ -5,16 +5,31 @@ execute 'download:mezuro' do user 'root' end -package 'kalibro-configurations' - -service 'kalibro-configurations' do - action [:enable, :start] -end - template '/etc/mezuro/kalibro-configurations/database.yml' do source 'kalibro_configurations/database.yml.erb' owner 'kalibro_configurations' group 'kalibro_configurations' mode '0600' - notifies :restart, 'service[kalibro-configurations]' + notifies :restart, 'service[kalibro-configurations.target]' +end + +package 'kalibro-configurations' + +service 'kalibro-configurations.target' do + action [:enable, :start] +end + +CONFIGURATIONS_DIR='/usr/share/mezuro/kalibro-configurations' + +execute 'kalibro-configurations:schema' do + command 'RAILS_ENV=production bundle exec rake db:schema:load' + cwd CONFIGURATIONS_DIR + user 'kalibro_configurations' +end + +execute 'kalibro-configurations:migrate' do + command 'RAILS_ENV=production bundle exec rake db:migrate' + cwd CONFIGURATIONS_DIR + user 'kalibro_configurations' + notifies :restart, 'service[kalibro-configurations.target]' end diff --git a/cookbooks/mezuro/recipes/prezento.rb b/cookbooks/mezuro/recipes/prezento.rb index 8ff417f..5fec9ea 100644 --- a/cookbooks/mezuro/recipes/prezento.rb +++ b/cookbooks/mezuro/recipes/prezento.rb @@ -1,20 +1,36 @@ +# change this to COPR repo execute 'download:mezuro' do command 'wget https://bintray.com/mezurometrics/rpm/rpm -O bintray-mezurometrics-rpm.repo' cwd '/etc/yum.repos.d' user 'root' end -package 'prezento' - -service 'prezento' do - action [:enable, :start] -end - template '/etc/mezuro/prezento/database.yml' do source 'prezento/database.yml.erb' owner 'prezento' group 'prezento' mode '0600' - notifies :restart, 'service[prezento]' + notifies :restart, 'service[prezento.target]' +end + +package 'prezento' + +service 'prezento.target' do + action [:enable, :start] +end + +PREZENTO_DIR='/usr/share/mezuro/prezento' + +execute 'prezento:schema' do + command 'RAILS_ENV=production bundle exec rake db:schema:load' + cwd PREZENTO_DIR + user 'prezento' +end + +execute 'prezento:migrate' do + command 'RAILS_ENV=production bundle exec rake db:migrate' + cwd PREZENTO_DIR + user 'prezento' + notifies :restart, 'service[prezento.target]' end -- libgit2 0.21.2