From 94d5d52b0d388749eb989a4794fd20bea8284f5d Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Sat, 5 Nov 2022 12:42:11 +0900 Subject: [PATCH] Update src/pgpool.spec: - Change /lib/tmpfiles.d/ file from /var/run to /run - Install /etc/sudoers.d/pgpool - Add new scripts aws_eip_if_cmd.sh.sample and aws_rtb_if_cmd.sh.sample --- src/Makefile.am | 6 +++- src/Makefile.in | 6 +++- src/pgpool.spec | 57 ++++++++++++++++++++++-------- src/redhat/pgpool_socket_dir.patch | 20 +++++------ src/redhat/pgpool_sudoers.d | 2 ++ src/redhat/pgpool_tmpfiles.d | 1 + 6 files changed, 66 insertions(+), 26 deletions(-) create mode 100644 src/redhat/pgpool_sudoers.d create mode 100644 src/redhat/pgpool_tmpfiles.d diff --git a/src/Makefile.am b/src/Makefile.am index ba2358f59..fa2693ad7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -78,7 +78,9 @@ sysconf_DATA = sample/pgpool.conf.sample \ sample/scripts/recovery_1st_stage.sample \ sample/scripts/replication_mode_recovery_1st_stage.sample \ sample/scripts/replication_mode_recovery_2nd_stage.sample \ - sample/scripts/escalation.sh.sample + sample/scripts/escalation.sh.sample \ + sample/scripts/aws_eip_if_cmd.sh.sample \ + sample/scripts/aws_rtb_if_cmd.sh.sample pkgdata_DATA = sql/insert_lock.sql \ @@ -107,6 +109,8 @@ EXTRA_DIST = sample/pgpool.pam \ sample/scripts/replication_mode_recovery_1st_stage.sample \ sample/scripts/replication_mode_recovery_2nd_stage.sample \ sample/scripts/escalation.sh.sample \ + sample/scripts/aws_eip_if_cmd.sh.sample \ + sample/scripts/aws_rtb_if_cmd.sh.sample \ sample/pgpool.conf.sample sample/pool_hba.conf.sample \ sample/pcp.conf.sample \ sql/Makefile \ diff --git a/src/Makefile.in b/src/Makefile.in index d3c5c3106..55eec878e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -507,7 +507,9 @@ sysconf_DATA = sample/pgpool.conf.sample \ sample/scripts/recovery_1st_stage.sample \ sample/scripts/replication_mode_recovery_1st_stage.sample \ sample/scripts/replication_mode_recovery_2nd_stage.sample \ - sample/scripts/escalation.sh.sample + sample/scripts/escalation.sh.sample \ + sample/scripts/aws_eip_if_cmd.sh.sample \ + sample/scripts/aws_rtb_if_cmd.sh.sample pkgdata_DATA = sql/insert_lock.sql \ sample/pgpool.pam @@ -531,6 +533,8 @@ EXTRA_DIST = sample/pgpool.pam \ sample/scripts/replication_mode_recovery_1st_stage.sample \ sample/scripts/replication_mode_recovery_2nd_stage.sample \ sample/scripts/escalation.sh.sample \ + sample/scripts/aws_eip_if_cmd.sh.sample \ + sample/scripts/aws_rtb_if_cmd.sh.sample \ sample/pgpool.conf.sample sample/pool_hba.conf.sample \ sample/pcp.conf.sample \ sql/Makefile \ diff --git a/src/pgpool.spec b/src/pgpool.spec index e77472f02..1b230cf01 100644 --- a/src/pgpool.spec +++ b/src/pgpool.spec @@ -1,10 +1,10 @@ # How to build RPM: # -# rpmbuild -ba pgpool.spec --define="pgpool_version 3.4.0" --define="pg_version 93" --define="pghome /usr/pgsql-9.3" --define="dist .rhel6" --define="pgsql_ver 93" +# rpmbuild -ba pgpool.spec --define="pgpool_version 3.4.0" --define="pg_version 93" --define="pghome /usr/pgsql-9.3" --define="dist .rhel7" --define="pgsql_ver 93" # # OR # -# rpmbuild -ba pgpool.spec --define="pgpool_version 3.4.0" --define="pg_version 11" --define="pghome /usr/pgsql-11" --define="dist .rhel6" --define="pgsql_ver 110" +# rpmbuild -ba pgpool.spec --define="pgpool_version 3.4.0" --define="pg_version 11" --define="pghome /usr/pgsql-11" --define="dist .rhel7" --define="pgsql_ver 110" # # expecting RPM name are: # pgpool-II-pg{pg_version}-{pgpool_version}-{rel}pgdg.rhel{v}.{arch}.rpm @@ -38,6 +38,8 @@ Source2: pgpool_rhel6.sysconfig Source3: pgpool.service %endif Source4: pgpool_rhel.sysconfig +Source5: pgpool_tmpfiles.d +Source6: pgpool_sudoers.d Patch1: pgpool-II-head.patch %if %{pgsql_ver} >=94 && %{rhel} >= 7 Patch2: pgpool_socket_dir.patch @@ -134,6 +136,25 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} install -C src/sql/pgpool_adm install -d %{buildroot}%{_datadir}/%{short_name} install -d %{buildroot}%{_sysconfdir}/%{short_name} +install -d %{buildroot}%{_sysconfdir}/%{short_name}/scripts +mv %{buildroot}%{_sysconfdir}/%{short_name}/failover.sh.sample \ + %{buildroot}%{_sysconfdir}/%{short_name}/scripts/failover.sh.sample +mv %{buildroot}%{_sysconfdir}/%{short_name}/follow_primary.sh.sample \ + %{buildroot}%{_sysconfdir}/%{short_name}/scripts/follow_primary.sh.sample +mv %{buildroot}%{_sysconfdir}/%{short_name}/pgpool_remote_start.sample \ + %{buildroot}%{_sysconfdir}/%{short_name}/scripts/pgpool_remote_start.sample +mv %{buildroot}%{_sysconfdir}/%{short_name}/recovery_1st_stage.sample \ + %{buildroot}%{_sysconfdir}/%{short_name}/scripts/recovery_1st_stage.sample +mv %{buildroot}%{_sysconfdir}/%{short_name}/replication_mode_recovery_1st_stage.sample \ + %{buildroot}%{_sysconfdir}/%{short_name}/scripts/replication_mode_recovery_1st_stage.sample +mv %{buildroot}%{_sysconfdir}/%{short_name}/replication_mode_recovery_2nd_stage.sample \ + %{buildroot}%{_sysconfdir}/%{short_name}/scripts/replication_mode_recovery_2nd_stage.sample +mv %{buildroot}%{_sysconfdir}/%{short_name}/escalation.sh.sample \ + %{buildroot}%{_sysconfdir}/%{short_name}/scripts/escalation.sh.sample +mv %{buildroot}%{_sysconfdir}/%{short_name}/aws_eip_if_cmd.sh.sample \ + %{buildroot}%{_sysconfdir}/%{short_name}/scripts/aws_eip_if_cmd.sh.sample +mv %{buildroot}%{_sysconfdir}/%{short_name}/aws_rtb_if_cmd.sh.sample \ + %{buildroot}%{_sysconfdir}/%{short_name}/scripts/aws_rtb_if_cmd.sh.sample cp %{buildroot}%{_sysconfdir}/%{short_name}/pcp.conf.sample %{buildroot}%{_sysconfdir}/%{short_name}/pcp.conf cp %{buildroot}%{_sysconfdir}/%{short_name}/pgpool.conf.sample %{buildroot}%{_sysconfdir}/%{short_name}/pgpool.conf cp %{buildroot}%{_sysconfdir}/%{short_name}/pool_hba.conf.sample %{buildroot}%{_sysconfdir}/%{short_name}/pool_hba.conf @@ -145,9 +166,7 @@ install -d %{buildroot}%{_unitdir} install -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/pgpool.service mkdir -p %{buildroot}%{_tmpfilesdir} -cat > %{buildroot}%{_tmpfilesdir}/%{name}.conf </dev/null 2>&1 || : -echo 'postgres ALL=NOPASSWD: /usr/sbin/arping' | sudo EDITOR='tee -a' visudo >/dev/null 2>&1 || : %if %{systemd_enabled} %systemd_post pgpool.service @@ -258,6 +279,7 @@ fi %if %{systemd_enabled} %ghost %{_varrundir} %{_tmpfilesdir}/%{name}.conf +%{_sysconfdir}/sudoers.d/pgpool %{_unitdir}/pgpool.service %else %{_initrddir}/pgpool @@ -268,13 +290,15 @@ fi %{_sysconfdir}/%{short_name}/pcp.conf.sample %{_sysconfdir}/%{short_name}/pool_hba.conf.sample %defattr(755,postgres,postgres,-) -%{_sysconfdir}/%{short_name}/failover.sh.sample -%{_sysconfdir}/%{short_name}/follow_primary.sh.sample -%{_sysconfdir}/%{short_name}/pgpool_remote_start.sample -%{_sysconfdir}/%{short_name}/recovery_1st_stage.sample -%{_sysconfdir}/%{short_name}/replication_mode_recovery_1st_stage.sample -%{_sysconfdir}/%{short_name}/replication_mode_recovery_2nd_stage.sample -%{_sysconfdir}/%{short_name}/escalation.sh.sample +%{_sysconfdir}/%{short_name}/scripts/failover.sh.sample +%{_sysconfdir}/%{short_name}/scripts/follow_primary.sh.sample +%{_sysconfdir}/%{short_name}/scripts/pgpool_remote_start.sample +%{_sysconfdir}/%{short_name}/scripts/recovery_1st_stage.sample +%{_sysconfdir}/%{short_name}/scripts/replication_mode_recovery_1st_stage.sample +%{_sysconfdir}/%{short_name}/scripts/replication_mode_recovery_2nd_stage.sample +%{_sysconfdir}/%{short_name}/scripts/escalation.sh.sample +%{_sysconfdir}/%{short_name}/scripts/aws_eip_if_cmd.sh.sample +%{_sysconfdir}/%{short_name}/scripts/aws_rtb_if_cmd.sh.sample %attr(600,postgres,postgres) %config(noreplace) %{_sysconfdir}/%{short_name}/*.conf %attr(600,postgres,postgres) %config(noreplace) %{_sysconfdir}/%{short_name}/pool_passwd %attr(600,postgres,postgres) %config(noreplace) %{_sysconfdir}/%{short_name}/pgpool_node_id @@ -329,6 +353,11 @@ fi %endif %changelog +* Wed Nov 2 2022 Bo Peng 4.4.0 +- Change /lib/tmpfiles.d/ file from /var/run to /run +- Install /etc/sudoers.d/pgpool +- Add scripts aws_eip_if_cmd.sh.sample and aws_rtb_if_cmd.sh.sample + * Thu Sep 10 2020 Bo Peng 4.2.0 - Update to 4.2 diff --git a/src/redhat/pgpool_socket_dir.patch b/src/redhat/pgpool_socket_dir.patch index 196af8d4a..986eefdae 100644 --- a/src/redhat/pgpool_socket_dir.patch +++ b/src/redhat/pgpool_socket_dir.patch @@ -1,24 +1,24 @@ -*** src/sample/pgpool.conf.sample 2021-11-08 15:00:32.984579019 +0900 ---- pgpool.conf.sample 2021-11-08 17:14:44.456058528 +0900 +*** src/sample/pgpool.conf.sample 2022-11-02 13:03:37.123808571 +0900 +--- pgpool.conf.sample 2022-11-04 13:35:43.081669422 +0900 *************** *** 39,45 **** #port = 9999 # Port number # (change requires restart) -! #socket_dir = '/tmp' - # Unix domain socket path +! #unix_socket_directories = '/tmp' + # Unix domain socket path(s) # The Debian package defaults to # /var/run/postgresql --- 39,45 ---- #port = 9999 # Port number # (change requires restart) -! socket_dir = '/var/run/postgresql' - # Unix domain socket path +! unix_socket_directories = '/var/run/postgresql' + # Unix domain socket path(s) # The Debian package defaults to # /var/run/postgresql *************** -*** 59,65 **** +*** 65,71 **** #pcp_port = 9898 # Port number for pcp # (change requires restart) @@ -26,7 +26,7 @@ # Unix domain socket path for pcp # The Debian package defaults to # /var/run/postgresql ---- 59,65 ---- +--- 65,71 ---- #pcp_port = 9898 # Port number for pcp # (change requires restart) @@ -35,7 +35,7 @@ # The Debian package defaults to # /var/run/postgresql *************** -*** 676,682 **** +*** 687,693 **** # Authentication key for watchdog communication # (change requires restart) @@ -43,7 +43,7 @@ # Unix domain socket path for watchdog IPC socket # The Debian package defaults to # /var/run/postgresql ---- 676,682 ---- +--- 687,693 ---- # Authentication key for watchdog communication # (change requires restart) diff --git a/src/redhat/pgpool_sudoers.d b/src/redhat/pgpool_sudoers.d new file mode 100644 index 000000000..e81c66580 --- /dev/null +++ b/src/redhat/pgpool_sudoers.d @@ -0,0 +1,2 @@ +postgres ALL=NOPASSWD: /sbin/ip +postgres ALL=NOPASSWD: /usr/sbin/arping diff --git a/src/redhat/pgpool_tmpfiles.d b/src/redhat/pgpool_tmpfiles.d new file mode 100644 index 000000000..145e56ac7 --- /dev/null +++ b/src/redhat/pgpool_tmpfiles.d @@ -0,0 +1 @@ +d /run/pgpool 0755 postgres postgres - -- 2.39.5