diff --git a/docker/images/proxysql/deb-compliant/ctl/proxysql.ctl b/docker/images/proxysql/deb-compliant/ctl/proxysql.ctl index ace1316df..970431f2a 100644 --- a/docker/images/proxysql/deb-compliant/ctl/proxysql.ctl +++ b/docker/images/proxysql/deb-compliant/ctl/proxysql.ctl @@ -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). . diff --git a/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash index af0bcb135..a7e632fd1 100755 --- a/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash @@ -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 diff --git a/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash index a6997070f..8de229570 100755 --- a/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash @@ -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 diff --git a/docker/images/proxysql/rhel-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec b/docker/images/proxysql/rhel-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec index 0b3171205..56ad6ab7f 100644 --- a/docker/images/proxysql/rhel-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec +++ b/docker/images/proxysql/rhel-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec @@ -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}/ diff --git a/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash index 1b1e97d1f..3b454af32 100755 --- a/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash @@ -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 diff --git a/docker/images/proxysql/suse-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec b/docker/images/proxysql/suse-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec index 0b3171205..f36166b6d 100644 --- a/docker/images/proxysql/suse-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec +++ b/docker/images/proxysql/suse-compliant/rpmmacros/rpmbuild/SPECS/proxysql.spec @@ -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}/ diff --git a/etc/proxysql.cnf b/etc/proxysql.cnf index 19669df53..39ed7bc1f 100644 --- a/etc/proxysql.cnf +++ b/etc/proxysql.cnf @@ -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"