Skip to content

Conversation

@mirostauder
Copy link
Collaborator

address systemd related issues during package install

docker container images generally don't use systemd, this means:

  • any systemd commands are unavailable
  • any systemd units are unusable
  • errors and misconfiguration due to above

use rpm macros which automatically handle systemd/no-systemd cases

@mirostauder mirostauder added this to the Release 3.0.4 milestone Dec 1, 2025
@mirostauder mirostauder self-assigned this Dec 1, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @mirostauder, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness and compatibility of ProxySQL RPM packages, especially within containerized environments. By transitioning from manual systemd commands to RPM's native systemd macros, the package installation and uninstallation processes become more adaptive and less prone to errors when systemd is not present. The changes also streamline the build process and improve the handling of user accounts and critical directories.

Highlights

  • Systemd Macro Adoption: The spec files have been refactored to utilize RPM's built-in systemd macros (%systemd_post, %systemd_preun) for service management, replacing manual systemctl commands.
  • Improved Container Compatibility: Changes address systemd-related issues in container images by using RPM macros that automatically handle environments with and without systemd, preventing errors during package installation.
  • Build Process Streamlining: Debug package generation and binary stripping have been disabled in the RPM build process, and DONT_STRIP=1 is now explicitly set during installation.
  • User and Directory Management: User and group creation logic has been simplified in the %pre section, and runtime directories (/var/run/%{name}, /var/lib/%{name}) are now created during installation and marked as config(noreplace) in %files.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 1, 2025

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request significantly refactors the RPM spec files for ProxySQL, primarily by adopting RPM macros for systemd service management. This change aims to improve compatibility and reduce issues when deploying ProxySQL in container environments that may or may not use systemd. Key improvements include disabling debug packages and binary stripping, more explicit user/group management in the %pre section, and proper permission/ownership settings for critical directories in the %files section. These changes significantly enhance the maintainability and reliability of the ProxySQL RPM packages across different deployment scenarios.

Comment on lines +1 to +5
# we don't want separate debuginfo packages
%global _enable_debug_package 0
%define debug_package %{nil}
# do not strip binaries
%global __strip /bin/true

Choose a reason for hiding this comment

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

medium

The explicit disabling of debug packages and binary stripping is a good practice for container images. This helps in reducing the final image size and potentially improves security by removing unnecessary debugging information. This aligns well with the goal of addressing systemd-related issues in container environments, where minimal images are often preferred.

Comment on lines +20 to +21
Provides: user(%{name})
Provides: group(%{name})

Choose a reason for hiding this comment

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

medium

Adding Provides: user(%{name}) and Provides: group(%{name}) is a good practice for RPM packages that create system users and groups. This explicitly declares these provisions, which can be helpful for other packages that might depend on the existence of this user or group, improving the overall package ecosystem's clarity.

Comment on lines +39 to +41
rm -rf %{buildroot}
mkdir -p %{buildroot}
cp -a * %{buildroot}

Choose a reason for hiding this comment

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

medium

While rm, mkdir, and cp are usually in the system's PATH, it's generally a more robust practice in RPM spec files to use their absolute paths (e.g., /bin/rm, /bin/mkdir, /bin/cp). This prevents potential issues if the build environment's PATH is unexpectedly modified or minimal, ensuring the correct utilities are always invoked.

/bin/rm -rf %{buildroot}
/bin/mkdir -p %{buildroot}
/bin/cp -a * %{buildroot}

Comment on lines +79 to +80
%config(noreplace) %attr(750,%{name},%{name}) /var/run/%{name}/
%config(noreplace) %attr(750,%{name},%{name}) /var/lib/%{name}/

Choose a reason for hiding this comment

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

medium

Explicitly defining the permissions and ownership for /var/run/%{name}/ and /var/lib/%{name}/ in the %files section is a strong improvement. This ensures that these directories are created with the correct security context, preventing potential privilege escalation or access issues for the application.

Comment on lines +1 to +5
# we don't want separate debuginfo packages
%global _enable_debug_package 0
%define debug_package %{nil}
# do not strip binaries
%global __strip /bin/true

Choose a reason for hiding this comment

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

medium

The explicit disabling of debug packages and binary stripping is a good practice for container images. This helps in reducing the final image size and potentially improves security by removing unnecessary debugging information. This aligns well with the goal of addressing systemd-related issues in container environments, where minimal images are often preferred.

Comment on lines +20 to 21
Provides: user(%{name})
Provides: group(%{name})

Choose a reason for hiding this comment

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

medium

Adding Provides: user(%{name}) and Provides: group(%{name}) is a good practice for RPM packages that create system users and groups. This explicitly declares these provisions, which can be helpful for other packages that might depend on the existence of this user or group, improving the overall package ecosystem's clarity.

Comment on lines +39 to +41
rm -rf %{buildroot}
mkdir -p %{buildroot}
cp -a * %{buildroot}

Choose a reason for hiding this comment

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

medium

While rm, mkdir, and cp are usually in the system's PATH, it's generally a more robust practice in RPM spec files to use their absolute paths (e.g., /bin/rm, /bin/mkdir, /bin/cp). This prevents potential issues if the build environment's PATH is unexpectedly modified or minimal, ensuring the correct utilities are always invoked.

/bin/rm -rf %{buildroot}
/bin/mkdir -p %{buildroot}
/bin/cp -a * %{buildroot}

Comment on lines +79 to +80
%config(noreplace) %attr(750,%{name},%{name}) /var/run/%{name}/
%config(noreplace) %attr(750,%{name},%{name}) /var/lib/%{name}/

Choose a reason for hiding this comment

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

medium

Explicitly defining the permissions and ownership for /var/run/%{name}/ and /var/lib/%{name}/ in the %files section is a strong improvement. This ensures that these directories are created with the correct security context, preventing potential privilege escalation or access issues for the application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants