{"id":47927915,"url":"https://github.com/vinted/chef-proxysql","last_synced_at":"2026-04-04T07:00:19.463Z","repository":{"id":54548934,"uuid":"110138192","full_name":"vinted/chef-proxysql","owner":"vinted","description":"Chef ProxySQL cookbook with auto loading and comprehensive configuration","archived":false,"fork":false,"pushed_at":"2024-08-27T05:36:59.000Z","size":104,"stargazers_count":6,"open_issues_count":3,"forks_count":8,"subscribers_count":11,"default_branch":"master","last_synced_at":"2026-04-04T07:00:00.933Z","etag":null,"topics":["chef","cookbook","database","proxy","proxysql"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinted.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-09T16:18:49.000Z","updated_at":"2024-08-27T05:37:03.000Z","dependencies_parsed_at":"2024-08-27T06:43:56.220Z","dependency_job_id":"98a507a8-2180-458a-bed6-6b4905ed5b0f","html_url":"https://github.com/vinted/chef-proxysql","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/vinted/chef-proxysql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinted%2Fchef-proxysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinted%2Fchef-proxysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinted%2Fchef-proxysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinted%2Fchef-proxysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinted","download_url":"https://codeload.github.com/vinted/chef-proxysql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinted%2Fchef-proxysql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31390695,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chef","cookbook","database","proxy","proxysql"],"created_at":"2026-04-04T07:00:18.428Z","updated_at":"2026-04-04T07:00:19.400Z","avatar_url":"https://github.com/vinted.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ProxySQL Chef cookbook\n\nProxySQL is a high performance, high availability, protocol aware proxy\nfor MySQL and forks (like Percona Server and MariaDB).\n\n[![Build Status](https://travis-ci.org/vinted/chef-proxysql.svg?branch=master)](https://travis-ci.org/vinted/chef-proxysql)\n[![Cookbook Version](https://img.shields.io/cookbook/v/proxysql.svg)](https://supermarket.chef.io/cookbooks/proxysql)\n\nCookbook configures any number of ProxySQL instances, each instance has\nisolated configuration. ProxySQL instance is installed through Chef\nresource `protocol_service`.\n\nInstances are configured through node['proxysql'] attributes and/or\n`proxysql_*` block arguments. See the examples below.\n\nEach ProxySQL is automatically managed by Chef, on disk configuration\nchanges are propagated to instance admin and are loaded to runtime.\nCookbook propagates these SQL statements to load configuration.\nThere are two types of statements propagated pre and post.\n - `pre` statements load everything from configuration\n - `post` statements saves configuration to disk if `pre` statements\n   propagation was successful\n\n\u003e PRE\n\n```sql\nLOAD MYSQL USERS FROM CONFIG\nLOAD MYSQL USERS TO RUNTIME\nLOAD MYSQL SERVERS FROM CONFIG\nLOAD MYSQL SERVERS TO RUNTIME\nLOAD MYSQL QUERY RULES FROM CONFIG\nLOAD MYSQL QUERY RULES TO RUNTIME\nLOAD MYSQL VARIABLES FROM CONFIG\nLOAD MYSQL VARIABLES TO RUNTIME\nLOAD ADMIN VARIABLES FROM DISK\nLOAD ADMIN VARIABLES TO RUNTIME\n```\n\nOne can change statements in this attribute `node['proxysql']['pre_statements']`.\n\n\u003e POST\n\n```sql\nSAVE MYSQL USERS TO DISK\nSAVE MYSQL SERVERS TO DISK\nSAVE MYSQL VARIABLES TO DISK\nSAVE ADMIN VARIABLES TO DISK\n```\n\nOne can change statements in this attribute `node['proxysql']['post_statements']`.\n\n## Design\n\nThere are 5 special `proxysql_service` resource attributes.\n\n```\n# mysql_servers Hash\n# mysql_users Hash\n# mysql_query_rules Hash\n# schedulers Hash\n# mysql_replication_hostgroups Hash\n# proxysql_servers Hash\n```\n\nEach attribute must be of type Hash (validated) and\nassociated key value must be Array (validated).\nThis structure allows merging node,role,data_bag overrides into\nsingle one.\n\nFor example given.:\n\n```json\n{\n  \"name\": \"datacenter1\",\n  \"override_attributes\": {\n    \"proxysql\": {\n      \"config\": {\n        \"mysql_servers\": {\n          \"dc1\": [\n            { \"address\": \"/var/lib/mysql/mysql.sock\", \"hostgroup\": 1 }\n          ]\n        }\n      }\n    }\n  }\n}\n```\n\n```json\n{\n  \"name\": \"datacenter2\",\n  \"override_attributes\": {\n    \"proxysql\": {\n      \"config\": {\n        \"mysql_servers\": {\n          \"dc2\": [\n            { \"address\": \"127.0.0.1\", \"port\": 21892 , \"hostgroup\": 1 }\n          ]\n        }\n      }\n    }\n  }\n}\n```\n\nThese two roles `datacenter1` and `datacenter2` attributes will be merged\nso the final `CNF` configuration will be.\n\n```cnf\nmysql_servers=(\n{\n  address=\"/var/lib/mysql/mysql.sock\"\n  hostgroup=1\n},\n{\n  address=\"127.0.0.1\"\n  port=21892\n  hostgroup=1\n}\n)\n```\n\n## Installation\n\nCookbook assumes `monitor` user is created on each database server.\n\nInclude this line in metadata.rb\n\n```ruby\ndepends 'proxysql'\n```\n\nThere are 2 ways to use this cookbook resources.\n\n1. Include default recipe and manipulate node['proxysql'] attributes.\n\n```ruby\ninclude_recipe 'proxysql::default'\n```\n\n2. Use resource in any recipe.\n\n```ruby\nproxysql_service 'default' do\n  # ...\nend\n```\n\n## Requirements\n\n - Systemd\n - MySQL client (for loading configuration from disk to proxysql)\n\n## Resources\n\n```ruby\nproxysql_service 'any name' do\n  # user String\n  # group String\n  # data_dir String\n  # config_dir String\n\n  # version String\n  # package_release String\n  # lock_version TrueClass, FalseClass\n  # pre_statements Array\n  # post_statements Array\n  # bin String\n  # admin_socket [String, NilClass]\n  # flags Hash\n  # admin_variables Hash\n  # mysql_variables Hash\n  # mysql_servers Hash\n  # mysql_users Hash\n  # mysql_query_rules Hash\n  # schedulers Hash\n  # mysql_replication_hostgroups Hash\n  # proxysql_servers Hash\n\n  # service_name String\n  # service_unit_after Array\n  # service_limit_core Integer\n  # service_limit_nofile Integer\n  # service_timeout_sec Integer\n  # service_restart String\nend\n```\n\n```ruby\nproxysql_admin_config 'eu1' do\n  # user String\n  # group String\n  # data_dir String\n  # config_dir String\n  # admin_username String\n  # admin_password String\n  # admin_hostname String\n  # admin_port Integer\n  # cluster_username String\n  # cluster_password String\n  # cluster_hostname String\n  # cluster_port Integer\n  # monitor_username String\n  # monitor_password String\n  # application_username String\n  # application_password String\n  # read_hostgroup_id String\n  # write_hostgroup_id String\n  # read_write_mode String\nend\n```\n\n## Attributes\n\n```ruby\ndefault['proxysql']['version'] = '1.4.16'\n\ndefault['proxysql']['user'] = 'proxysql'\ndefault['proxysql']['group'] = 'proxysql'\n\ndefault['proxysql']['config_dir'] = '/etc/proxysql'\ndefault['proxysql']['data_dir'] = '/var/lib/proxysql'\n\ndefault['proxysql']['service']['flags'] = {\n  'exit-on-error' =\u003e false,\n  'no-monitor' =\u003e false,\n  'no-start' =\u003e false,\n  'reuseport' =\u003e true,\n  'idle-threads' =\u003e true,\n  'initial' =\u003e false,\n  'reload' =\u003e false,\n  'sqlite3-server' =\u003e false\n}\n\ndefault['proxysql']['config']['admin_variables'] = {}\ndefault['proxysql']['config']['mysql_variables'] = {}\n\n# Special node attributes must be in a form of:\n# {\n#   \"string\": [objects]\n# }\n# Hash key \"string\" must be of type String it is necessary for support\n# of multiple attributes, hash values then are merged into 1 and\n# gets casted to CNF.\ndefault['proxysql']['config']['mysql_servers'] = {}\ndefault['proxysql']['config']['mysql_users'] = {}\ndefault['proxysql']['config']['mysql_query_rules'] = {}\ndefault['proxysql']['config']['schedulers'] = {}\ndefault['proxysql']['config']['mysql_replication_hostgroups'] = {}\ndefault['proxysql']['config']['proxysql_servers'] = {}\n```\n\n## Examples\n\n```ruby\npass = 'suchsecret'\nfirst_port = 3300\nsecond_port = 3301\n\nservers = {\n  '2mysql' =\u003e [\n    {\n      address: '127.0.0.1',\n      'port' =\u003e first_port,\n      hostgroup: 1,\n      'max_connections' =\u003e 200\n    },\n    {\n      'address' =\u003e '127.0.0.1',\n      'port' =\u003e second_port,\n      'hostgroup' =\u003e 1\n    }\n  ]\n}\n\nusers = {\n  '2mysql' =\u003e [\n    {\n      username: 'root',\n      password: pass,\n      default_hostgroup: 2,\n      'active' =\u003e 1\n    }\n  ]\n}\n\nadmin_variables = {\n  admin_credentials: 'admin:admin',\n  'mysql_ifaces' =\u003e '127.0.0.1:6032'\n}\n\nvariables = {\n  'monitor_username' =\u003e 'monitor',\n  'monitor_password' =\u003e 'monitor'\n}\n\nproxysql_service '2balance' do\n  service_name 'proxysql-2balance'\n  admin_variables admin_variables\n  mysql_servers servers\n  mysql_users users\n  mysql_variables variables\nend\n```\n\n## License\n\nMIT License\n\nCopyright (c) 2018 Vinted\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinted%2Fchef-proxysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinted%2Fchef-proxysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinted%2Fchef-proxysql/lists"}