voxpupuli / puppet-proxysql

Puppet module to configure ProxySQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ubuntu support

ryanmasse opened this issue · comments

Hi,

We'd like to be able to take advantage of this project for our environment. I was hoping someone could point me in the right direction as to what it would take to make this project compatible with Ubuntu Xenial in hopes of submitting a PR.

Thanks!

Hi @slopokeit, the current version on master should support Ubuntu (12.04, 14.04 and 16.04). Test it out when you have time and do provide feedback.

I'm preparing a new release to the Puppet Forge (v1.2.0). The PR #19 is open and I'm waiting for a reviewer to approve it.

Thanks for the quick feedback! I whipped up a quick test and was able to get ProxySQL installed on Ubuntu 16.04.

I had to mess about with the defaults in the config params a bit to get compatibility with Ubuntu. A couple items worth mentioning for the next guy:

  1. Proxysql installs as proxysql:proxysql so we need to change the config params to refer to the non-root user.
  2. Despite instructing the config to load the admin iface to use /tmp/proxysql_admin.sock no such socket get's created on the agent. As a workaround, I disabled the admin socket in favor of the port.

Below is a crude working example with a valid package repository.

    class { '::proxysql':        
        listen_port             => 3306,
        sys_owner               => 'proxysql',
        sys_group               => 'proxysql',
        admin_listen_socket     => '',
        repo                    => {
                'debs_proxysql_repo' => {
                        comment  => 'Percona repo',
                        location => 'http://repo.percona.com/apt',
                        repos    => 'main',
                },      
        },
    }

Thanks for stewarding this project.. It will undoubtedly come in handy!

@mcrauwel might have discovered an issue. Not matter what is supplied for the admin user and password, they appear to be ignored and the proxysql defaults loaded.

@slopokeit: did you credentials get setup when first running proxysql? No matter what you put in the configfile, the config file is only used by proxysql when it starts the first time. Afterwards it just reads it's SQLite database... The solution for this is starting proxysql with the --reload option, that will force the configfile to be re-parsed and merged with the SQLite database... (see https://github.com/sysown/proxysql/wiki/Multi-layer-configuration-system#startup)

You could always set the admin password with the proxy_global_variable provider... But that might get you in trouble since this uses the credentials in /root/.my.cnf at they will not be accurate I think. I've been looking for solutions for this issue myself, but couldn't come up with one yet... I'm open to suggestions...

the socket problem I can not reproduce:

root@ubuntu1604:~# ls -hal /tmp/proxysql*
srwxrwxrwx 1 root root 0 Mar 20 06:57 /tmp/proxysql_admin.sock
srwxrwxrwx 1 root root 0 Mar 20 06:57 /tmp/proxysql.sock

maybe the same issue as with the admin-password?

@mcrauwel: to your question, no the credentials do not get setup properly on a fresh install.

For brevity I've pasted the cli output supporting this at http://pastebin.com/raw/dDLQTrRK

I suspect the culprit is the sequence of events below. As we know, we really only have one crack at loading the admin credentials from the config file on first start. My interpretation of the logs suggest that the service is started/refreshed before the config file from puppet is loaded onto the server.

Notice: /Stage[main]/Proxysql::Install/Package[proxysql]/ensure: created
Notice: /Stage[main]/Proxysql::Install/File[proxysql-datadir]/mode: mode changed '0755' to '0700'
Info: Class[Proxysql::Install]: Scheduling refresh of Class[Proxysql::Service]
Notice: /Stage[main]/Proxysql::Config/File[proxysql-config-file]/content:

I couldn't find anything obvious when inspecting manifests/init.php that would have resulting in this sequence.

I've added some requires on the configfiles to fix the ordering... Can you try now?

@mcrauwel: the result was no different.

I haven't quite nailed it down, but I suspect this has more to do with the Percona package as opposed to the puppet manifest. Percona's package creates an /etc/proxysql-admin.cnf which exports a number of environment variables including the admin password which appears to override anything found in the main config.

To confirm my suspicion I tweaked the project source code removing all references to Percona and apt and changed install.pp to install the native package from https://github.com/sysown/proxysql/releases forcing:

    package { $::proxysql::package_name:
        provider => dpkg,
        ensure          => 'installed',
        source          => '/root/proxysql_1.3.4-ubuntu16_amd64.deb',
    }

Installing the native package gets us the result we expect. The admin and monitoring credentials are being respected.

Not sure what the best plan of action is.. Continue tweaking the manifests to support Percona? or recommend that Ubuntu users use the native package? Not sure what pros/cons might be.

It works (with the Percona package) in my vagrant box. Keep in mind that my commits are in te release branch/PR. Did you switch to that?

@mcrauwel totally my fault.. didn't switch branches after I fetched the PR... DERP!

Works like a charm now :) Thanks for being so attentive on this.. appreciate the help!