mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
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.
This commit is contained in:
parent
9e217d0256
commit
baeff9e4f0
@ -154,6 +154,10 @@
|
||||
<release-item>
|
||||
<p>Documentation may be built with user-specified packages.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Create common <id>if</id> expressions for testing <id>os-type</id>.</p>
|
||||
</release-item>
|
||||
</release-development-list>
|
||||
</release-doc-list>
|
||||
|
||||
|
@ -15,15 +15,19 @@
|
||||
<!-- Defines the general OS type that will be used to generate commands. Also supported: centos6 -->
|
||||
<variable key="os-type">debian</variable>
|
||||
|
||||
<!-- Common if expressions for testing os-type -->
|
||||
<variable key="os-type-is-debian">'{[os-type]}' eq '{[os-debian]}'</variable>
|
||||
<variable key="os-type-is-centos6">'{[os-type]}' eq '{[os-centos6]}'</variable>
|
||||
|
||||
<!-- Defines the container image that will be used to build the host -->
|
||||
<variable key="os-image" if="'{[os-type]}' eq '{[os-debian]}'">ubuntu:16.04</variable>
|
||||
<variable key="os-image" if="'{[os-type]}' eq '{[os-centos6]}'">centos:6</variable>
|
||||
<variable key="os-image" if="{[os-type-is-debian]}">ubuntu:16.04</variable>
|
||||
<variable key="os-image" if="{[os-type-is-centos6]}">centos:6</variable>
|
||||
|
||||
<variable key="user-guide-subtitle" if="'{[os-type]}' eq '{[os-debian]}'">Debian & Ubuntu</variable>
|
||||
<variable key="user-guide-subtitle" if="'{[os-type]}' eq '{[os-centos6]}'">RHEL & CentOS 6</variable>
|
||||
<variable key="user-guide-subtitle" if="{[os-type-is-debian]}">Debian & Ubuntu</variable>
|
||||
<variable key="user-guide-subtitle" if="{[os-type-is-centos6]}">RHEL & CentOS 6</variable>
|
||||
|
||||
<variable key="user-guide-os" if="'{[os-type]}' eq '{[os-debian]}'">Debian/Ubuntu</variable>
|
||||
<variable key="user-guide-os" if="'{[os-type]}' eq '{[os-centos6]}'">RHEL/CentOS 6</variable>
|
||||
<variable key="user-guide-os" if="{[os-type-is-debian]}">Debian/Ubuntu</variable>
|
||||
<variable key="user-guide-os" if="{[os-type-is-centos6]}">RHEL/CentOS 6</variable>
|
||||
|
||||
<variable key="pgbackrest-path" eval="y">
|
||||
use File::Basename qw(dirname);
|
||||
@ -32,21 +36,21 @@
|
||||
dirname(dirname(abs_path($0)));
|
||||
</variable>
|
||||
|
||||
<variable key="pg-version" if="'{[os-type]}' eq '{[os-debian]}'">9.4</variable>
|
||||
<variable key="pg-version" if="'{[os-type]}' eq '{[os-centos6]}'">9.5</variable>
|
||||
<variable key="pg-version" if="{[os-type-is-debian]}">9.4</variable>
|
||||
<variable key="pg-version" if="{[os-type-is-centos6]}">9.5</variable>
|
||||
<variable key="pg-version-nodot">95</variable>
|
||||
<variable key="pg-version-upgrade" if="'{[os-type]}' eq '{[os-debian]}'">9.5</variable>
|
||||
<variable key="pg-version-upgrade" if="'{[os-type]}' eq '{[os-centos6]}'">9.6</variable>
|
||||
<variable key="pg-version-upgrade-nodot" if="'{[os-type]}' eq '{[os-centos6]}'">96</variable>
|
||||
<variable key="pg-version-upgrade" if="{[os-type-is-debian]}">9.5</variable>
|
||||
<variable key="pg-version-upgrade" if="{[os-type-is-centos6]}">9.6</variable>
|
||||
<variable key="pg-version-upgrade-nodot" if="{[os-type-is-centos6]}">96</variable>
|
||||
|
||||
<variable key="pg-bin-path" if="'{[os-type]}' eq '{[os-debian]}'">/usr/lib/postgresql/{[pg-version]}/bin</variable>
|
||||
<variable key="pg-bin-path" if="'{[os-type]}' eq '{[os-centos6]}'">/usr/pgsql-{[pg-version]}/bin</variable>
|
||||
<variable key="pg-bin-path" if="{[os-type-is-debian]}">/usr/lib/postgresql/{[pg-version]}/bin</variable>
|
||||
<variable key="pg-bin-path" if="{[os-type-is-centos6]}">/usr/pgsql-{[pg-version]}/bin</variable>
|
||||
|
||||
<variable key="pg-bin-upgrade-path" if="'{[os-type]}' eq '{[os-debian]}'">/usr/lib/postgresql/{[pg-version-upgrade]}/bin</variable>
|
||||
<variable key="pg-bin-upgrade-path" if="'{[os-type]}' eq '{[os-centos6]}'">/usr/pgsql-{[pg-version-upgrade]}/bin</variable>
|
||||
<variable key="pg-bin-upgrade-path" if="{[os-type-is-debian]}">/usr/lib/postgresql/{[pg-version-upgrade]}/bin</variable>
|
||||
<variable key="pg-bin-upgrade-path" if="{[os-type-is-centos6]}">/usr/pgsql-{[pg-version-upgrade]}/bin</variable>
|
||||
|
||||
<variable key="pg-home-path" if="'{[os-type]}' eq '{[os-debian]}'">/var/lib/postgresql</variable>
|
||||
<variable key="pg-home-path" if="'{[os-type]}' eq '{[os-centos6]}'">/var/lib/pgsql</variable>
|
||||
<variable key="pg-home-path" if="{[os-type-is-debian]}">/var/lib/postgresql</variable>
|
||||
<variable key="pg-home-path" if="{[os-type-is-centos6]}">/var/lib/pgsql</variable>
|
||||
|
||||
<variable key="pg-group">postgres</variable>
|
||||
|
||||
@ -67,44 +71,44 @@
|
||||
<variable if="'{[package]}' eq 'none'" key="backrest-config-demo">{[backrest-config-path]}/{[project-exe]}.conf</variable>
|
||||
<variable if="'{[package]}' ne 'none'" key="backrest-config-demo">/etc/{[project-exe]}.conf</variable>
|
||||
|
||||
<variable key="pg-path-default" if="'{[os-type]}' eq '{[os-debian]}'">/var/lib/postgresql/[version]/[cluster]</variable>
|
||||
<variable key="pg-path-default" if="'{[os-type]}' eq '{[os-centos6]}'">/var/lib/pgsql/[version]/data</variable>
|
||||
<variable key="pg-path-default" if="{[os-type-is-debian]}">/var/lib/postgresql/[version]/[cluster]</variable>
|
||||
<variable key="pg-path-default" if="{[os-type-is-centos6]}">/var/lib/pgsql/[version]/data</variable>
|
||||
|
||||
<variable key="pg-path" if="'{[os-type]}' eq '{[os-debian]}'">/var/lib/postgresql/{[pg-version]}/{[postgres-cluster-demo]}</variable>
|
||||
<variable key="pg-path" if="'{[os-type]}' eq '{[os-centos6]}'">/var/lib/pgsql/{[pg-version]}/data</variable>
|
||||
<variable key="pg-path" if="{[os-type-is-debian]}">/var/lib/postgresql/{[pg-version]}/{[postgres-cluster-demo]}</variable>
|
||||
<variable key="pg-path" if="{[os-type-is-centos6]}">/var/lib/pgsql/{[pg-version]}/data</variable>
|
||||
|
||||
<variable key="pg-path-upgrade" if="'{[os-type]}' eq '{[os-debian]}'">/var/lib/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]}</variable>
|
||||
<variable key="pg-path-upgrade" if="'{[os-type]}' eq '{[os-centos6]}'">/var/lib/pgsql/{[pg-version-upgrade]}/data</variable>
|
||||
<variable key="pg-path-upgrade" if="{[os-type-is-debian]}">/var/lib/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]}</variable>
|
||||
<variable key="pg-path-upgrade" if="{[os-type-is-centos6]}">/var/lib/pgsql/{[pg-version-upgrade]}/data</variable>
|
||||
|
||||
<variable key="spool-path">/var/spool/pgbackrest</variable>
|
||||
|
||||
<variable key="postgres-config-demo" if="'{[os-type]}' eq '{[os-debian]}'">/etc/postgresql/{[pg-version]}/{[postgres-cluster-demo]}/postgresql.conf</variable>
|
||||
<variable key="postgres-config-demo" if="'{[os-type]}' eq '{[os-centos6]}'">{[pg-path]}/postgresql.conf</variable>
|
||||
<variable key="postgres-config-demo" if="{[os-type-is-debian]}">/etc/postgresql/{[pg-version]}/{[postgres-cluster-demo]}/postgresql.conf</variable>
|
||||
<variable key="postgres-config-demo" if="{[os-type-is-centos6]}">{[pg-path]}/postgresql.conf</variable>
|
||||
|
||||
<variable key="postgres-config-demo-upgrade" if="'{[os-type]}' eq '{[os-debian]}'">/etc/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]}/postgresql.conf</variable>
|
||||
<variable key="postgres-config-demo-upgrade" if="'{[os-type]}' eq '{[os-centos6]}'">{[pg-path-upgrade]}/postgresql.conf</variable>
|
||||
<variable key="postgres-config-demo-upgrade" if="{[os-type-is-debian]}">/etc/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]}/postgresql.conf</variable>
|
||||
<variable key="postgres-config-demo-upgrade" if="{[os-type-is-centos6]}">{[pg-path-upgrade]}/postgresql.conf</variable>
|
||||
|
||||
<variable key="postgres-hba-demo" if="'{[os-type]}' eq '{[os-debian]}'">/etc/postgresql/{[pg-version]}/{[postgres-cluster-demo]}/pg_hba.conf</variable>
|
||||
<variable key="postgres-hba-demo" if="'{[os-type]}' eq '{[os-centos6]}'">{[pg-path]}/pg_hba.conf</variable>
|
||||
<variable key="postgres-hba-demo" if="{[os-type-is-debian]}">/etc/postgresql/{[pg-version]}/{[postgres-cluster-demo]}/pg_hba.conf</variable>
|
||||
<variable key="postgres-hba-demo" if="{[os-type-is-centos6]}">{[pg-path]}/pg_hba.conf</variable>
|
||||
|
||||
<variable key="postgres-hba-demo-upgrade" if="'{[os-type]}' eq '{[os-debian]}'">/etc/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]}/pg_hba.conf</variable>
|
||||
<variable key="postgres-hba-demo-upgrade" if="'{[os-type]}' eq '{[os-centos6]}'">{[pg-path-upgrade]}/pg_hba.conf</variable>
|
||||
<variable key="postgres-hba-demo-upgrade" if="{[os-type-is-debian]}">/etc/postgresql/{[pg-version-upgrade]}/{[postgres-cluster-demo]}/pg_hba.conf</variable>
|
||||
<variable key="postgres-hba-demo-upgrade" if="{[os-type-is-centos6]}">{[pg-path-upgrade]}/pg_hba.conf</variable>
|
||||
|
||||
<variable key="postgres-pgpass">{[pg-home-path]}/.pgpass</variable>
|
||||
|
||||
<variable key="postgres-log-demo" if="'{[os-type]}' eq '{[os-debian]}'">/var/log/postgresql/postgresql-{[pg-version]}-{[postgres-cluster-demo]}.log</variable>
|
||||
<variable key="postgres-log-demo" if="'{[os-type]}' eq '{[os-centos6]}'">{[pg-path]}/pg_log/postgresql.log</variable>
|
||||
<variable key="postgres-log-demo" if="{[os-type-is-debian]}">/var/log/postgresql/postgresql-{[pg-version]}-{[postgres-cluster-demo]}.log</variable>
|
||||
<variable key="postgres-log-demo" if="{[os-type-is-centos6]}">{[pg-path]}/pg_log/postgresql.log</variable>
|
||||
|
||||
<variable key="postgres-log-pgstartup-demo" if="'{[os-type]}' eq '{[os-centos6]}'">/var/lib/pgsql/{[pg-version]}/pgstartup.log</variable>
|
||||
<variable key="postgres-log-pgstartup-demo" if="{[os-type-is-centos6]}">/var/lib/pgsql/{[pg-version]}/pgstartup.log</variable>
|
||||
|
||||
<variable key="postgres-recovery-demo" if="'{[os-type]}' eq '{[os-debian]}'">{[pg-path]}/recovery.conf</variable>
|
||||
<variable key="postgres-recovery-demo" if="'{[os-type]}' eq '{[os-centos6]}'">{[pg-path]}/recovery.conf</variable>
|
||||
<variable key="postgres-recovery-demo" if="{[os-type-is-debian]}">{[pg-path]}/recovery.conf</variable>
|
||||
<variable key="postgres-recovery-demo" if="{[os-type-is-centos6]}">{[pg-path]}/recovery.conf</variable>
|
||||
|
||||
<variable key="pg-switch-wal">pg_switch_xlog</variable>
|
||||
|
||||
<!-- Hosts -->
|
||||
<variable key="host-os" if="'{[os-type]}' eq '{[os-debian]}'">u16</variable>
|
||||
<variable key="host-os" if="'{[os-type]}' eq '{[os-centos6]}'">co6</variable>
|
||||
<variable key="host-os" if="{[os-type-is-debian]}">u16</variable>
|
||||
<variable key="host-os" if="{[os-type-is-centos6]}">co6</variable>
|
||||
|
||||
<variable key="host-image">pgbackrest/doc:{[os-type]}</variable>
|
||||
|
||||
@ -148,28 +152,28 @@
|
||||
<!-- Database cluster commmands -->
|
||||
<variable key="pg-cluster-wait">sleep 2</variable>
|
||||
|
||||
<variable key="pg-cluster-create" if="'{[os-type]}' eq '{[os-debian]}'">pg_createcluster {[pg-version]} {[postgres-cluster-demo]}</variable>
|
||||
<variable key="pg-cluster-create" if="'{[os-type]}' eq '{[os-centos6]}'">service postgresql-{[pg-version]} initdb</variable>
|
||||
<variable key="pg-cluster-create" if="{[os-type-is-debian]}">pg_createcluster {[pg-version]} {[postgres-cluster-demo]}</variable>
|
||||
<variable key="pg-cluster-create" if="{[os-type-is-centos6]}">service postgresql-{[pg-version]} initdb</variable>
|
||||
|
||||
<variable key="pg-cluster-create-upgrade" if="'{[os-type]}' eq '{[os-debian]}'">pg_createcluster {[pg-version-upgrade]} {[postgres-cluster-demo]}</variable>
|
||||
<variable key="pg-cluster-create-upgrade" if="{[os-type-is-debian]}">pg_createcluster {[pg-version-upgrade]} {[postgres-cluster-demo]}</variable>
|
||||
|
||||
<variable key="pg-cluster-start" if="'{[os-type]}' eq '{[os-debian]}'">pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} start</variable>
|
||||
<variable key="pg-cluster-start" if="'{[os-type]}' eq '{[os-centos6]}'">service postgresql-{[pg-version]} start</variable>
|
||||
<variable key="pg-cluster-start" if="{[os-type-is-debian]}">pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} start</variable>
|
||||
<variable key="pg-cluster-start" if="{[os-type-is-centos6]}">service postgresql-{[pg-version]} start</variable>
|
||||
|
||||
<variable key="pg-cluster-start-upgrade" if="'{[os-type]}' eq '{[os-debian]}'">pg_ctlcluster {[pg-version-upgrade]} {[postgres-cluster-demo]} start</variable>
|
||||
<variable key="pg-cluster-start-upgrade" if="'{[os-type]}' eq '{[os-centos6]}'">service postgresql-{[pg-version-upgrade]} start</variable>
|
||||
<variable key="pg-cluster-start-upgrade" if="{[os-type-is-debian]}">pg_ctlcluster {[pg-version-upgrade]} {[postgres-cluster-demo]} start</variable>
|
||||
<variable key="pg-cluster-start-upgrade" if="{[os-type-is-centos6]}">service postgresql-{[pg-version-upgrade]} start</variable>
|
||||
|
||||
<variable key="pg-cluster-stop" if="'{[os-type]}' eq '{[os-debian]}'">pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} stop</variable>
|
||||
<variable key="pg-cluster-stop" if="'{[os-type]}' eq '{[os-centos6]}'">service postgresql-{[pg-version]} stop</variable>
|
||||
<variable key="pg-cluster-stop" if="{[os-type-is-debian]}">pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} stop</variable>
|
||||
<variable key="pg-cluster-stop" if="{[os-type-is-centos6]}">service postgresql-{[pg-version]} stop</variable>
|
||||
|
||||
<variable key="pg-cluster-restart" if="'{[os-type]}' eq '{[os-debian]}'">pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} restart</variable>
|
||||
<variable key="pg-cluster-restart" if="'{[os-type]}' eq '{[os-centos6]}'">service postgresql-{[pg-version]} restart</variable>
|
||||
<variable key="pg-cluster-restart" if="{[os-type-is-debian]}">pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} restart</variable>
|
||||
<variable key="pg-cluster-restart" if="{[os-type-is-centos6]}">service postgresql-{[pg-version]} restart</variable>
|
||||
|
||||
<variable key="pg-cluster-reload" if="'{[os-type]}' eq '{[os-debian]}'">pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} reload</variable>
|
||||
<variable key="pg-cluster-reload" if="'{[os-type]}' eq '{[os-centos6]}'">service postgresql-{[pg-version]} reload</variable>
|
||||
<variable key="pg-cluster-reload" if="{[os-type-is-debian]}">pg_ctlcluster {[pg-version]} {[postgres-cluster-demo]} reload</variable>
|
||||
<variable key="pg-cluster-reload" if="{[os-type-is-centos6]}">service postgresql-{[pg-version]} reload</variable>
|
||||
|
||||
<variable key="pg-cluster-check-upgrade" if="'{[os-type]}' eq '{[os-debian]}'">pg_lsclusters</variable>
|
||||
<variable key="pg-cluster-check-upgrade" if="'{[os-type]}' eq '{[os-centos6]}'">service postgresql-{[pg-version-upgrade]} status</variable>
|
||||
<variable key="pg-cluster-check-upgrade" if="{[os-type-is-debian]}">pg_lsclusters</variable>
|
||||
<variable key="pg-cluster-check-upgrade" if="{[os-type-is-centos6]}">service postgresql-{[pg-version-upgrade]} status</variable>
|
||||
|
||||
<!-- Common commands -->
|
||||
<variable key="ssh-key-install">
|
||||
@ -198,7 +202,7 @@
|
||||
|
||||
<!-- Setup hosts used to build the documentation
|
||||
============================================================================================================================ -->
|
||||
<host-define if="'{[os-type]}' eq '{[os-debian]}'" image="{[host-image]}" from="{[os-image]}">
|
||||
<host-define if="{[os-type-is-debian]}" image="{[host-image]}" from="{[os-image]}">
|
||||
# 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
|
||||
</host-define>
|
||||
|
||||
<host-define if="'{[os-type]}' eq '{[os-centos6]}'" image="{[host-image]}" from="{[os-image]}">
|
||||
<host-define if="{[os-type-is-centos6]}" image="{[host-image]}" from="{[os-image]}">
|
||||
# Install packages
|
||||
RUN yum install -y openssh-server openssh-clients sudo wget vim 2>&1
|
||||
|
||||
@ -343,12 +347,12 @@
|
||||
<execute-list host="{[br-install-host]}">
|
||||
<title>Install required Perl packages</title>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root" pre="y">
|
||||
<execute if="{[os-type-is-debian]}" user="root" pre="y">
|
||||
<exe-cmd>apt-get install libdbd-pg-perl</exe-cmd>
|
||||
<exe-cmd-extra>-y 2>&1</exe-cmd-extra>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root" pre="y">
|
||||
<execute if="{[os-type-is-centos6]}" user="root" pre="y">
|
||||
<exe-cmd>yum install perl perl-Time-HiRes perl-parent perl-JSON
|
||||
perl-Digest-SHA perl-DBD-Pg</exe-cmd>
|
||||
<exe-cmd-extra>-y 2>&1</exe-cmd-extra>
|
||||
@ -388,26 +392,26 @@
|
||||
<execute-list host="{[br-install-host]}">
|
||||
<title>Install <backrest/> from package</title>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root" err-suppress="y" show="n">
|
||||
<execute if="{[os-type-is-debian]}" user="root" err-suppress="y" show="n">
|
||||
<exe-cmd>dpkg -i {[pgbackrest-path]}/{[package]}</exe-cmd>
|
||||
<exe-cmd-extra> 2>&1</exe-cmd-extra>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root" show="n">
|
||||
<execute if="{[os-type-is-debian]}" user="root" show="n">
|
||||
<exe-cmd>apt-get -y install -f</exe-cmd>
|
||||
<exe-cmd-extra>-y 2>&1</exe-cmd-extra>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root" skip="y">
|
||||
<execute if="{[os-type-is-debian]}" user="root" skip="y">
|
||||
<exe-cmd>apt-get install pgbackrest</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root" show="n">
|
||||
<execute if="{[os-type-is-centos6]}" user="root" show="n">
|
||||
<exe-cmd>yum -y install {[pgbackrest-path]}/{[package]}</exe-cmd>
|
||||
<exe-cmd-extra>-y 2>&1</exe-cmd-extra>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root" skip="y">
|
||||
<execute if="{[os-type-is-centos6]}" user="root" skip="y">
|
||||
<exe-cmd>yum install pgbackrest</exe-cmd>
|
||||
</execute>
|
||||
</execute-list>
|
||||
@ -540,9 +544,9 @@
|
||||
<section if="'{[package]}' eq 'none'" id="build">
|
||||
<title>Build</title>
|
||||
|
||||
<p if="'{[os-type]}' eq '{[os-debian]}'">{[user-guide-os]} packages for <backrest/> are available at <link url="https://www.postgresql.org/download/linux/ubuntu/">apt.postgresql.org</link>. If they are not provided for your distribution/version it is easy to download the source and install manually.</p>
|
||||
<p if="{[os-type-is-debian]}">{[user-guide-os]} packages for <backrest/> are available at <link url="https://www.postgresql.org/download/linux/ubuntu/">apt.postgresql.org</link>. If they are not provided for your distribution/version it is easy to download the source and install manually.</p>
|
||||
|
||||
<p if="'{[os-type]}' eq '{[os-centos6]}'">{[user-guide-os]} packages for <backrest/> are available from <link url="{[crunchy-url-base]}">Crunchy Data</link> or <link url="http://yum.postgresql.org">yum.postgresql.org</link>, but it is also easy to download the source and install manually.</p>
|
||||
<p if="{[os-type-is-centos6]}">{[user-guide-os]} packages for <backrest/> are available from <link url="{[crunchy-url-base]}">Crunchy Data</link> or <link url="http://yum.postgresql.org">yum.postgresql.org</link>, but it is also easy to download the source and install manually.</p>
|
||||
|
||||
<host-add id="{[host-build-id]}" name="{[host-build]}" user="{[host-build-user]}" image="{[host-build-image]}" os="{[os-type]}" mount="{[host-build-mount]}"/>
|
||||
|
||||
@ -573,16 +577,16 @@
|
||||
<execute-list host="{[host-build]}">
|
||||
<title>Install build dependencies</title>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root" show="n" pre="y">
|
||||
<execute if="{[os-type-is-debian]}" user="root" show="n" pre="y">
|
||||
<exe-cmd>apt-get update</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root" pre="y">
|
||||
<execute if="{[os-type-is-debian]}" user="root" pre="y">
|
||||
<exe-cmd>apt-get install build-essential libssl-dev libxml2-dev libperl-dev</exe-cmd>
|
||||
<exe-cmd-extra>-y 2>&1</exe-cmd-extra>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root" pre="y">
|
||||
<execute if="{[os-type-is-centos6]}" user="root" pre="y">
|
||||
<exe-cmd>
|
||||
yum install build-essential gcc openssl-devel libxml2-devel
|
||||
perl-ExtUtils-Embed
|
||||
@ -631,10 +635,10 @@
|
||||
<execute-list if="{[pg-version]} >= 11" host="{[host-pg1]}">
|
||||
<title>Create <user>{[br-user]}</user> user</title>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root">
|
||||
<execute if="{[os-type-is-debian]}" user="root">
|
||||
<exe-cmd>adduser --ingroup {[pg-group]} --disabled-password --gecos "" {[br-user]}</exe-cmd>
|
||||
</execute>
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root">
|
||||
<execute if="{[os-type-is-centos6]}" user="root">
|
||||
<exe-cmd>adduser -g{[pg-group]} -n {[br-user]}</exe-cmd>
|
||||
</execute>
|
||||
</execute-list>
|
||||
@ -677,7 +681,7 @@
|
||||
-D {[pg-path]} -k -A peer</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root" output="y" filter="n">
|
||||
<execute if="{[os-type-is-debian]}" user="root" output="y" filter="n">
|
||||
<exe-cmd>{[pg-cluster-create]}</exe-cmd>
|
||||
</execute>
|
||||
</execute-list>
|
||||
@ -698,9 +702,9 @@
|
||||
<postgres-config-option key="log_line_prefix">''</postgres-config-option>
|
||||
</postgres-config>
|
||||
|
||||
<p if="'{[os-type]}' eq '{[os-centos6]}'">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 <pg-option>log_filename</pg-option> is set to a constant.</p>
|
||||
<p if="{[os-type-is-centos6]}">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 <pg-option>log_filename</pg-option> is set to a constant.</p>
|
||||
|
||||
<postgres-config host="{[host-pg1]}" if="'{[os-type]}' eq '{[os-centos6]}'" file="{[postgres-config-demo]}">
|
||||
<postgres-config host="{[host-pg1]}" if="{[os-type-is-centos6]}" file="{[postgres-config-demo]}">
|
||||
<title>Set <pg-option>log_filename</pg-option></title>
|
||||
|
||||
<postgres-config-option key="log_filename">'postgresql.log'</postgres-config-option>
|
||||
@ -1015,7 +1019,7 @@
|
||||
<execute-list host="{[host-pg1]}">
|
||||
<title>Attempt to start the corrupted {[postgres-cluster-demo]} cluster</title>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root" output="y" err-expect="1">
|
||||
<execute if="{[os-type-is-debian]}" user="root" output="y" err-expect="1">
|
||||
<exe-cmd>{[pg-cluster-start]}</exe-cmd>
|
||||
<exe-highlight>could not find the database system</exe-highlight>
|
||||
</execute>
|
||||
@ -1024,15 +1028,15 @@
|
||||
<exe-cmd>{[pg-cluster-wait]}</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root" show="n">
|
||||
<execute if="{[os-type-is-centos6]}" user="root" show="n">
|
||||
<exe-cmd>rm -f {[postgres-log-pgstartup-demo]}</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root" err-expect="1">
|
||||
<execute if="{[os-type-is-centos6]}" user="root" err-expect="1">
|
||||
<exe-cmd>{[pg-cluster-start]}</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root" output="y">
|
||||
<execute if="{[os-type-is-centos6]}" user="root" output="y">
|
||||
<exe-cmd>cat {[postgres-log-pgstartup-demo]}</exe-cmd>
|
||||
<exe-highlight-type>error</exe-highlight-type>
|
||||
<exe-highlight>could not find the database system</exe-highlight>
|
||||
@ -1244,7 +1248,7 @@
|
||||
</execute-list>
|
||||
</section>
|
||||
|
||||
<section if="'{[os-type]}' eq '{[os-debian]}'" id="jq">
|
||||
<section if="{[os-type-is-debian]}" id="jq">
|
||||
<title>Using <proper>jq</proper></title>
|
||||
|
||||
<p><proper>jq</proper> is a command-line utility that can easily extract data from JSON.</p>
|
||||
@ -1866,12 +1870,12 @@
|
||||
<execute-list host="{[host-pg1]}">
|
||||
<title>Install packages required for S3 support</title>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root" pre="y">
|
||||
<execute if="{[os-type-is-debian]}" user="root" pre="y">
|
||||
<exe-cmd>apt-get install libio-socket-ssl-perl libxml-libxml-perl</exe-cmd>
|
||||
<exe-cmd-extra>-y 2>&1</exe-cmd-extra>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root" pre="y">
|
||||
<execute if="{[os-type-is-centos6]}" user="root" pre="y">
|
||||
<exe-cmd>yum install perl-XML-LibXML perl-IO-Socket-SSL</exe-cmd>
|
||||
<exe-cmd-extra>-y 2>&1</exe-cmd-extra>
|
||||
</execute>
|
||||
@ -2052,13 +2056,13 @@
|
||||
<execute-list host="{[host-repo1]}">
|
||||
<title>Create <user>{[br-user]}</user> user</title>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root">
|
||||
<execute if="{[os-type-is-debian]}" user="root">
|
||||
<exe-cmd>adduser --disabled-password --gecos "" {[br-user]}</exe-cmd>
|
||||
</execute>
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root">
|
||||
<execute if="{[os-type-is-centos6]}" user="root">
|
||||
<exe-cmd>groupadd {[br-group]}</exe-cmd>
|
||||
</execute>
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root">
|
||||
<execute if="{[os-type-is-centos6]}" user="root">
|
||||
<exe-cmd>adduser -g{[br-group]} -n {[br-user]}</exe-cmd>
|
||||
</execute>
|
||||
</execute-list>
|
||||
@ -2392,10 +2396,10 @@
|
||||
<execute-list if="{[pg-version]} >= 11" host="{[host-pg2]}">
|
||||
<title>Create <user>{[br-user]}</user> user</title>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root">
|
||||
<execute if="{[os-type-is-debian]}" user="root">
|
||||
<exe-cmd>adduser --ingroup {[pg-group]} --disabled-password --gecos "" {[br-user]}</exe-cmd>
|
||||
</execute>
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root">
|
||||
<execute if="{[os-type-is-centos6]}" user="root">
|
||||
<exe-cmd>adduser -g{[pg-group]} -n {[br-user]}</exe-cmd>
|
||||
</execute>
|
||||
</execute-list>
|
||||
@ -2452,9 +2456,9 @@
|
||||
<backrest-config-option section="global" key="log-timestamp">n</backrest-config-option>
|
||||
</backrest-config>
|
||||
|
||||
<p if="'{[os-type]}' eq '{[os-debian]}'">The demo cluster must be created (even though it will be overwritten on restore) in order to create the <postgres/> configuration files.</p>
|
||||
<p if="{[os-type-is-debian]}">The demo cluster must be created (even though it will be overwritten on restore) in order to create the <postgres/> configuration files.</p>
|
||||
|
||||
<execute-list if="'{[os-type]}' eq '{[os-debian]}'" host="{[host-pg2]}">
|
||||
<execute-list if="{[os-type-is-debian]}" host="{[host-pg2]}">
|
||||
<title>Create demo cluster</title>
|
||||
|
||||
<execute user="root">
|
||||
@ -2462,9 +2466,9 @@
|
||||
</execute>
|
||||
</execute-list>
|
||||
|
||||
<p if="'{[os-type]}' eq '{[os-centos6]}'">Create the path where <postgres/> will be restored.</p>
|
||||
<p if="{[os-type-is-centos6]}">Create the path where <postgres/> will be restored.</p>
|
||||
|
||||
<execute-list if="'{[os-type]}' eq '{[os-centos6]}'" host="{[host-pg2]}">
|
||||
<execute-list if="{[os-type-is-centos6]}" host="{[host-pg2]}">
|
||||
<title>Create <postgres/> path</title>
|
||||
|
||||
<execute user="postgres">
|
||||
@ -2479,11 +2483,11 @@
|
||||
<execute-list host="{[host-pg2]}">
|
||||
<title>Restore the {[postgres-cluster-demo]} standby cluster</title>
|
||||
|
||||
<execute user="postgres" if="'{[os-type]}' eq '{[os-debian]}'">
|
||||
<execute user="postgres" if="{[os-type-is-debian]}">
|
||||
<exe-cmd>{[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} {[dash]}-delta restore</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute user="postgres" if="'{[os-type]}' eq '{[os-centos6]}'">
|
||||
<execute user="postgres" if="{[os-type-is-centos6]}">
|
||||
<exe-cmd>{[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} restore</exe-cmd>
|
||||
</execute>
|
||||
|
||||
@ -2679,9 +2683,9 @@
|
||||
</execute>
|
||||
</execute-list>
|
||||
|
||||
<p if="'{[os-type]}' eq '{[os-centos6]}'">By default {[user-guide-os]} stores the <file>postgresql.conf</file> file in the <postgres/> data directory. That means the change made to <file>postgresql.conf</file> was overwritten by the last restore and the <pg-option>hot_standby</pg-option> setting must be enabled again. Other solutions to this problem are to store the <file>postgresql.conf</file> file elsewhere or to enable the <pg-option>hot_standby</pg-option> setting on the <host>{[host-pg1]}</host> host where it will be ignored.</p>
|
||||
<p if="{[os-type-is-centos6]}">By default {[user-guide-os]} stores the <file>postgresql.conf</file> file in the <postgres/> data directory. That means the change made to <file>postgresql.conf</file> was overwritten by the last restore and the <pg-option>hot_standby</pg-option> setting must be enabled again. Other solutions to this problem are to store the <file>postgresql.conf</file> file elsewhere or to enable the <pg-option>hot_standby</pg-option> setting on the <host>{[host-pg1]}</host> host where it will be ignored.</p>
|
||||
|
||||
<postgres-config host="{[host-pg2]}" if="'{[os-type]}' eq '{[os-centos6]}'" file="{[postgres-config-demo]}">
|
||||
<postgres-config host="{[host-pg2]}" if="{[os-type-is-centos6]}" file="{[postgres-config-demo]}">
|
||||
<title>Enable <pg-option>hot_standby</pg-option></title>
|
||||
|
||||
<postgres-config-option key="hot_standby">on</postgres-config-option>
|
||||
@ -2966,11 +2970,11 @@
|
||||
</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute user="root" if="'{[os-type]}' eq '{[os-debian]}'">
|
||||
<execute user="root" if="{[os-type-is-debian]}">
|
||||
<exe-cmd>{[pg-cluster-create-upgrade]}</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute user="postgres" output="y" if="'{[os-type]}' eq '{[os-debian]}'">
|
||||
<execute user="postgres" output="y" if="{[os-type-is-debian]}">
|
||||
<exe-cmd>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 @@
|
||||
<exe-highlight>Upgrade Complete</exe-highlight>
|
||||
</execute>
|
||||
|
||||
<execute user="postgres" output="y" if="'{[os-type]}' eq '{[os-centos6]}'">
|
||||
<execute user="postgres" output="y" if="{[os-type-is-centos6]}">
|
||||
<exe-cmd>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 @@
|
||||
<execute-list host="{[host-pg1]}">
|
||||
<title>Remove old cluster</title>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root">
|
||||
<execute if="{[os-type-is-debian]}" user="root">
|
||||
<exe-cmd>pg_dropcluster {[pg-version]} {[postgres-cluster-demo]}</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root">
|
||||
<execute if="{[os-type-is-centos6]}" user="root">
|
||||
<exe-cmd>rm -rf {[pg-path]}</exe-cmd>
|
||||
</execute>
|
||||
</execute-list>
|
||||
@ -3098,21 +3102,21 @@
|
||||
<execute-list host="{[host-pg2]}">
|
||||
<title>Remove old cluster and create the new cluster</title>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-debian]}'" user="root">
|
||||
<execute if="{[os-type-is-debian]}" user="root">
|
||||
<exe-cmd>pg_dropcluster {[pg-version]} {[postgres-cluster-demo]}</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute if="'{[os-type]}' eq '{[os-centos6]}'" user="root">
|
||||
<execute if="{[os-type-is-centos6]}" user="root">
|
||||
<exe-cmd>rm -rf {[pg-path]}</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute user="postgres" if="'{[os-type]}' eq '{[os-centos6]}'">
|
||||
<execute user="postgres" if="{[os-type-is-centos6]}">
|
||||
<exe-cmd>
|
||||
mkdir -p -m 700 {[pg-bin-upgrade-path]}
|
||||
</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute user="root" if="'{[os-type]}' eq '{[os-debian]}'">
|
||||
<execute user="root" if="{[os-type-is-debian]}">
|
||||
<exe-cmd>{[pg-cluster-create-upgrade]}</exe-cmd>
|
||||
</execute>
|
||||
</execute-list>
|
||||
@ -3140,11 +3144,11 @@
|
||||
<execute-list host="{[host-pg2]}">
|
||||
<title>Restore the {[postgres-cluster-demo]} standby cluster</title>
|
||||
|
||||
<execute user="postgres" if="'{[os-type]}' eq '{[os-debian]}'">
|
||||
<execute user="postgres" if="{[os-type-is-debian]}">
|
||||
<exe-cmd>{[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} {[dash]}-delta restore</exe-cmd>
|
||||
</execute>
|
||||
|
||||
<execute user="postgres" if="'{[os-type]}' eq '{[os-centos6]}'">
|
||||
<execute user="postgres" if="{[os-type-is-centos6]}">
|
||||
<exe-cmd>{[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} restore</exe-cmd>
|
||||
</execute>
|
||||
</execute-list>
|
||||
|
Loading…
Reference in New Issue
Block a user