{"id":13681019,"url":"https://github.com/voxpupuli/puppet-proxysql","last_synced_at":"2025-04-30T02:34:00.046Z","repository":{"uuid":"73965228","full_name":"voxpupuli/puppet-proxysql","owner":"voxpupuli","description":"Puppet module to configure ProxySQL","archived":false,"fork":false,"pushed_at":"2024-04-12T11:44:10.000Z","size":539,"stargazers_count":15,"open_issues_count":21,"forks_count":56,"subscribers_count":44,"default_branch":"master","last_synced_at":"2024-04-13T23:10:39.917Z","etag":null,"topics":["amazon-puppet-module","centos-puppet-module","debian-puppet-module","hacktoberfest","linux-puppet-module","oraclelinux-puppet-module","puppet","redhat-puppet-module","scientific-puppet-module","ubuntu-puppet-module"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voxpupuli.png","metadata":{"files":{"readme":"README.markdown","changelog":"CHANGELOG.md","contributing":".github/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},"funding":{"open_collective":"vox-pupuli","github":"voxpupuli"}},"created_at":"2016-11-16T22:02:48.000Z","updated_at":"2024-04-15T07:15:17.449Z","dependencies_parsed_at":"2023-12-19T08:34:28.895Z","dependency_job_id":"da0b0979-cdfd-4d3a-9eb9-45f16fb23c9a","html_url":"https://github.com/voxpupuli/puppet-proxysql","commit_stats":{"total_commits":364,"total_committers":44,"mean_commits":8.272727272727273,"dds":0.771978021978022,"last_synced_commit":"c964e4f08f51f1139fa63a4bdd90a25eaaad3513"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-proxysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-proxysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-proxysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-proxysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpupuli","download_url":"https://codeload.github.com/voxpupuli/puppet-proxysql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":199129553,"owners_count":13554151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["amazon-puppet-module","centos-puppet-module","debian-puppet-module","hacktoberfest","linux-puppet-module","oraclelinux-puppet-module","puppet","redhat-puppet-module","scientific-puppet-module","ubuntu-puppet-module"],"created_at":"2024-08-02T13:01:25.072Z","updated_at":"2024-11-12T00:30:37.088Z","avatar_url":"https://github.com/voxpupuli.png","language":"Ruby","funding_links":["https://opencollective.com/vox-pupuli","https://github.com/sponsors/voxpupuli"],"categories":["Ruby"],"sub_categories":[],"readme":"# Puppet module for ProxySQL\n\n[![CI](https://github.com/voxpupuli/puppet-proxysql/actions/workflows/ci.yml/badge.svg)](https://github.com/voxpupuli/puppet-proxysql/actions/workflows/ci.yml)\n[![Code Coverage](https://coveralls.io/repos/github/voxpupuli/puppet-proxysql/badge.svg?branch=master)](https://coveralls.io/github/voxpupuli/puppet-proxysql)\n[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/proxysql.svg)](https://forge.puppet.com/puppet/proxysql)\n[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/proxysql.svg)](https://forge.puppet.com/puppet/proxysql)\n[![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/proxysql.svg)](https://forge.puppet.com/puppet/proxysql)\n[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/proxysql.svg)](https://forge.puppet.com/puppet/proxysql)\n\n## Table of Contents\n\n1. [Overview](#overview)\n2. [Setup - The basics of getting started with proxysql](#setup)\n    * [Setup requirements](#setup-requirements)\n    * [Beginning with proxysql](#beginning-with-proxysql)\n3. [Usage - Configuration options and additional functionality](#usage)\n4. [Reference - An under-the-hood peek at what the module is doing and how](#reference)\n5. [Limitations - OS compatibility, etc.](#limitations)\n6. [Development - Guide for contributing to the module](#development)\n\n## Overview\n\nThe proxysql module installs, configures and manages the [ProxySQL](https://github.com/sysown/proxysql) service.\n\nThis module will install the ProxySQL and manage it's configuration. It also extends Puppet to be able to manage `mysql_users`, `mysql_servers`, `mysql_replication_hostgroups`, `mysql_galera_hostgroups`, `mysql_query_rules`, `proxysql_servers`, `scheduler` and `global_variables`.\n\n## Setup\n\n### Setup Requirements\n\nThe module requires Puppet 5.5.8 and above. It also depends on:\n\n* [puppetlabs/mysql](https://forge.puppet.com/puppetlabs/mysql)\n* [puppetlabs/apt](https://forge.puppet.com/puppetlabs/apt) - (Not strictly required on non Debian based systems)\n* [puppetlabs/stdlib](https://forge.puppet.com/puppetlabs/stdlib)\n* [camptocamp/systemd](https://forge.puppet.com/camptocamp/systemd)\n\nFor up to date details on external dependencies, please see the [metadata.json](https://github.com/voxpupuli/puppet-proxysql/blob/master/metadata.json) or for released versions, the [puppet forge page](https://forge.puppet.com/puppet/proxysql/dependencies).\n\n[puppet/selinux](https://forge.puppet.com/puppet/selinux) is an optional `soft` dependency and not even listed in the [metadata.json](https://github.com/voxpupuli/puppet-proxysql/blob/master/metadata.json). No Operating Systems *require* this module to be present, but if it is, it will be used to install SELinux rules that allow logrotate to work. See [manage\\_selinux](REFERENCE.md#-proxysql--manage_selinux)\n\n### Beginning with proxysql\n\nTo install the ProxySQL software with all the default options:\n\n```puppet\ninclude proxysql\n```\n\nBy default, packages come from the official upstream package repositories which the module will configure.\nOn new installations, (by default), the 2.7.x repository will be configured. If ProxySQL is already installed, then the repository matching the currently installed version\nwill be used.\n\nTo use your Operating System's own packages set `manage_repo =\u003e false`.\n\n```puppet\nclass { 'proxysql':\n  manage_repo =\u003e false,\n}\n```\n\nor you can configure your own repository by eg. declaring your own `yumrepo`, `pulp_rpmbind` or `rhn_channel` resource and setting `manage_repo =\u003e false`.\n\nFor example, using `pulp` and [katello/pulp](https://forge.puppet.com/katello/pulp)\n\n```puppet\npulp_rpmbind { 'my_proxysql_repo':}\n\nclass { 'proxysql':\n  manage_repo =\u003e false,\n  require     =\u003e Pulp_rpmbind['my_proxysql_repo'],\n}\n```\n\nAlternatively, you can specify a `package_source` and associated options.  This mimics the old, (pre version 4), behaviour of this module.\n\n```puppet\nclass { 'proxysql':\n  package_source         =\u003e 'https://github.com/sysown/proxysql/releases/download/v1.4.11/proxysql_1.4.11-debian9_amd64.deb',\n  package_checksum_value =\u003e '65a3c2b98eefa42946ee59eef18ba18534c2a39d',\n  package_checksum_type  =\u003e 'sha1',\n}\n```\n\nYou can customize options such as (but not limited to) `listen_port`, `admin_password`, `monitor_password`, ...\n\n```puppet\n  class { 'proxysql':\n    listen_port              =\u003e 3306,\n    admin_password           =\u003e Sensitive('654321'),\n    monitor_password         =\u003e Sensitive('123456'),\n    override_config_settings =\u003e $override_settings,\n  }\n```\n\nYou can configure users\\hostgroups\\rules\\schedulers using class parameters\n\n```puppet\n  class { 'proxysql':\n     mysql_servers    =\u003e [\n       {\n         'db1' =\u003e {\n           'port' =\u003e 3306,\n           'hostgroup_id' =\u003e 1,\n         }\n       },\n       {\n         'db2' =\u003e {\n           'hostgroup_id' =\u003e 2,\n         }\n       },\n     ],\n     mysql_users      =\u003e [\n       {\n         'app' =\u003e {\n           'password' =\u003e '*92C74DFBDA5D60ABD41EFD7EB0DAE389F4646ABB',\n           'default_hostgroup' =\u003e 1,\n         }\n       },\n       {\n         'ro'  =\u003e {\n           'password' =\u003e mysql_password('MyReadOnlyUserPassword'),\n           'default_hostgroup' =\u003e 2,\n         }\n       },\n     ],\n     mysql_hostgroups =\u003e [\n       {\n         '1-2' =\u003e {\n           'writer' =\u003e 1,\n           'reader' =\u003e 2,\n         }\n       },\n     ],\n     mysql_group_replication_hostgroups =\u003e [\n       {\n         'hostgroup 2' =\u003e {\n           'reader'  =\u003e 10,\n           'writer'  =\u003e 5,\n           'backup'  =\u003e 2,\n           'offline' =\u003e 11,\n         }\n       },\n     ],\n     mysql_galera_hostgroups =\u003e [\n       {\n         'galera hostgroup 1' =\u003e {\n           'writer'  =\u003e 1,\n           'backup'  =\u003e 2,\n           'reader'  =\u003e 3,\n           'offline' =\u003e 4,\n         }\n       },\n     ],\n     mysql_rules      =\u003e [\n       {\n         'mysql_query_rule-1' =\u003e {\n           'rule_id'         =\u003e 1,\n           'match_pattern'   =\u003e 'testtable',\n           'replace_pattern' =\u003e 'test.newtable',\n           'apply'           =\u003e 1,\n           'active'          =\u003e 1,\n         }\n       },\n     ],\n     schedulers       =\u003e [\n       {\n         'scheduler-1' =\u003e {\n           'scheduler_id'  =\u003e 1,\n           'active'        =\u003e 0,\n           'filename'      =\u003e '/usr/bin/whoami',\n         }\n       },\n     ],\n```\n\nOr by using individual resources:\n\n```puppet\n  class { 'proxysql':\n    listen_port    =\u003e 3306,\n    admin_password =\u003e Sensitive('SuperSecretPassword'),\n  }\n\n  proxy_mysql_server { '192.168.33.31:3306-31':\n    hostname     =\u003e '192.168.33.31',\n    port         =\u003e 3306,\n    hostgroup_id =\u003e 31,\n  }\n\n  proxy_mysql_server { '192.168.33.32:3306-31':\n    hostname     =\u003e '192.168.33.32',\n    port         =\u003e 3306,\n    hostgroup_id =\u003e 31,\n  }\n\n  proxy_mysql_server { '192.168.33.33:3306-31':\n    hostname     =\u003e '192.168.33.33',\n    port         =\u003e 3306,\n    hostgroup_id =\u003e 31,\n  }\n\n  proxy_mysql_server { '192.168.33.34:3306-31':\n    hostname     =\u003e '192.168.33.34',\n    port         =\u003e 3306,\n    hostgroup_id =\u003e 31,\n  }\n\n  proxy_mysql_server { '192.168.33.35:3306-31':\n    hostname     =\u003e '192.168.33.35',\n    port         =\u003e 3306,\n    hostgroup_id =\u003e 31,\n  }\n\n  proxy_mysql_replication_hostgroup { '30-31':\n    writer_hostgroup =\u003e 30,\n    reader_hostgroup =\u003e 31,\n    comment          =\u003e 'Replication Group 1',\n  }\n\n  proxy_mysql_replication_hostgroup { '20-21':\n    writer_hostgroup =\u003e 20,\n    reader_hostgroup =\u003e 21,\n    comment          =\u003e 'Replication Group 2',\n  }\n\n  proxy_mysql_group_replication_hostgroup { '5-2-10-11':\n    reader_hostgroup        =\u003e 10,\n    writer_hostgroup        =\u003e 5,\n    backup_writer_hostgroup =\u003e 2,\n    offline_hostgroup       =\u003e 11,\n  }\n\n  proxy_mysql_galera_hostgroup { '1-2-3-4':\n    writer_hostgroup        =\u003e 1,\n    backup_writer_hostgroup =\u003e 2,\n    reader_hostgroup        =\u003e 3,\n    offline_hostgroup       =\u003e 4,\n  }\n\n  proxy_mysql_user { 'tester':\n    password          =\u003e 'testerpwd',\n    default_hostgroup =\u003e 30,\n  }\n\n  proxy_mysql_query_rule { 'mysql_query_rule-1':\n    rule_id               =\u003e 1,\n    match_pattern         =\u003e '^SELECT',\n    apply                 =\u003e 1,\n    active                =\u003e 1,\n    destination_hostgroup =\u003e 31,\n  }\n\n  proxy_scheduler { 'scheduler-1':\n    scheduler_id =\u003e 1,\n    active       =\u003e 0,\n    filename     =\u003e '/usr/bin/whoami',\n  }\n\n  proxy_scheduler { 'scheduler-2':\n    scheduler_id =\u003e 2,\n    active       =\u003e 0,\n    interval_ms  =\u003e 1000,\n    filename     =\u003e '/usr/bin/id',\n  }\n```\n\n## Usage\n\nConfiguration is done by the `proxysql` class.\n\n### Customize config settings\n\nYou can override any configuration setting by using the `override_config_settings` hash. This hash resembles the structure of the `proxysql.cnf` file\n\n```puppet\n{\n    admin_variables =\u003e {\n      refresh_interval =\u003e 2000,\n      ...\n    },\n    mysql_variables =\u003e {\n      monitor_writer_is_also_reader =\u003e false,\n      ...\n    },\n    mysql_servers =\u003e {\n      '127.0.0.1:33061-1' =\u003e {\n         'address'      =\u003e '127.0.0.1',\n         'port'         =\u003e 33061,\n         'hostgroup_id' =\u003e 1,\n       },\n      '127.0.0.1:33062-1' =\u003e {\n         'address'      =\u003e '127.0.0.1',\n         'port'         =\u003e 33062,\n         'hostgroup_id' =\u003e 1,\n       },\n      ...\n    },\n    mysql_users =\u003e { ... },\n    mysql_query_rules =\u003e { ... },\n    scheduler =\u003e { ... },\n    mysql_replication_hostgroups =\u003e { ... },\n    mysql_galera_hostgroups =\u003e { ... },\n\n}\n```\n\n## Reference\n\nsee [REFERENCE.md](REFERENCE.md)\n\n### `proxysql\\_runtime` fact\n\nThis module ships a fact that you may find useful in your profiles.  It is not used by the module itself.\nThe `proxysql_runtime` fact queries ProxySQL and returns a hash containing the contents of several of the [runtime tables](https://github.com/sysown/proxysql/wiki/Main-(runtime)).\n\nThe fact will only return data if the [mysql2](https://rubygems.org/gems/mysql2) library is installed in your puppet agent's gem environment.\n\nFor systems using official puppet packages, (All In One packages), the following code can be used to install this gem and make the fact\navailable.\n\n```puppet\n$dev_packages = ['mariadb-devel','make','gcc']\nensure_packages($dev_packages)\n\npackage { 'mysql2 gem':\n  ensure   =\u003e present,\n  name     =\u003e 'mysql',\n  provider =\u003e 'puppet_gem',\n  require  =\u003e Package[$dev_packages],\n}\n```\n\n## Limitations\n\nThe module requires Puppet 5.5 or above. The `proxysql_runtime` fact only works when using the default value for `mycnf_file_name`.\n\n## Development\n\nThis module is originally developed by [Matthias Crauwels](mailto:matthias@crauwels.net) for use at [Ghent University, Belgium](http://www.ugent.be). This module is published under the Apache 2.0 license.\nIt is now maintained by [Vox Pupuli](https://voxpupuli.org)\n\nWe are open to feature requests, bug reports, contributions, etc...\n\n## Contributors\n\nOriginal author: Matthias Crauwels\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-proxysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpupuli%2Fpuppet-proxysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-proxysql/lists"}