1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00
Commit Graph

147 Commits

Author SHA1 Message Date
David Steele
4815752ccc Add Perl interface to C storage layer.
Maintaining the storage layer/drivers in two languages is burdensome.  Since the integration tests require the Perl storage layer/drivers we'll need them even after the core code is migrated to C.  Create an interface layer so the Perl code can be removed and new storage drivers/features introduced without adding Perl equivalents.

The goal is to move the integration tests to C so this interface will eventually be removed.  That being the case, the interface was designed for maximum compatibility to ease the transition.  The result looks a bit hacky but we'll improve it as needed until it can be retired.
2019-06-26 08:24:58 -04:00
David Steele
51fcaee43e Add host-repo-path variable internal replacement.
This variable needs to be replaced right before being used without being added to the cache since the host repo path will vary from system to system.

This is frankly a bit of a hack to get the documentation to build in the Debian packages for the upcoming release.  We'll need to come up with something more flexible going forward.
2019-06-25 07:58:38 -04:00
David Steele
6e809e578f Add tag to specify minio version to use for documentation build.
The new minio major release broke the build.  We'll need to figure that out but for now use the last major version, which is known to work.
2019-06-11 10:34:42 -04:00
David Steele
d7bd0c58cd Use wal_level=replica in the documentation for PostgreSQL >= 9.6.
The documentation was using wal_level=hot_standby which is a deprecated setting.

Also remove the reference to wal_level=archive since it is no longer supported and is not recommended for older versions.

Suggested by Patrick McLaughlin.
2019-06-05 07:27:24 -04:00
David Steele
64260b2e98 Build all docs with S3 using --var=s3-all=y
Force repo-type=s3 for all tests.  This is not currently the default for any OS builds.
2019-05-29 08:38:45 -04:00
David Steele
20e5b92f36 Add ls command.
Allows listing repo paths/files from the command-line, to be used primarily for testing and debugging.

This command is internal-only so the interface may change at any time without notice.
2019-05-28 10:03:48 -04:00
David Steele
3e1b06acaa Use minio as local S3 emulator in documentation.
The documentation was relying on a ScalityS3 container built for testing which wasn't very transparent.  Instead, use the stock minio container and configure it in the documentation.

Also, install certificates and CA so that TLS verification can be enabled.
2019-05-27 07:37:20 -04:00
David Steele
c51274d1b6 Add user guides for CentOS/RHEL 6/7.
It would be better if the documentation could be generated on multiple operating systems all in one go, but the doc system currently does not allow vars to be changed once they are set.

The solution is to run the docs for each required OS and stitch the documentation together.  It's not pretty but it works and the automation in release.pl should at least make it easy to use.
2019-05-16 08:32:02 -04:00
David Steele
027c263871 Add configure script for improved multi-platform support.
Use autoconf to provide a basic configure script. WITH_BACKTRACE is yet to be migrated to configure and the unit tests still use a custom Makefile.

Each C file must include "build.auto.conf" before all other includes and defines.  This is enforced by test.pl for includes, but it won't detect incorrect define ordering.

Update packages to call configure and use standard flags to pass options.
2019-04-26 08:08:23 -04:00
David Steele
281d2848b9 Option to build documentation from current apt.postgres.org packages.
This is useful for testing any issue currently being seen in the field.

We'll also need to add a "yum" option at some point.
2019-04-17 18:39:35 -04:00
David Steele
867690c08d Begin v2.13 development.
Also update CentOS packages so documentation builds.
2019-04-12 08:33:10 -04:00
David Steele
4e57b68916 v2.12: C Implementation of Archive Push
IMPORTANT NOTE: The new TLS/SSL implementation forbids dots in S3 bucket names per RFC-2818. This security fix is required for compliant hostname verification.

Bug Fixes:

* Fix issues when a path option is / terminated. (Reported by Marc Cousin.)
* Fix issues when log-level-file=off is set for the archive-get command. (Reported by Brad Nicholson.)
* Fix C code to recognize host:port option format like Perl does. (Reported by Kyle Nevins.)
* Fix issues with remote/local command logging options.

Improvements:

* The archive-push command is implemented entirely in C.
* Increase process-max limit to 999. (Suggested by Rakshitha-BR.)
* Improve error message when an S3 bucket name contains dots.

Documentation Improvements:

* Clarify that S3-compatible object stores are supported. (Suggested by Magnus Hagander.)
2019-04-11 09:14:22 -04:00
David Steele
e97b8241a5 Clarify that S3-compatible object stores are supported.
The documentation mentioned Amazon S3 frequently but failed to mention that other S3-compatible object stores are also supported.

Tone down the specific mentions of Amazon S3 and replace them with "S3-compatible object store" when appropriate.

Suggested by Magnus Hagander.
2019-04-03 11:40:12 +01:00
David Steele
6ce3310f8a Update default documentation version to PostgreSQL 10.
Also update CentOS 6 and 7 versions to PostgreSQL 9.5 and 9.6 respectively.
2019-03-01 09:10:14 +02:00
David Steele
4093609241 Documentation builds on PostgreSQL 9.4-10.
More than likely 9.2-11 will work as well, but this has not been tested.

However, 11 needs work on the group permissions introduced in that version.
2019-03-01 09:00:51 +02:00
David Steele
db4b447be8 The archive-get command is implemented entirely in C.
This new implementation should behave exactly like the old Perl code with the exception of a few updated log messages.

Remove as much of the Perl code as possible without breaking other commands.
2019-02-27 23:03:02 +02:00
David Steele
dada50ee26 Fix hard-coded repository path.
This prevented packages from being passed to the documentation unless they were in the /backrest directory on the host.

Also make the local path /pgbackrest instead of the deprecated /backrest.

Reported by Heath Lord.
2019-01-30 13:39:22 +02:00
David Steele
200fd3aa05 Clarify that encryption is always performed client-side.
Suggested by Bruce Burdick.
2019-01-04 12:25:58 +02:00
Cynthia Shang
72865ca33b Add admonitions to documentation renderers.
Admonitions call out places where the user should take special care.

Support added for HTML, PDF, Markdown and help text renderers.  XML files have been updated accordingly.

Contributed by Cynthia Shang.
2018-12-30 16:40:20 +02:00
David Steele
d6dfbfd2f3 Add zlib1g-dev to Debian builds.
Not all debian-based distros were getting this installed.
2018-12-12 14:35:44 -05:00
David Steele
ee04ebe314 Fix Centos/RHEL 7 documentation builds.
This was caused by a new container version that was released around December 5th.  The new version explicitly denies user logons by leaving /var/run/nologin in place after boot.

The solution is to enable the service that is responsible for removing this file on a successful boot.
2018-12-12 11:15:09 -05:00
David Steele
1c5f8f45b6 Add configuration to the standby so it works as a primary when promoted.
This code was generated during testing and it seemed a good idea to keep it.  It is only a partial solution since the primary also needs additional configuration to be able to fail back and forth.
2018-12-07 12:32:10 -05:00
David Steele
495391c743 Pick pg_switch_wal()/pg_switch_xlog() based on PostgreSQL version.
One step in making the documentation build for all versions that we support.
2018-12-07 12:19:28 -05:00
David Steele
33fa2ede7d Add Centos/RHEL 7 option to documentation build.
Centos/RHEL 7 builds can be specified with --var=os-type=centos7.

Also added to the documentation release and CI builds.
2018-12-05 07:12:28 -05:00
David Steele
baeff9e4f0 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.
2018-12-04 17:33:56 -05:00
David Steele
9e217d0256 Documentation may be built with user-specified packages.
By default the documentation builds pgBackRest from source, but the documentation is also a good way to smoke-test packages.

Allow a package file to be specified by passing --var=package=/path/to/package.ext.  This works for Debian and CentOS 6 builds.
2018-12-04 13:17:55 -05:00
David Steele
17e611cb88 Replace keywords with more flexible if statements.
Keywords were extremely limited and prevented us from generating multi-version documentation and other improvements.

Replace keywords with an if statement that can evaluate a Perl expression with variable replacement.

Since keywords were used to generate cache keys, add a --key-var parameter to identify which variables should make up the key.
2018-12-01 12:40:01 -05:00
David Steele
977506b446 Clarify that region/endpoint must be configured correctly for the bucket.
Suggested by Pritam Barhate.
2018-11-30 11:15:52 -05:00
David Steele
5d3c8e47f1 Pre-build containers for any execute elements marked pre.
This allows the documentation to be built more quickly and offline during development when --pre is specified on the command line.

Each host gets a pre-built container with all the execute elements marked pre. As long as the pre elements do not change the container will not need to be rebuilt.

The feature should not be used for CI builds as it may hide errors in the documentation.
2018-11-29 14:45:15 -05:00
David Steele
bc25db5667 Add interface objects for libxml2.
Add XmlDocument, XmlNode, and XmlNodeList objects as a thin interface layer on libxml2.

This interface is not intended to be comprehensive. Only a few libxml2 capabilities are exposed but more can be added as needed.
2018-11-20 20:40:11 -05:00
David Steele
504e7d77fa Add comment regarding vars being required in blocks.
Documentation block syntax requires that at least one var be specified.

This limitation should be removed but for now add a comment to describe why a bogus var is defined.
2018-11-14 08:13:01 -05:00
David Steele
bc810e5a87 Remove error suppression for pgBackRest make.
This looks like a copy-pasto because make works just fine without it.
2018-11-12 20:44:56 -05:00
David Steele
50266cc26c Use command in authorized_hosts to improve SSH security.
Unsecured, passwordless SSH can be a scary thing. If an attacker gains access to one system they can easily hop to other systems.

Add documentation on how to use the command parameter in authorized_keys to limit ssh to running a single command, pgbackrest. There is more that could be done for security but this likely addresses most needs.

Also change references to "trusted ssh" to "passwordless ssh" since this seems more correct.

Suggested by Stephen Frost, Magnus Hagander.
2018-09-19 16:41:20 -04:00
David Steele
bc7462d86d v2.05: Environment Variable Options and Exclude Temporary/Unlogged Relations
Bug Fixes:

* Fix issue where relative links in $PGDATA could be stored in the backup with the wrong path. This issue did not affect absolute links and relative tablespace links were caught by other checks. (Reported by Cynthia Shang.)
* Remove incompletely implemented online option from the check command. Offline operation runs counter to the purpose of this command, which is to check if archiving and backups are working correctly. (Reported by Jason O'Donnell.)
* Fix issue where errors raised in C were not logged when called from Perl. pgBackRest properly terminated with the correct error code but lacked an error message to aid in debugging. (Reported by Douglas J Hunley.)
* Fix issue when a boolean option (e.g. delta) was specified more than once. (Reported by Yogesh Sharma.)

Features:

* Allow any option to be set in an environment variable. This includes options that previously could only be specified on the command line, e.g. stanza, and secret options that could not be specified on the command-line, e.g. repo1-s3-key-secret.
* Exclude temporary and unlogged relation (table/index) files from backup. Implemented using the same logic as the patches adding this feature to PostgreSQL, 8694cc96 and 920a5e50. Temporary relation exclusion is enabled in PostgreSQL ≥ 9.0. Unlogged relation exclusion is enabled in PostgreSQL ≥ 9.1, where the feature was introduced. (Contributed by Cynthia Shang.)
* Allow arbitrary directories and/or files to be excluded from a backup. Misuse of this feature can lead to inconsistent backups so read the --exclude documentation carefully before using. (Reviewed by Cynthia Shang.)
* Add log-subprocess option to allow file logging for local and remote subprocesses.
* PostgreSQL 11 Beta 3 support.

Improvements:

* Allow zero-size files in backup manifest to reference a prior manifest regardless of timestamp delta. (Contributed by Cynthia Shang.)
* Improve asynchronous archive-get/archive-push performance by directly checking status files. (Contributed by Stephen Frost.)
* Improve error message when a command is missing the stanza option. (Suggested by Sarah Conway.)
2018-08-31 13:19:43 -04:00
David Steele
d0b9f986a0 Allow any option to be set in an environment variable.
This includes options that previously could only be specified on the command line, e.g. stanza.
2018-08-15 10:52:53 -04:00
David Steele
8e1017c162 Move most host setup to containers defined in the documentation.
This includes PostgreSQL installation which had previously been included in the documentation. This way produces faster builds and there is no need for us to document PostgreSQL installation.
2018-07-23 07:59:24 -04:00
David Steele
a8143ec125 v2.04: Critical Bug Fix for Backup Resume
IMPORTANT NOTE: This release fixes a critical bug in the backup resume feature. All resumed backups prior to this release should be considered inconsistent. A backup will be resumed after a prior backup fails, unless resume=n has been specified. A resumed backup can be identified by checking the backup log for the message "aborted backup of same type exists, will be cleaned to remove invalid files and resumed". If the message exists, do not use this backup or any backup in the same set for a restore and check the restore logs to see if a resumed backup was restored. If so, there may be inconsistent data in the cluster.

Bug Fixes:

* Fix critical bug in resume that resulted in inconsistent backups. A regression in v0.82 removed the timestamp comparison when deciding which files from the aborted backup to keep on resume. See note above for more details. (Reported by David Youatt, Yogesh Sharma, Stephen Frost.)
* Fix error in selective restore when only one user database exists in the cluster. (Fixed by Cynthia Shang. Reported by Nj Baliyan.)
* Fix non-compliant ISO-8601 timestamp format in S3 authorization headers. AWS and some gateways were tolerant of space rather than zero-padded hours while others were not. (Fixed by Andrew Schwartz.)

Features:

* PostgreSQL 11 Beta 2 support.

Improvements:

* Improve the HTTP client to set content-length to 0 when not specified by the server. S3 (and gateways) always set content-length or transfer-encoding but HTTP 1.1 does not require it and proxies (e.g. HAProxy) may not include either. (Suggested by Adam K. Sumner.)
* Set search_path = 'pg_catalog' on PostgreSQL connections. (Suggested by Stephen Frost.)
2018-07-05 20:16:41 -04:00
David Steele
6f6dad6dd5 Remove call to lscpu which can vary widely by build host. 2018-07-05 16:49:46 -04:00
David Steele
ead70e16bb Add sample S3 policy to restrict bucket privileges.
Suggested by Douglas J Hunley, Jason O'Donnell.
2018-06-23 13:09:56 -04:00
David Steele
1a0d568600 Preliminary documentation for PostgreSQL 11 unprivileged user backup. 2018-06-14 19:05:35 -04:00
David Steele
fbd1da0523 Create a new section to describe building pgBackRest and build on a separate host. 2018-06-13 13:43:17 -04:00
David Steele
d55e609959 Use a prebuilt s3 server container for documentation and tests. 2018-06-12 13:43:15 -04:00
David Steele
835396751f Document generator improvements.
* Build containers from scratch for more accurate testing.
* Allow environment load to be skipped.
* Allow bash wrapping to be skipped.
* Allow forcing a command to run as a user without sudo.
2018-06-10 14:13:56 -04:00
David Steele
4c7408ea52 Embed exported C functions and Perl modules directly into the pgBackRest executable. 2018-05-22 12:53:08 -04:00
David Steele
9d9fad88a2 Add example of command section usage to archiving configuration.
Suggested by Christophe Courtois.
2018-05-02 07:31:44 -04:00
David Steele
54dd6f3ed4 Add asynchronous, parallel archive-get.
This feature maintains a queue of WAL segments to help reduce latency when PostgreSQL requests a WAL segment with restore_command.
2018-04-30 17:27:39 -04:00
David Steele
c48b0a2a1e Update docs with 32-bit support and caveats.
32-bit support was added in v1.26.

Reported by Viorel Tabara.
2018-04-30 08:13:56 -04:00
Cynthia Shang
27aa5f756e Add support for additional pgBackRest configuration files.
Configuration files are loaded from the directory specified by the --config-include-path option.

Add --config-path option for overriding the default base path of the --config and --config-include-path option.

Contributed by Cynthia Shang.
2018-04-19 11:09:39 -04:00
David Steele
79b7552940 Rename archive-queue-max option to archive-push-queue-max.
This avoids confusion with the archive-get-queue-max option. The old option name will continue to be accepted.
2018-04-18 19:37:35 -04:00
David Steele
49fc737cd0 Add monitoring examples using PostgreSQL and jq.
Suggested by Stephen Frost, Brian Faherty.
2018-04-13 14:31:33 -04:00