From baeff9e4f04c7f86f9cbe84efaf4dc66b3a4add4 Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 4 Dec 2018 17:33:56 -0500 Subject: [PATCH] Create common if expressions for testing os-type. These expressions simplify os-type testing. This will be especially true as more OS types are added. --- doc/xml/release.xml | 4 + doc/xml/user-guide.xml | 210 +++++++++++++++++++++-------------------- 2 files changed, 111 insertions(+), 103 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index d917cf9ed..51e79cf0c 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -154,6 +154,10 @@

Documentation may be built with user-specified packages.

+ + +

Create common if expressions for testing os-type.

+
diff --git a/doc/xml/user-guide.xml b/doc/xml/user-guide.xml index 7d7cc3691..9160497ab 100644 --- a/doc/xml/user-guide.xml +++ b/doc/xml/user-guide.xml @@ -15,15 +15,19 @@ debian + + '{[os-type]}' eq '{[os-debian]}' + '{[os-type]}' eq '{[os-centos6]}' + - ubuntu:16.04 - centos:6 + ubuntu:16.04 + centos:6 - Debian & Ubuntu - RHEL & CentOS 6 + Debian & Ubuntu + RHEL & CentOS 6 - Debian/Ubuntu - RHEL/CentOS 6 + Debian/Ubuntu + RHEL/CentOS 6 use File::Basename qw(dirname); @@ -32,21 +36,21 @@ dirname(dirname(abs_path($0))); - 9.4 - 9.5 + 9.4 + 9.5 95 - 9.5 - 9.6 - 96 + 9.5 + 9.6 + 96 - /usr/lib/postgresql/{[pg-version]}/bin - /usr/pgsql-{[pg-version]}/bin + /usr/lib/postgresql/{[pg-version]}/bin + /usr/pgsql-{[pg-version]}/bin - /usr/lib/postgresql/{[pg-version-upgrade]}/bin - /usr/pgsql-{[pg-version-upgrade]}/bin + /usr/lib/postgresql/{[pg-version-upgrade]}/bin + /usr/pgsql-{[pg-version-upgrade]}/bin - /var/lib/postgresql - /var/lib/pgsql + /var/lib/postgresql + /var/lib/pgsql postgres @@ -67,44 +71,44 @@ {[backrest-config-path]}/{[project-exe]}.conf /etc/{[project-exe]}.conf - /var/lib/postgresql/[version]/[cluster] - /var/lib/pgsql/[version]/data + /var/lib/postgresql/[version]/[cluster] + /var/lib/pgsql/[version]/data - /var/lib/postgresql/{[pg-version]}/{[postgres-cluster-demo]} - /var/lib/pgsql/{[pg-version]}/data + /var/lib/postgresql/{[pg-version]}/{[postgres-cluster-demo]} + /var/lib/pgsql/{[pg-version]}/data - /var/lib/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]} - /var/lib/pgsql/{[pg-version-upgrade]}/data + /var/lib/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]} + /var/lib/pgsql/{[pg-version-upgrade]}/data /var/spool/pgbackrest - /etc/postgresql/{[pg-version]}/{[postgres-cluster-demo]}/postgresql.conf - {[pg-path]}/postgresql.conf + /etc/postgresql/{[pg-version]}/{[postgres-cluster-demo]}/postgresql.conf + {[pg-path]}/postgresql.conf - /etc/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]}/postgresql.conf - {[pg-path-upgrade]}/postgresql.conf + /etc/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]}/postgresql.conf + {[pg-path-upgrade]}/postgresql.conf - /etc/postgresql/{[pg-version]}/{[postgres-cluster-demo]}/pg_hba.conf - {[pg-path]}/pg_hba.conf + /etc/postgresql/{[pg-version]}/{[postgres-cluster-demo]}/pg_hba.conf + {[pg-path]}/pg_hba.conf - /etc/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]}/pg_hba.conf - {[pg-path-upgrade]}/pg_hba.conf + /etc/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]}/pg_hba.conf + {[pg-path-upgrade]}/pg_hba.conf {[pg-home-path]}/.pgpass - /var/log/postgresql/postgresql-{[pg-version]}-{[postgres-cluster-demo]}.log - {[pg-path]}/pg_log/postgresql.log + /var/log/postgresql/postgresql-{[pg-version]}-{[postgres-cluster-demo]}.log + {[pg-path]}/pg_log/postgresql.log - /var/lib/pgsql/{[pg-version]}/pgstartup.log + /var/lib/pgsql/{[pg-version]}/pgstartup.log - {[pg-path]}/recovery.conf - {[pg-path]}/recovery.conf + {[pg-path]}/recovery.conf + {[pg-path]}/recovery.conf pg_switch_xlog - u16 - co6 + u16 + co6 pgbackrest/doc:{[os-type]} @@ -148,28 +152,28 @@ sleep 2 - pg_createcluster {[pg-version]} {[postgres-cluster-demo]} - service postgresql-{[pg-version]} initdb + pg_createcluster {[pg-version]} {[postgres-cluster-demo]} + service postgresql-{[pg-version]} initdb - pg_createcluster {[pg-version-upgrade]} {[postgres-cluster-demo]} + pg_createcluster {[pg-version-upgrade]} {[postgres-cluster-demo]} - pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} start - service postgresql-{[pg-version]} start + pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} start + service postgresql-{[pg-version]} start - pg_ctlcluster {[pg-version-upgrade]} {[postgres-cluster-demo]} start - service postgresql-{[pg-version-upgrade]} start + pg_ctlcluster {[pg-version-upgrade]} {[postgres-cluster-demo]} start + service postgresql-{[pg-version-upgrade]} start - pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} stop - service postgresql-{[pg-version]} stop + pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} stop + service postgresql-{[pg-version]} stop - pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} restart - service postgresql-{[pg-version]} restart + pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} restart + service postgresql-{[pg-version]} restart - pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} reload - service postgresql-{[pg-version]} reload + pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} reload + service postgresql-{[pg-version]} reload - pg_lsclusters - service postgresql-{[pg-version-upgrade]} status + pg_lsclusters + service postgresql-{[pg-version-upgrade]} status @@ -198,7 +202,7 @@ - + # Fix root tty RUN sed -i 's/^mesg n/tty -s \&\& mesg n/g' /root/.profile && \ @@ -230,7 +234,7 @@ ENTRYPOINT service ssh restart && bash - + # Install packages RUN yum install -y openssh-server openssh-clients sudo wget vim 2>&1 @@ -343,12 +347,12 @@ Install required Perl packages - + apt-get install libdbd-pg-perl -y 2>&1 - + yum install perl perl-Time-HiRes perl-parent perl-JSON perl-Digest-SHA perl-DBD-Pg -y 2>&1 @@ -388,26 +392,26 @@ Install <backrest/> from package - + dpkg -i {[pgbackrest-path]}/{[package]} 2>&1 - + apt-get -y install -f -y 2>&1 - + apt-get install pgbackrest - + yum -y install {[pgbackrest-path]}/{[package]} -y 2>&1 - + yum install pgbackrest @@ -540,9 +544,9 @@
Build -

{[user-guide-os]} packages for are available at apt.postgresql.org. If they are not provided for your distribution/version it is easy to download the source and install manually.

+

{[user-guide-os]} packages for are available at apt.postgresql.org. If they are not provided for your distribution/version it is easy to download the source and install manually.

-

{[user-guide-os]} packages for are available from Crunchy Data or yum.postgresql.org, but it is also easy to download the source and install manually.

+

{[user-guide-os]} packages for are available from Crunchy Data or yum.postgresql.org, but it is also easy to download the source and install manually.

@@ -573,16 +577,16 @@ Install build dependencies - + apt-get update - + apt-get install build-essential libssl-dev libxml2-dev libperl-dev -y 2>&1 - + yum install build-essential gcc openssl-devel libxml2-devel perl-ExtUtils-Embed @@ -631,10 +635,10 @@ Create <user>{[br-user]}</user> user - + adduser --ingroup {[pg-group]} --disabled-password --gecos "" {[br-user]} - + adduser -g{[pg-group]} -n {[br-user]} @@ -677,7 +681,7 @@ -D {[pg-path]} -k -A peer - + {[pg-cluster-create]} @@ -698,9 +702,9 @@ '' -

By default {[user-guide-os]} includes the day of the week in the log filename. This makes automating the user guide a bit more complicated so the log_filename is set to a constant.

+

By default {[user-guide-os]} includes the day of the week in the log filename. This makes automating the user guide a bit more complicated so the log_filename is set to a constant.

- + Set <pg-option>log_filename</pg-option> 'postgresql.log' @@ -1015,7 +1019,7 @@ Attempt to start the corrupted {[postgres-cluster-demo]} cluster - + {[pg-cluster-start]} could not find the database system @@ -1024,15 +1028,15 @@ {[pg-cluster-wait]} - + rm -f {[postgres-log-pgstartup-demo]} - + {[pg-cluster-start]} - + cat {[postgres-log-pgstartup-demo]} error could not find the database system @@ -1244,7 +1248,7 @@
-
+
Using <proper>jq</proper>

jq is a command-line utility that can easily extract data from JSON.

@@ -1866,12 +1870,12 @@ Install packages required for S3 support - + apt-get install libio-socket-ssl-perl libxml-libxml-perl -y 2>&1 - + yum install perl-XML-LibXML perl-IO-Socket-SSL -y 2>&1 @@ -2052,13 +2056,13 @@ Create <user>{[br-user]}</user> user - + adduser --disabled-password --gecos "" {[br-user]} - + groupadd {[br-group]} - + adduser -g{[br-group]} -n {[br-user]} @@ -2392,10 +2396,10 @@ Create <user>{[br-user]}</user> user - + adduser --ingroup {[pg-group]} --disabled-password --gecos "" {[br-user]} - + adduser -g{[pg-group]} -n {[br-user]} @@ -2452,9 +2456,9 @@ n -

The demo cluster must be created (even though it will be overwritten on restore) in order to create the configuration files.

+

The demo cluster must be created (even though it will be overwritten on restore) in order to create the configuration files.

- + Create demo cluster @@ -2462,9 +2466,9 @@ -

Create the path where will be restored.

+

Create the path where will be restored.

- + Create <postgres/> path @@ -2479,11 +2483,11 @@ Restore the {[postgres-cluster-demo]} standby cluster - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} {[dash]}-delta restore - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} restore @@ -2679,9 +2683,9 @@ -

By default {[user-guide-os]} stores the postgresql.conf file in the data directory. That means the change made to postgresql.conf was overwritten by the last restore and the hot_standby setting must be enabled again. Other solutions to this problem are to store the postgresql.conf file elsewhere or to enable the hot_standby setting on the {[host-pg1]} host where it will be ignored.

+

By default {[user-guide-os]} stores the postgresql.conf file in the data directory. That means the change made to postgresql.conf was overwritten by the last restore and the hot_standby setting must be enabled again. Other solutions to this problem are to store the postgresql.conf file elsewhere or to enable the hot_standby setting on the {[host-pg1]} host where it will be ignored.

- + Enable <pg-option>hot_standby</pg-option> on @@ -2966,11 +2970,11 @@
- + {[pg-cluster-create-upgrade]} - + sh -c 'cd /var/lib/postgresql && /usr/lib/postgresql/{[pg-version-upgrade]}/bin/pg_upgrade {[dash]}-old-bindir=/usr/lib/postgresql/{[pg-version]}/bin @@ -2983,7 +2987,7 @@ Upgrade Complete - + sh -c 'cd /var/lib/pgsql && /usr/pgsql-{[pg-version-upgrade]}/bin/pg_upgrade {[dash]}-old-bindir=/usr/pgsql-{[pg-version]}/bin @@ -3084,11 +3088,11 @@ Remove old cluster - + pg_dropcluster {[pg-version]} {[postgres-cluster-demo]} - + rm -rf {[pg-path]} @@ -3098,21 +3102,21 @@ Remove old cluster and create the new cluster - + pg_dropcluster {[pg-version]} {[postgres-cluster-demo]} - + rm -rf {[pg-path]} - + mkdir -p -m 700 {[pg-bin-upgrade-path]} - + {[pg-cluster-create-upgrade]} @@ -3140,11 +3144,11 @@ Restore the {[postgres-cluster-demo]} standby cluster - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} {[dash]}-delta restore - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} restore