juanje / cookbook-redmine

Chef's Cookbook for installing Redmine
25 stars 21 forks source link

db:migrate failing on install w/ v2.5.1 #22

Closed fbrier closed 10 years ago

fbrier commented 10 years ago

This is my first time using this cookbook. I have repeated the install twice on clean Ubuntu 12.04 LTS VMs and got the same result. The cookbook fetches and installs redmine with no problem and then fails on the deploy running db:migrate. I had set the revision attribute to 2.5.1, which is the latest version. Has anyone else seen this? Thank you.

================================================================================
Error executing action `deploy` on resource 'deploy_revision[/opt/redmine]'
================================================================================

Chef::Exceptions::Exec
----------------------
rake db:migrate returned 1, expected 0

Amending since the above comment, I created a bare bones role, letting the revision default to 2.2.4, again on a clean VM, and it worked. Using another bare bones role, but setting just the revision to 2.5.1, it failed as above.

fbrier commented 10 years ago

I read through all the Redmine release notes between 2.2.4 and 2.5.1 and saw no changes to the tools or ruby libraries or packages or database features that would explain why 2.5.1 would behave differently on a clean install. Also, why would db:migrate execute on a clean install?

fbrier commented 10 years ago

So I noticed the mysql gem was not installed. So I installed it. Didn't work. But I did see Juanje's comment about the Chef gems possibly being in a different path. After reading about Chef logging, I re-ran chef-client and got the message, "Could not find gem 'mysql (~> 2.8.1) ruby' in the gems available on this machine." But then I read that Redmine does not include the mysql gem in its bundle definition and you have to specify it when installing. So why would it work for 2.2.4 and not 2.5.1? That has not changed. Still researching...

fbrier commented 10 years ago

Something must have changed to require the mysql gem to be added. In recipes/source.rb, the mysql gem has to be explicitly added:

     gem_package "bundler" do
       action :install
     end
+    gem_package "mysql" do
+      package_name "mysql"
+      version "2.8.1"
+      action :install
+    end

This seems to have solved the problem as 2.5.1 stable is now installed and operational. I did make one other change that I believe is unrelated, but appears to be a bug. In the same file, it appears that the execute bundle install command's parameters are reversed. Please feel free to let me know if I am off-base on these changes. Thank you.

     case adapter
     when "mysql"
-      execute "bundle install --without development test postgresql sqlite" do
+      execute "bundle install --without development test mysql sqlite" do
         cwd release_path
       end
     when "postgresql"
-      execute "bundle install --without development test mysql sqlite" do
+      execute "bundle install --without development test postgresql sqlite" do
         cwd release_path
       end
     end
jniggemann commented 10 years ago

Never looked at chef before and chances are I might be wrong about this, but

when "mysql"
   execute "bundle install --without development test mysql sqlite" do
   cwd release_path

doesn't look OK: You're in a case statement branch with adapter==mysql, hence it makes no sense to tell bundler to not use the mysql database...

fbrier commented 10 years ago

Thank you for logging into the project. Your hint on the redmine website zeroed me in. I'd actually caught the error you saw and posted it in the previous comment, although I don't think that is what was causing the db:migrate to fail. Thank you again. My next thought is to figure out how to do redmine plugins in the cookbook and integrate julionc's gitolite cookbook with the gitolite/redmine integration.