2789d3b620
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs. Two new error codes were introduced: 6 = requested backup not found 99 = other, which is used to indicate an error has occurred that requires more details to be provided A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found. If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s): stanza: stanza1 status: error (other) [CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy': CryptoError: cipher header invalid HINT: is or was the repo encrypted? FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read HINT: backup.info cannot be opened and is required to perform a backup. HINT: has a stanza-create been performed? HINT: use option --stanza if encryption settings are different for the stanza than the global cipher: aes-256-cbc If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors: pgbackrest info --stanza=demo --set=bogus stanza: demo status: error (requested backup not found) cipher: mixed repo1: aes-256-cbc repo2: none If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error: pgbackrest info --stanza=demo --set=20210322-171211F stanza: demo status: mixed repo1: error [CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy': CryptoError: cipher header invalid HINT: is or was the repo encrypted? FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read HINT: backup.info cannot be opened and is required to perform a backup. HINT: has a stanza-create been performed? HINT: use option --stanza if encryption settings are different for the stanza than the global repo2: ok cipher: mixed repo1: aes-256-cbc repo2: none db (current) wal archive min/max (12): 000000010000000000000001/000000010000000000000003 full backup: 20210322-171211F timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28 wal start/stop: 000000010000000000000002 / 000000010000000000000002 database size: 23.4MB, database backup size: 23.4MB repo2: backup set size: 2.8MB, backup size: 2.8MB database list: postgres (13359) Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name: [ { "archive":[], "backup":[], "cipher":"none", "db":[], "name":"[invalid]", "repo":[ { "cipher":"none", "key":1, "status":{ "code":99, "message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied" } } ], "status":{ "code":99, "lock":{"backup":{"held":false}}, "message":"other" } } ] |
||
---|---|---|
.. | ||
example | ||
lib/pgBackRestDoc | ||
resource | ||
xml | ||
.gitignore | ||
doc.pl | ||
FORMAT.md | ||
manifest.xml | ||
README.md | ||
RELEASE.md | ||
release.pl |
pgBackRest
Building Documentation
General Builds
The pgBackRest documentation can output a variety of formats and target several platforms and PostgreSQL versions.
This will build all documentation with defaults:
./doc.pl
The user guide can be built for different platforms: centos7
, centos8
and debian
. This will build the HTML user guide for CentOS/RHEL 7:
./doc.pl --out=html --include=user-guide --var=os-type=centos7
Documentation generation will build a cache of all executed statements and use the cache to build the documentation quickly if no executed statements have changed. This makes proofing text-only edits very fast, but sometimes it is useful to do a full build without using the cache:
./doc.pl --out=html --include=user-guide --var=os-type=centos8 --no-cache
Each os-type
has a default container image that will be used as a base for creating hosts. For centos7
/centos8
these defaults are generally fine, but for debian
it can be useful to change the image.
./doc.pl --out=html --include=user-guide --var=os-type=debian --var=os-image=debian:9
The following is a sample CentOS/RHEL 7 configuration that can be used for building the documentation.
# Install docker
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce
sudo systemctl start docker
# Install tools
sudo yum install -y git wget
# Install latex (for building PDF)
sudo yum install -y texlive texlive-titlesec texlive-sectsty texlive-framed texlive-epstopdf ghostscript
# Install Perl modules that do not have CentOS packages via CPAN
sudo yum install -y yum cpanminus
sudo yum groupinstall -y "Development Tools" "Development Libraries"
sudo cpanm install --force XML::Checker::Parser
# Add documentation test user
sudo groupadd test
sudo adduser -gtest -n testdoc
sudo usermod -aG docker testdoc
Building with Packages
A user-specified package can be used when building the documentation. Since the documentation exercises most pgBackRest functionality this is a great way to smoke-test packages.
The package must be located within the pgBackRest repo and the specified path should be relative to the repository base. test/package
is a good default path to use.
Ubuntu 16.04:
./doc.pl --out=html --include=user-guide --no-cache --var=os-type=debian --var=os-image=ubuntu:16.04 --var=package=test/package/pgbackrest_2.08-0_amd64.deb
CentOS/RHEL 7:
./doc.pl --out=html --include=user-guide --no-cache --var=os-type=centos7 --var=package=test/package/pgbackrest-2.08-1.el7.x86_64.rpm
CentOS/RHEL 8:
./doc.pl --out=html --include=user-guide --no-cache --var=os-type=centos8 --var=package=test/package/pgbackrest-2.08-1.el8.x86_64.rpm
Packages can be built with test.pl
using the following configuration on top of the configuration given for building the documentation.
# Install recent git
sudo yum remove -y git
sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm
sudo yum install -y git2u-all
# Install Perl modules
sudo yum install -y perl-ExtUtils-ParseXS perl-ExtUtils-Embed perl-ExtUtils-MakeMaker perl-YAML-LibYAML
# Install dev libraries
sudo yum install -y libxml2-devel openssl-devel
# Add test user with sudo privileges
sudo adduser -gtest -n test
sudo usermod -aG docker test
sudo chmod 750 /home/test
sudo echo 'test ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/pgbackrest
# Add pgbackrest user required by tests
sudo adduser -gtest -n pgbackrest