From 0b4027f8e12c444b39b8a8e9f89adb283a86060b Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 26 Aug 2014 15:45:27 +0200 Subject: [PATCH] Log `rake db:migrate` output in /tmp --- CHANGELOG | 1 + files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb | 9 +++++++-- files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0173422..0f78e84 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ omnibus-gitlab repository. 7.3.0 - Add systemd support for Centos 7 - Add a Centos 7 SELinux module for ssh-keygen permissions +- Log `rake db:migrate` output in /tmp 7.2.0 - Pass environment variables to Unicorn and Sidekiq (Chris Portman) diff --git a/files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb b/files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb index 1b2452e..232fa92 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb @@ -20,7 +20,12 @@ execute "initialize database" do action :nothing end -execute "migrate database" do - command "/opt/gitlab/bin/gitlab-rake db:migrate" +bash "migrate database" do + code <<-EOH + log_file="/tmp/gitlab-db-migrate-$(date +%s)-$$" + umask 077 + /opt/gitlab/bin/gitlab-rake db:migrate 2>& 1 | tee ${log_file} + exit ${PIPESTATUS[0]} + EOH action :nothing end diff --git a/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb b/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb index f300414..3efab02 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb @@ -202,7 +202,7 @@ end # Only run `rake db:migrate` when the gitlab-rails version has changed remote_file File.join(gitlab_rails_dir, 'VERSION') do source "file:///opt/gitlab/embedded/service/gitlab-rails/VERSION" - notifies :run, 'execute[migrate database]' unless postgresql_not_listening + notifies :run, 'bash[migrate database]' unless postgresql_not_listening notifies :run, 'execute[clear the gitlab-rails cache]' unless redis_not_listening dependent_services.each do |sv| notifies :restart, sv -- libgit2 0.21.2