Skip to content

Commit 63de65b

Browse files
authored
Add support for PostgreSQL 18 (#1274)
1 parent c040524 commit 63de65b

File tree

18 files changed

+99
-93
lines changed

18 files changed

+99
-93
lines changed

.github/workflows/molecule.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ jobs:
3535
- distro: almalinux10
3636
tag: latest
3737
namespace: glillico
38-
- distro: oraclelinux9
39-
tag: latest
40-
namespace: glillico
41-
- distro: oraclelinux10
42-
tag: latest
43-
namespace: glillico
4438

4539
steps:
4640
- name: Set TERM environment variable

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ It requires the installation of a consul in client mode on each application serv
101101

102102
## Compatibility
103103

104-
RedHat and Debian based distros (x86_64)
104+
RedHat and Debian based distros.
105105

106106
###### Supported Linux Distributions:
107107

@@ -112,11 +112,13 @@ RedHat and Debian based distros (x86_64)
112112
- **Rocky Linux**: 8, 9, 10
113113
- **AlmaLinux**: 8, 9, 10
114114

115+
Architecture: x86_64 (amd64), aarch64 (arm64).
116+
115117
###### PostgreSQL versions:
116118

117119
all supported PostgreSQL versions
118120

119-
:white_check_mark: tested, works fine: PostgreSQL 10, 11, 12, 13, 14, 15, 16, 17
121+
:white_check_mark: tested, works fine: PostgreSQL 10, 11, 12, 13, 14, 15, 16, 17, 18
120122

121123
_Table of results of daily automated testing of cluster deployment:_
122124
| Distribution | Test result |

automation/molecule/default/converge.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
else (['etcd', 'consul'] | random) }}" # TODO: Consul support for RHEL 10, Debian 13
1919
consul_node_role: server # if dcs_type: "consul"
2020
consul_bootstrap_expect: true # if dcs_type: "consul"
21-
postgresql_version: 17 # to test custom WAL dir
21+
postgresql_version: 18
2222
pgbouncer_processes: 2 # Test multiple pgbouncer processes (so_reuseport)
2323
patroni_tags: "datacenter=dc1,key1=value1"
2424
balancer_tags: "datacenter=dc1"
@@ -61,25 +61,21 @@
6161

6262
- name: Set variables for Extensions test
6363
ansible.builtin.set_fact:
64-
# TODO: timescaledb packages are not available for RHEL 10, Debian 13
65-
# Citus packages are not available for Ubuntu 24.04 and Debian 13
66-
enable_timescale: "{{ 'false' if ansible_distribution_major_version in ['10'] or ansible_distribution_release in ['trixie'] else 'true' }}"
64+
enable_timescale: false # TODO: not available for PostgreSQL 18
6765
enable_pg_repack: true
6866
enable_pg_cron: true
6967
enable_pgaudit: true
7068
enable_pgvector: true
7169
enable_postgis: true
7270
enable_pgrouting: true
73-
enable_pg_stat_kcache: true
7471
enable_pg_wait_sampling: true
75-
enable_pg_partman: true
76-
enable_citus: "{{ 'false' if ansible_distribution_release in ['noble', 'trixie'] else 'true' }}"
77-
enable_pgvectorscale: "{{ 'true' if ansible_distribution_release in ['bookworm', 'jammy', 'noble'] else 'false' }}" # only deb packages are available
72+
enable_pg_stat_kcache: false # TODO: not available for PostgreSQL 18
73+
enable_pg_partman: false # TODO: not available for PostgreSQL 18
74+
enable_pgvectorscale: false # TODO: not available for PostgreSQL 18
7875
# create extension
7976
postgresql_extensions:
8077
- { ext: "vector", db: "postgres" }
81-
- { ext: "vectorscale", db: "postgres" }
82-
# - { ext: "", db: "" }
78+
# - { ext: "vectorscale", db: "postgres" }
8379

8480
- name: Set variables for PostgreSQL Cluster update test
8581
ansible.builtin.set_fact:

automation/molecule/default/molecule.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
platforms:
33
- name: pgnode01
44
hostname: pgnode01
5-
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2204}-ansible:${IMAGE_TAG:-latest}"
5+
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2404}-ansible:${IMAGE_TAG:-latest}"
66
# docker_networks: # TODO github.com/ansible-community/molecule/pull/2696
77
# - name: test_docker_network
88
# ipam_config:
@@ -38,7 +38,7 @@ platforms:
3838

3939
- name: pgnode02
4040
hostname: pgnode02
41-
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2204}-ansible:${IMAGE_TAG:-latest}"
41+
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2404}-ansible:${IMAGE_TAG:-latest}"
4242
networks:
4343
- name: test_docker_network
4444
ipv4_address: 10.172.0.21
@@ -69,7 +69,7 @@ platforms:
6969

7070
- name: pgnode03
7171
hostname: pgnode03
72-
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2204}-ansible:${IMAGE_TAG:-latest}"
72+
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2404}-ansible:${IMAGE_TAG:-latest}"
7373
networks:
7474
- name: test_docker_network
7575
ipv4_address: 10.172.0.22

automation/molecule/pg_upgrade/converge.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
else (['etcd', 'consul'] | random) }}" # TODO: Consul support for RHEL 10, Debian 13
1919
consul_node_role: server # if dcs_type: "consul"
2020
consul_bootstrap_expect: true # if dcs_type: "consul"
21-
postgresql_version: 16 # redefine the version to install for the upgrade test
21+
postgresql_version: 17 # redefine the version to install for the upgrade test
2222
pgbouncer_processes: 4 # Test multiple pgbouncer processes (so_reuseport)
2323
cacheable: true
2424
delegate_to: localhost
@@ -27,25 +27,21 @@
2727
# Extension Auto-Setup
2828
- name: Set variables for Extensions test
2929
ansible.builtin.set_fact:
30-
# TODO: timescaledb packages are not available for RHEL 10, Debian 13
31-
# Citus packages are not available for Ubuntu 24.04 and Debian 13
32-
enable_timescale: "{{ 'false' if ansible_distribution_major_version in ['10'] or ansible_distribution_release in ['trixie'] else 'true' }}"
30+
enable_timescale: false # TODO: not available for PostgreSQL 18
3331
enable_pg_repack: true
3432
enable_pg_cron: true
3533
enable_pgaudit: true
3634
enable_pgvector: true
3735
enable_postgis: true
3836
enable_pgrouting: true
39-
enable_pg_stat_kcache: true
4037
enable_pg_wait_sampling: true
41-
enable_pg_partman: true
42-
enable_citus: "{{ 'false' if ansible_distribution_release in ['noble', 'trixie'] else 'true' }}"
43-
enable_pgvectorscale: "{{ 'true' if ansible_distribution_release in ['bookworm', 'jammy', 'noble'] else 'false' }}" # only deb packages are available
38+
enable_pg_stat_kcache: false # TODO: not available for PostgreSQL 18
39+
enable_pg_partman: false # TODO: not available for PostgreSQL 18
40+
enable_pgvectorscale: false # TODO: not available for PostgreSQL 18
4441
# create extension
4542
postgresql_extensions:
4643
- { ext: "vector", db: "postgres" }
47-
- { ext: "vectorscale", db: "postgres" }
48-
# - { ext: "", db: "" }
44+
# - { ext: "vectorscale", db: "postgres" }
4945

5046
# Consul package for OracleLinux missing in HashiCorp repository
5147
# Only the installation of a binary file is supported
@@ -64,8 +60,8 @@
6460

6561
- name: Set variables for PostgreSQL upgrade test
6662
ansible.builtin.set_fact:
67-
pg_old_version: 16
68-
pg_new_version: 17
63+
pg_old_version: 17
64+
pg_new_version: 18
6965

7066
- name: Add repository GPG key
7167
ansible.builtin.command: "rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux-{{ ansible_distribution_major_version }}"

automation/molecule/pg_upgrade/molecule.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
platforms:
33
- name: pgnode01
44
hostname: pgnode01
5-
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2204}-ansible:${IMAGE_TAG:-latest}"
5+
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2404}-ansible:${IMAGE_TAG:-latest}"
66
networks:
77
- name: upgrade_test_docker_network
88
ipv4_address: 10.172.2.20
@@ -33,7 +33,7 @@ platforms:
3333

3434
- name: pgnode02
3535
hostname: pgnode02
36-
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2204}-ansible:${IMAGE_TAG:-latest}"
36+
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2404}-ansible:${IMAGE_TAG:-latest}"
3737
networks:
3838
- name: upgrade_test_docker_network
3939
ipv4_address: 10.172.2.21
@@ -64,7 +64,7 @@ platforms:
6464

6565
- name: pgnode03
6666
hostname: pgnode03
67-
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2204}-ansible:${IMAGE_TAG:-latest}"
67+
image: "${IMAGE_NAMESPACE:-geerlingguy}/docker-${IMAGE_DISTRO:-ubuntu2404}-ansible:${IMAGE_TAG:-latest}"
6868
networks:
6969
- name: upgrade_test_docker_network
7070
ipv4_address: 10.172.2.22

automation/molecule/tests/patroni/patroni.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
22
- name: Check Patroni status
33
ansible.builtin.uri:
4-
url: "{{ patroni_restapi_protocol }}://{{ patroni_restapi_connect_addr | default(patroni_bind_address | default(bind_address, true), true) }}:\
5-
{{ patroni_restapi_port | default(8008) }}/patroni"
4+
url: >-
5+
{{ patroni_restapi_protocol | default('https') }}://{{ patroni_restapi_connect_addr
6+
| default(patroni_bind_address | default(bind_address, true), true) }}:{{ patroni_restapi_port
7+
| default('8008') }}/leader
68
method: GET
79
return_content: true
8-
ca_path: "{{ patroni_restapi_cafile | default(omit, true) }}"
10+
ca_path: "{{ patroni_restapi_cafile | default('/etc/tls/ca.crt') }}"
911
register: patroni_response
1012
failed_when: "'running' not in patroni_response.json.state"
1113

automation/molecule/tests/roles/patroni/variables/custom_wal_dir.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# 🎯 The goal is to verify the correct display of renaming based on PostgreSQL version
44

55
# 🔄 Set postgresql_version for the first test scenario
6-
- name: Molecule.tests.roles.patroni.variables.custom_wal_dir | Define PG version as 17 for scenario 1
6+
- name: Molecule.tests.roles.patroni.variables.custom_wal_dir | Define PG version as 18 for scenario 1
77
run_once: true
88
ansible.builtin.set_fact:
9-
postgresql_version: 17
9+
postgresql_version: 18
1010

1111
# ======================================
1212
# 💻 Scenario: PostgreSQL version >= 10
@@ -22,21 +22,21 @@
2222
- name: Molecule.tests.roles.patroni.variables.custom_wal_dir | Determine mv command for scenario 1
2323
run_once: true
2424
ansible.builtin.set_fact:
25-
mv_command_postgresql_version_17: "mv {{ postgresql_data_dir }}/{{ pg_wal_dir }} {{ postgresql_data_dir }}/{{ pg_wal_dir }}_old"
25+
mv_command_postgresql_version_18: "mv {{ postgresql_data_dir }}/{{ pg_wal_dir }} {{ postgresql_data_dir }}/{{ pg_wal_dir }}_old"
2626

2727
# 🚀 Display the command
2828
- name: Molecule.tests.roles.patroni.variables.custom_wal_dir | Display command for scenario 1
2929
run_once: true
3030
ansible.builtin.debug:
31-
var: mv_command_postgresql_version_17
31+
var: mv_command_postgresql_version_18
3232

3333
# ✅ Verify if the name has been determined correctly
3434
- name: Molecule.tests.roles.patroni.variables.custom_wal_dir | Validate mv command for scenario 1 (RedHat)
3535
run_once: true
3636
when: ansible_os_family == 'RedHat'
3737
ansible.builtin.assert:
3838
that:
39-
- mv_command_postgresql_version_17 == 'mv /var/lib/pgsql/17/data/pg_wal /var/lib/pgsql/17/data/pg_wal_old'
39+
- mv_command_postgresql_version_18 == 'mv /var/lib/pgsql/18/data/pg_wal /var/lib/pgsql/18/data/pg_wal_old'
4040
fail_msg: "Test failed for RedHat: incorrect mv command."
4141
success_msg: "Test passed: mv command for RedHat is correct."
4242

@@ -45,7 +45,7 @@
4545
when: ansible_os_family == 'Debian'
4646
ansible.builtin.assert:
4747
that:
48-
- mv_command_postgresql_version_17 == 'mv /var/lib/postgresql/17/main/pg_wal /var/lib/postgresql/17/main/pg_wal_old'
48+
- mv_command_postgresql_version_18 == 'mv /var/lib/postgresql/18/main/pg_wal /var/lib/postgresql/18/main/pg_wal_old'
4949
fail_msg: "Test failed for Debian: incorrect mv command."
5050
success_msg: "Test passed: mv command for Debian is correct."
5151

automation/playbooks/config_pgcluster.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@
4747

4848
- name: "[Prepare] Get Patroni Cluster Leader Node"
4949
ansible.builtin.uri:
50-
url: "{{ patroni_restapi_protocol }}://{{ patroni_restapi_connect_addr | default(patroni_bind_address | default(bind_address, true), true) }}:\
51-
{{ patroni_restapi_port | default('8008') }}/leader"
50+
url: >-
51+
{{ patroni_restapi_protocol | default('https') }}://{{ patroni_restapi_connect_addr
52+
| default(patroni_bind_address | default(bind_address, true), true) }}:{{ patroni_restapi_port
53+
| default('8008') }}/leader
5254
status_code: 200
53-
ca_path: "{{ patroni_restapi_cafile | default(omit, true) }}"
55+
ca_path: "{{ patroni_restapi_cafile | default('/etc/tls/ca.crt') }}"
5456
register: patroni_leader_result
5557
changed_when: false
5658
failed_when: false

automation/playbooks/pg_upgrade.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
---
2-
# TODO:
3-
# - Citus support
42
- name: "vitabaks.autobase.pg_upgrade | Upgrade PostgreSQL {{ pg_old_version }} to the new version {{ pg_new_version }}"
53
hosts: postgres_cluster
64
gather_facts: true
@@ -19,10 +17,12 @@
1917

2018
- name: "[Prepare] Get Patroni Cluster Leader Node"
2119
ansible.builtin.uri:
22-
url: "{{ patroni_restapi_protocol }}://{{ patroni_restapi_connect_addr | default(patroni_bind_address | default(bind_address, true), true) }}:\
23-
{{ patroni_restapi_port | default('8008') }}/leader"
20+
url: >-
21+
{{ patroni_restapi_protocol | default('https') }}://{{ patroni_restapi_connect_addr
22+
| default(patroni_bind_address | default(bind_address, true), true) }}:{{ patroni_restapi_port
23+
| default('8008') }}/leader
2424
status_code: 200
25-
ca_path: "{{ patroni_restapi_cafile | default(omit, true) }}"
25+
ca_path: "{{ patroni_restapi_cafile | default('/etc/tls/ca.crt') }}"
2626
register: patroni_leader_result
2727
changed_when: false
2828
failed_when: false

0 commit comments

Comments
 (0)