GithubHelp home page GithubHelp logo

sous-chefs / percona Goto Github PK

View Code? Open in Web Editor NEW
118.0 26.0 199.0 1.25 MB

Development repository for the percona cookbook

Home Page: https://supermarket.chef.io/cookbooks/percona

License: Apache License 2.0

Ruby 62.69% HTML 37.31%
chef-cookbook percona chef-resource chef hacktoberfest managed-by-terraform

percona's Introduction

Percona Cookbook

Cookbook Version OpenCollective OpenCollective License

Description

Installs the Percona MySQL client and/or server components. (We are attempting to leverage the Sous-Chefs MySQL cookbook as much as possible.)

Optionally installs:

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Supported Platforms

We provide an expanding set of tests against the following 64-bit platforms which match what upstream supports:

  • CentOS 7+
  • Debian 10+
  • Ubuntu 18.04+ LTS

Cookbooks

Chef

This cookbook requires Chef >= 16.

Recipes

  • percona - The default which includes the client recipe.
  • percona::package_repo - Sets up the package repository and installs common packages.
  • percona::client - Installs the Percona MySQL client libraries.
  • percona::server - Installs and configures the Percona MySQL server daemon.
  • percona::backup - Installs and configures the Percona XtraBackup hot backup software.
  • percona::toolkit - Installs the Percona Toolkit software
  • percona::cluster - Installs the Percona XtraDB Cluster server components
  • percona::configure_server - Used internally to manage the server configuration.
  • percona::replication - Used internally to grant permissions for replication.
  • percona::access_grants - Used internally to grant permissions for recipes.
  • percona::ssl - Used internally to setup ssl certificates for server/client.

Resources

Usage

This cookbook installs the Percona MySQL components if not present, and pulls updates if they are installed on the system.

This cookbook uses inclusion terminology where applicable replacing terms such as master/slave to source/replica which matches the terminology decided upstream. Older releases of Percona still use the terms in their configuration so those will remain, however we will be using the newer terms with attributes, property and variable names. Currently both terms should work however the next major release of this cookbook will only use the new terminology.

Encrypted Passwords

This cookbook requires Encrypted Data Bags. If you forget to use them or do not use a node attribute to overwrite them empty passwords will be used.

To use encrypted passwords, you must create an encrypted data bag. This cookbook assumes a data bag named passwords, but you can override the name using the node['percona']['encrypted_data_bag'] attribute. You can also optionally specify a data bag secret file to be loaded for the secret key using the node['percona']['encrypted_data_bag_secret_file'] attribute.

This cookbook expects a mysql item and a system item. Please refer to the official documentation on how to get this setup. It actually uses a MySQL example so it can be mostly copied. Ensure you cover the data bag items as described below.

You also may set expected item names via attributes node['percona']['encrypted_data_bag_item_mysql'] and node['percona']['encrypted_data_bag_item_system'].

Skip passwords

Set the ['percona']['skip_passwords'] attribute to skip setting up passwords. Removes the need for the encrypted data bag if using chef-solo. Is useful for setting up development and ci environments where you just want to use the root user with no password. If you are doing this you may want to set ['percona']['server']['debian_username'] to be "root" also.

Skip Configure

Set the ['percona']['skip_configure'] attribute to skip having the server recipe include the configure_server recipe directly after install. This is mostly useful in a wrapper cookbook sort of context. Once skipped, you can then perform any pre-config actions your wrapper needs to, such as dropping a custom configuration file or init script or cleaning up incorrectly sized innodb logfiles. You can then include configure_server where necessary.

mysql item

The mysql item should contain entries for root, backup, and replication. If no value is found, the cookbook will fall back to the default non-encrypted password.

system item

The "system" item should contain an entry for the debian system user as specified in the node['percona']['server']['debian_username'] attribute. If no such entry is found, the cookbook will fall back to the default non-encrypted password.

Example: "passwords" data bag - this example assumes that node['percona']['server']['debian_username'] = spud

{
  "mysql" :
  {
    "root" : "trywgFA6R70NO28PNhMpGhEvKBZuxouemnbnAUQsUyo=\n"
    "backup" : "eqoiudfj098389fjadfkadf=\n"
    "replication" : "qwo0fj0213fm9020fm2023fjsld=\n"
  },
  "system" :
  {
    "spud" : "dwoifm2340f024jfadgfu243hf2=\n"
  }
}

Above shows the encrypted password in the data bag. Check out the encrypted_data_bag_secret setting in knife.rb to setup your data bag secret during bootstrapping.

Install client development package

To install the package including header files needed to compile software using the client library (percona-server-devel on Centos and libperconaserverclient-dev on Debian), set node['percona']['client']['install_devel_package'] to true. This will add those packages to the list to be installed when running the percona::client recipe. This attribute is disabled by default.

Replication over SSL

To enable SSL based replication, you will need to flip the attribute node['percona']['server']['replication']['ssl_enabled'] to true and add a new data_bag item to the percona encrypted data_bag (seenode['percona']['encrypted_data_bag'] attribute) with the id ssl_replication ( see node['percona']['encrypted_data_bag_item_ssl_replication'] attribute) that contains this data:

{
  "id": "ssl_replication",
  "ca-cert": "CA_CERTIFICATE_STRING",
  "server": {
    "server-cert": "SERVER_CERTIFICATE_STRING",
    "server-key": "SERVER_KEY_STRING"
  },
  "client": {
    "client-cert": "CLIENT_CERTIFICATE_STRING",
    "client-key": "CLIENT_KEY_STRING"
  }
}

All certificates and keys have to be converted to a string (easiest way is to use ruby: /usr/bin/env ruby -e 'p ARGF.read' <filename>) and placed instead of CA_CERTIFICATE_STRING, SERVER_CERTIFICATE_STRING, SERVER_KEY_STRING, CLIENT_CERTIFICATE_STRING, CLIENT_KEY_STRING.

Percona XtraDB Cluster

Below is a minimal example setup to bootstrap a Percona XtraDB Cluster. Please see the official documentation for more information. This is not a perfect example. It is just a sample to get you started.

Wrapper recipe recipes/percona.rb:

# Setup the Percona XtraDB Cluster
cluster_ips = []
unless Chef::Config[:solo]
  search(:node, 'role:percona').each do |other_node|
    next if other_node['private_ipaddress'] == node['private_ipaddress']
    Chef::Log.info "Found Percona XtraDB cluster peer: #{other_node['private_ipaddress']}"
    cluster_ips << other_node['private_ipaddress']
  end
end

cluster_ips.each do |ip|
  firewall_rule "allow Percona group communication to peer #{ip}" do
    source ip
    port 4567
    action :allow
  end

  firewall_rule "allow Percona state transfer to peer #{ip}" do
    source ip
    port 4444
    action :allow
  end

  firewall_rule "allow Percona incremental state transfer to peer #{ip}" do
    source ip
    port 4568
    action :allow
  end
end

cluster_address = "gcomm://#{cluster_ips.join(',')}"
Chef::Log.info "Using Percona XtraDB cluster address of: #{cluster_address}"
node.override['percona']['cluster']['wsrep_cluster_address'] = cluster_address
node.override['percona']['cluster']['wsrep_node_name'] = node['hostname']

include_recipe 'percona::cluster'
include_recipe 'percona::backup'
include_recipe 'percona::toolkit'

Example percona role roles/percona.rb:

name "percona"
description "Percona XtraDB Cluster"

run_list 'recipe[paydici::percona]'

default_attributes(
  "percona" => {
    "server" => {
      "role" => "cluster"
    },

    "cluster" => {
      "package"                     => "percona-xtradb-cluster-56",
      "wsrep_cluster_name"          => "percona_cluster_1",
      "wsrep_sst_receive_interface" => "eth1" # can be eth0, public, private, etc.
    }
  }
)

Now you need to bring three servers up one at a time with the percona role applied to them. By default the servers will sync up via rsync server state transfer (SST)

Explicit my.cnf templating

In some situations it is preferable to explicitly define the attributes needed in a my.cnf file. This is enabled by adding categories to the node['percona']['conf'] attributes. All keys found in the node['percona']['conf'] map will represent categories in the my.cnf file. Each category contains a map of attributes that will be written to the my.cnf file for that category. See the example for more details.

Example

node['percona']['conf']['mysqld']['slow_query_log_file'] = "/var/lib/mysql/data/mysql-slow.log"

This configuration would write the mysqld category to the my.cnf file and have an attribute slow_query_log_file whose value would be /var/lib/mysql/data/mysql-slow.log.

Example output (my.cnf)

[mysqld]
slow_query_log_file = /var/lib/mysql/data/mysql-slow.log

Dynamically setting the bind address

There's a special attribute node['percona']['server']['bind_to'] that allows you to dynamically set the bind address. This attribute accepts the values "public_ip", "private_ip", "loopback", or and interface name like "eth0". Based on this, the recipe will find a corresponding ipv4 address, and override the node['percona']['server']['bind_address'] attribute.

Goals

In no particular order:

  • Be the most flexible way to setup a MySQL distribution through Chef
    • Support for Chef Solo
    • Support for Chef Server
  • Support the following common database infrastructures:
    • Single server instance
    • Traditional Source/Replica replication
    • Multi-source cluster replication
  • Support the most recent Chef runtime environments
  • Be the easiest way to setup a MySQL distribution through Chef

TODO

  • Fully support all of the standard Chef-supported distributions

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Added some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

percona's People

Contributors

abecciu avatar arnesund avatar avit avatar bensomers avatar bp-bsizemore avatar cyberflow avatar damacus avatar emh333 avatar errm avatar freerobby avatar helgi avatar iancoffey avatar jarrad avatar jesseadams avatar kitchen-porter avatar mancdaz avatar masv avatar onlyhavecans avatar phlipper avatar pmccarren avatar pmichalec avatar ramereth avatar renovate[bot] avatar rll3 avatar rodriguezsergio avatar shortdudey123 avatar tas50 avatar tkuhlman avatar xorima avatar xorimabot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

percona's Issues

Use a common my.cnf template (mysql cookbook?)

If you do think it appropriate to move to using the mysql cookbook, then they'll have their own my.cnf file:
https://github.com/phlipper/chef-percona/tree/master/templates/default
https://github.com/opscode-cookbooks/mysql/blob/master/templates/default/my.cnf.erb

Thinking that we can remove much the custom attributes and probbably generalize it like the php cookbook has done:
https://github.com/opscode-cookbooks/php/blob/master/templates/default/php.ini.erb#L1898

Much of the customization, if possible, might be more fitting to keep in an example role that provides all the relevant directives in a hash. Would that be too much of a change? Just seems more extensible and tailorable to individual needs, but I understand that it would be a bit of a change.

If we're set on being able to include a recipe to get a "cluster" of some pre-defined setup, the only other thing (if aiming to use a common my.cnf template from mysql), would be to set all the my.cnf directives in the cluster/etc recipe itself, either as hardcoded variables passed into the template (which wouldn't be flexible to mess with), or by setting chef attributes in the recipe itself (which strikes me as a bit hacky and a layer of indirection).

Thoughts?

Setting datadir causes install to fail

I have an environment config of

"percona" => {
    "server" => {
        "datadir" => '/mnt/var/lib/mysql'
    }
}

On a fresh build of an ec2 instance I get the follow:

Error executing actionrunon resource 'execute[setup mysql datadir]'

Which is from the block in configure_server.rb

# install db to the data directory
execute "setup mysql datadir" do
  command "mysql_install_db --user=#{user} --datadir=#{datadir}"
  not_if "test -f #{datadir}/mysql/user.frm"
end

From the output, it looks like the error is the user is not being passed in, here is the broken command being run:

mysql_install_db --user= --datadir=/mnt/var/lib/mysql

This is odd, since I see that the default attributes sets default["percona"]["server"]["username"] to mysql. 😕

Packages getting reinstalled every chef-client run during server install

Hi

While testing the cookbook in our chef environment i see that all the above packages are removed by the:
package "mysql-libs" do
action :remove
end

Percona-Server-client-55-5.5.28-rel29.3.388.rhel5
Percona-Server-shared-55-5.5.28-rel29.3.388.rhel5
Percona-Server-server-55-5.5.28-rel29.3.388.rhel5

Is there something i'm missing?

Empty Passwords on new Installation

Hey @phlipper,

I just installed Percona on our staging setup but apparently it didn't generate random passwords even though OpenSSL is part of the package:

root@even-mediumseagreen-stardust:/etc/mysql# cat grants.sql 
# Generated by Chef for even-mediumseagreen-stardust.init.bigpoint.net.
# Local modifications will be overwritten.

# debian-sys-maint user for administration
GRANT ALL PRIVILEGES ON *.*
  TO 'debian-sys-maint'@'localhost'
  IDENTIFIED BY ''
  WITH GRANT OPTION;


# Grant permissions for the XtraBackup user
# Ensure the user exists, then revoke all grants, then re-grant specific permissions
GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'backup'@'localhost' IDENTIFIED BY '';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'backup'@'localhost';
GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'backup'@'localhost' IDENTIFIED BY '';

# Set the server root password. This should be preseeded by the package installation.
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');


FLUSH PRIVILEGES;

It really has no password set, I am able to login fine as root without entering a password.

Any idea what is causing this? I am using various settings to generate a my.cnf that fits our needs but that shouldn't interfere with the standard procedure of setting up passwords.

Slave Replication Setup Issues and Shortcomings

  1. When setting up a master/slave environment I noticed that a newly setup slave will not automatically issue a START SLAVE command. This had to be done manually but worked fine after that.
  2. It is currently not possible to create a new slave from an existing master. I assume this is due to the fact that we would have to ensure a backup exists that we can access. I am wondering if this could be added to the existing backup recipe: Ensure backup software is installed and a basic backup can be triggered. Once that is done, maybe the Slave setup recipe could be adjusted to check a master for an existing backup and import that from a configurable location?
  3. While testing slave to master promotion it did not seem to be covered by this cookbook. I'd think it would be as easy as a "STOP SLAVE; RESET SLAVE; CHANGE MASTER TO MASTER_HOST=''" somewhere in the recipe, possibly storing this information so it won't be executed with each Chef run.

I am open for discussion of these points and probably looking at (at least) number 3 since it is an option we lack to run our test environment tomorrow. 😄

Create new tag

The latest tag for this cookbook (0.14.5) is over a year old and is no longer compatible due to changes with the Opscode yum 3.0.0 cookbook. Would it be possible to create a more up to date tag so we can pull a from a frozen state rather than the master branch.

Make use of "percona" namespace on Opscode community site

While I'm here, what are your thoughts on asking the current maintainers of the "official" percona cookbook on the community site, to see whether they'd be amenable to handing the namespace over to you?

http://ckbk.it/percona

It seems your cookbook is much more active and general, and it would only make sense. I imagine they'd be able to see that.

Would you be interested if they were? I can get in touch.

After setting passwords for mysql, grant commands can no longer run

After a chef run that sets up mysql users the grants and replication mysql commands fail because no password is passed to them. I have solved this by using chef-rewind and some pretty nasty bash:

#percona/recipes/access_grants.rb


execute "mysql-install-privileges" do
  command "/usr/bin/mysql < /etc/mysql/grants.sql"
  action :nothing
  subscribes :run, resources("template[/etc/mysql/grants.sql]"), :immediately
end

My ugly rewind (mysql_credentials is available from a databag in this scope):

rewind "execute[mysql-install-privileges]" do
  command "mysql -p'" + mysql_credentials['password'] + "' -e '' &> /dev/null > /dev/null &> /dev/null ; if [ $? -eq 0 ] ; then /usr/bin/mysql -p'" + mysql_credentials['password'] + "' < /etc/mysql/grants.sql ; else /usr/bin/mysql < /etc/mysql/grants.sql ; fi ;"
end

I do something similar for 'mysql-set-replication' in replication.rb.

Is there a better way I could approach this? Unsure why others wouldn't have this problem with this cookbook …

Recipe package_repo.rb fails on amazon platform

Hey,
on package_repo.rb case rhel will be used for platform amazon. this results in the var pversion being set to whatever year the amazon AMI had been released (in my case 2013) which results in a 404 during the repo update.

Is there a chance that this case gets set to fall back to the centos 6 option? right now i*m hacking around wiht a wrapper cookbook, but that just seems to fail all along...

Version value override only affects client recipe, not server

Hey,
working with 15.5, i tried to override:
version = default["percona"]["version"] = "5.6"
with "5.5"

it works for node["percona"]["client"]["packages"] in client.rb, but not for
node["percona"]["server"]["package"] in default.rb

working on AWS AMI image

can anybody confirm this?

Mysql passwords are passed as plaintext in various commands

Mysql mentions this as a security vulnerability (which it def. is). see:
https://dev.mysql.com/doc/refman/5.1/en/password-security-user.html

The problem is that while a command is being executed with "-u root -p'plaintext_pw' ", if a normal user is looking at a processlist, they can see the whole command, password included.

Eg:
bar:$ mysql -u root -p'very naked password' my_db -e "select * from users"
foo:$ ps aux | grep 'mysql -u root'
bar 17126 3.0 42.0 1810076 1562628 pts/4 S+ 12:41 0:01 mysql -u root --password='very naked password' my_db -e "select * from users"

Pull request coming up

more trouble with apt-get update

including client recipe, and failing with

[2013-10-25T19:11:59+00:00] INFO: Processing package[percona-server-client] action install (percona::client line 5)

Error executing action install on resource 'package[percona-server-client]'

Chef::Exceptions::Exec


apt-get -q -y --force-yes install percona-server-client=1:5.6.14-rel62.0-483.precise returned 100, expected 0

Resource Declaration:


In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/percona/recipes/client.rb

5: package "percona-server-client" do
6: options "--force-yes"
7: end
8: when "rhel"

Compiled Resource:


Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/percona/recipes/client.rb:5:in `from_file'

package("percona-server-client") do
action :install
retries 0
retry_delay 2
options "--force-yes"
package_name "percona-server-client"
version "1:5.6.14-rel62.0-483.precise"
cookbook_name :percona
recipe_name "client"
end

I'm updating apt-get repos, both within including recipe and manually within the node, and still getting this. Not sure how to fix... thanks.

Unable to get Cluster working

I am attempting to create a very basic non-optimized cluster to test with. However I am having a bit of an issue even getting mysql started after using this cookbook.

Right now my role (database_test) looks as such:

https://gist.github.com/4390878

When I attempt to start mysqld_safe I get the following error:

121227 10:41:17 mysqld_safe Logging to '/var/lib/mysql/domU-12-31-38-04-92-46.err'.
121227 10:41:17 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
121227 10:41:17 mysqld_safe WSREP: Running position recovery with --log_error=/tmp/tmp.pOaMVxRlKV
nohup: ignoring input and appending output to `nohup.out'
121227 10:41:22 mysqld_safe WSREP: Failed to recover position:
121227 10:41:23 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Looking at the log file the primary error that I see is this:

121227 10:41:22 [ERROR] WSREP: wsrep_load(): dlopen(): /usr/lib64/libgalera_smm.so: cannot open shared object file: No such file or directory

make sql-mode tunable in option files

Currently, this is the only reason I can't just use this cookbook as-is. It seems like something most people would tune too. (Or we're just outliers.)

<% if !node["percona"]["server"]["sql-mode"].nil? %>
sql-mode            = <%= node["percona"]["server"]["sql-mode"] %>
<% end %>

Thoughts?

Question about restart notification in configure_server recipe

Would it be possible to restrict this a bit? For example, a mysql restart on a production database server is obviously a serious deal, and one that should be done quite deliberately. If someone changes an attribute that affects the main config file, this cookbook will automatically restart mysql (when one might want to do the actual restart late at night, perhaps manually if other restarts need to occur subsequently (eg: application servers)).

I understand people may be used to this default, but seems like it might be good to either restrict based on environment, or have options to trigger a restart at a specific time, or maybe just leave it up to the user to restart manually. In any case, the current default startled me a bit.

Thoughts?

Thanks,
-Chris

Question about XtraDB Clustering

I note that the clustering and replication functionality is marked as 'Deprecated'. Is there a reason for this or is there some work that I can do to update/add clustering?

just looking for a starting point.

Thanks
K

Remove dependency on opscode mysql recipe

The only line that references the recipe is https://github.com/phlipper/chef-percona/blob/master/recipes/client.rb#L2

From what we can see in https://github.com/opscode-cookbooks/mysql/blob/3.0.0/recipes/client.rb, it looks like all the recipe does is install the packages listed in node["mysql"]["client"]["packages". Is there any reason to keep this dependency instead of just calling:

node['mysql']['client']['packages'].each do |mysql_pack|
  package mysql_pack do
    action :install
  end
end

Let us know if this makes sense to you, and if so we'll be happy to do the work and issue a PR.

World-readable debian config file

Wondering about the security implications of this... since the debian user is given full access in the grants table, and the config file with the debian password in plaintext is world readable, this means that any user on the system can do anything they want to the database, correct?

Seems like a serious problem. Can we change the permissions such that the file is only readable by root... also does it need to be executable?

Thanks

[ERROR] Slow log not works

Hi,
As I know that problem for all systems. But I had CentOS 6.3 and Percona 5.5.
I got error in mysql logs:

/usr/sbin/mysqld: File '/var/log/mysql/mysql-slow.log' not found (Errcode: 2)
[ERROR] Could not use /var/log/mysql/mysql-slow.log for logging (error 2). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.

Problem is very simpple, directory /var/log/mysql/ doesn't exist.
I didn't find open issue about that. I will try make pull request in next few days.

Compatibility with Percona 5.5

I just tried to set up Percona with this cookbook (which I really like, btw), but failed miserably since apt-get install percona-server-server installs Percona 5.5 now. The cookbook sets a number of settings (skip-bdb, default_table_type and master-*) in my.cnf that has been deprecated and makes the server refuse to start.

Are there any plans to make this cookbook compatible with 5.5, or are you planning to stick with 5.1? Either way, can I help with patches? I'm a bit stuck here and I'll have to modify the cookbook for my own use anyway :)

When using percona with the database cookbook, the mysql chef gem fails to build (Ubuntu 14.04)

As per the description - the problem occurs in the 'Monkey patch' provider_mysql_chef_gem.rb:
chef_gem "mysql" do
action :install
end

Debugging through, this step fails because the percona library links to libssl and libcrypto, which are not installed by default.

For now, I've worked around this by adding the following before including the database::mysql recipe:
package "libssl-dev" do
action :install
end

set_unless behaves oddly with chef-solo

I ran into some weird behavior when running percona::backup using chef-solo: Despite having the appropriate password attributes set on the node via default_attributes on a role, the grants template was being rendered with secure_password passwords.

A little poking around revealed that this seems to be because of an existing issue with chef and the set_unless method where set_unless will ignore values set at different precedence levels and override them. There's been an issue at Opscode tracking this behavior since 2012-02-12: https://tickets.opscode.com/browse/CHEF-2945

Best I can tell, this issue would affect any of the recipes that use the grants.sql template or use the root_password or debian_password methods from the password library.

I plan to switch to encrypted passwords in the near future, but in the meantime, to work around this issue I changed my role to use override_attributes instead of default attributes which prevented set_unless from ignoring them.

Depending on the desired behavior, you might consider a different approach to providing password defaults that doesn't use set_unless.

The Opscode issue I mentioned previously has a couple of good suggestions for addressing this issue. Also, this pull request seems to address when this issue was fixed in the mysql cookbook and may be a good point of reference: sous-chefs/mysql#31

RuntimeError: The repository file to create is nil, cannot continue.

We have an error using this cookbook in Vagrant/Chef.

This is stacktrace:

[2013-02-20T08:17:56+00:00] INFO: Processing apt_repository[percona] action add (percona::package_repo line 10)

Error executing action add on resource 'apt_repository[percona]'

RuntimeError

The repository file to create is nil, cannot continue.

Cookbook Trace:

/tmp/vagrant-chef-1/chef-solo-1/cookbooks/apt/providers/repository.rb:123:in `class_from_file'

Resource Declaration:

In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/percona/recipes/package_repo.rb

9:
10: apt_repository "percona" do
11: uri "http://repo.percona.com/apt"
12: distribution node["lsb"]["codename"]
13: components ["main"]
14: keyserver node["percona"]["keyserver"]
15: key "1C4CBDCDCD2EFD2A"
16: action :add
17: notifies :run, "execute[apt-get update]", :immediately
18: end
19:

Compiled Resource:

Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/percona/recipes/package_repo.rb:10:in `from_file'

apt_repository("percona") do
uri "http://repo.percona.com/apt"
components ["main"]
retry_delay 2
distribution "precise"
retries 0
recipe_name "package_repo"
action [:add]
cookbook_name :percona
key "1C4CBDCDCD2EFD2A"
keyserver "keys.gnupg.net"
end

Add TESTING.md documentation

Forked from #65 (comment)

  • Mention [ci skip]
  • Explain how to use local.kitchen.yml, and give sample content.
  • Sometimes yum repo mirrors run out on gnupg2 package (perhaps because we're running so many instances?). When this happens, restarting the travis job often makes it run clean. How to do with should be explained, as a push will rerun the whole build (with mutliple jobs each for both chef 10 & 11), instead of just the failing job.

my.cnf custom settings, mysqld fails to start

When trying to use some overrides of the default settings it seems that those cause the MySQL server to fail.

I have looked a bit into this and it seems that the Debian package forces a server restart. This means that, after restart, the server will come up with the default percona my.cnf which has different settings than mine.

Here the DEBUG output of Vagrant:

[2012-10-04T14:55:20+02:00] DEBUG: STDERR: Stopping MySQL (Percona Server): mysqld.
Starting MySQL (Percona Server) database server: mysqld ..
Checking for corrupt, not cleanly closed and upgrade needing tables..

Now when the template is written MySQL will fail to start:

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 301989888 bytes!
121004 14:55:55 [ERROR] Plugin 'InnoDB' init function returned error.
121004 14:55:55 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
121004 14:55:55 [ERROR] Unknown/unsupported storage engine: InnoDB
121004 14:55:55 [ERROR] Aborting

The only workaround I was able to find was to delete my logfile and let MySQL recreate them.
I think innodb_log_file_size is causing this, I upgraded that to 288 MB.

I am not sure how this could be fixed other than not using this custom variable at all. I doubt the Cookbook could stop the package from restarting the server.

Setting innodb_log_file_size causes server to crash with Percona Cluster

When using Percona Cluster, if ['percona']['server']['innodb_log_file_size'] is set, MySQL will crash after 'my.cnf' is built from the template with an error similar to this:

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 8388608 bytes!

Root accounts left with no passwords despite using encrypted data bags

After using percona::server with appropriately set encrypted data bags, I tested it worked with mysql -u root. I was able to login. I also tested with mysql -u root -p which also worked. Not understanding what was happening, I investigated further:

mysql> use mysql;
mysql> select host,user,password from user;
+-----------+------------------+-------------------------------------------+
| host | user | password |
+-----------+------------------+-------------------------------------------+
| localhost | root | redacted|
| myhostname | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | debian-sys-maint |redacted |
+-----------+------------------+-------------------------------------------+
5 rows in set (0.00 sec)

It looks like the line from percona/recipes/configure_server.rb which performs the update:

configure_server.rb: command "mysqladmin --user=root --password='' password '#{passwords.root_password}'"

...only applies the change to root@"localhost", but leaves other open root entries.

This is a nasty security issue.

I'd like to know if there's something in an attribute i can do to fix this, or if I need to write a separate recipe to clear out any accounts without passwords (or apply the password across all entries).

This was on Ubuntu 12.04 for reference.

mysql-install-privileges fails on the first run

I'm bootstrapping a host that includes percona::package_repo, percona::client and percona::server. The first time I run the chef install, mysql-install-privileges fails with the following:

[2013-06-17T15:48:56+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: execute[mysql-install-privileges] (percona::access_grants line 18) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/mysql < /etc/mysql/grants.sql ----
STDOUT:
STDERR: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
---- End output of /usr/bin/mysql < /etc/mysql/grants.sql ----
Ran /usr/bin/mysql < /etc/mysql/grants.sql returned 1

This runs fine the second time. Since it's not passing the password, I assume it's relying on the presence of the /root/.my.cnf file, and I wonder if something needs to happen in order for that to kick in, as it has just been created when this command is issued.

Error yum_key

On the recipe percona:package_repo I keep getting the following error:

Cannot find a resource for yum_key on centos version 6.5

Debian Jessie support

Can't use your cookbook on debian jessie

My role:

{
   "name": "db",
   "description": "db server",
   "default_attributes": {
   },
   "json_class": "Chef::Role",
   "run_list": [
        "recipe[percona]",
        "recipe[percona::server]"
   ],
   "chef_type": "role",
   "override_attributes": {
   }
}
[2014-04-13T15:19:25+00:00] INFO: WindowsPackage light-weight resource already initialized -- overriding!
[2014-04-13T15:19:35+00:00] INFO: Resource {:package=>"libmysqlclient-dev"} found, now rewinding it
[2014-04-13T15:19:35+00:00] INFO: Resource {:package=>"percona-server-client-5.5"} found, now rewinding it
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for debian-sys-maint, system
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for debian-sys-maint, system
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for backup, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for replication, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:35+00:00] INFO: Using non-encrypted password for root, mysql
[2014-04-13T15:19:44+00:00] ERROR: execute[apt-get-update] (apt::default line 29) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
---- Begin output of apt-get update ----
STDOUT: Hit http://security.debian.org jessie/updates InRelease
Hit http://ftp.uk.debian.org jessie InRelease
Hit http://ftp.uk.debian.org jessie-updates InRelease
Hit http://security.debian.org jessie/updates/main Sources
Hit http://security.debian.org jessie/updates/contrib Sources
Hit http://ftp.uk.debian.org jessie-backports InRelease
Hit http://security.debian.org jessie/updates/non-free Sources
Hit http://ftp.uk.debian.org jessie/main Sources/DiffIndex
Hit http://ftp.uk.debian.org jessie/contrib Sources/DiffIndex
Hit http://ftp.uk.debian.org jessie/non-free Sources/DiffIndex
Hit http://ftp.uk.debian.org jessie/main amd64 Packages/DiffIndex
Hit http://ftp.uk.debian.org jessie/contrib amd64 Packages/DiffIndex
Hit http://ftp.uk.debian.org jessie/non-free amd64 Packages/DiffIndex
Hit http://ftp.uk.debian.org jessie/contrib Translation-en/DiffIndex
Hit http://ftp.uk.debian.org jessie/main Translation-en/DiffIndex
Hit http://ftp.uk.debian.org jessie/non-free Translation-en/DiffIndex
Hit http://ftp.uk.debian.org jessie-updates/main Sources
Hit http://security.debian.org jessie/updates/main amd64 Packages
Hit http://security.debian.org jessie/updates/contrib amd64 Packages
Hit http://security.debian.org jessie/updates/non-free amd64 Packages
Hit http://security.debian.org jessie/updates/contrib Translation-en
Hit http://security.debian.org jessie/updates/main Translation-en
Hit http://security.debian.org jessie/updates/non-free Translation-en
Ign http://repo.percona.com jessie InRelease
Hit http://ftp.uk.debian.org jessie-updates/contrib Sources
Hit http://ftp.uk.debian.org jessie-updates/non-free Sources
Hit http://ftp.uk.debian.org jessie-updates/main amd64 Packages
Ign http://repo.percona.com jessie Release.gpg
Hit http://ftp.uk.debian.org jessie-updates/contrib amd64 Packages
Hit http://ftp.uk.debian.org jessie-updates/non-free amd64 Packages
Ign http://repo.percona.com jessie Release
Hit http://ftp.uk.debian.org jessie-updates/contrib Translation-en
Hit http://ftp.uk.debian.org jessie-updates/main Translation-en
Hit http://ftp.uk.debian.org jessie-updates/non-free Translation-en
Hit http://ftp.uk.debian.org jessie-backports/main Sources
Hit http://ftp.uk.debian.org jessie-backports/contrib Sources
Hit http://ftp.uk.debian.org jessie-backports/non-free Sources
Hit http://ftp.uk.debian.org jessie-backports/main amd64 Packages
Hit http://ftp.uk.debian.org jessie-backports/contrib amd64 Packages
Hit http://ftp.uk.debian.org jessie-backports/non-free amd64 Packages
Hit http://ftp.uk.debian.org jessie-backports/contrib Translation-en
Hit http://ftp.uk.debian.org jessie-backports/main Translation-en
Hit http://ftp.uk.debian.org jessie-backports/non-free Translation-en
Err http://repo.percona.com jessie/main amd64 Packages
  404  Not Found [IP: 74.121.199.234 80]
Ign http://repo.percona.com jessie/main Translation-en
STDERR: W: Failed to fetch http://repo.percona.com/apt/dists/jessie/main/binary-amd64/Packages  404  Not Found [IP: 74.121.199.234 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.
---- End output of apt-get update ----
Ran apt-get update returned 100; ignore_failure is set, continuing

================================================================================
Error executing action `run` on resource 'execute[apt-get-update]'
================================================================================


Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '100'
---- Begin output of apt-get update ----
STDOUT: Hit http://security.debian.org jessie/updates InRelease
Hit http://ftp.uk.debian.org jessie InRelease
Hit http://ftp.uk.debian.org jessie-updates InRelease
Hit http://security.debian.org jessie/updates/main Sources
Hit http://security.debian.org jessie/updates/contrib Sources
Hit http://ftp.uk.debian.org jessie-backports InRelease
Hit http://security.debian.org jessie/updates/non-free Sources
Hit http://ftp.uk.debian.org jessie/main Sources/DiffIndex
Hit http://ftp.uk.debian.org jessie/contrib Sources/DiffIndex
Hit http://ftp.uk.debian.org jessie/non-free Sources/DiffIndex
Hit http://ftp.uk.debian.org jessie/main amd64 Packages/DiffIndex
Hit http://ftp.uk.debian.org jessie/contrib amd64 Packages/DiffIndex
Hit http://ftp.uk.debian.org jessie/non-free amd64 Packages/DiffIndex
Hit http://ftp.uk.debian.org jessie/contrib Translation-en/DiffIndex
Hit http://ftp.uk.debian.org jessie/main Translation-en/DiffIndex
Hit http://ftp.uk.debian.org jessie/non-free Translation-en/DiffIndex
Hit http://ftp.uk.debian.org jessie-updates/main Sources
Hit http://security.debian.org jessie/updates/main amd64 Packages
Hit http://security.debian.org jessie/updates/contrib amd64 Packages
Hit http://security.debian.org jessie/updates/non-free amd64 Packages
Hit http://security.debian.org jessie/updates/contrib Translation-en
Hit http://security.debian.org jessie/updates/main Translation-en
Hit http://security.debian.org jessie/updates/non-free Translation-en
Ign http://repo.percona.com jessie InRelease
Hit http://ftp.uk.debian.org jessie-updates/contrib Sources
Hit http://ftp.uk.debian.org jessie-updates/non-free Sources
Hit http://ftp.uk.debian.org jessie-updates/main amd64 Packages
Ign http://repo.percona.com jessie Release.gpg
Hit http://ftp.uk.debian.org jessie-updates/contrib amd64 Packages
Hit http://ftp.uk.debian.org jessie-updates/non-free amd64 Packages
Ign http://repo.percona.com jessie Release
Hit http://ftp.uk.debian.org jessie-updates/contrib Translation-en
Hit http://ftp.uk.debian.org jessie-updates/main Translation-en
Hit http://ftp.uk.debian.org jessie-updates/non-free Translation-en
Hit http://ftp.uk.debian.org jessie-backports/main Sources
Hit http://ftp.uk.debian.org jessie-backports/contrib Sources
Hit http://ftp.uk.debian.org jessie-backports/non-free Sources
Hit http://ftp.uk.debian.org jessie-backports/main amd64 Packages
Hit http://ftp.uk.debian.org jessie-backports/contrib amd64 Packages
Hit http://ftp.uk.debian.org jessie-backports/non-free amd64 Packages
Hit http://ftp.uk.debian.org jessie-backports/contrib Translation-en
Hit http://ftp.uk.debian.org jessie-backports/main Translation-en
Hit http://ftp.uk.debian.org jessie-backports/non-free Translation-en
Err http://repo.percona.com jessie/main amd64 Packages
  404  Not Found [IP: 74.121.199.234 80]
Ign http://repo.percona.com jessie/main Translation-en
STDERR: W: Failed to fetch http://repo.percona.com/apt/dists/jessie/main/binary-amd64/Packages  404  Not Found [IP: 74.121.199.234 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.
---- End output of apt-get update ----
Ran apt-get update returned 100


Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apt/recipes/default.rb

 29: execute 'apt-get-update' do
 30:   command 'apt-get update'
 31:   ignore_failure true
 32:   only_if { apt_installed? }
 33:   not_if { ::File.exists?('/var/lib/apt/periodic/update-success-stamp') }
 34: end
 35:



Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apt/recipes/default.rb:29:in `from_file'

execute("apt-get-update") do
  action "run"
  ignore_failure true
  retries 0
  retry_delay 2
  guard_interpreter :default
  command "apt-get update"
  backup 5
  returns 0
  cookbook_name :apt
  recipe_name "default"
  not_if { #code block }
  only_if { #code block }
end



[2014-04-13T15:19:48+00:00] WARN: This recipe uses search. Chef Solo does not support search unless you install the chef-solo-search cookbook.
[2014-04-13T15:19:48+00:00] WARN: This recipe uses search. Chef Solo does not support search unless you install the chef-solo-search cookbook.
[2014-04-13T15:19:48+00:00] INFO: package[ncurses-dev] is a virtual package, actually acting on package[libncurses5-dev]

================================================================================
Error executing action `install` on resource 'package[percona-server-client-5.5]'
================================================================================


Chef::Exceptions::Package
-------------------------
No version specified, and no candidate version available for percona-server-client-5.5


Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/client.rb

 46:   package mysql_pack do
 47:     action :install
 48:   end
 49: end



Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/client.rb:46:in `block in from_file'

package("percona-server-client-5.5") do
  action [:install]
  retries 0
  retry_delay 2
  guard_interpreter :default
  options "--force-yes"
  package_name "percona-server-client-5.5"
  cookbook_name :mysql
  recipe_name "client"
end



[2014-04-13T15:20:00+00:00] INFO: Running queued delayed notifications before re-raising exception
[2014-04-13T15:20:00+00:00] ERROR: Running exception handlers
[2014-04-13T15:20:00+00:00] ERROR: Exception handlers complete
[2014-04-13T15:20:00+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-04-13T15:20:00+00:00] ERROR: package[percona-server-client-5.5] (mysql::client line 46) had an error: Chef::Exceptions::Package: No version specified, and no candidate version available for percona-server-client-5.5
[2014-04-13T15:20:00+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

skip_passwords and configure_server recipe

root password is still updated even with "skip_passwords" set. Recipe even tries to update root password every time it runs,m because "grants.sql" is skipped.
Same for debian user.
Maybe just

unless percona["skip_passwords"]

around the update root password execute and the two cnf templates

skip_passwords and debian.cnf

When ["percona"]["skip_passwords"] is set, the /etc/mysql/debian.cnf is rewriten each time I run the chef client, because the configure recipe don't test if skip_passwords is set for updating this file. I suspect it would make sense to only update /etc/mysql/debian.cnf when the skip_password is false.

(note, I skip password because I want to use chef-vault rather than traditional encrypted data bags, that would be cool if that was an option)

Install Failure Due to yum_key being deprecated

This is true for all versions of the Yum cookbook > 3.0.0. The method yum_key has been deprecated, and instead a yum-percona has been added.

NoMethodError

No resource or method named yum_key' forChef::Recipe "package_repo"'

Cookbook Trace:

/etc/chef/chef-solo-1/cookbooks/percona/recipes/package_repo.rb:35:in from_file' /etc/chef/chef-solo-1/cookbooks/percona/recipes/server.rb:1:infrom_file'
/etc/chef/chef-solo-1/cookbooks/scrum_stage/recipes/database.rb:12:in `from_file'

Relevant File Content:

/etc/chef/chef-solo-1/cookbooks/percona/recipes/package_repo.rb:

28: # install dependent package
29: package "libmysqlclient-dev" do
30: options "--force-yes"
31: end
32:
33: when "rhel"
34: include_recipe "yum"
35>> yum_key "RPM-GPG-KEY-percona" do
36: url "http://www.percona.com/downloads/RPM-GPG-KEY-percona"
37: action :add
38: end
39:
40: yum_repository "percona" do
41: name "CentOS-Percona"
42: url "http://repo.percona.com/centos/#{node["platform_version"].split('.')[0]}/os/#{node["kernel"]["machine"]}/"
43: key "RPM-GPG-KEY-percona"
44: action :add

Also from the Yum cookbook changelog.md:

https://github.com/opscode-cookbooks/yum/blob/a42b643c39f04960b9f91bffcb5012473abe206f/CHANGELOG.md

v3.0.0

3.0.0 Major rewrite with breaking changes. Recipes broken out into individual cookbooks yum_key resource has been removed yum_repository resource now takes gpgkey as a URL directly yum_repository actions have been reduced to :create and :delete 'name' has been changed to repositoryid to avoid ambiguity chefspec test coverage gpgcheck is set to 'true' by default and must be explicitly disabled

Add create database lwrp

The database cookbook's mysql_database will fail with any percona install. Would be wonderful if, when using a percona build, we could actually create a database easily. So far, none of the various percona related cookbooks make this possible; have to resort to more low level ways of accomplishing it. Just a thought; thanks.

Incorrect main_config_file for Ubuntu 14.04 + Percona 5.6

The default config location (default["percona"]["main_config_file"]) is /etc/my.cnf, however the normal Debian/Ubuntu location is actually /etc/mysql/my.cnf:

root@vagrant-ubuntu-trusty-64:/etc# uname -a
Linux vagrant-ubuntu-trusty-64 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
root@vagrant-ubuntu-trusty-64:/etc# dpkg -L Percona-Server-server-5.6 | grep init.d/mysql
/etc/init.d/mysql
root@vagrant-ubuntu-trusty-64:/etc# cat /etc/init.d/mysql | grep CONF
CONF=/etc/mysql/my.cnf

Skip access grants and replication

I am using the cookbook to setup a ci image with chef solo, and I want to have a root user with no password.

The access grants cookbook fails with
STDERR: Enter password: Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

It would be simple to have an attribute to just skip access grants and replication for cases like these. Is this something you would accept as a pr?

Plain text access passwords

Not an issue per say:

When setting up a Percona Server a file is created to properly set the user passwords:

https://github.com/phlipper/chef-percona/blob/master/recipes/access_grants.rb#L4

Now from a security standpoint, even when setting the file permissions very restrictive to root only, this is not a good idea.

I am wondering if there is another solution than writing out all granted permissions into a template and then loading this file via mysql.

Besides the fact that we have a plain text file with all main passwords on disk we also were unable to change the root password. Could this be a limitation by chef itself? Once we update the password the machine does not have the old root password available in order to setup a new password, correct?

I am open for suggestions how this could be solved.

Split percona tools into separate cookbook

I'm hitting this with xtrabackup, but it likely applies to any percona tools that don't necessarily require percona itself. For example, xtrabackup should work with mysql-server as well.

The problem is that chef seems to load all attributes, even if we're not including the corresponding recipes. So while we can run percona::backup without having percona::server in the run_list, chef still loads the attributes and therefore overrides the mysql server packages in that specific attribute.

Maybe chef shouldn't work like this, but rather than adding complexity to get around it, I was wondering how you might feel about splitting tools that don't require percona into another cookbook, perhaps called percona-utils or percona-tools.

Thoughts?

User defined encrypted data bag not being found for password template

Instead of using the default data bag passwords, I created a data bag named 'foo'. I could not get the passwords to populate and had other recipes accessing that databag with the supplied key.

After debugging libraries/passwords.rb for hours, it worked with the following change:

Original

  def find_password(key, user, default = nil)
    begin
      # first, let's check for an encrypted data bag and the given key
      passwords = Chef::EncryptedDataBagItem.load(@bag, key)
      # now, let's look for the user password
      password = passwords[user] ### PROBLEM HERE
    rescue
      Chef::Log.info("Using non-encrypted password for #{user}, #{key}")
    end
    # password will be nil if no encrypted data bag was loaded
    # fall back to the attribute on this node
    password ||= default
  end

Modified:

  def find_password(key, user, default = nil)
    begin
      # first, let's check for an encrypted data bag and the given key
      passwords = Chef::EncryptedDataBagItem.load(@bag, key)
      # now, let's look for the user password
      password = passwords[key][user] # ADDED THE KEY REFERENCE
    rescue
      Chef::Log.info("Using non-encrypted password for #{user}, #{key}")
    end
    # password will be nil if no encrypted data bag was loaded
    # fall back to the attribute on this node
    password ||= default
  end

Not sure how this works normally, but when you define your own custom bag, it failed.. or atleast for me it did.

run failed with Run List is [recipe[percona], recipe[percona::server], recipe[percona::cluster]]

Hi everybody.

I trying to use this cookbook for my nodes but stuck with this issue :

{{{
[Wed, 13 Jun 2012 17:08:56 +0200] INFO: Processing package[percona-xtradb-cluster-server-5.5] action install (percona::cluster line 4)
[Wed, 13 Jun 2012 17:09:38 +0200] ERROR: package[percona-xtradb-cluster-server-5.5](percona::cluster line 4) has had an error
[Wed, 13 Jun 2012 17:09:38 +0200] ERROR: package[percona-xtradb-cluster-server-5.5](/var/cache/chef/cookbooks/percona/recipes/cluster.rb:4:in from_file') had an error: package[percona-xtradb-cluster-server-5.5](percona::cluster line 4) had an error: Chef::Exceptions::Exec: apt-get -q -y --force-yes install percona-xtradb-cluster-server-5.5=5.5.24-23.6-341.lucid returned 100, expected 0 /usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:128:in handle_command_failures'
/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:75:inrun_command' /usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:143:in run_command_with_systems_locale'
/usr/lib/ruby/vendor_ruby/chef/provider/package/apt.rb:94:ininstall_package' /usr/lib/ruby/vendor_ruby/chef/provider/package.rb:59:in action_install'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:454:insend' /usr/lib/ruby/vendor_ruby/chef/resource.rb:454:in run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:49:inrun_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:85:in converge'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:85:ineach' /usr/lib/ruby/vendor_ruby/chef/runner.rb:85:in converge'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:incall' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call_iterator_block'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:instep' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in iterate'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:ineach_with_index' /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:80:inconverge' /usr/lib/ruby/vendor_ruby/chef/client.rb:330:in converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:163:inrun' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:254:in run_application'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:241:inloop' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:241:in run_application'
/usr/lib/ruby/vendor_ruby/chef/application.rb:70:in`run'
/usr/bin/chef-client:25
[Wed, 13 Jun 2012 17:09:38 +0200] ERROR: Running exception handlers
[Wed, 13 Jun 2012 17:09:38 +0200] FATAL: Saving node information to /var/cache/chef/failed-run-data.json
[Wed, 13 Jun 2012 17:09:38 +0200] ERROR: Exception handlers complete
[Wed, 13 Jun 2012 17:09:38 +0200] ERROR: Chef::Exceptions::Exec: package[percona-xtradb-cluster-server-5.5](percona::cluster line 4) had an error: Chef::Exceptions::Exec: apt-get -q -y --force-yes install percona-xtradb-cluster-server-5.5=5.5.24-23.6-341.lucid returned 100, expected 0
[Wed, 13 Jun 2012 17:09:38 +0200] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out
[Wed, 13 Jun 2012 17:09:38 +0200] ERROR: Sleeping for 1800 seconds before trying again
}}}

The node running under a 10.04 LTS

Any advices ?

Best regards.

Make percona version tunable via attribute

This will replace #9 for clarity.
cc: @masv @TheSerapher @phlipper

Going to submit a patch for this in the vein of this snippet:
https://github.com/myplanetdigital/chef-percona/blob/master/attributes/default.rb#L33-L46

Can definitely augment the tests so that we run some basic checks for each version.

This will either go in suites for test-kitchen...
https://github.com/phlipper/chef-percona/blob/master/.kitchen.yml#L28-L48

Or the travis.yml file itself like we do for chef versions...
https://github.com/phlipper/chef-percona/blob/master/.travis.yml#L12-L13
https://github.com/phlipper/chef-percona/blob/master/.kitchen.yml#L11

Will have to test to see which makes more sense

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.