build(packaging): ship plugin .so files in DEB / RPM / SUSE artefacts

The chassis turns proxysql into a loader; runtime features
(mysqlx, genai/MCP) ship as separate .so files. Until now the
pre-existing packaging only saw the proxysql binary, so a v4.0
package install lost the plugins entirely — the operator had to
manually drop the .so files in place.

Wire them through all three packaging flavours:

* docker/images/proxysql/deb-compliant
  - entrypoint.bash: copies the built .so files into pkgroot/plugins/
    when the appropriate build flag is set (PROXYSQL40 for mysqlx,
    PROXYSQLGENAI for genai), then patches a placeholder in the
    equivs control file with the matching `Files:` entries that
    install them under /usr/lib/proxysql/.
  - proxysql.ctl: adds the placeholder line.

* docker/images/proxysql/{rhel,suse}-compliant
  - entrypoint.bash: copies the .so files into proxysql-${VER}/usr/lib/
    proxysql/ before the source tarball is rolled, and passes
    `--define "with_plugins 1"` to rpmbuild when the flags are set.
  - proxysql.spec: gates the new `%dir /usr/lib/proxysql` +
    `/usr/lib/proxysql/*.so` block under `%if 0%{?with_plugins}` so
    v3.x release builds (where the directory is empty) don't fail
    the build with `RPM build errors: File not found by glob`.

* etc/proxysql.cnf: add a commented-out `plugins=(...)` example
  with absolute paths matching the install location. Operators have
  to opt in explicitly — auto-loading would silently change behaviour
  on a v3.x → v4.0 upgrade without giving them a chance to review.

Conditional on PROXYSQL40 / PROXYSQLGENAI throughout so the v3.x
release-package paths stay byte-identical to before this commit.
v3.0-genai-plugin
Rene Cannao 3 weeks ago
parent 482ce386cd
commit 34838ebea4

@ -18,6 +18,7 @@ Files: proxysql /usr/bin/
systemd/system/proxysql.service /lib/systemd/system/
tools/proxysql_galera_checker.sh /usr/share/proxysql/tools/
tools/proxysql_galera_writer.pl /usr/share/proxysql/tools/
PKG_PLUGIN_FILES_PLACEHOLDER
Description: High performance MySQL and PostgreSQL proxy
ProxySQL is a fast, reliable MySQL and PostgreSQL proxy with advanced runtime configuration management (virtually no configuration change requires a restart).
.

@ -90,6 +90,37 @@ cp ../src/proxysql ./
cp -r ../etc ./etc
cp -r ../tools ./tools
cp -r ../systemd ./systemd
# Plugin .so artefacts (v4.0+ chassis): the proxysql binary is the
# loader; runtime features (mysqlx, genai/MCP) ship as separate .so
# files installed to /usr/lib/proxysql/ and named in proxysql.cnf
# `plugins=("...")` to be loaded. Conditional on the same flags that
# gated the build above so v3.x deb packaging stays unchanged.
PLUGIN_FILES_LINES=""
mkdir -p ./plugins
if [[ "${PROXYSQL40:-}" == "1" || "${PROXYSQLGENAI:-}" == "1" ]]; then
if [[ -f ../plugins/mysqlx/ProxySQL_Mysqlx_Plugin.so ]]; then
cp ../plugins/mysqlx/ProxySQL_Mysqlx_Plugin.so ./plugins/
PLUGIN_FILES_LINES+=" plugins/ProxySQL_Mysqlx_Plugin.so /usr/lib/proxysql/\n"
fi
fi
if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then
if [[ -f ../plugins/genai/ProxySQL_GenAI_Plugin.so ]]; then
cp ../plugins/genai/ProxySQL_GenAI_Plugin.so ./plugins/
PLUGIN_FILES_LINES+=" plugins/ProxySQL_GenAI_Plugin.so /usr/lib/proxysql/\n"
fi
fi
# Substitute the placeholder line in the ctl file. If no plugins were
# built (v3.x release builds), strip the placeholder line entirely.
if [[ -n "${PLUGIN_FILES_LINES}" ]]; then
# awk so we don't have to escape the newline-laden RHS for sed.
awk -v repl="${PLUGIN_FILES_LINES%\\n}" '{
if ($0 == "PKG_PLUGIN_FILES_PLACEHOLDER") { gsub("\\\\n", "\n", repl); printf "%s", repl; }
else { print; }
}' ./proxysql.ctl > ./proxysql.ctl.new && mv ./proxysql.ctl.new ./proxysql.ctl
else
sed -i '/^PKG_PLUGIN_FILES_PLACEHOLDER$/d' ./proxysql.ctl
fi
DEB_BUILD_OPTIONS=nostrip equivs-build proxysql.ctl
cp ./proxysql_${CURVER}_${ARCH}.deb ../binaries/proxysql_${CURVER}-${PKG_RELEASE}_${ARCH}.deb
# get SHA1 of the packaged executable

@ -81,13 +81,38 @@ cp -a etc/proxysql.cnf proxysql/etc/
cp -a etc/logrotate.d proxysql/etc/
mkdir -p proxysql/usr/share/proxysql/tools
cp -a tools/proxysql_galera_checker.sh tools/proxysql_galera_writer.pl proxysql/usr/share/proxysql/tools
# Plugin .so artefacts (v4.0+ chassis): proxysql becomes the loader;
# runtime features (mysqlx, genai/MCP) ship as separate .so files
# installed to /usr/lib/proxysql/ and named in proxysql.cnf
# `plugins=("...")` to be loaded. Conditional on the same flags that
# gated the build above so v3.x rpm packaging stays unchanged. The
# proxysql.spec %files section already lists /usr/lib/proxysql/* so
# anything dropped in this directory ends up packaged automatically.
if [[ "${PROXYSQL40:-}" == "1" || "${PROXYSQLGENAI:-}" == "1" ]]; then
mkdir -p proxysql/usr/lib/proxysql
if [[ -f plugins/mysqlx/ProxySQL_Mysqlx_Plugin.so ]]; then
cp plugins/mysqlx/ProxySQL_Mysqlx_Plugin.so proxysql/usr/lib/proxysql/
fi
fi
if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then
mkdir -p proxysql/usr/lib/proxysql
if [[ -f plugins/genai/ProxySQL_GenAI_Plugin.so ]]; then
cp plugins/genai/ProxySQL_GenAI_Plugin.so proxysql/usr/lib/proxysql/
fi
fi
mv proxysql "proxysql-${CURVER}"
tar czvf "proxysql-${CURVER}.tar.gz" proxysql-${CURVER}
mkdir -p /root/rpmbuild/{RPMS,SRPMS,BUILD,SOURCES,SPECS,tmp}
chown -R root:root /root/rpmbuild/SPECS
mv "/opt/proxysql/proxysql-${CURVER}.tar.gz" /root/rpmbuild/SOURCES
# build package
cd /root/rpmbuild && rpmbuild -ba SPECS/proxysql.spec --define "version ${CURVER}"
RPMBUILD_DEFINES=( --define "version ${CURVER}" )
if [[ "${PROXYSQL40:-}" == "1" || "${PROXYSQLGENAI:-}" == "1" ]]; then
# gates the %if 0%{?with_plugins} block in proxysql.spec %files
RPMBUILD_DEFINES+=( --define "with_plugins 1" )
fi
cd /root/rpmbuild && rpmbuild -ba SPECS/proxysql.spec "${RPMBUILD_DEFINES[@]}"
cp "/root/rpmbuild/RPMS/${ARCH}/proxysql-${CURVER}-1.${ARCH}.rpm" "/opt/proxysql/binaries/proxysql-${CURVER}-1-${PKG_RELEASE}.${ARCH}.rpm"
# get SHA1 of the packaged executable
mkdir -p /opt/proxysql/pkgroot/tmp

@ -76,6 +76,15 @@ rm -rf %{buildroot}
%{_sysconfdir}/systemd/system/%{name}-initial.service
/usr/share/proxysql/tools/proxysql_galera_checker.sh
/usr/share/proxysql/tools/proxysql_galera_writer.pl
# Plugin .so artefacts for v4.0+ chassis builds (mysqlx, genai/MCP).
# Gated on the `with_plugins` define passed by the rhel-compliant
# entrypoint when PROXYSQL40=1 or PROXYSQLGENAI=1. Without the gate
# the wildcard match would fail on v3.x release builds where the
# directory is empty and rpmbuild aborts on no-files-match.
%if 0%{?with_plugins}
%dir /usr/lib/proxysql
/usr/lib/proxysql/*.so
%endif
%config(noreplace) %attr(750,%{name},%{name}) /var/run/%{name}/
%config(noreplace) %attr(750,%{name},%{name}) /var/lib/%{name}/

@ -84,10 +84,32 @@ cp -a systemd proxysql-${CURVER}/etc/
cp -a etc/proxysql.cnf proxysql-${CURVER}/etc/
cp -a etc/logrotate.d proxysql-${CURVER}/etc/
cp -a tools/proxysql_galera_checker.sh tools/proxysql_galera_writer.pl proxysql-${CURVER}/usr/share/proxysql/tools
# Plugin .so artefacts (v4.0+ chassis); see rhel-compliant entrypoint
# for the full rationale. Gated on the same build flags so v3.x
# packaging is unchanged.
if [[ "${PROXYSQL40:-}" == "1" || "${PROXYSQLGENAI:-}" == "1" ]]; then
mkdir -p proxysql-${CURVER}/usr/lib/proxysql
if [[ -f plugins/mysqlx/ProxySQL_Mysqlx_Plugin.so ]]; then
cp plugins/mysqlx/ProxySQL_Mysqlx_Plugin.so proxysql-${CURVER}/usr/lib/proxysql/
fi
fi
if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then
mkdir -p proxysql-${CURVER}/usr/lib/proxysql
if [[ -f plugins/genai/ProxySQL_GenAI_Plugin.so ]]; then
cp plugins/genai/ProxySQL_GenAI_Plugin.so proxysql-${CURVER}/usr/lib/proxysql/
fi
fi
tar czvf "proxysql-${CURVER}.tar.gz" proxysql-${CURVER}
mv "/opt/proxysql/proxysql-${CURVER}.tar.gz" "/root/rpmbuild/SOURCES"
# build package
rpmbuild -bb --define "version ${CURVER}" /root/rpmbuild/SPECS/proxysql.spec
RPMBUILD_DEFINES=( --define "version ${CURVER}" )
if [[ "${PROXYSQL40:-}" == "1" || "${PROXYSQLGENAI:-}" == "1" ]]; then
# gates the %if 0%{?with_plugins} block in proxysql.spec %files
RPMBUILD_DEFINES+=( --define "with_plugins 1" )
fi
rpmbuild -bb "${RPMBUILD_DEFINES[@]}" /root/rpmbuild/SPECS/proxysql.spec
cp /root/rpmbuild/RPMS/${ARCH}/proxysql-${CURVER}-1.${ARCH}.rpm ./binaries/proxysql-${CURVER}-1-${PKG_RELEASE}.${ARCH}.rpm
# get SHA1 of the packaged executable
mkdir -p /opt/proxysql/pkgroot/tmp

@ -76,6 +76,12 @@ rm -rf %{buildroot}
%{_sysconfdir}/systemd/system/%{name}-initial.service
/usr/share/proxysql/tools/proxysql_galera_checker.sh
/usr/share/proxysql/tools/proxysql_galera_writer.pl
# Plugin .so artefacts for v4.0+ chassis builds (mysqlx, genai/MCP).
# See rhel-compliant proxysql.spec for the rationale on the gate.
%if 0%{?with_plugins}
%dir /usr/lib/proxysql
/usr/lib/proxysql/*.so
%endif
%config(noreplace) %attr(750,%{name},%{name}) /var/run/%{name}/
%config(noreplace) %attr(750,%{name},%{name}) /var/lib/%{name}/

@ -34,6 +34,17 @@
datadir="/var/lib/proxysql"
errorlog="/var/lib/proxysql/proxysql.log"
# Plugin chassis (v4.0+). Uncomment to load runtime-loadable
# extensions. Each entry is the absolute path to a .so file shipped
# under /usr/lib/proxysql/. Plugins are loaded in declaration order
# during startup; missing files cause the proxy to abort with an
# explanatory message.
#
# plugins=(
# "/usr/lib/proxysql/ProxySQL_Mysqlx_Plugin.so"
# "/usr/lib/proxysql/ProxySQL_GenAI_Plugin.so"
# )
admin_variables=
{
admin_credentials="admin:admin"

Loading…
Cancel
Save