brint / wordpress-cookbook

Development repository for Opscode Cookbook wordpress
https://supermarket.chef.io/cookbooks/wordpress
Apache License 2.0
80 stars 176 forks source link

Errors with mysql cookbook 6.0.0+ #52

Closed gothick closed 9 years ago

gothick commented 9 years ago

I'm finding that when I try to run the wordpress recipe, I immediately get the error:

ERROR: could not find recipe client for cookbook mysql

I think this may be due to the changes in the 6.0.0 version of the mysql cookbook, "Cookbook now provides LWRPs instead of recipes"—it looks like, e.g. include_recipe "mysql::client" now won't work.

(Trying with wordpress-2.3.0 and mysql-6.0.6)

Any hints? I only started using chef a few days ago, so this is a little above my head!

rillip3 commented 9 years ago

gothick: I'm working on an update to this today as I'm running into it for the first time. You could, as a workaround, either manually download or use the Berksfile to pin the mysql cookbook to an older version of their cookbook as a workaround

rillip3 commented 9 years ago

I've run into a lot of problems converting this and don't know if/when I'll have something to commit. I've gotten it updated to the point that it builds and the passwords seem to work, but I get a chef runtime error complaining about the versions of mysql client compiled vs what's installed. Since this is all coming from package that's not really something I can control. It might be possible to ignore the error but I haven't nailed that down.

lpbedard commented 9 years ago

Hello,

I managed to make it run by downgrading the mysql version in the metadata.rb and metadata.json:

depends "mysql", "~> 5.0" depends "mysql-chef_gem", "~> 0.0" depends "database", "= 2.3.1"

gothick commented 9 years ago

Thanks for the updates! I've stepped away from the WordPress installation briefly (got distracted by writing a phpBB extension!) so I can't test this right now, but I'm sure that would be the way to go for a workaround.

zsol commented 9 years ago

Maybe there should be a constraint on the mysql dependency in metadata.rb in the meanwhile

paulmakl commented 9 years ago

I tried to implement the change that @lpbedard posted, but I get the following error message

================================================================================
           Error executing action `create` on resource 'mysql_service[default]'
           ================================================================================

           ArgumentError
           -------------
           You must supply a name when declaring a package resource

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb:55:in `block in <class:Ubuntu>'

           Resource Declaration:
           ---------------------
       # In /tmp/kitchen/cookbooks/mysql/recipes/server.rb

            20: mysql_service node['mysql']['service_name'] do
            21:   version node['mysql']['version']
            22:   port node['mysql']['port']
            23:   data_dir node['mysql']['data_dir']
            24:   server_root_password node['mysql']['server_root_password']
            25:   server_debian_password node['mysql']['server_debian_password']
            26:   server_repl_password node['mysql']['server_repl_password']
        27:   allow_remote_root node['mysql']['allow_remote_root']
            28:   remove_anonymous_users node['mysql']['remove_anonymous_users']
            29:   remove_test_database node['mysql']['remove_test_database']
            30:   root_network_acl node['mysql']['root_network_acl']
            31:   package_version node['mysql']['server_package_version']
        32:   package_action node['mysql']['server_package_action']
            33:   enable_utf8 node['mysql']['enable_utf8']
            34:   action :create
            35: end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cookbooks/mysql/recipes/server.rb:20:in `from_file'

           mysql_service("default") do
             action [:create]

             retry_delay 2
             default_guard_interpreter :default
             declared_type :mysql_service
             cookbook_name :mysql
             recipe_name "server"
             version "5.7"

             data_dir "/var/lib/mysql"
             server_root_password "ilikerandompasswords"
             server_debian_password "gnuslashlinux4ev4r"
             remove_anonymous_users true
             remove_test_database true
             package_action "install"
           end

       Running handlers:
       [2015-02-03T00:18:10+00:00] ERROR: Running exception handlers
       Running handlers complete

       [2015-02-03T00:18:10+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       Chef Client failed. 1 resources updated in 18.799817601 seconds
       [2015-02-03T00:18:11+00:00] ERROR: mysql_service[default] (mysql::server line 20) had an error: ArgumentError: You must supply a name when declaring a package resource
       [2015-02-03T00:18:11+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
lpbedard commented 9 years ago

I first made it run using a wrapper cookbook, so I just tried with the kitchen gem. I just installed the latest chef-dk from opscode (https://downloads.chef.io/chef-dk/)

$ git clone https://github.com/brint/wordpress-cookbook $ cd wordpress-cookbook $ vim metadata.rb

Change the 3 dependencies in metadata.rb:

depends "database", ">= 1.6.0"

depends "mysql", ">= 5.0.0"

depends "mysql-chef_gem", ">= 0.0.2"

depends "database", "= 2.3.1" depends "mysql", "~> 5.0" depends "mysql-chef_gem", "~> 0.0"

$ berks $ kitchen converge default-ubuntu-1204

I guess that if you first tried without modifying the dependencies and it failed, you will have to run berks update to resolve the new ones before trying again. Maybe destroy your instance before running kitchen again... or start from fresh git clone like I did.

paulmakl commented 9 years ago

Refreshed everything and it worked perfectly. Thank you for your detailed response. It helped a lot :).

brint commented 9 years ago

Hey everyone,

I've pushed out v3.0.0 that now supports 6.0+ of the MySQL community cookbook. I'm going to go ahead and close out this issue since the new release does properly support it now.