Skip to content

Commit 34508dc

Browse files
committed
feat!: migrate percona to resources
Convert the cookbook from recipes and attributes to custom resources with resource documentation and migration guidance. Verification: berks install; cookstyle; chef exec rspec --format documentation; KITCHEN_LOCAL_YAML=kitchen.dokken.yml kitchen test default-ubuntu-2404 --destroy=always.
1 parent 2e37d84 commit 34508dc

106 files changed

Lines changed: 2421 additions & 3110 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,56 +26,33 @@ jobs:
2626
- almalinux-8
2727
- almalinux-9
2828
- almalinux-10
29+
- amazonlinux-2023
2930
- centos-stream-9
3031
- centos-stream-10
3132
- debian-12
33+
- debian-13
34+
- oraclelinux-8
35+
- oraclelinux-9
36+
- rockylinux-8
37+
- rockylinux-9
38+
- rockylinux-10
3239
- ubuntu-2204
3340
- ubuntu-2404
3441
suite:
35-
- client-80
36-
- client-84
37-
- devel-80
38-
- devel-84
39-
- server-80
40-
- server-84
41-
- source-80
42-
- source-84
43-
- replication-80
44-
- replication-84
45-
- resources-80
46-
- resources-84
47-
exclude:
48-
- os: almalinux-10
49-
suite: client-80
50-
- os: almalinux-10
51-
suite: devel-80
52-
- os: almalinux-10
53-
suite: server-80
54-
- os: almalinux-10
55-
suite: source-80
56-
- os: almalinux-10
57-
suite: replication-80
58-
- os: almalinux-10
59-
suite: resources-80
60-
- os: centos-stream-10
61-
suite: client-80
62-
- os: centos-stream-10
63-
suite: devel-80
64-
- os: centos-stream-10
65-
suite: server-80
66-
- os: centos-stream-10
67-
suite: source-80
68-
- os: centos-stream-10
69-
suite: replication-80
70-
- os: centos-stream-10
71-
suite: resources-80
42+
- default
43+
- client
44+
- server
45+
- source
46+
- replication
47+
- cluster
48+
- resources
7249
fail-fast: false
7350

7451
steps:
7552
- name: Check out code
7653
uses: actions/checkout@v6
7754
- name: Install Chef
78-
uses: actionshub/chef-install@6.0.0
55+
uses: sous-chefs/.github/.github/actions/install-workstation@6.0.0
7956
# https://github.com/actions/virtual-environments/issues/181#issuecomment-610874237
8057
- name: Disable apparmor for mysqld
8158
run: |

Berksfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ source 'https://supermarket.chef.io'
33
metadata
44

55
group :integration do
6-
cookbook 'test', path: 'test/fixtures/cookbooks/test'
6+
cookbook 'test', path: 'test/cookbooks/test'
77
end

LIMITATIONS.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Percona Cookbook Limitations
2+
3+
This cookbook targets Percona Server for MySQL 8.4 LTS and related Percona packages distributed through the official Percona repositories.
4+
5+
## Supported Product Line
6+
7+
* Percona Server for MySQL 8.4 uses the `ps-84-lts` repository.
8+
* Percona XtraDB Cluster 8.4 uses the `pxc-84-lts` repository.
9+
* Percona XtraBackup 8.4 uses the `percona-xtrabackup-84` package.
10+
* Percona Server 8.0 support was removed from this cookbook because Percona's lifecycle matrix lists Percona Server for MySQL 8.0 end of life as April 1, 2026.
11+
12+
## Platform Support
13+
14+
Percona's lifecycle policy says supported operating systems and platforms are provided only as 64-bit packages, with AMD64 and ARM64 available where listed. This cookbook keeps platforms that are current and have Percona 8.4 package support:
15+
16+
* AlmaLinux 8, 9, and 10 through RHEL-compatible package support.
17+
* Amazon Linux 2023.
18+
* CentOS Stream 9 and 10 through RHEL-compatible package support.
19+
* Debian 12 and 13.
20+
* Oracle Linux 8 and 9.
21+
* Rocky Linux 8, 9, and 10 through RHEL-compatible package support.
22+
* Ubuntu 22.04 and 24.04 LTS.
23+
24+
Ubuntu 20.04 is intentionally removed. Percona Server 8.4 release notes state that Ubuntu 20.04 support ended and Debian 13 support was added.
25+
26+
## Package Constraints
27+
28+
* The repository setup resource manages Percona's release, telemetry, PMM client, tools, and product repositories directly instead of shelling out to `percona-release`.
29+
* RHEL-family systems disable the default MySQL DNF module so Percona packages are visible.
30+
* Percona XtraDB Cluster requires ports 3306, 4444, 4567, and 4568 to be open between cluster nodes. The cookbook does not manage firewall rules.
31+
* Percona Server and Percona Server Pro are distinct upstream build families. Current Percona Server 8.4 release notes state that Pro build features were consolidated into the main community release; this cookbook manages the standard Percona Server packages.
32+
33+
## Sources
34+
35+
* [Percona Server for MySQL 8.4 documentation](https://docs.percona.com/percona-server/8.4/print_page.html)
36+
* [Percona XtraDB Cluster 8.4 documentation](https://docs.percona.com/percona-xtradb-cluster/8.4/print_page.html)
37+
* [Percona Software Support Lifecycle](https://www.percona.com/services/policies/percona-software-support-lifecycle)
38+
* [Percona Server 8.4 APT repository docs](https://docs.percona.com/percona-server/8.4/apt-repo.html)
39+
* [Percona XtraDB Cluster 8.4 APT repository docs](https://docs.percona.com/percona-xtradb-cluster/8.4/apt.html)
40+
* [Percona XtraDB Cluster 8.4 YUM repository docs](https://docs.percona.com/percona-xtradb-cluster/8.4/yum.html)

README.md

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,35 +37,34 @@ This cookbook supports the following platforms (64-bit):
3737

3838
### Cookbooks
3939

40-
- [yum-epel](https://supermarket.chef.io/cookbooks/yum-epel)
41-
- [line](https://supermarket.chef.io/cookbooks/line)
40+
- [yum](https://supermarket.chef.io/cookbooks/yum)
4241

4342
### Chef
4443

4544
Chef >= 16 is required. Chef 17+ is recommended for full resource compatibility.
4645

47-
## Recipes
46+
## Migration
4847

49-
- `percona` - Default recipe, includes the client recipe.
50-
- `percona::package_repo` - Sets up Percona package repositories and installs common packages.
51-
- `percona::client` - Installs Percona MySQL client libraries.
52-
- `percona::server` - Installs and configures Percona MySQL server daemon.
53-
- `percona::backup` - Installs and configures Percona XtraBackup hot backup software.
54-
- `percona::toolkit` - Installs Percona Toolkit software.
55-
- `percona::cluster` - Installs Percona XtraDB Cluster server components.
56-
- `percona::configure_server` - Internal: manages server configuration.
57-
- `percona::replication` - Internal: grants permissions for replication.
58-
- `percona::access_grants` - Internal: grants permissions for recipes.
59-
- `percona::ssl` - Internal: sets up SSL certificates for server/client.
48+
This cookbook now exposes custom resources only. Recipes and node attributes were removed in the breaking custom resource migration. See [migration.md](migration.md) for replacement examples.
6049

6150
## Resources
6251

52+
- [`percona_repository`](documentation/resource_percona_repository.md): Manage Percona package repositories.
53+
- [`percona_client`](documentation/resource_percona_client.md): Install Percona client packages.
54+
- [`percona_server`](documentation/resource_percona_server.md): Install and configure Percona Server.
55+
- [`percona_server_config`](documentation/resource_percona_server_config.md): Manage server configuration files and service state.
56+
- [`percona_backup`](documentation/resource_percona_backup.md): Install Percona XtraBackup and backup grants.
57+
- [`percona_toolkit`](documentation/resource_percona_toolkit.md): Install Percona Toolkit.
58+
- [`percona_cluster`](documentation/resource_percona_cluster.md): Install and configure Percona XtraDB Cluster.
59+
- [`percona_ssl`](documentation/resource_percona_ssl.md): Manage replication SSL files.
60+
- [`percona_access_grants`](documentation/resource_percona_access_grants.md): Manage grant SQL.
61+
- [`percona_replication`](documentation/resource_percona_replication.md): Manage replication SQL.
6362
- [`percona_mysql_user`](documentation/resource_percona_mysql_user.md): Manage Percona MySQL users and privileges.
6463
- [`percona_mysql_database`](documentation/resource_percona_mysql_database.md): Manage Percona MySQL databases and execute SQL queries.
6564

6665
## Resource Documentation
6766

68-
See [documentation/resource_percona_mysql_user.md](documentation/resource_percona_mysql_user.md) and [documentation/resource_percona_mysql_database.md](documentation/resource_percona_mysql_database.md) for full details on custom resources, properties, actions, and usage examples.
67+
See the files in [documentation/](documentation/) for full details on custom resources, properties, actions, and usage examples.
6968

7069
## Usage
7170

@@ -78,7 +77,7 @@ This cookbook uses inclusive terminology, replacing terms such as `master/slave`
7877

7978
This cookbook requires [Encrypted Data Bags](https://docs.chef.io/secrets/#encrypt-a-data-bag-item) for managing passwords and secrets. If you do not use encrypted data bags or override passwords via node attributes, empty passwords will be used (not recommended).
8079

81-
By default, the cookbook expects a data bag named `passwords`. You can override this with `node['percona']['encrypted_data_bag']`. Optionally, specify a data bag secret file with `node['percona']['encrypted_data_bag_secret_file']`.
80+
By default, the cookbook expects a data bag named `passwords`. You can override this with the `encrypted_data_bag` property. Optionally, specify a data bag secret file with `encrypted_data_bag_secret_file`.
8281

8382
Required items:
8483

@@ -87,25 +86,25 @@ Required items:
8786

8887
Refer to Chef documentation for setup details. Example data bag items are provided in the test suite under `test/integration/data_bags/passwords/`.
8988

90-
You also may set expected item names via attributes `node['percona']['encrypted_data_bag_item_mysql']` and `node['percona']['encrypted_data_bag_item_system']`.
89+
You also may set expected item names via `encrypted_data_bag_item_mysql` and `encrypted_data_bag_item_system`.
9190

9291
### Skip passwords
9392

94-
Set the `['percona']['skip_passwords']` attribute to skip setting up passwords. Removes the need for the encrypted data bag if using chef-solo. Is useful for setting up development and ci environments where you just want to use the root user with no password. If you are doing this you may want to set `['percona']['server']['debian_username']` to be `"root"` also.
93+
Set the `skip_passwords` property to skip setting up passwords. This removes the need for the encrypted data bag if using chef-solo. It is useful for development and CI environments where you just want to use the root user with no password. If you do this, set `server_config(debian_username: 'root')` also.
9594

9695
### Skip Configure
9796

98-
Set the `['percona']['skip_configure']` attribute to skip having the server recipe include the configure\_server recipe directly after install. This is mostly useful in a wrapper cookbook sort of context. Once skipped, you can then perform any pre-config actions your wrapper needs to, such as dropping a custom configuration file or init script or cleaning up incorrectly sized innodb logfiles. You can then include configure\_server where necessary.
97+
Set `configure_server false` on `percona_server` to skip server configuration directly after install. This is mostly useful in a wrapper cookbook context. You can then perform pre-configuration actions and call `percona_server_config` where necessary.
9998

10099
#### mysql item
101100

102101
The mysql item should contain entries for root, backup, and replication. If no value is found, the cookbook will fall back to the default non-encrypted password.
103102

104103
#### system item
105104

106-
The "system" item should contain an entry for the debian system user as specified in the `node['percona']['server']['debian_username']` attribute. If no such entry is found, the cookbook will fall back to the default non-encrypted password.
105+
The "system" item should contain an entry for the Debian system user specified in `server_config[:debian_username]`. If no such entry is found, the cookbook falls back to the resource property password.
107106

108-
Example: "passwords" data bag - this example assumes that `node['percona']['server']['debian_username'] = spud`
107+
Example: "passwords" data bag - this example assumes that `server_config(debian_username: 'spud')` is used.
109108

110109
```javascript
111110
{
@@ -126,12 +125,12 @@ Above shows the encrypted password in the data bag. Check out the `encrypted_dat
126125

127126
### Install client development package
128127

129-
To install the package including header files needed to compile software using the client library (`percona-server-devel` on Centos and `libperconaserverclient-dev` on Debian), set `node['percona']['client']['install_devel_package']` to `true`. This will add those packages to the list to be installed when running the `percona::client` recipe. This attribute is disabled by default.
128+
To install the package including header files needed to compile software using the client library (`percona-server-devel` on RHEL-family systems and `libperconaserverclient22-dev` on Debian/Ubuntu), set `install_devel_package true` on `percona_client`. This property is disabled by default.
130129

131130
### Replication over SSL
132131

133-
To enable SSL based replication, you will need to flip the attribute `node['percona']['server']['replication']['ssl_enabled']` to `true` and add a new data\_bag item
134-
to the percona encrypted data\_bag (see`node['percona']['encrypted_data_bag']` attribute) with the id `ssl_replication` ( see `node['percona']['encrypted_data_bag_item_ssl_replication']` attribute) that contains this data:
132+
To enable SSL based replication, set `server_config(replication: { ssl_enabled: true })` and add a data bag item
133+
to the Percona encrypted data bag with the id `ssl_replication` that contains this data:
135134

136135
```javascript
137136
{
@@ -193,9 +192,15 @@ Chef::Log.info "Using Percona XtraDB cluster address of: #{cluster_address}"
193192
node.override['percona']['cluster']['wsrep_cluster_address'] = cluster_address
194193
node.override['percona']['cluster']['wsrep_node_name'] = node['hostname']
195194

196-
include_recipe 'percona::cluster'
197-
include_recipe 'percona::backup'
198-
include_recipe 'percona::toolkit'
195+
percona_cluster 'default' do
196+
cluster_config(
197+
wsrep_cluster_address: cluster_address,
198+
wsrep_node_name: node['hostname']
199+
)
200+
end
201+
202+
percona_backup 'default'
203+
percona_toolkit 'default'
199204
```
200205

201206
Example percona role roles/percona.rb:
@@ -225,12 +230,18 @@ Now you need to bring three servers up one at a time with the percona role appli
225230

226231
## Explicit my.cnf templating
227232

228-
In some situations it is preferable to explicitly define the attributes needed in a `my.cnf` file. This is enabled by adding categories to the `node['percona']['conf']` attributes. All keys found in the `node['percona']['conf']` map will represent categories in the `my.cnf` file. Each category contains a map of attributes that will be written to the `my.cnf` file for that category. See the example for more details.
233+
In some situations it is preferable to explicitly define the settings needed in a `my.cnf` file. This is enabled by passing categories through the `extra_config` property. All keys found in the `extra_config` map represent categories in the `my.cnf` file.
229234

230235
### Example
231236

232237
```ruby
233-
node['percona']['conf']['mysqld']['slow_query_log_file'] = "/var/lib/mysql/data/mysql-slow.log"
238+
percona_server 'default' do
239+
extra_config(
240+
mysqld: {
241+
slow_query_log_file: '/var/lib/mysql/data/mysql-slow.log'
242+
}
243+
)
244+
end
234245
```
235246

236247
This configuration would write the `mysqld` category to the `my.cnf` file and have an attribute `slow_query_log_file` whose value would be `/var/lib/mysql/data/mysql-slow.log`.
@@ -244,7 +255,7 @@ slow_query_log_file = /var/lib/mysql/data/mysql-slow.log
244255

245256
## Dynamically setting the bind address
246257

247-
There's a special attribute `node['percona']['server']['bind_to']` that allows you to dynamically set the bind address. This attribute accepts the values `"public_ip"`, `"private_ip"`, `"loopback"`, or and interface name like `"eth0"`. Based on this, the recipe will find a corresponding ipv4 address, and override the `node['percona']['server']['bind_address']` attribute.
258+
Set `server_config(bind_to: ...)` to dynamically set the bind address. This accepts `"public_ip"`, `"private_ip"`, `"loopback"`, or an interface name like `"eth0"`.
248259

249260
## Goals
250261

attributes/client.rb

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)