-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic support for pgbackrest multi-repo feature (#22)
* add basic support for pgbackrest multi-repo feature * new test suite using ansible * add check_pgbackrest regress tests to the new test suite
- Loading branch information
Showing
118 changed files
with
3,092 additions
and
2,579 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
name: main | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
use-case-1: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- DOCKERI: centos:7 | ||
DBTYPE: PG | ||
DBVERSION: 13 | ||
CLNAME: c7pg | ||
EXTRA_VARS: "pgbackrest_excpected_release=2.34 check_pgbackrest_build=true" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shogo82148/actions-setup-perl@v1 | ||
|
||
- name: Initial step | ||
run: sh run.sh -i | ||
|
||
- name: Run CI script | ||
env: | ||
EDB_REPO_USERNAME: ${{ secrets.EDB_REPO_USERNAME }} | ||
EDB_REPO_PASSWORD: ${{ secrets.EDB_REPO_PASSWORD }} | ||
ARCH: use-case-1 | ||
CLPATH: /home/runner/clusters | ||
CLNAME: ${{ matrix.CLNAME }} | ||
DBTYPE: ${{ matrix.DBTYPE }} | ||
DBVERSION: ${{ matrix.DBVERSION }} | ||
DOCKERI: ${{ matrix.DOCKERI }} | ||
EXTRA_VARS: ${{ matrix.EXTRA_VARS }} | ||
run: sh ci.sh | ||
|
||
use-case-2: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- DOCKERI: ubuntu:20.04 | ||
DBTYPE: PG | ||
DBVERSION: 13 | ||
CLNAME: u20pg | ||
EXTRA_VARS: "pgbackrest_excpected_release=2.34 check_pgbackrest_build=true" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shogo82148/actions-setup-perl@v1 | ||
|
||
- name: Initial step | ||
run: sh run.sh -i | ||
|
||
- name: Run CI script | ||
env: | ||
EDB_REPO_USERNAME: ${{ secrets.EDB_REPO_USERNAME }} | ||
EDB_REPO_PASSWORD: ${{ secrets.EDB_REPO_PASSWORD }} | ||
ARCH: use-case-2 | ||
CLPATH: /home/runner/clusters | ||
CLNAME: ${{ matrix.CLNAME }} | ||
DBTYPE: ${{ matrix.DBTYPE }} | ||
DBVERSION: ${{ matrix.DBVERSION }} | ||
DOCKERI: ${{ matrix.DOCKERI }} | ||
EXTRA_VARS: ${{ matrix.EXTRA_VARS }} | ||
run: sh ci.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
.vagrant/ | ||
tests/common/perf/nytprof* | ||
vagrant.yml | ||
tests/common/configuration.profile | ||
_old.* | ||
*.rpm | ||
tests/validation.sh | ||
tests/validation.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
### Global variables | ||
# disable running the activity script by default | ||
ACTIVITY='false' | ||
# define PG on CentOS 7 as default profile | ||
PROFILE='c7pg' | ||
|
||
### Make targets | ||
init: clean_vm create_vm | ||
|
||
uc1: | ||
ACTIVITY=$(ACTIVITY) ARCH='use-case-1' EXTRA="$(EXTRA) check_pgbackrest_build=true deploy_icinga2=true" PGBR_BUILD='false' PGBR_REPO_TYPE=$(PGBR_REPO_TYPE) PROFILE=$(PROFILE) vagrant up --provision-with=exec-ci | ||
uc1_full: | ||
ACTIVITY=$(ACTIVITY) ARCH='use-case-1' EXTRA="$(EXTRA) check_pgbackrest_build=true deploy_icinga2=true" PGBR_BUILD='true' PGBR_REPO_TYPE=$(PGBR_REPO_TYPE) PROFILE=$(PROFILE) vagrant up --provision-with=exec-ci | ||
uc1_light: | ||
ACTIVITY=$(ACTIVITY) ARCH='use-case-1' EXTRA="$(EXTRA)" PGBR_BUILD='false' PGBR_REPO_TYPE=$(PGBR_REPO_TYPE) PROFILE=$(PROFILE) vagrant up --provision-with=exec-ci | ||
|
||
uc2: | ||
ACTIVITY=$(ACTIVITY) ARCH='use-case-2' EXTRA="$(EXTRA) check_pgbackrest_build=true deploy_icinga2=true" PGBR_BUILD='false' PGBR_REPO_TYPE=$(PGBR_REPO_TYPE) PROFILE=$(PROFILE) vagrant up --provision-with=exec-ci | ||
uc2_full: | ||
ACTIVITY=$(ACTIVITY) ARCH='use-case-2' EXTRA="$(EXTRA) check_pgbackrest_build=true deploy_icinga2=true" PGBR_BUILD='true' PGBR_REPO_TYPE=$(PGBR_REPO_TYPE) PROFILE=$(PROFILE) vagrant up --provision-with=exec-ci | ||
uc2_light: | ||
ACTIVITY=$(ACTIVITY) ARCH='use-case-2' EXTRA="$(EXTRA)" PGBR_BUILD='false' PGBR_REPO_TYPE=$(PGBR_REPO_TYPE) PROFILE=$(PROFILE) vagrant up --provision-with=exec-ci | ||
|
||
### Setup | ||
clean_ci: | ||
PROFILE=$(PROFILE) vagrant up --provision-with=clean-ci | ||
|
||
clean_docker: | ||
vagrant ssh -c "docker rm -f $(docker ps -a -q)" | ||
|
||
clean_git: | ||
git clean -f -dX --dry-run | ||
|
||
clean_icinga2: | ||
vagrant ssh -c "docker stop $(PROFILE)-icinga2 && docker rm $(PROFILE)-icinga2" | ||
|
||
clean_vm: | ||
vagrant destroy -f | ||
|
||
create_vm: | ||
vagrant up | ||
vagrant ssh -c "sh /vagrant/run.sh -i" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# README | ||
|
||
<!-- | ||
(\_/) | ||
( •_•) | ||
/ > 🐘 | ||
--> | ||
|
||
--- | ||
|
||
## Introduction | ||
|
||
This _Test Suite_ is based on the [edb-ansible](https://github.com/EnterpriseDB/edb-ansible) Ansible Collection. It deploys docker containers and typical architectures. | ||
|
||
It tends to support the following situations: | ||
* Directly-attached storage - [Use Case 1](https://www.enterprisedb.com/docs/supported-open-source/pgbackrest/06-use_case_1/) | ||
* Dedicated repository host - [Use Case 2](https://www.enterprisedb.com/docs/supported-open-source/pgbackrest/07-use_case_2) | ||
|
||
--- | ||
|
||
## GitHub Actions | ||
|
||
[GitHub Actions](../.github/workflows/main.yml) are testing: | ||
* Use-Case 1: PG 13, CentOS 7, using pgBackRest PGDG packages | ||
* Use-Case 2: PG 13, Ubuntu 20.04, using pgBackRest PGDG packages | ||
|
||
--- | ||
|
||
## Vagrant | ||
|
||
To be able to run the tests manually, define your EDB repositories personal credential `vagrant.yml`. Example in [vagrant.yml-dist](vagrant.yml-dist). | ||
|
||
First of all, initialize the virtual machine with `make init`. | ||
|
||
* Deploy Use-Case 1 and run the activity script: `make ACTIVITY=true uc1` | ||
* Deploy Use-Case 2 and run the activity script: `make ACTIVITY=true uc2` | ||
|
||
To build pgBackRest from sources, use `uc1_full` or `uc2_full` make targets. | ||
|
||
To install pgBackRest and **check_pgbackrest** using PGDG packages, without deploying Icinga2, use `uc1_light` or `uc2_light` make targets. | ||
|
||
### Change the test profile | ||
|
||
Add `PROFILE=xxx` to the make command. | ||
|
||
Available profiles: `c7epas`, `c7pg`, `d10epas`, `d10pg`, `u20epas`, `u20pg`. | ||
|
||
### Change the pgBackRest repository type | ||
|
||
Add `PGBR_REPO_TYPE=xxx` to the make command. | ||
|
||
Available types: `azure`, `s3`, `multi`, `posix`. | ||
|
||
When setting `multi` repository, both `s3` and `azure` will be used. When setting `posix` repository, the repository path will be automatically adjusted to `/shared/repo1` where */shared* is a shared volume between the docker containers. | ||
|
||
### Icinga2 | ||
|
||
To interact with Icinga2, the easiest way is to use the API: | ||
|
||
```bash | ||
# Login to the vagrant box | ||
$ vagrant ssh | ||
|
||
# Reschedule check_pgbackrest checks | ||
$ curl -k -s -u 'icinga2-director:anyPassWord' -H 'Accept: application/json' -X POST \ | ||
'https://localhost:5665/v1/actions/reschedule-check' \ | ||
-d '{ "type": "Service", "filter": "match(pattern,service.name)", "filter_vars": { "pattern": "pgbackrest*" }, "pretty": true }' |jq | ||
|
||
# Get check_pgbackrest checks status | ||
$ curl -k -s -u 'icinga2-director:anyPassWord' -H 'Accept: application/json' -X GET \ | ||
'https://localhost:5665/v1/objects/services' \ | ||
-d '{ "filter": "match(pattern,service.name)", "filter_vars": { "pattern": "pgbackrest*" } }' |jq | ||
``` | ||
|
||
### Cleaning | ||
|
||
Before changing the `PROFILE` to deploy a new architecture, remove the docker containers and cluster directory using `make PROFILE=xxx clean_ci`. | ||
|
||
To remove the vagrant virtual machine: `make clean_vm`. |
Oops, something went wrong.