Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ability to split config into 2 files #60

Merged
merged 9 commits into from
Sep 10, 2018

Conversation

MaxFedotov
Copy link
Contributor

@MaxFedotov MaxFedotov commented Aug 23, 2018

Added ability to create two different config files, if variable $split_configis set to true - one for admin\mysql variables (controlled by $config_file and $manage_config_file variables), another for servers\users\hostgroups\scheduler\rules params of ProxySQL (controlled by $proxy_config_file and manage_proxy_config_file variables) . This was done to allow management of main config file by puppet and manage all proxy configuration settings by some external provider (for example, consul-template, bash script), as this file needs to be updated in more frequent intervals that actual puppet agent interval (e.g. for each failover)
Also added creation of sys_owner user and sys_group group in install.pp to fix possible errors if this groups doesn't exists.
Added package_name and package_ensure, because got problems with mariadb conflicting package trying to install during puppet run.
Added reload_config manifest to allow dynamic config reload

@@ -27,6 +36,8 @@
}

class { '::mysql::client':
package_name => 'mysql-client',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardcoding like this will break for RedHat/CentOS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also duplicated in #58

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered in #58

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove it from this PR and keep the fix in #58. Agreed?

Copy link
Contributor Author

@MaxFedotov MaxFedotov Aug 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, as will be changed to variable in #58

manifests/reload_config.pp Show resolved Hide resolved
@@ -132,8 +143,11 @@
String $monitor_username = $::proxysql::params::monitor_username,
Sensitive[String] $monitor_password = $::proxysql::params::monitor_password,

Boolean $split_config = $::proxysql::params::split_config,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the leading ::

<%
end
else
default_handler.call(k, v)
end
end
-%>

<% if scope.lookupvar('::proxysql::split_config') == true -%>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work as well:

if @proxysql::split_config == true

@@ -0,0 +1,56 @@
<%
default_handler = Proc.new do |k, v|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please migrate this to an epp() template? We require that for new templates. Quote from our docs:

Is a new template added? The preferred language is epp, not erb

@bastelfreak bastelfreak added enhancement New feature or request needs-work not ready to merge just yet labels Aug 31, 2018
@MaxFedotov MaxFedotov force-pushed the configs_separation branch 6 times, most recently from b25c7ba to e1da828 Compare September 1, 2018 14:04
@MaxFedotov
Copy link
Contributor Author

Review notes applied - changed all $:: to $. Changed to facts[] instead of $::. Changed scope.lookupvar() in proxysql.cnf.erb. Moved proxysql_proxy.cnf.erb to proxysql_proxy.cnf.epp

@mcrauwel
Copy link
Member

mcrauwel commented Sep 2, 2018

@MaxFedotov can you rebase on the current master?

@MaxFedotov
Copy link
Contributor Author

Hi,
I've rebased on current master.
But can you please take a look on tests? Everything is working when i test module installation locally.

@mcrauwel
Copy link
Member

mcrauwel commented Sep 3, 2018

now let's rebase this. I will try to find the issue in the tests...

@MaxFedotov
Copy link
Contributor Author

done, but errors are the same

@bastelfreak
Copy link
Member

2018-09-03-175609_602x349_scrot

mhm, travis is trolling me at the moment.

ensure => 'present',
}

user { $::proxysql::sys_owner:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not add leading ::

@@ -158,6 +168,11 @@
String $monitor_username = $proxysql::params::monitor_username,
Sensitive[String] $monitor_password = $proxysql::params::monitor_password,

Boolean $split_config = $proxysql::params::split_config,

String $proxy_config_file = $proxysql::params::proxy_config_file,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use String[1]? Otherwise empty string is allowed as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this is a path. Please use Stdlib::Absolutepath here.

SAVE MYSQL VARIABLES TO DISK; \"
",
subscribe => $subscribe,
require => [ Service[$::proxysql::service_name] , File['root-mycnf-file'] ],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not add leading ::

@MaxFedotov
Copy link
Contributor Author

MaxFedotov commented Sep 4, 2018

Still got this :(
Failure/Error: it { is_expected.to compile.with_all_deps }
dependency cycles found: (File[/etc/apt/sources.list.d/proxysql_repo.list] => Apt::Setting[list-proxysql_repo] => Apt::Source[proxysql_repo] => Class[Proxysql::Repo] => Class[Proxysql::Install] => Group[root] => File[/etc/apt/sources.list.d/proxysql_repo.list])

and + when using stdlib got:
An error occurred while loading ./spec/acceptance/class_spec.rb.
Failure/Error: install_module_dependencies_on(hosts)
Beaker::Host::CommandFailure:
Host 'ubuntu1404-64-1' exited with 1 running:
puppet module install puppetlabs-stdlib -v 5.0.0
Last 10 lines of output were:
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Error: Could not install module 'puppetlabs-stdlib' (v5.0.0)
Module 'puppetlabs-stdlib' (v4.25.1) is already installed
Use puppet module upgrade to install a different version
Use puppet module install --force to re-install only this module

@MaxFedotov
Copy link
Contributor Author

@bastelfreak were you able to fix problems with Travis?

metadata.json Outdated
@@ -12,6 +12,10 @@
"name": "puppetlabs-mysql",
"version_requirement": ">= 2.5.0 < 7.0.0"
},
{
"name": "puppetlabs-stdlib",
"version_requirement": ">= 1.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to remove this now or wait for releases from puppetlabs: #65

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this for now and i will create another PR, which will add this and can be merged later :)

@MaxFedotov
Copy link
Contributor Author

MaxFedotov commented Sep 6, 2018

made rebase on master. Still got errors

@bastelfreak
Copy link
Member

@mcrauwel can you look into this? Is master broken?

@mcrauwel
Copy link
Member

mcrauwel commented Sep 8, 2018

master is ok, so it must be something in the PR, it's only happening on deb based systems hence some tests (RHEL/CentOS) are successful

@MaxFedotov
Copy link
Contributor Author

I have no errors when installing it on centos. Will check PR one more time again tomorrow

@mcrauwel
Copy link
Member

mcrauwel commented Sep 8, 2018

@MaxFedotov you can run the acceptance test locally for the deb env's I used this:

export PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker
bundle exec rake beaker

these env variables are coming from the .travis.yml file

@mcrauwel
Copy link
Member

mcrauwel commented Sep 8, 2018

current issue looks like a bug in the debian8 package for proxysql...

@mcrauwel
Copy link
Member

mcrauwel commented Sep 8, 2018

created upstream issue sysown/proxysql#1679

@bastelfreak
Copy link
Member

should we, for now, remove debian 8 from .travis.yml/metadata.json? So we could merge this now and later add it back. This would allow us to do a new release finally.

@mcrauwel
Copy link
Member

mcrauwel commented Sep 8, 2018 via email

@mcrauwel
Copy link
Member

mcrauwel commented Sep 8, 2018

update: i found the error and opened an upstream PR sysown/proxysql#1680

@mcrauwel
Copy link
Member

Hooray! Thanks for your contributions @MaxFedotov and thanks for the help @bastelfreak!

@mcrauwel mcrauwel merged commit 5bdf86f into voxpupuli:master Sep 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-work not ready to merge just yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants