Skip to content

Commit

Permalink
Merge branch 'main' into feature/juju_3_6_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shayancanonical committed Oct 2, 2024
2 parents 0e198f9 + 2e6341a commit a70e4fc
Show file tree
Hide file tree
Showing 19 changed files with 269 additions and 206 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v21.0.1
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v22.0.0

unit-test:
name: Unit test charm
Expand All @@ -46,7 +46,7 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v21.0.1
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v22.0.0
with:
cache: true

Expand All @@ -55,24 +55,24 @@ jobs:
fail-fast: false
matrix:
juju:
- agent: 2.9.50 # renovate: juju-agent-pin-minor
- agent: 2.9.51 # renovate: juju-agent-pin-minor
libjuju: ==2.9.49.0 # renovate: latest libjuju 2
allure_on_amd64: false
- agent: 3.4.5 # renovate: juju-agent-pin-minor
- agent: 3.4.6 # renovate: juju-agent-pin-minor
allure_on_amd64: true
architecture:
- amd64
include:
- juju:
agent: 3.4.5 # renovate: juju-agent-pin-minor
agent: 3.4.6 # renovate: juju-agent-pin-minor
allure_on_amd64: true
architecture: arm64
name: Integration | ${{ matrix.juju.agent }} | ${{ matrix.architecture }}
needs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v21.0.1
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v22.0.0
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
architecture: ${{ matrix.architecture }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cla-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
cla-check:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Check if Canonical's Contributor License Agreement has been signed
uses: canonical/has-signed-canonical-cla@v1
11 changes: 0 additions & 11 deletions .github/workflows/lib-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up environment
run: |
pipx install tox
pipx install poetry
pipx inject poetry poetry-plugin-export
# TODO: Remove after https://github.com/python-poetry/poetry/pull/5980 is closed
poetry config warnings.export false
- name: Generate requirements
run: |
tox run -e build-wrapper
mv requirements-last-build.txt requirements.txt
- name: Check libs
uses: canonical/charming-actions/check-libraries@2.6.3
with:
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up environment
run: |
pipx install tox
pipx install poetry
pipx inject poetry poetry-plugin-export
# TODO: Remove after https://github.com/python-poetry/poetry/pull/5980 is closed
poetry config warnings.export false
- name: Generate requirements
run: |
tox run -e build-wrapper
mv requirements-last-build.txt requirements.txt
- name: Release charm libraries
uses: canonical/charming-actions/release-libraries@2.6.3
with:
Expand All @@ -53,14 +42,14 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v21.0.1
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v22.0.0

release:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v21.0.1
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v22.0.0
with:
channel: 14/edge
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sync_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ on:
jobs:
sync-docs:
name: Sync docs from Discourse
uses: canonical/data-platform-workflows/.github/workflows/sync_docs.yaml@v21.0.1
uses: canonical/data-platform-workflows/.github/workflows/sync_docs.yaml@v22.0.0
with:
reviewers: a-velasco,izmalk
reviewers: a-velasco
permissions:
contents: write # Needed to push branch & tag
pull-requests: write # Needed to create PR
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ microk8s config > ~/.kube/config
Build the charm in this git repository using:

```shell
tox run -e build-dev
charmcraftcache pack
```

### Deploy
Expand Down
25 changes: 12 additions & 13 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type: "charm"
type: charm
bases:
- name: ubuntu
channel: "22.04"
Expand All @@ -8,24 +8,23 @@ bases:
architectures: [arm64]
parts:
charm:
override-pull: |
craftctl default
if [[ ! -f requirements.txt ]]
then
echo 'ERROR: Use "tox run -e build-dev" instead of calling "charmcraft pack" directly' >&2
exit 1
fi
override-build: |
rustup default stable
craftctl default
charm-strict-dependencies: true
build-snaps:
- rustup/latest/stable
- rustup
build-packages:
- libffi-dev
- libssl-dev
- pkg-config
- libpq-dev
override-build: |
rustup default stable
# Convert subset of poetry.lock to requirements.txt
curl -sSL https://install.python-poetry.org | python3 -
/root/.local/bin/poetry export --only main,charm-libs --output requirements.txt
craftctl default
charm-strict-dependencies: true
charm-requirements: [requirements.txt]
libpq:
build-packages:
- libpq-dev
Expand Down
50 changes: 44 additions & 6 deletions docs/how-to/h-restore-backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ This is a guide on how to restore a locally made backup.

To restore a backup that was made from a *different* cluster, (i.e. cluster migration via restore), see [How to migrate cluster using backups](/t/charmed-postgresql-k8s-how-to-migrate-clusters/9598?channel=14/stable).


## Prerequisites
- Deployments have been [scaled-down](/t/charmed-postgresql-k8s-how-to-manage-units/9592?channel=14/stable) to a single PostgreSQL unit (scale it up after the backup is restored)
- Access to S3 storage
- [Configured settings for S3 storage](/t/charmed-postgresql-k8s-how-to-configure-s3/9595?channel=14/stable)
- [Existing backups in your S3-storage](/t/charmed-postgresql-k8s-how-to-create-and-list-backups/9596?channel=14/stable)
- [Point-in-time recovery](#point-in-time-recovery) requires the following PostgreSQL charm revisions:
- 435+ for `arm64`
- 436+ for `amd64`

## Summary
* [List backups](#list-backups)
* [Point-in-time recovery](#point-in-time-recovery)
* [Restore backup](#restore-backup)

---

Expand All @@ -27,15 +34,46 @@ juju run postgresql-k8s/leader list-backups

This should show your available backups like in the sample output below:
```shell
backups: |-
backup-id | backup-type | backup-status
----------------------------------------------------
YYYY-MM-DDTHH:MM:SSZ | physical | finished
list-backups: |-
Storage bucket name: canonical-postgres
Backups base path: /test/backup/

backup-id | action | ... | timeline
---------------------------------------------------------------------------
2024-07-22T13:11:56Z | full backup | ... | 1
2024-07-22T14:12:45Z | incremental backup | ... | 1
2024-07-22T15:34:24Z | restore | ... | 2
2024-07-22T16:26:48Z | incremental backup | ... | 2
2024-07-22T17:17:59Z | full | ... | 2
2024-07-22T18:05:32Z | restore | ... | 3
```

Below is a complete list of parameters shown for each backup/restore operation:
* `backup-id`: unique identifier of the backup.
* `action`: indicates the action performed by the user through one of the charm action; can be any of full backup, incremental backup, differential backup or restore.
* `status`: either finished (successfully) or failed.
* `reference-backup-id`
* `LSN start/stop`: a database specific number (or timestamp) to identify its state.
* `start-time`: records start of the backup operation.
* `finish-time`: records end of the backup operation.
* `backup-path`: path of the backup related files in the S3 repository.
* `timeline`: number which identifies different branches in the database transactions history; every time a restore or PITR is made, this number is incremented by 1.

## Point-in-time recovery
Point-in-time recovery (PITR) is a PostgreSQL feature that enables restorations to the database state at specific points in time.

After performing a PITR in a PostgreSQL cluster, a new timeline is created to track from the point to where the database was restored. They can be tracked via the `timeline` parameter in the `list-backups` output.

## Restore backup
To restore a backup from that list, run the `restore` command and pass the corresponding `backup-id`:
To restore a backup from that list, run the `restore` command and pass the parameter corresponding to the backup type.

When the user needs to restore a specific backup that was made, they can use the `backup-id` that is listed in the `list-backups` output.
```shell
juju run postgresql-k8s/leader restore backup-id=YYYY-MM-DDTHH:MM:SSZ
```
However, if the user needs to restore to a specific point in time between different backups (e.g. to restore only specific transactions made between those backups), they can use the `restore-to-time` parameter to pass a timestamp related to the moment they want to restore.
```shell
juju run postgresql-k8s/leader restore restore-to-time="YYYY-MM-DDTHH:MM:SSZ"
```

Your restore will then be in progress.
3 changes: 1 addition & 2 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ PostgreSQL is a trademark or registered trademark of PostgreSQL Global Developme
| 2 | h-enable-plugins-extensions | [Enable plugins/extensions](/t/10907) |
| 1 | reference | [Reference]() |
| 2 | r-overview | [Overview](/t/13977) |
| 2 | r-releases | [Release Notes]() |
| 3 | r-all-releases | [All releases](/t/11872) |
| 2 | r-releases | [Release Notes](/t/11872) |
| 3 | r-revision-381-382 | [Revision 381/382](/t/15442) |
| 3 | r-revision-280-281 | [Revision 280/281](/t/14068) |
| 3 | r-revision-193 | [Revision 193](/t/13208) |
Expand Down
30 changes: 0 additions & 30 deletions docs/reference/r-all-releases.md

This file was deleted.

65 changes: 65 additions & 0 deletions docs/reference/r-releases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Release Notes

This page provides high-level overviews of the dependencies and features that are supported by each revision in every stable release.

To learn more about the different release tracks and channels, see the [Juju documentation about channels](https://juju.is/docs/juju/channel#heading--risk).

To see all releases and commits, check the [Charmed PostgreSQL Releases page on GitHub](https://github.com/canonical/postgresql-k8s-operator/releases).

## Dependencies and supported features

For a given release, this table shows:
* The PostgreSQL version packaged inside
* The minimum Juju version required to reliably operate **all** features of the release
> This charm still supports older versions of Juju down to 2.9. See the [Juju section of the system requirements](/t/) for more details
* Support for specific features

| Revision | PostgreSQL version | Juju version | [TLS encryption](/t/9685)* | [COS monitoring](/t/10600) | [Minor version upgrades](/t/) | [Cross-regional async replication](/t/) | [Point-in-time recovery](/t/)
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
| [381], [382] | 14.12 | `3.4.5+` | ![check] | ![check] | ![check] | ![check] | ![check] |
| [280], [281] | 14.11 | `3.1.8+` | ![check] | ![check] | ![check] | ![check] |
| [193] | 14.10 | `3.1.7+` | ![check] | ![check] | ![check] | ![check] |
| [177] | 14.9 | `3.1.6+` | | ![check] | ![check] |
| [158] | 14.9 | `3.1.5+` | | ![check] | ![check] |
| [73] | 14.7 | `2.9.32+` | | |


**TLS encryption***: Support for **`v2` or higher** of the [`tls-certificates` interface](https://charmhub.io/tls-certificates-interface/libraries/tls_certificates). This means that you can integrate with [modern TLS charms](https://charmhub.io/topics/security-with-x-509-certificates).

For more details about a particular revision, refer to its dedicated Release Notes page.
For more details about each feature/interface, refer to their dedicated How-To guide.

## Architecture and base
One release may come with more than one revision. This is because each revision is built for a specific combination of hardware architecture and base (Ubuntu version).

| Release | amd64 | arm64 | Ubuntu 22.04 LTS
|:--------:|:-----:|:-----:|:-----:|
|[382] | | ![check] | ![check] |
|[381] | ![check] | | ![check] |
|[281] |![check]| | ![check] |
|[280] | | ![check]| ![check] |
|[193] | ![check]| | ![check] |
|[177] |![check]| | ![check] |
|[158] |![check]| | ![check] |
|[73] |![check]| | ![check] |

## Plugins/extensions

For a list of all plugins supported for each revision, see the reference page [Plugins/extensions](/t/10945).

[note]
Our release notes are an ongoing work in progress. If there is any additional information about releases that you would like to see or suggestions for other improvements, don't hesitate to contact us on [Matrix ](https://matrix.to/#/#charmhub-data-platform:ubuntu.com) or [leave a comment](https://discourse.charmhub.io/t/charmed-postgresql-reference-release-notes/11875).
[/note]

<!-- LINKS -->
[382]: /t/15442
[381]: /t/15442
[281]: /t/14068
[280]: /t/14068
[193]: /t/13208
[177]: /t/12668
[158]: /t/11874
[73]: /t/11873

<!--BADGES-->
[check]: https://img.icons8.com/color/20/checkmark--v1.png
Loading

0 comments on commit a70e4fc

Please sign in to comment.