Giter VIP home page Giter VIP logo

chef-proxysql's People

Contributors

ernestas-poskus avatar ernestas-vinted avatar otani88 avatar vbalys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chef-proxysql's Issues

allow proxysql 2.x

currently this cookbook appears to be hardcoded for proxysql 1.x. would you take a PR for allowing this cookbook to install both 1.x and 2.x?

Open file default limit it limiting proxysq.

I ran into this problem with having 1500 connections on one of my systems. Proxysql was throwing errors and bringing the load to a halt.

The proxysql user default open files limit is 1024 and that restricts the number of db connections proxysql can handle. The guys at Proxysql suggested this in the systemd unit file:
LimitNOFILE=102400

Is there a way we can add extra options to the unit file that is being created by the proxysql cookbook so that we can change this value as needed?

Thanks!

Doesn't handle multiple admin interface declarations.

Me again. lol

I have had an issue when I set up multiple admin interfaces in the admin_variables section:
mysql_ifaces: '127.0.0.1:6032;/var/run/proxysql/proxysql.sock'

The code looks to see if there is a .sock in the string and then adds the string to the command that is used in the load-config command.

    connection = if admin_mysql_ifaces =~ /\.sock/
                   "--socket #{admin_mysql_ifaces}"
                 else
                   host, port = admin_mysql_ifaces.split(':')
                   "--host #{host} --port #{port}"
                 end

And I get this error:
mysql --user=admin --password=admin --socket localhost:6032;/var/run/proxysql/proxysql.sock returned 2

I have fixed it with this code:
connection = if admin_mysql_ifaces =~ /.sock/
iface = admin_mysql_ifaces.split(";").select {|inf| inf =~ /.sock/}
"--socket #{iface.first}"
else
host, port = admin_mysql_ifaces.split(':')
"--host #{host} --port #{port}"
end

Thanks again for this cookbook!

Multiple admin credentials feature fails in validation

While the multiple admin credential feature was added in #41, that update did not include fixes for the validation function to support multiple credentials in the admin_credential attribute.

Looking at:

if admin_credentials
if admin_credentials.split(':').size != 2
raise "Provide admin_variables['admin_credentials'] in a "\
"form of 'admin:admin'"
end
else
raise "Provide admin_variables['admin_credentials'] attribute"
end

you can see the if statement doesn't check for multiple credentials

Maybe something like:

if admin_credentials.split(';').first.split(':').size != 2

Though the above seems a bit ugly. Any other ideas?

Frozen Array Error

I was deploying a cookbook which included recipes from chef-proxysql and there were some issues, as you see in the stack trace and the logs below:

Compiling Cookbooks...

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb
================================================================================

FrozenError
-----------
can't modify frozen Array

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/poise/files/halite_gem/poise/helpers/subresources/container.rb:220:in `included'
  /var/chef/cache/cookbooks/poise/files/halite_gem/poise/resource.rb:51:in `include'
  /var/chef/cache/cookbooks/poise/files/halite_gem/poise/resource.rb:51:in `poise_subresource_container'
  /var/chef/cache/cookbooks/poise/files/halite_gem/poise.rb:93:in `block in Poise'
  /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb:8:in `include'
  /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb:8:in `<class:ProxysqlBaseService>'
  /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb:7:in `<class:Resource>'
  /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb:6:in `<class:Chef>'
  /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb:5:in `<top (required)>'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/poise/files/halite_gem/poise/helpers/subresources/container.rb:

213:                @container_default
214:              end
215:            end
216:
217:            def included(klass)
218:              super
219:              klass.extend(ClassMethods)
220>>             klass.const_get(:HIDDEN_IVARS) << :@subcontexts
221:              klass.const_get(:FORBIDDEN_IVARS) << :@subcontexts
222:            end
223:          end
224:
225:          extend ClassMethods
226:        end
227:      end
228:    end
229:  end

Additional information:
-----------------------
      Ruby objects are often frozen to prevent further modifications
      when they would negatively impact the process (e.g. values inside
      Ruby's ENV class) or to prevent polluting other objects when default
      values are passed by reference to many instances of an object (e.g.
      the empty Array as a Chef resource default, passed by reference
      to every instance of the resource).

      Chef uses Object#freeze to ensure the default values of properties
      inside Chef resources are not modified, so that when a new instance
      of a Chef resource is created, and Object#dup copies values by
      reference, the new resource is not receiving a default value that
      has been by a previous instance of that resource.

      Instead of modifying an object that contains a default value for all
      instances of a Chef resource, create a new object and assign it to
      the resource's parameter, e.g.:

      fruit_basket = resource(:fruit_basket, 'default')

      # BAD: modifies 'contents' object for all new fruit_basket instances
      fruit_basket.contents << 'apple'

      # GOOD: allocates new array only owned by this fruit_basket instance
      fruit_basket.contents %w(apple)


System Info:
------------
chef_version=14.14.29
platform=ubuntu
platform_version=18.04
ruby=ruby 2.5.7p206 (2019-10-01 revision 67816) [x86_64-linux]
program_name=chef-client worker: ppid=974;start=08:36:34;
executable=/opt/chef/bin/chef-client

As I looked this issue up, it appears that this was an issue with Poise 2.8.1 which is a dependency of this cookbook, as somebody asked the Poise maintainer in this issue and that issue was fixed in this commit which is a part of Poise 2.8.2 Release, so long story short, I will make a PR to bump the poise version in this cookbook's requirements to 2.8.2

Thanks.

load-config command fails on first chef run.

I have found the issue and have fixed it here: https://github.com/daveallen/chef-proxysql/blob/bf28b662378fae01686f14a3a08199a61157f200/libraries/proxysql_service.rb#L314-L325

The issue is that when an OS is using systemd it adds a systemd service when an init style service is added. So that when this is run: https://github.com/daveallen/chef-proxysql/blob/bf28b662378fae01686f14a3a08199a61157f200/libraries/proxysql_service.rb#L231-L242

systemctl is-active #{constructed_service_name} returns 'active' executing the load-config command before the service is in place and functioning.

The code I have added removes the initial systemd service that points to the init style service.

Version attribute not using wrapper cookbooks override.

The proxysql cookbook is setting this in the repository.rb attributes file:
default['proxysql']['package_version'] = "#{node['proxysql']['version']}-1.1.#{lsb_release}"

So when any other cookbooks set the ['proxysql']['version'] attribute the ['proxysql']['package_version'] attribute has already set with what is in the proxysql cookbook ignoring what the wrapper cookbook set.

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.