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

rocky9 support with postgres backend #185

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

pdemonaco
Copy link

I ran into a few minor issues trying to setup an authoritative PowerDNS server on Rocky9 and made some corrections to get it working:

  • Redhat 9 derivatives replace powertools with crb (code ready builder) - updates the handling of that repo
  • The permissions on the /etc/pdns/pdns.conf file did not allow the service to read it when using the standard pdns user
  • The PostgreSQL schema file has a different path (at least for pdns 4.8.5 which is the release at the time of this PR).

Minor rework to support installation on a redhat 9 server. The primary
change is that the powertools repo has been replaced with crb (code
ready builders) in major release 9.
On rocky9 the default configuration does not allow the authoritative
server to actually read its own configuration file. This ensures it is
readable.

Also fixes some bugs in the spec.
@pdemonaco pdemonaco force-pushed the feat-rocky9-support branch from 16d1ffd to a09ef93 Compare March 10, 2025 02:10
Comment on lines +20 to +21
group => $group,
mode => '0640',
Copy link
Member

Choose a reason for hiding this comment

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

This might potentially break things on other distributions, if the group is missing or it's not running under this group or root.

Copy link
Contributor

@ju5t ju5t Mar 11, 2025

Choose a reason for hiding this comment

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

Also, does this mean PowerDNS does not create a config anymore during installation?

Copy link
Member

Choose a reason for hiding this comment

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

Config file will still be installed with the package installation, but managing it like that isn't going to work. It will definitely break on other distros

Copy link
Author

Choose a reason for hiding this comment

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

Interesting. I can't speak to what the behavior is on other distros, however, the file was created with 0600 permissions on Rocky 9.5 in my testing.

I'll rework it so this change only applies on Rocky9 or perhaps Redhat 9 generally.

$gpgkey = 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial'
$code_repo_params = {
mirrorlist => "https://mirrors.rockylinux.org/mirrorlist?arch=\$basearch&repo=${repo_desc}-\$releasever",
gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial',
Copy link
Member

@saz saz Mar 10, 2025

Choose a reason for hiding this comment

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

I'd suggest to switch to some generic name or leave the centos and rocky part out.

Copy link
Author

Choose a reason for hiding this comment

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

I'm sure the other derivatives need these repos as well, however, I don't know enough about their structure to address it directly. The hiera based code makes no assumptions

$mirrorlist = "https://mirrors.rockylinux.org/mirrorlist?arch=\$basearch&repo=PowerTools-\$releasever"
$gpgkey = 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial'
$code_repo_params = {
mirrorlist => "https://mirrors.rockylinux.org/mirrorlist?arch=\$basearch&repo=${repo_desc}-\$releasever",
Copy link
Member

Choose a reason for hiding this comment

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

We might simplify the whole code by adding a parameter, which gets it's value from hiera.

Copy link
Author

Choose a reason for hiding this comment

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

Good idea. I've updated the logic at least for the RHEL derivatives.

Copy link
Member

Choose a reason for hiding this comment

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

After reading a bit about it, it seems to be more complicated.
Looking at https://wiki.rockylinux.org/rocky/repo/#base-repositories there's no powertools or PowerTools repo on Rocky 9, but instead it's crb.

crb is also available on CentOS Stream 9.

On Rocky 9 and CentOS Stream 9 we might use an exec to run dnf config-manager --enable <repo>

Copy link
Member

Choose a reason for hiding this comment

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

Rocky 8 requires either the dnf-plugins-core or we just update the enabled line in /etc/yum.repos.d/Rocky-PowerTools.repo (might also be an option for the other versions 🤷 )

Copy link
Member

Choose a reason for hiding this comment

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

I've found an even easier solution: the powertools repo isn't needed. EPEL is enough. Tested on CentOS Stream 9, Rocky 8 and 9

I'll create a PR to get rid of it.

@@ -0,0 +1,2 @@
---
powerdns::pgsql_schema_file: /usr/share/doc/pdns-backend-postgresql/schema.pgsql.sql
Copy link
Member

Choose a reason for hiding this comment

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

As far as I can see, all RedHat-based packages have /usr/share/doc/pdns-backend-<name>/schema.<backend>.sql available and we can just update the paths in data/os/RedHat.yaml

Copy link
Author

Choose a reason for hiding this comment

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

Makes sense to me.

Updating the path to the appropriate location. The package version
number is not included in the default schema path as of this release.
Adding a REFERENCE.md file with the parameters we currently have
documented.
Moves the logic for CentOS and Rocky additional supporting repos out of
the repo class itself and into hiera where they can be more precisely
maintained.

Note that this code nolonger handles the CRB or PowerTools repos for
RedHat derivatives other than Rocky and CentOS.
@pdemonaco pdemonaco force-pushed the feat-rocky9-support branch from 46dfbe1 to 4da10f2 Compare March 12, 2025 04:03
Copy link
Member

Choose a reason for hiding this comment

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

CentOS 8 is EOL so I don't see a good reason to add this

@@ -33,8 +33,7 @@
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"8",
"9"
Copy link
Member

Choose a reason for hiding this comment

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

Why drop 9? It should really be the only version since 8 is EOL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants