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

(MODULES-1550) add new Feature MySQL login paths #1295

Merged
merged 24 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c09a1ae
(MODULES-1550) add new Feature MySQL login paths for Mysql Community …
andreas-stuerz Apr 2, 2020
a6f8c92
(MODULES-1550) remove scripts directory
Apr 22, 2020
bf768e9
(MODULES-1550) add full stop to summary
Apr 22, 2020
5fa3556
Add net-ssh dependency gems to development group
Apr 27, 2020
0a8f005
Merge pull request #1297 from puppetlabs/pdksync_dependency_gems_update
daianamezdrea Apr 27, 2020
11abd6a
Revert "Puppet 4 functions"
alexjfisher Apr 28, 2020
5a70627
Remove legacy (old API) `mysql_password` function
alexjfisher Apr 28, 2020
dd49fdd
Merge pull request #1298 from alexjfisher/revert-1274-puppet_4_functions
david22swan Apr 30, 2020
39b7bde
Merge pull request #1299 from alexjfisher/remove_legacy_mysql_passwor…
david22swan Apr 30, 2020
db30274
(MODULES-10023) Fix multiple xtrabackup regressions (#1245)
fraenki May 12, 2020
6a7347b
(maint) - Pdk Update
May 12, 2020
d6c5363
(maint) - add back gems removed by pdk update
david22swan May 13, 2020
7f9bf78
Release version 10.5.0 (#1301)
david22swan May 13, 2020
b03fc2c
Manage the 'cron' package using ensure_package()
baldurmen May 13, 2020
7eab9e4
Merge pull request #1300 from puppetlabs/pdksync_PDK_UPDATE
daianamezdrea May 14, 2020
3610f44
Change provision from vmpooler to abs
May 18, 2020
d49e874
Switch to default spec_helper_acceptance file
May 18, 2020
f7b93a0
Update spec_helper_acceptance_local.rb
May 18, 2020
1529f91
Merge pull request #1302 from puppetlabs/pdksync_abs
sheenaajay May 18, 2020
4a056a8
Merge pull request #1269 from baldurmen/no_cron
sheenaajay May 19, 2020
9722116
(MODULES-1550) add new Feature MySQL login paths for Mysql Community …
andreas-stuerz Apr 2, 2020
c076179
(MODULES-1550) remove scripts directory
Apr 22, 2020
1592186
(MODULES-1550) add full stop to summary
Apr 22, 2020
0bbe3fe
Merge remote-tracking branch 'origin/master'
May 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ Style/BlockDelimiters:
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
be consistent then.
EnforcedStyle: braces_for_chaining
Style/BracesAroundHashParameters:
Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0.
See https://github.com/rubocop-hq/rubocop/pull/7643
Enabled: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this right?? Seems to directly contradict the change made in PDK.
puppetlabs/pdk-templates#329

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ignore this comment. It doesn't relate to this PR. Rebasing/merging must have gone a bit funny at some point to pull this in here.

Style/ClassAndModuleChildren:
Description: Compact style reduces the required amount of indentation.
EnforcedStyle: compact
Expand Down
1 change: 1 addition & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Gemfile:
git: https://github.com/skywinder/github-changelog-generator
ref: 20ee04ba1234e9e83eb2ffb5056e23d641c7a018
condition: Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
- gem: puppet-resource_api
Rakefile:
requires:
- puppet_pot_generator/rake_tasks
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"recommendations": [
"jpogran.puppet-vscode",
"puppet.puppet-vscode",
"rebornix.Ruby"
]
}
23 changes: 19 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,32 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v10.4.0](https://github.com/puppetlabs/puppetlabs-mysql/tree/v10.3.0) (2020-02-27)
## [v10.5.0](https://github.com/puppetlabs/puppetlabs-mysql/tree/v10.5.0) (2020-05-13)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/v10.3.0...v10.3.0)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/v10.4.0...v10.5.0)

### Added

- Support mariadb's ed25519-based authentication [\#1292](https://github.com/puppetlabs/puppetlabs-mysql/pull/1292) ([dciabrin](https://github.com/dciabrin))
- Allow changing the mysql-config-file group-ownership [\#1284](https://github.com/puppetlabs/puppetlabs-mysql/pull/1284) ([unki](https://github.com/unki))

### Fixed

- Remove legacy \(old API\) `mysql\_password` function [\#1299](https://github.com/puppetlabs/puppetlabs-mysql/pull/1299) ([alexjfisher](https://github.com/alexjfisher))
- Improve differences between generated mysql service id values [\#1293](https://github.com/puppetlabs/puppetlabs-mysql/pull/1293) ([ryaner](https://github.com/ryaner))
- \(MODULES-10023\) Fix multiple xtrabackup regressions [\#1245](https://github.com/puppetlabs/puppetlabs-mysql/pull/1245) ([fraenki](https://github.com/fraenki))
- Fix binarylog by allowing users to specify managed directories [\#1194](https://github.com/puppetlabs/puppetlabs-mysql/pull/1194) ([elfranne](https://github.com/elfranne))

## [v10.4.0](https://github.com/puppetlabs/puppetlabs-mysql/tree/v10.4.0) (2020-03-02)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/v10.3.0...v10.4.0)

### Added

- Allow adapting MySQL configuration file's permissions mode [\#1278](https://github.com/puppetlabs/puppetlabs-mysql/pull/1278) ([unki](https://github.com/unki))
- pdksync - \(FM-8581\) - Debian 10 added to travis and provision file refactored [\#1275](https://github.com/puppetlabs/puppetlabs-mysql/pull/1275) ([david22swan](https://github.com/david22swan))
- Puppet 4 functions [\#1274](https://github.com/puppetlabs/puppetlabs-mysql/pull/1274) ([binford2k](https://github.com/binford2k))
- Allow backupcompress for xtrabackup profile [\#1196](https://github.com/puppetlabs/puppetlabs-mysql/pull/1196) ([Spuffnduff](https://github.com/Spuffnduff))
- Enable module to not use default options [\#1192](https://github.com/puppetlabs/puppetlabs-mysql/pull/1192) ([mauricemeyer](https://github.com/mauricemeyer))
- Enable module to not use default options [\#1192](https://github.com/puppetlabs/puppetlabs-mysql/pull/1192) ([morremeyer](https://github.com/morremeyer))

## [v10.3.0](https://github.com/puppetlabs/puppetlabs-mysql/tree/v10.3.0) (2019-12-11)

Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ group :development do
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-lint-i18n", require: false
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
gem 'ed25519', '>= 1.2', '< 2.0'
gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0'
gem "puppet-resource_api", require: false
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [Install Percona server on CentOS](#install-percona-server-on-centos)
* [Install MariaDB on Ubuntu](#install-mariadb-on-ubuntu)
* [Install Plugins](#install-plugins)
* [Use Percona XtraBackup](#use-percona-xtrabackup)
4. [Reference - An under-the-hood peek at what the module is doing and how](REFERENCE.md)
5. [Limitations - OS compatibility, etc.](#limitations)
6. [Development - Guide for contributing to the module](#development)
Expand Down Expand Up @@ -183,6 +184,36 @@ mysql::db { 'mydb':

If required, the password can also be an empty string to allow connections without an password.

### Create login paths

This feature works only for the MySQL Community Edition >= 5.6.6.

A login path is a set of options (host, user, password, port and socket) that specify which MySQL server to connect to and which account to authenticate as. The authentication credentials and the other options are stored in an encrypted login file named .mylogin.cnf typically under the users home directory.

More information about MySQL login paths: https://dev.mysql.com/doc/refman/8.0/en/mysql-config-editor.html.

Some example for login paths:
```puppet
mysql_login_path { 'client':
owner => root,
host => 'localhost',
user => 'root',
password => Sensitive('secure'),
socket => '/var/run/mysqld/mysqld.sock',
ensure => present,
}

mysql_login_path { 'remote_db':
owner => root,
host => '10.0.0.1',
user => 'network',
password => Sensitive('secure'),
port => 3306,
ensure => present,
}
```
See examples/mysql_login_path.pp for further examples.

### Install Percona server on CentOS

This example shows how to do a minimal installation of a Percona server on a
Expand Down Expand Up @@ -392,6 +423,69 @@ mysql::server::db:
### Install Plugins

Plugins can be installed by using the `mysql_plugin` defined type. See `examples/mysql_plugin.pp` for futher examples.

### Use Percona XtraBackup

This example shows how to configure MySQL backups with Percona XtraBackup. This sets up a weekly cronjob to perform a full backup and additional daily cronjobs for incremental backups. Each backup will create a new directory. A cleanup job will automatically remove backups that are older than 15 days.

```puppet
yumrepo { 'percona':
descr => 'CentOS $releasever - Percona',
baseurl => 'http://repo.percona.com/release/$releasever/RPMS/$basearch',
gpgkey => 'https://www.percona.com/downloads/RPM-GPG-KEY-percona https://repo.percona.com/yum/PERCONA-PACKAGING-KEY',
enabled => 1,
gpgcheck => 1,
}

class { 'mysql::server::backup':
backupuser => 'myuser',
backuppassword => 'mypassword',
backupdir => '/tmp/backups',
provider => 'xtrabackup',
rotate => 15,
execpath => '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin',
time => ['23', '15'],
}
```

If the daily or weekly backup was successful, then the empty file `/tmp/mysqlbackup_success` is created, which makes it easy to monitor the status of the database backup.

After two weeks the backup directory should look similar to the example below.

```
/tmp/backups/2019-11-10_full
/tmp/backups/2019-11-11_23-15-01
/tmp/backups/2019-11-13_23-15-01
/tmp/backups/2019-11-13_23-15-02
/tmp/backups/2019-11-14_23-15-01
/tmp/backups/2019-11-15_23-15-02
/tmp/backups/2019-11-16_23-15-01
/tmp/backups/2019-11-17_full
/tmp/backups/2019-11-18_23-15-01
/tmp/backups/2019-11-19_23-15-01
/tmp/backups/2019-11-20_23-15-02
/tmp/backups/2019-11-21_23-15-01
/tmp/backups/2019-11-22_23-15-02
/tmp/backups/2019-11-23_23-15-01
```

A drawback of using incremental backups is the need to keep at least 7 days of backups, otherwise the full backups is removed early and consecutive incremental backups will fail. Furthermore an incremental backups becomes obsolete once the required full backup was removed.

The next example uses XtraBackup with incremental backups disabled. In this case the daily cronjob will always perform a full backup.

```puppet
class { 'mysql::server::backup':
backupuser => 'myuser',
backuppassword => 'mypassword',
backupdir => '/tmp/backups',
provider => 'xtrabackup',
incremental_backups => false,
rotate => 5,
execpath => '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin',
time => ['23', '15'],
}
```

## Reference

### Classes
Expand Down Expand Up @@ -549,3 +643,4 @@ This module is based on work by David Schmitt. The following contributors have c
* Daniël van Eeden
* Jan-Otto Kröpke
* Timothy Sven Nelson
* Andreas Stürz
Loading